// modules are defined as an array
// [ module function, map of requires ]
//
// map of requires is short require name -> numeric require
//
// anything defined in a previous bundle is accessed via the
// orig method which is the require for previous bundles
parcelRequire = (function (modules, cache, entry, globalName) {
  // Save the require from previous bundle to this closure if any
  var previousRequire = typeof parcelRequire === 'function' && parcelRequire;
  var nodeRequire = typeof require === 'function' && require;

  function newRequire(name, jumped) {
    if (!cache[name]) {
      if (!modules[name]) {
        // if we cannot find the module within our internal map or
        // cache jump to the current global require ie. the last bundle
        // that was added to the page.
        var currentRequire = typeof parcelRequire === 'function' && parcelRequire;
        if (!jumped && currentRequire) {
          return currentRequire(name, true);
        }

        // If there are other bundles on this page the require from the
        // previous one is saved to 'previousRequire'. Repeat this as
        // many times as there are bundles until the module is found or
        // we exhaust the require chain.
        if (previousRequire) {
          return previousRequire(name, true);
        }

        // Try the node require function if it exists.
        if (nodeRequire && typeof name === 'string') {
          return nodeRequire(name);
        }

        var err = new Error('Cannot find module \'' + name + '\'');
        err.code = 'MODULE_NOT_FOUND';
        throw err;
      }

      localRequire.resolve = resolve;
      localRequire.cache = {};

      var module = cache[name] = new newRequire.Module(name);

      modules[name][0].call(module.exports, localRequire, module, module.exports, this);
    }

    return cache[name].exports;

    function localRequire(x){
      return newRequire(localRequire.resolve(x));
    }

    function resolve(x){
      return modules[name][1][x] || x;
    }
  }

  function Module(moduleName) {
    this.id = moduleName;
    this.bundle = newRequire;
    this.exports = {};
  }

  newRequire.isParcelRequire = true;
  newRequire.Module = Module;
  newRequire.modules = modules;
  newRequire.cache = cache;
  newRequire.parent = previousRequire;
  newRequire.register = function (id, exports) {
    modules[id] = [function (require, module) {
      module.exports = exports;
    }, {}];
  };

  var error;
  for (var i = 0; i < entry.length; i++) {
    try {
      newRequire(entry[i]);
    } catch (e) {
      // Save first error but execute all entries
      if (!error) {
        error = e;
      }
    }
  }

  if (entry.length) {
    // Expose entry point to Node, AMD or browser globals
    // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
    var mainExports = newRequire(entry[entry.length - 1]);

    // CommonJS
    if (typeof exports === "object" && typeof module !== "undefined") {
      module.exports = mainExports;

    // RequireJS
    } else if (typeof define === "function" && define.amd) {
     define(function () {
       return mainExports;
     });

    // <script>
    } else if (globalName) {
      this[globalName] = mainExports;
    }
  }

  // Override the current require with this new one
  parcelRequire = newRequire;

  if (error) {
    // throw error from earlier, _after updating parcelRequire_
    throw error;
  }

  return newRequire;
})({"r7L2":[function(require,module,exports) {

// shim for using process in browser
var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it
// don't break things.  But we need to wrap it in a try catch in case it is
// wrapped in strict mode code which doesn't define any globals.  It's inside a
// function because try/catches deoptimize in certain engines.

var cachedSetTimeout;
var cachedClearTimeout;

function defaultSetTimout() {
  throw new Error('setTimeout has not been defined');
}

function defaultClearTimeout() {
  throw new Error('clearTimeout has not been defined');
}

(function () {
  try {
    if (typeof setTimeout === 'function') {
      cachedSetTimeout = setTimeout;
    } else {
      cachedSetTimeout = defaultSetTimout;
    }
  } catch (e) {
    cachedSetTimeout = defaultSetTimout;
  }

  try {
    if (typeof clearTimeout === 'function') {
      cachedClearTimeout = clearTimeout;
    } else {
      cachedClearTimeout = defaultClearTimeout;
    }
  } catch (e) {
    cachedClearTimeout = defaultClearTimeout;
  }
})();

function runTimeout(fun) {
  if (cachedSetTimeout === setTimeout) {
    //normal enviroments in sane situations
    return setTimeout(fun, 0);
  } // if setTimeout wasn't available but was latter defined


  if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
    cachedSetTimeout = setTimeout;
    return setTimeout(fun, 0);
  }

  try {
    // when when somebody has screwed with setTimeout but no I.E. maddness
    return cachedSetTimeout(fun, 0);
  } catch (e) {
    try {
      // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
      return cachedSetTimeout.call(null, fun, 0);
    } catch (e) {
      // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
      return cachedSetTimeout.call(this, fun, 0);
    }
  }
}

function runClearTimeout(marker) {
  if (cachedClearTimeout === clearTimeout) {
    //normal enviroments in sane situations
    return clearTimeout(marker);
  } // if clearTimeout wasn't available but was latter defined


  if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
    cachedClearTimeout = clearTimeout;
    return clearTimeout(marker);
  }

  try {
    // when when somebody has screwed with setTimeout but no I.E. maddness
    return cachedClearTimeout(marker);
  } catch (e) {
    try {
      // When we are in I.E. but the script has been evaled so I.E. doesn't  trust the global object when called normally
      return cachedClearTimeout.call(null, marker);
    } catch (e) {
      // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
      // Some versions of I.E. have different rules for clearTimeout vs setTimeout
      return cachedClearTimeout.call(this, marker);
    }
  }
}

var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;

function cleanUpNextTick() {
  if (!draining || !currentQueue) {
    return;
  }

  draining = false;

  if (currentQueue.length) {
    queue = currentQueue.concat(queue);
  } else {
    queueIndex = -1;
  }

  if (queue.length) {
    drainQueue();
  }
}

function drainQueue() {
  if (draining) {
    return;
  }

  var timeout = runTimeout(cleanUpNextTick);
  draining = true;
  var len = queue.length;

  while (len) {
    currentQueue = queue;
    queue = [];

    while (++queueIndex < len) {
      if (currentQueue) {
        currentQueue[queueIndex].run();
      }
    }

    queueIndex = -1;
    len = queue.length;
  }

  currentQueue = null;
  draining = false;
  runClearTimeout(timeout);
}

process.nextTick = function (fun) {
  var args = new Array(arguments.length - 1);

  if (arguments.length > 1) {
    for (var i = 1; i < arguments.length; i++) {
      args[i - 1] = arguments[i];
    }
  }

  queue.push(new Item(fun, args));

  if (queue.length === 1 && !draining) {
    runTimeout(drainQueue);
  }
}; // v8 likes predictible objects


function Item(fun, array) {
  this.fun = fun;
  this.array = array;
}

Item.prototype.run = function () {
  this.fun.apply(null, this.array);
};

process.title = 'browser';
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues

process.versions = {};

function noop() {}

process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.prependListener = noop;
process.prependOnceListener = noop;

process.listeners = function (name) {
  return [];
};

process.binding = function (name) {
  throw new Error('process.binding is not supported');
};

process.cwd = function () {
  return '/';
};

process.chdir = function (dir) {
  throw new Error('process.chdir is not supported');
};

process.umask = function () {
  return 0;
};
},{}],"sPFf":[function(require,module,exports) {
var process = require("process");
var global = arguments[3];
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.document = exports.global = exports.window = exports.isBrowser = void 0;

function _typeof(obj) {
  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);
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
// Purpose: include this in your module to avoids adding dependencies on
// micro modules like 'global' and 'is-browser';

/* global process, window, global, document */


var isBrowser = (typeof process === "undefined" ? "undefined" : _typeof(process)) !== 'object' || String(process) !== '[object process]' || true;
exports.isBrowser = isBrowser;
var window_ = typeof window !== 'undefined' ? window : global;
exports.window = window_;
var global_ = typeof global !== 'undefined' ? global : window;
exports.global = global_;
var document_ = typeof document !== 'undefined' ? document : {};
exports.document = document_;
},{"process":"r7L2"}],"Izky":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _typeof;

function _typeof2(obj) {
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof2 = function _typeof2(obj) {
      return typeof obj;
    };
  } else {
    _typeof2 = function _typeof2(obj) {
      return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
    };
  }

  return _typeof2(obj);
}

function _typeof(obj) {
  if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") {
    exports.default = _typeof = function _typeof(obj) {
      return _typeof2(obj);
    };
  } else {
    exports.default = _typeof = function _typeof(obj) {
      return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj);
    };
  }

  return _typeof(obj);
}
},{}],"DQbi":[function(require,module,exports) {
var process = require("process");
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = isElectron;

var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function isElectron(mockUserAgent) {
  if (typeof window !== 'undefined' && (0, _typeof2.default)(window.process) === 'object' && window.process.type === 'renderer') {
    return true;
  }

  if (typeof process !== 'undefined' && (0, _typeof2.default)(process.versions) === 'object' && Boolean(process.versions.electron)) {
    return true;
  }

  var realUserAgent = (typeof navigator === "undefined" ? "undefined" : (0, _typeof2.default)(navigator)) === 'object' && typeof navigator.userAgent === 'string' && navigator.userAgent;
  var userAgent = mockUserAgent || realUserAgent;

  if (userAgent && userAgent.indexOf('Electron') >= 0) {
    return true;
  }

  return false;
}
},{"@babel/runtime/helpers/esm/typeof":"Izky","process":"r7L2"}],"g6d6":[function(require,module,exports) {
var process = require("process");
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = isBrowser;
exports.isBrowserMainThread = isBrowserMainThread;

var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof"));

var _isElectron = _interopRequireDefault(require("./is-electron"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function isBrowser() {
  var isNode = (typeof process === "undefined" ? "undefined" : (0, _typeof2.default)(process)) === 'object' && String(process) === '[object process]' && !true;
  return !isNode || (0, _isElectron.default)();
}

function isBrowserMainThread() {
  return isBrowser() && typeof document !== 'undefined';
}
},{"@babel/runtime/helpers/esm/typeof":"Izky","./is-electron":"DQbi","process":"r7L2"}],"GsUh":[function(require,module,exports) {
var global = arguments[3];
var process = require("process");
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.console = exports.process = exports.document = exports.global = exports.window = exports.self = void 0;

var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var globals = {
  self: typeof self !== 'undefined' && self,
  window: typeof window !== 'undefined' && window,
  global: typeof global !== 'undefined' && global,
  document: typeof document !== 'undefined' && document,
  process: (typeof process === "undefined" ? "undefined" : (0, _typeof2.default)(process)) === 'object' && process
};
var self_ = globals.self || globals.window || globals.global;
exports.self = self_;
var window_ = globals.window || globals.self || globals.global;
exports.window = window_;
var global_ = globals.global || globals.self || globals.window;
exports.global = global_;
var document_ = globals.document || {};
exports.document = document_;
var process_ = globals.process || {};
exports.process = process_;
var console_ = console;
exports.console = console_;
},{"@babel/runtime/helpers/esm/typeof":"Izky","process":"r7L2"}],"RR0R":[function(require,module,exports) {
var global = arguments[3];
var process = require("process");
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "self", {
  enumerable: true,
  get: function () {
    return _globals.self;
  }
});
Object.defineProperty(exports, "window", {
  enumerable: true,
  get: function () {
    return _globals.window;
  }
});
Object.defineProperty(exports, "global", {
  enumerable: true,
  get: function () {
    return _globals.global;
  }
});
Object.defineProperty(exports, "document", {
  enumerable: true,
  get: function () {
    return _globals.document;
  }
});
Object.defineProperty(exports, "process", {
  enumerable: true,
  get: function () {
    return _globals.process;
  }
});
Object.defineProperty(exports, "console", {
  enumerable: true,
  get: function () {
    return _globals.console;
  }
});
exports.isBrowser = exports.VERSION = void 0;

var _isBrowser = _interopRequireDefault(require("../../env/is-browser"));

var _globals = require("../../env/globals");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var VERSION = typeof "2.1.0" !== 'undefined' ? "2.1.0" : 'untranspiled source';
exports.VERSION = VERSION;
var isBrowser = (0, _isBrowser.default)();
exports.isBrowser = isBrowser;
},{"../../env/is-browser":"g6d6","../../env/globals":"GsUh","process":"r7L2"}],"bczM":[function(require,module,exports) {

"use strict";

var _globals = require("./lib/utils/globals");

_globals.global.probe = {};
},{"./lib/utils/globals":"RR0R"}],"z3aF":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.isMobile = isMobile;
exports.default = getBrowser;

var _globals = require("./globals");

var _isBrowser = _interopRequireDefault(require("./is-browser"));

var _isElectron = _interopRequireDefault(require("./is-electron"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function isMobile() {
  return typeof _globals.window.orientation !== 'undefined';
}

function getBrowser(mockUserAgent) {
  if (!mockUserAgent && !(0, _isBrowser.default)()) {
    return 'Node';
  }

  if ((0, _isElectron.default)(mockUserAgent)) {
    return 'Electron';
  }

  var navigator_ = typeof navigator !== 'undefined' ? navigator : {};
  var userAgent = mockUserAgent || navigator_.userAgent || '';

  if (userAgent.indexOf('Edge') > -1) {
    return 'Edge';
  }

  var isMSIE = userAgent.indexOf('MSIE ') !== -1;
  var isTrident = userAgent.indexOf('Trident/') !== -1;

  if (isMSIE || isTrident) {
    return 'IE';
  }

  if (_globals.window.chrome) {
    return 'Chrome';
  }

  if (_globals.window.safari) {
    return 'Safari';
  }

  if (_globals.window.mozInnerScreenX) {
    return 'Firefox';
  }

  return 'Unknown';
}
},{"./globals":"GsUh","./is-browser":"g6d6","./is-electron":"DQbi"}],"ekKi":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = assert;

function assert(condition, message) {
  if (!condition) {
    throw new Error("Assertion failed. ".concat(message));
  }
}
},{}],"uYrB":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _classCallCheck;

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
},{}],"Q7Ky":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _createClass;

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;
}
},{}],"mBYT":[function(require,module,exports) {

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getTimestamp = getTimestamp;
exports.startTimestamp = void 0;

var _globals = require("./globals");

function getTimestamp() {
  if (!_globals.isBrowser) {
    var secondsAndNanoseconds = _globals.process.hrtime();

    return secondsAndNanoseconds[0] + secondsAndNanoseconds[1] / 1e6;
  }

  if (_globals.window.performance) {
    return _globals.window.performance.now();
  }

  return Date.now();
}

var startTimestamp = getTimestamp();
exports.startTimestamp = startTimestamp;
},{"./globals":"RR0R"}],"Z1eE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.formatTime = formatTime;
exports.leftPad = leftPad;
exports.rightPad = rightPad;
exports.getSISuffix = getSISuffix;
exports.formatSI = formatSI;
exports.formatValue = formatValue;
exports.formatImage = formatImage;

function formatTime(ms) {
  var formatted;

  if (ms < 10) {
    formatted = "".concat(ms.toFixed(2), "ms");
  } else if (ms < 100) {
    formatted = "".concat(ms.toFixed(1), "ms");
  } else if (ms < 1000) {
    formatted = "".concat(ms.toFixed(0), "ms");
  } else {
    formatted = "".concat((ms / 1000).toFixed(2), "s");
  }

  return formatted;
}

function leftPad(string) {
  var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 8;
  var padLength = Math.max(length - string.length, 0);
  return "".concat(' '.repeat(padLength)).concat(string);
}

function rightPad(string) {
  var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 8;
  var padLength = Math.max(length - string.length, 0);
  return "".concat(string).concat(' '.repeat(padLength));
}

function splitIntoBaseAndExponent(number) {
  var base = number;
  var exponent = 0;

  if (number !== 0) {
    while (base >= 10 || base <= -10) {
      base /= 10;
      exponent++;
    }

    while (base < 1 && base > -1) {
      base *= 10;
      exponent--;
    }
  }

  return {
    base: base,
    exponent: exponent
  };
}

function getSISuffix(multipleOf3) {
  var SI_SUFFIXES = {
    0: '',
    1: 'K',
    2: 'M',
    3: 'G',
    '-1': 'm',
    '-2': 'µ',
    '-3': 'n'
  };
  var key = String(multipleOf3);
  return key in SI_SUFFIXES ? SI_SUFFIXES[key] : "e".concat(multipleOf3 * 3);
}

function formatSI(number) {
  var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;

  var _splitIntoBaseAndExpo = splitIntoBaseAndExponent(number),
      base = _splitIntoBaseAndExpo.base,
      exponent = _splitIntoBaseAndExpo.exponent;

  var multipleOf3 = Math.floor(exponent / 3);
  var remaining = exponent - multipleOf3 * 3;
  var digits = base * Math.pow(10, remaining);
  return "".concat(digits.toPrecision(precision)).concat(getSISuffix(multipleOf3));
}

function formatValue(v) {
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  var EPSILON = 1e-16;
  var _opts$isInteger = opts.isInteger,
      isInteger = _opts$isInteger === void 0 ? false : _opts$isInteger;

  if (Array.isArray(v) || ArrayBuffer.isView(v)) {
    return formatArrayValue(v, opts);
  }

  if (!Number.isFinite(v)) {
    return String(v);
  }

  if (Math.abs(v) < EPSILON) {
    return isInteger ? '0' : '0.';
  }

  if (isInteger) {
    return v.toFixed(0);
  }

  if (Math.abs(v) > 100 && Math.abs(v) < 10000) {
    return v.toFixed(0);
  }

  var string = v.toPrecision(2);
  var decimal = string.indexOf('.0');
  return decimal === string.length - 2 ? string.slice(0, -1) : string;
}

function formatArrayValue(v, opts) {
  var _opts$maxElts = opts.maxElts,
      maxElts = _opts$maxElts === void 0 ? 16 : _opts$maxElts,
      _opts$size = opts.size,
      size = _opts$size === void 0 ? 1 : _opts$size;
  var string = '[';

  for (var i = 0; i < v.length && i < maxElts; ++i) {
    if (i > 0) {
      string += ",".concat(i % size === 0 ? ' ' : '');
    }

    string += formatValue(v[i], opts);
  }

  var terminator = v.length > maxElts ? '...' : ']';
  return "".concat(string).concat(terminator);
}

function formatImage(image, message, scale) {
  var maxWidth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 600;
  var imageUrl = image.src.replace(/\(/g, '%28').replace(/\)/g, '%29');

  if (image.width > maxWidth) {
    scale = Math.min(scale, maxWidth / image.width);
  }

  var width = image.width * scale;
  var height = image.height * scale;
  var style = ['font-size:1px;', "padding:".concat(Math.floor(height / 2), "px ").concat(Math.floor(width / 2), "px;"), "line-height:".concat(height, "px;"), "background:url(".concat(imageUrl, ");"), "background-size:".concat(width, "px ").concat(height, "px;"), 'color:transparent;'].join('');
  return ["".concat(message, " %c+"), style];
}
},{}],"DVZC":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _timestamp = require("./utils/timestamp");

var _formatters = require("./utils/formatters");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Stats = function () {
  function Stats(_ref) {
    var id = _ref.id;
    (0, _classCallCheck2.default)(this, Stats);
    this.id = id;
    this.time = (0, _timestamp.getTimestamp)();
    this.counters = {};
    Object.seal(this);
  }

  (0, _createClass2.default)(Stats, [{
    key: "addCounter",
    value: function addCounter(name) {
      this._getCounter(name);

      return this;
    }
  }, {
    key: "bump",
    value: function bump(name) {
      var counter = this._getCounter(name);

      counter.call++;
      counter.count++;
      return this;
    }
  }, {
    key: "increment",
    value: function increment(name, count) {
      var counter = this._getCounter(name);

      counter.call++;
      counter.count += count;
      return this;
    }
  }, {
    key: "addTimer",
    value: function addTimer(name) {
      var timer = this._getCounter(name);

      timer.time = 0;
      return this;
    }
  }, {
    key: "addTime",
    value: function addTime(name, time) {
      var timer = this._getCounter(name);

      timer.time += time;
      timer.count++;
      return this;
    }
  }, {
    key: "timeStart",
    value: function timeStart(name, subname) {
      var timer = this._getCounter(name);

      timer._startTime = (0, _timestamp.getTimestamp)();
    }
  }, {
    key: "timeEnd",
    value: function timeEnd(name, subname) {
      var timer = this._getCounter(name);

      this.addTime(name, (0, _timestamp.getTimestamp)() - timer._startTime);
    }
  }, {
    key: "reset",
    value: function reset() {
      this.time = (0, _timestamp.getTimestamp)();

      for (var key in this.counters) {
        var counter = this.counters[key];
        counter.count = 0;
        counter.time = 0;
      }

      return this;
    }
  }, {
    key: "hasTimeElapsed",
    value: function hasTimeElapsed() {
      var deltaTime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1000;
      return (0, _timestamp.getTimestamp)() - this.time > 1000;
    }
  }, {
    key: "getStats",
    value: function getStats() {
      var deltaTime = ((0, _timestamp.getTimestamp)() - this.time) / 1000;
      var stats = {};

      for (var key in this.counters) {
        var counter = this.counters[key];
        stats[counter.title] = {
          total: counter.count,
          fps: Math.round(counter.count / deltaTime)
        };

        if (counter.time) {
          stats[counter.title].totalTime = (0, _formatters.formatTime)(counter.time);
          stats[counter.title].avgTime = (0, _formatters.formatTime)(counter.time / counter.count);
        }
      }

      return stats;
    }
  }, {
    key: "getStatsTable",
    value: function getStatsTable() {
      var stats = this.getStats();

      for (var key in stats) {
        if (stats[key].total === 0) {
          delete stats[key];
        }
      }

      return stats;
    }
  }, {
    key: "getStatNames",
    value: function getStatNames() {
      return Object.keys(this.counters);
    }
  }, {
    key: "get",
    value: function get(name) {
      var counter = this._getCounter(name);

      return counter.count;
    }
  }, {
    key: "getCount",
    value: function getCount(name) {
      var counter = this._getCounter(name);

      return counter.count;
    }
  }, {
    key: "getFPS",
    value: function getFPS(name) {
      var counter = this._getCounter(name);

      var deltaTime = ((0, _timestamp.getTimestamp)() - this.time) / 1000;
      return Math.round(counter.count / deltaTime);
    }
  }, {
    key: "getTimeString",
    value: function getTimeString() {
      return "".concat(this.id, ":").concat((0, _formatters.formatTime)(this.time), "(").concat(this.count, ")");
    }
  }, {
    key: "oneSecondPassed",
    value: function oneSecondPassed() {
      var deltaTime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1000;
      return this.hasTimeElapsed(deltaTime);
    }
  }, {
    key: "_getCounter",
    value: function _getCounter(name) {
      var counter = this.counters[name];

      if (!counter) {
        counter = {
          title: name,
          unit: '',
          timer: false,
          count: 0,
          time: 0,
          totalTime: 0,
          averageTime: 0
        };
        this.counters[name] = counter;
      }

      return counter;
    }
  }, {
    key: "_incrementTimer",
    value: function _incrementTimer(counter, time, count) {
      counter.count += count;
      counter.totalTime += time;
      counter.averageTime = counter.totalTime / count;
    }
  }]);
  return Stats;
}();

exports.default = Stats;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","./utils/timestamp":"mBYT","./utils/formatters":"Z1eE"}],"TZ1C":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _arrayWithoutHoles;

function _arrayWithoutHoles(arr) {
  if (Array.isArray(arr)) {
    for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
      arr2[i] = arr[i];
    }

    return arr2;
  }
}
},{}],"BHut":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _iterableToArray;

function _iterableToArray(iter) {
  if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}
},{}],"aG6K":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _nonIterableSpread;

function _nonIterableSpread() {
  throw new TypeError("Invalid attempt to spread non-iterable instance");
}
},{}],"lA6S":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _toConsumableArray;

var _arrayWithoutHoles = _interopRequireDefault(require("./arrayWithoutHoles"));

var _iterableToArray = _interopRequireDefault(require("./iterableToArray"));

var _nonIterableSpread = _interopRequireDefault(require("./nonIterableSpread"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _toConsumableArray(arr) {
  return (0, _arrayWithoutHoles.default)(arr) || (0, _iterableToArray.default)(arr) || (0, _nonIterableSpread.default)();
}
},{"./arrayWithoutHoles":"TZ1C","./iterableToArray":"BHut","./nonIterableSpread":"aG6K"}],"DOnw":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _defineProperty;

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;
}
},{}],"c3Uv":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function getStorage(type) {
  try {
    var storage = window[type];
    var x = '__storage_test__';
    storage.setItem(x, x);
    storage.removeItem(x);
    return storage;
  } catch (e) {
    return null;
  }
}

var LocalStorage = function () {
  function LocalStorage(id, defaultSettings) {
    var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'sessionStorage';
    (0, _classCallCheck2.default)(this, LocalStorage);
    this.storage = getStorage(type);
    this.id = id;
    this.config = {};
    Object.assign(this.config, defaultSettings);

    this._loadConfiguration();
  }

  (0, _createClass2.default)(LocalStorage, [{
    key: "getConfiguration",
    value: function getConfiguration() {
      return this.config;
    }
  }, {
    key: "setConfiguration",
    value: function setConfiguration(configuration) {
      this.config = {};
      return this.updateConfiguration(configuration);
    }
  }, {
    key: "updateConfiguration",
    value: function updateConfiguration(configuration) {
      Object.assign(this.config, configuration);

      if (this.storage) {
        var serialized = JSON.stringify(this.config);
        this.storage.setItem(this.id, serialized);
      }

      return this;
    }
  }, {
    key: "_loadConfiguration",
    value: function _loadConfiguration() {
      var configuration = {};

      if (this.storage) {
        var serializedConfiguration = this.storage.getItem(this.id);
        configuration = serializedConfiguration ? JSON.parse(serializedConfiguration) : {};
      }

      Object.assign(this.config, configuration);
      return this;
    }
  }]);
  return LocalStorage;
}();

exports.default = LocalStorage;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky"}],"eUrp":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.addColor = addColor;
exports.COLOR = void 0;

var _globals = require("./globals");

var COLOR = {
  BLACK: 30,
  RED: 31,
  GREEN: 32,
  YELLOW: 33,
  BLUE: 34,
  MAGENTA: 35,
  CYAN: 36,
  WHITE: 37,
  BRIGHT_BLACK: 90,
  BRIGHT_RED: 91,
  BRIGHT_GREEN: 92,
  BRIGHT_YELLOW: 93,
  BRIGHT_BLUE: 94,
  BRIGHT_MAGENTA: 95,
  BRIGHT_CYAN: 96,
  BRIGHT_WHITE: 97
};
exports.COLOR = COLOR;

function getColor(color) {
  return typeof color === 'string' ? COLOR[color.toUpperCase()] || COLOR.WHITE : color;
}

function addColor(string, color, background) {
  if (!_globals.isBrowser && typeof string === 'string') {
    if (color) {
      color = getColor(color);
      string = "\x1B[".concat(color, "m").concat(string, "\x1B[39m");
    }

    if (background) {
      color = getColor(background);
      string = "\x1B[".concat(background + 10, "m").concat(string, "\x1B[49m");
    }
  }

  return string;
}
},{"./globals":"RR0R"}],"V7Hl":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.autobind = autobind;

function autobind(obj) {
  var predefined = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['constructor'];
  var proto = Object.getPrototypeOf(obj);
  var propNames = Object.getOwnPropertyNames(proto);
  var _iteratorNormalCompletion = true;
  var _didIteratorError = false;
  var _iteratorError = undefined;

  try {
    var _loop = function _loop() {
      var key = _step.value;

      if (typeof obj[key] === 'function') {
        if (!predefined.find(function (name) {
          return key === name;
        })) {
          obj[key] = obj[key].bind(obj);
        }
      }
    };

    for (var _iterator = propNames[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
      _loop();
    }
  } catch (err) {
    _didIteratorError = true;
    _iteratorError = err;
  } finally {
    try {
      if (!_iteratorNormalCompletion && _iterator.return != null) {
        _iterator.return();
      }
    } finally {
      if (_didIteratorError) {
        throw _iteratorError;
      }
    }
  }
}
},{}],"U6CE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = assert;

function assert(condition, message) {
  if (!condition) {
    throw new Error(message || 'Assertion failed');
  }
}
},{}],"GYI9":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof"));

var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _globals = require("./utils/globals");

var _localStorage = _interopRequireDefault(require("./utils/local-storage"));

var _timestamp = require("./utils/timestamp");

var _formatters = require("./utils/formatters");

var _color = require("./utils/color");

var _autobind = require("./utils/autobind");

var _assert2 = _interopRequireDefault(require("../lib/utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var originalConsole = {
  debug: _globals.isBrowser ? console.debug || console.log : console.log,
  log: console.log,
  info: console.info,
  warn: console.warn,
  error: console.error
};
var DEFAULT_SETTINGS = {
  enabled: false,
  priority: 0
};

function noop() {}

var cache = {};

function getTableHeader(table) {
  for (var key in table) {
    for (var title in table[key]) {
      return title || 'untitled';
    }
  }

  return 'empty';
}

var Log = function () {
  function Log() {
    var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
        id = _ref.id;

    (0, _classCallCheck2.default)(this, Log);
    this.id = id;
    this.VERSION = _globals.VERSION;
    this._startTs = (0, _timestamp.getTimestamp)();
    this._deltaTs = (0, _timestamp.getTimestamp)();
    this.LOG_THROTTLE_TIMEOUT = 0;
    this._storage = new _localStorage.default("__probe-".concat(this.id, "__"), DEFAULT_SETTINGS);
    this.userData = {};
    this.timeStamp("".concat(this.id, " started"));
    (0, _autobind.autobind)(this);
    Object.seal(this);
  }

  (0, _createClass2.default)(Log, [{
    key: "isEnabled",
    value: function isEnabled() {
      return this._storage.config.enabled;
    }
  }, {
    key: "getPriority",
    value: function getPriority() {
      return this._storage.config.priority;
    }
  }, {
    key: "getLevel",
    value: function getLevel() {
      return this._storage.config.priority;
    }
  }, {
    key: "getTotal",
    value: function getTotal() {
      return Number(((0, _timestamp.getTimestamp)() - this._startTs).toPrecision(10));
    }
  }, {
    key: "getDelta",
    value: function getDelta() {
      return Number(((0, _timestamp.getTimestamp)() - this._deltaTs).toPrecision(10));
    }
  }, {
    key: "enable",
    value: function enable() {
      var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;

      this._storage.updateConfiguration({
        enabled: enabled
      });

      return this;
    }
  }, {
    key: "setLevel",
    value: function setLevel(level) {
      this._storage.updateConfiguration({
        priority: level
      });

      return this;
    }
  }, {
    key: "assert",
    value: function assert(condition, message) {
      (0, _assert2.default)(condition, message);
    }
  }, {
    key: "warn",
    value: function warn(message) {
      for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
        args[_key - 1] = arguments[_key];
      }

      return this._getLogFunction({
        message: message,
        args: args,
        method: originalConsole.warn,
        once: true
      });
    }
  }, {
    key: "error",
    value: function error(message) {
      for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
        args[_key2 - 1] = arguments[_key2];
      }

      return this._getLogFunction({
        message: message,
        args: args,
        method: originalConsole.error
      });
    }
  }, {
    key: "deprecated",
    value: function deprecated(oldUsage, newUsage) {
      return this.warn("`".concat(oldUsage, "` is deprecated and will be removed in a later version. Use `").concat(newUsage, "` instead"));
    }
  }, {
    key: "removed",
    value: function removed(oldUsage, newUsage) {
      return this.error("`".concat(oldUsage, "` has been removed. Use `").concat(newUsage, "` instead"));
    }
  }, {
    key: "probe",
    value: function probe(priority, message) {
      for (var _len3 = arguments.length, args = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
        args[_key3 - 2] = arguments[_key3];
      }

      return this._getLogFunction({
        priority: priority,
        message: message,
        args: args,
        method: originalConsole.log,
        time: true,
        once: true
      });
    }
  }, {
    key: "log",
    value: function log(priority, message) {
      for (var _len4 = arguments.length, args = new Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) {
        args[_key4 - 2] = arguments[_key4];
      }

      return this._getLogFunction({
        priority: priority,
        message: message,
        args: args,
        method: originalConsole.debug
      });
    }
  }, {
    key: "info",
    value: function info(priority, message) {
      for (var _len5 = arguments.length, args = new Array(_len5 > 2 ? _len5 - 2 : 0), _key5 = 2; _key5 < _len5; _key5++) {
        args[_key5 - 2] = arguments[_key5];
      }

      return this._getLogFunction({
        priority: priority,
        message: message,
        args: args,
        method: console.info
      });
    }
  }, {
    key: "once",
    value: function once(priority, message) {
      for (var _len6 = arguments.length, args = new Array(_len6 > 2 ? _len6 - 2 : 0), _key6 = 2; _key6 < _len6; _key6++) {
        args[_key6 - 2] = arguments[_key6];
      }

      return this._getLogFunction({
        priority: priority,
        message: message,
        args: args,
        method: originalConsole.debug || originalConsole.info,
        once: true
      });
    }
  }, {
    key: "table",
    value: function table(priority, _table, columns) {
      if (_table) {
        var tag = getTableHeader(_table);
        return this._getLogFunction({
          priority: priority,
          message: _table,
          args: columns && [columns],
          tag: tag,
          method: console.table || noop
        });
      }

      return noop;
    }
  }, {
    key: "image",
    value: function image(_ref2) {
      var priority = _ref2.priority,
          _image = _ref2.image,
          _ref2$message = _ref2.message,
          message = _ref2$message === void 0 ? '' : _ref2$message,
          _ref2$scale = _ref2.scale,
          scale = _ref2$scale === void 0 ? 1 : _ref2$scale;

      if (priority > this.getPriority()) {
        return noop;
      }

      return _globals.isBrowser ? this._logImageInBrowser({
        image: _image,
        message: message,
        scale: scale
      }) : this._logImageInNode({
        image: _image,
        message: message,
        scale: scale
      });
    }
  }, {
    key: "settings",
    value: function settings() {
      if (console.table) {
        console.table(this._storage.config);
      } else {
        console.log(this._storage.config);
      }
    }
  }, {
    key: "get",
    value: function get(setting) {
      return this._storage.config[setting];
    }
  }, {
    key: "set",
    value: function set(setting, value) {
      this._storage.updateConfiguration((0, _defineProperty2.default)({}, setting, value));
    }
  }, {
    key: "_logImageInNode",
    value: function _logImageInNode(_ref3) {
      var image = _ref3.image,
          _ref3$message = _ref3.message,
          message = _ref3$message === void 0 ? '' : _ref3$message,
          _ref3$scale = _ref3.scale,
          scale = _ref3$scale === void 0 ? 1 : _ref3$scale;
      var asciify = null;

      try {
        asciify = module.require('asciify-image');
      } catch (error) {}

      if (asciify) {
        return function () {
          return asciify(image, {
            fit: 'box',
            width: "".concat(Math.round(80 * scale), "%")
          }).then(function (data) {
            return console.log(data);
          });
        };
      }

      return noop;
    }
  }, {
    key: "_logImageInBrowser",
    value: function _logImageInBrowser(_ref4) {
      var image = _ref4.image,
          _ref4$message = _ref4.message,
          message = _ref4$message === void 0 ? '' : _ref4$message,
          _ref4$scale = _ref4.scale,
          scale = _ref4$scale === void 0 ? 1 : _ref4$scale;

      if (typeof image === 'string') {
        var img = new Image();

        img.onload = function () {
          var _console;

          var args = (0, _formatters.formatImage)(img, message, scale);

          (_console = console).log.apply(_console, (0, _toConsumableArray2.default)(args));
        };

        img.src = image;
        return noop;
      }

      var element = image.nodeName || '';

      if (element.toLowerCase() === 'img') {
        var _console2;

        (_console2 = console).log.apply(_console2, (0, _toConsumableArray2.default)((0, _formatters.formatImage)(image, message, scale)));

        return noop;
      }

      if (element.toLowerCase() === 'canvas') {
        var _img = new Image();

        _img.onload = function () {
          var _console3;

          return (_console3 = console).log.apply(_console3, (0, _toConsumableArray2.default)((0, _formatters.formatImage)(_img, message, scale)));
        };

        _img.src = image.toDataURL();
        return noop;
      }

      return noop;
    }
  }, {
    key: "time",
    value: function time(priority, message) {
      return this._getLogFunction({
        priority: priority,
        message: message,
        method: console.time ? console.time : console.info
      });
    }
  }, {
    key: "timeEnd",
    value: function timeEnd(priority, message) {
      return this._getLogFunction({
        priority: priority,
        message: message,
        method: console.timeEnd ? console.timeEnd : console.info
      });
    }
  }, {
    key: "timeStamp",
    value: function timeStamp(priority, message) {
      return this._getLogFunction({
        priority: priority,
        message: message,
        method: console.timeStamp || noop
      });
    }
  }, {
    key: "group",
    value: function group(priority, message) {
      var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
        collapsed: false
      };
      opts = this._normalizeArguments({
        priority: priority,
        message: message,
        opts: opts
      });
      var _opts = opts,
          collapsed = _opts.collapsed;
      return this._getLogFunction({
        priority: priority,
        message: message,
        opts: opts,
        method: (collapsed ? console.groupCollapsed : console.group) || console.info
      });
    }
  }, {
    key: "groupCollapsed",
    value: function groupCollapsed(priority, message) {
      var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
      return this.group(priority, message, Object.assign({}, opts, {
        collapsed: true
      }));
    }
  }, {
    key: "groupEnd",
    value: function groupEnd(priority) {
      return this._getLogFunction({
        priority: priority,
        message: '',
        method: console.groupEnd || noop
      });
    }
  }, {
    key: "withGroup",
    value: function withGroup(priority, message, func) {
      var opts = this._normalizeArguments({
        priority: priority,
        message: message
      });

      this.group(opts);

      try {
        func();
      } finally {
        this.groupEnd(opts.message);
      }
    }
  }, {
    key: "trace",
    value: function trace() {
      if (console.trace) {
        console.trace();
      }
    }
  }, {
    key: "_shouldLog",
    value: function _shouldLog(priority) {
      priority = this._normalizePriority(priority);
      return priority === 0 || this.isEnabled() && this.getPriority() >= priority;
    }
  }, {
    key: "_getElapsedTime",
    value: function _getElapsedTime() {
      var total = this.getTotal();
      var delta = this.getDelta();
      this._deltaTs = (0, _timestamp.getTimestamp)();
      return {
        total: total,
        delta: delta
      };
    }
  }, {
    key: "_getLogFunction",
    value: function _getLogFunction(opts) {
      if (this._shouldLog(opts.priority)) {
        var _opts2 = opts,
            method = _opts2.method;
        opts = this._parseArguments(opts);
        (0, _assert2.default)(method);
        var _opts3 = opts,
            message = _opts3.message;
        var tag = opts.tag || opts.message;

        if (opts.once) {
          if (!cache[tag]) {
            cache[tag] = (0, _timestamp.getTimestamp)();
          } else {
            return noop;
          }
        }

        message = this._decorateMessage(message, opts);
        return method.bind.apply(method, [console, message].concat((0, _toConsumableArray2.default)(opts.args)));
      }

      return noop;
    }
  }, {
    key: "_parseArguments",
    value: function _parseArguments(options) {
      var normOpts = this._normalizeArguments(options);

      var _this$_getElapsedTime = this._getElapsedTime(),
          delta = _this$_getElapsedTime.delta,
          total = _this$_getElapsedTime.total;

      return Object.assign(options, normOpts, {
        delta: delta,
        total: total
      });
    }
  }, {
    key: "_normalizePriority",
    value: function _normalizePriority(priority) {
      var resolvedPriority;

      switch ((0, _typeof2.default)(priority)) {
        case 'number':
          resolvedPriority = priority;
          break;

        case 'object':
          resolvedPriority = priority.priority || 0;
          break;

        default:
          resolvedPriority = 0;
      }

      (0, _assert2.default)(Number.isFinite(resolvedPriority) && resolvedPriority >= 0);
      return resolvedPriority;
    }
  }, {
    key: "_normalizeArguments",
    value: function _normalizeArguments(_ref5) {
      var priority = _ref5.priority,
          message = _ref5.message,
          _ref5$args = _ref5.args,
          args = _ref5$args === void 0 ? [] : _ref5$args,
          opts = _ref5.opts;
      var newOpts = {
        priority: this._normalizePriority(priority),
        message: message,
        args: args
      };

      switch ((0, _typeof2.default)(priority)) {
        case 'string':
        case 'function':
          if (message !== undefined) {
            args.unshift(message);
          }

          Object.assign(newOpts, {
            message: priority
          });
          break;

        case 'object':
          Object.assign(newOpts, priority);
          break;

        default:
      }

      if (typeof newOpts.message === 'function') {
        newOpts.message = this._shouldLog(newOpts.priority) ? newOpts.message() : '';
      }

      (0, _assert2.default)(typeof newOpts.message === 'string' || (0, _typeof2.default)(newOpts.message) === 'object');
      return Object.assign(newOpts, opts);
    }
  }, {
    key: "_decorateMessage",
    value: function _decorateMessage(message, opts) {
      if (typeof message === 'string') {
        var time = '';

        if (opts.time) {
          var _this$_getElapsedTime2 = this._getElapsedTime(),
              total = _this$_getElapsedTime2.total;

          time = (0, _formatters.leftPad)((0, _formatters.formatTime)(total));
        }

        message = opts.time ? "".concat(this.id, ": ").concat(time, "  ").concat(message) : "".concat(this.id, ": ").concat(message);
        message = (0, _color.addColor)(message, opts.color, opts.background);
      }

      return message;
    }
  }, {
    key: "priority",
    set: function set(newPriority) {
      this._storage.updateConfiguration({
        priority: newPriority
      });

      return this;
    },
    get: function get() {
      return this._storage.config.priority;
    }
  }]);
  return Log;
}();

exports.default = Log;
Log.VERSION = _globals.VERSION;
},{"@babel/runtime/helpers/esm/typeof":"Izky","@babel/runtime/helpers/esm/toConsumableArray":"lA6S","@babel/runtime/helpers/esm/defineProperty":"DOnw","@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","./utils/globals":"RR0R","./utils/local-storage":"c3Uv","./utils/timestamp":"mBYT","./utils/formatters":"Z1eE","./utils/color":"eUrp","./utils/autobind":"V7Hl","../lib/utils/assert":"U6CE"}],"unVT":[function(require,module,exports) {

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.enableDOMLogging = enableDOMLogging;
exports.logLineToDOM = logLineToDOM;
exports.default = void 0;

var _globals = require("./globals");

var old = null;

function enableDOMLogging() {
  var enable = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;

  if (enable && !old) {
    old = _globals.console.log.bind(_globals.console);

    _globals.console.log = function () {
      logLineToDOM.apply(void 0, arguments);
      old.apply(void 0, arguments);
    };
  }

  if (!enable && old) {
    _globals.console.log = old;
    old = null;
  }
}

var logDiv = null;

function logLineToDOM(message) {
  if (!logDiv) {
    var markdown = _globals.global.probe.markdown;
    logDiv = _globals.document.createElement(markdown ? 'pre' : 'div');
  }

  var childNodes = _globals.document.body.childNodes;

  _globals.document.body.insertBefore(logDiv, childNodes && childNodes[0]);

  if (typeof message === 'string') {
    logDiv.innerHTML += "".concat(message, "<br />");
  }
}

var _default = enableDOMLogging;
exports.default = _default;
},{"./globals":"RR0R"}],"aapK":[function(require,module,exports) {
var global = arguments[3];
var process = require("process");
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "VERSION", {
  enumerable: true,
  get: function () {
    return _globals.VERSION;
  }
});
Object.defineProperty(exports, "self", {
  enumerable: true,
  get: function () {
    return _globals2.self;
  }
});
Object.defineProperty(exports, "window", {
  enumerable: true,
  get: function () {
    return _globals2.window;
  }
});
Object.defineProperty(exports, "global", {
  enumerable: true,
  get: function () {
    return _globals2.global;
  }
});
Object.defineProperty(exports, "document", {
  enumerable: true,
  get: function () {
    return _globals2.document;
  }
});
Object.defineProperty(exports, "process", {
  enumerable: true,
  get: function () {
    return _globals2.process;
  }
});
Object.defineProperty(exports, "console", {
  enumerable: true,
  get: function () {
    return _globals2.console;
  }
});
Object.defineProperty(exports, "isBrowser", {
  enumerable: true,
  get: function () {
    return _isBrowser.default;
  }
});
Object.defineProperty(exports, "isBrowserMainThread", {
  enumerable: true,
  get: function () {
    return _isBrowser.isBrowserMainThread;
  }
});
Object.defineProperty(exports, "getBrowser", {
  enumerable: true,
  get: function () {
    return _getBrowser.default;
  }
});
Object.defineProperty(exports, "isMobile", {
  enumerable: true,
  get: function () {
    return _getBrowser.isMobile;
  }
});
Object.defineProperty(exports, "isElectron", {
  enumerable: true,
  get: function () {
    return _isElectron.default;
  }
});
Object.defineProperty(exports, "assert", {
  enumerable: true,
  get: function () {
    return _assert.default;
  }
});
Object.defineProperty(exports, "Stats", {
  enumerable: true,
  get: function () {
    return _stats.default;
  }
});
Object.defineProperty(exports, "Log", {
  enumerable: true,
  get: function () {
    return _log.default;
  }
});
Object.defineProperty(exports, "COLOR", {
  enumerable: true,
  get: function () {
    return _color.COLOR;
  }
});
Object.defineProperty(exports, "_enableDOMLogging", {
  enumerable: true,
  get: function () {
    return _logToDom.enableDOMLogging;
  }
});
exports.default = void 0;

require("./init");

var _globals = require("./lib/utils/globals");

var _globals2 = require("./env/globals");

var _isBrowser = _interopRequireWildcard(require("./env/is-browser"));

var _getBrowser = _interopRequireWildcard(require("./env/get-browser"));

var _isElectron = _interopRequireDefault(require("./env/is-electron"));

var _assert = _interopRequireDefault(require("./env/assert"));

var _stats = _interopRequireDefault(require("./lib/stats"));

var _log = _interopRequireDefault(require("./lib/log"));

var _color = require("./lib/utils/color");

var _logToDom = require("./lib/utils/log-to-dom");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var _default = new _log.default({
  id: 'probe.gl'
});

exports.default = _default;
},{"./init":"bczM","./lib/utils/globals":"RR0R","./env/globals":"GsUh","./env/is-browser":"g6d6","./env/get-browser":"z3aF","./env/is-electron":"DQbi","./env/assert":"ekKi","./lib/stats":"DVZC","./lib/log":"GYI9","./lib/utils/color":"eUrp","./lib/utils/log-to-dom":"unVT","process":"r7L2"}],"q39U":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _probe = require("probe.gl");

var _default = new _probe.Log({
  id: 'deck'
}).enable();

exports.default = _default;
},{"probe.gl":"aapK"}],"xwR1":[function(require,module,exports) {

"use strict";

var _globals = require("../utils/globals");

var _log = _interopRequireDefault(require("../utils/log"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
// Version detection using babel plugin
// Fallback for tests and SSR since global variable is defined by Webpack.

/* global __VERSION__ */
var version = typeof "6.4.10" !== 'undefined' ? "6.4.10" : _globals.global.DECK_VERSION || 'untranspiled source';
var STARTUP_MESSAGE = 'set deck.log.priority=1 (or higher) to trace attribute updates';

if (_globals.global.deck && _globals.global.deck.VERSION !== version) {
  throw new Error("deck.gl - multiple versions detected: ".concat(_globals.global.deck.VERSION, " vs ").concat(version));
}

if (!_globals.global.deck) {
  /* global console */

  /* eslint-disable no-console */
  _log.default.log(0, "deck.gl ".concat(version, " - ").concat(STARTUP_MESSAGE))();

  _globals.global.deck = _globals.global.deck || {
    VERSION: version,
    version: version,
    log: _log.default
  };
} // TODO - Hack, remove when luma.gl 4.1.0-alpha.5 is published


if (!console.table) {
  console.table = function () {};
}
},{"../utils/globals":"sPFf","../utils/log":"q39U"}],"T6Uq":[function(require,module,exports) {
var process = require("process");
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// based on https://github.com/cheton/is-electron
// https://github.com/electron/electron/issues/2288

/* global window, process, navigator */
function isElectron() {
  // Renderer process
  if (typeof window !== 'undefined' && (0, _typeof2.default)(window.process) === 'object' && window.process.type === 'renderer') {
    return true;
  } // Main process


  if (typeof process !== 'undefined' && (0, _typeof2.default)(process.versions) === 'object' && Boolean(process.versions.electron)) {
    return true;
  } // Detect the user agent when the `nodeIntegration` option is set to true


  if ((typeof navigator === "undefined" ? "undefined" : (0, _typeof2.default)(navigator)) === 'object' && typeof navigator.userAgent === 'string' && navigator.userAgent.indexOf('Electron') >= 0) {
    return true;
  }

  return false;
}

var _default = isElectron();

exports.default = _default;
},{"@babel/runtime/helpers/esm/typeof":"Izky","process":"r7L2"}],"noZ1":[function(require,module,exports) {
var process = require("process");
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.isBrowserMainThread = void 0;

var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof"));

var _isElectron = _interopRequireDefault(require("./is-electron"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// This function is needed in initialization stages,
// make sure it can be imported in isolation

/* global process */
var isNode = (typeof process === "undefined" ? "undefined" : (0, _typeof2.default)(process)) === 'object' && String(process) === '[object process]' && !true;
var isBrowser = !isNode || _isElectron.default; // document does not exist on worker thread

var isBrowserMainThread = isBrowser && typeof document !== 'undefined';
exports.isBrowserMainThread = isBrowserMainThread;
var _default = isBrowser;
exports.default = _default;
},{"@babel/runtime/helpers/esm/typeof":"Izky","./is-electron":"T6Uq","process":"r7L2"}],"AlqY":[function(require,module,exports) {
var global = arguments[3];
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.document = exports.global = exports.window = exports.self = void 0;

/* global self, window, global, document */
var globals = {
  self: typeof self !== 'undefined' && self,
  window: typeof window !== 'undefined' && window,
  global: typeof global !== 'undefined' && global,
  document: typeof document !== 'undefined' && document
};
var self_ = globals.self || globals.window || globals.global;
exports.self = self_;
var window_ = globals.window || globals.self || globals.global;
exports.window = window_;
var global_ = globals.global || globals.self || globals.window;
exports.global = global_;
var document_ = globals.document || {};
exports.document = document_;
},{}],"na3T":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _probe = require("probe.gl");

var _default = new _probe.Log({
  id: 'luma'
}).enable();

exports.default = _default;
},{"probe.gl":"aapK"}],"VoGG":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getParameterPolyfill = getParameterPolyfill;

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _WEBGL_PARAMETERS;
/* eslint-disable no-inline-comments, max-len, camelcase */


var OES_element_index = 'OES_element_index';
var WEBGL_draw_buffers = 'WEBGL_draw_buffers';
var EXT_disjoint_timer_query = 'EXT_disjoint_timer_query';
var EXT_disjoint_timer_query_webgl2 = 'EXT_disjoint_timer_query_webgl2';
var EXT_texture_filter_anisotropic = 'EXT_texture_filter_anisotropic';
var WEBGL_debug_renderer_info = 'WEBGL_debug_renderer_info';
var GL_FRAGMENT_SHADER_DERIVATIVE_HINT = 0x8b8b;
var GL_DONT_CARE = 0x1100;
var GL_GPU_DISJOINT_EXT = 0x8fbb;
var GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84ff;
var GL_UNMASKED_VENDOR_WEBGL = 0x9245; // vendor string of the graphics driver.

var GL_UNMASKED_RENDERER_WEBGL = 0x9246; // renderer string of the graphics driver.

var getWebGL2ValueOrZero = function getWebGL2ValueOrZero(gl) {
  return !isWebGL2(gl) ? 0 : undefined;
}; // if a function returns undefined in this table,
// the original getParameter will be called, defeating the override


var WEBGL_PARAMETERS = (_WEBGL_PARAMETERS = {}, (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 3074, function (gl) {
  return !isWebGL2(gl) ? 36064 : undefined;
}), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, GL_FRAGMENT_SHADER_DERIVATIVE_HINT, function (gl) {
  return !isWebGL2(gl) ? GL_DONT_CARE : undefined;
}), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 35977, getWebGL2ValueOrZero), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 32937, getWebGL2ValueOrZero), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, GL_GPU_DISJOINT_EXT, function (gl, getParameter) {
  var ext = isWebGL2(gl) ? gl.getExtension(EXT_disjoint_timer_query_webgl2) : gl.getExtension(EXT_disjoint_timer_query);
  return ext && ext.GPU_DISJOINT_EXT ? getParameter(ext.GPU_DISJOINT_EXT) : 0;
}), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, GL_UNMASKED_VENDOR_WEBGL, function (gl, getParameter) {
  var ext = gl.getExtension(WEBGL_debug_renderer_info);
  return getParameter(ext && ext.UNMASKED_VENDOR_WEBGL || 7936);
}), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, GL_UNMASKED_RENDERER_WEBGL, function (gl, getParameter) {
  var ext = gl.getExtension(WEBGL_debug_renderer_info);
  return getParameter(ext && ext.UNMASKED_RENDERER_WEBGL || 7937);
}), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, function (gl, getParameter) {
  var ext = gl.luma.extensions[EXT_texture_filter_anisotropic];
  return ext ? getParameter(ext.MAX_TEXTURE_MAX_ANISOTROPY_EXT) : 1.0;
}), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 32883, getWebGL2ValueOrZero), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 35071, getWebGL2ValueOrZero), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 37447, getWebGL2ValueOrZero), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 36063, function (gl, getParameter) {
  if (!isWebGL2(gl)) {
    var ext = gl.getExtension(WEBGL_draw_buffers);
    return ext ? getParameter(ext.MAX_COLOR_ATTACHMENTS_WEBGL) : 0;
  }

  return undefined;
}), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 35379, getWebGL2ValueOrZero), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 35374, getWebGL2ValueOrZero), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 35377, getWebGL2ValueOrZero), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 34852, function (gl) {
  if (!isWebGL2(gl)) {
    var ext = gl.getExtension(WEBGL_draw_buffers);
    return ext ? ext.MAX_DRAW_BUFFERS_WEBGL : 0;
  }

  return undefined;
}), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 36203, // Guess: per webglstats.com 99.6% of webgl2 supports 2147483647
function (gl) {
  return gl.getExtension(OES_element_index) ? 2147483647 : 65535;
}), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 33001, // Guess: "Reasonably safe" per webglstats.com - could be higher/lower (on some mobile devices)
function (gl) {
  return gl.getExtension(OES_element_index) ? 16777216 : 65535;
}), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 33000, // Guess: "Reasonably safe" per webglstats.com - could be higher/lower (on some mobile devices)
function (gl) {
  return 16777216;
}), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 37157, getWebGL2ValueOrZero), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 35373, getWebGL2ValueOrZero), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 35657, getWebGL2ValueOrZero), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 36183, getWebGL2ValueOrZero), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 37137, getWebGL2ValueOrZero), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 34045, getWebGL2ValueOrZero), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 35978, getWebGL2ValueOrZero), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 35979, getWebGL2ValueOrZero), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 35968, getWebGL2ValueOrZero), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 35376, getWebGL2ValueOrZero), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 35375, getWebGL2ValueOrZero), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 35659, getWebGL2ValueOrZero), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 37154, getWebGL2ValueOrZero), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 35371, getWebGL2ValueOrZero), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 35658, getWebGL2ValueOrZero), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 35076, getWebGL2ValueOrZero), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 35077, getWebGL2ValueOrZero), (0, _defineProperty2.default)(_WEBGL_PARAMETERS, 35380, getWebGL2ValueOrZero), _WEBGL_PARAMETERS); // Return true if WebGL2 context

function isWebGL2(gl) {
  var GL_TEXTURE_BINDING_3D = 0x806a;
  return gl && 32874 === GL_TEXTURE_BINDING_3D;
} // A "replacement" gl.getParameter that accepts "enums" from extensions and WebGL2
// and returns reasonably safe defaults


function getParameterPolyfill(gl, originalGetParameter, pname) {
  // Return mock limits (usually 0) for WebGL2 constants to ensure these
  // can be queries without error
  var limit = WEBGL_PARAMETERS[pname];
  var value = typeof limit === 'function' ? limit(gl, originalGetParameter, pname) : limit;
  var result = value !== undefined ? value : originalGetParameter(pname);
  return result;
}
},{"@babel/runtime/helpers/esm/defineProperty":"DOnw"}],"HbLk":[function(require,module,exports) {
var global = arguments[3];
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = polyfillContext;

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));

var _polyfillGetParameter = require("./polyfill-get-parameter");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _WEBGL_CONTEXT_POLYFI; // WebGL1/WebGL2 extension polyfill support
//
// Provides a function that creates polyfills for WebGL2 functions based
// on available extensions and installs them on a supplied target (could be
// the WebGLContext or its prototype, or a separate object).
//
// This is intended to be a stand-alone file with minimal dependencies,
// easy to reuse or repurpose in other projects.

/* eslint-disable camelcase, brace-style */


// import polyfillVertexArrayObject from './polyfill-vertex-array-object';
// import {WebGLRenderingContext} from './webgl-rendering-context';
function assert(condition, message) {
  if (!condition) {
    throw new Error(message || 'luma.gl: assertion failed.');
  }
}

var OES_vertex_array_object = 'OES_vertex_array_object';
var ANGLE_instanced_arrays = 'ANGLE_instanced_arrays';
var WEBGL_draw_buffers = 'WEBGL_draw_buffers';
var EXT_disjoint_timer_query = 'EXT_disjoint_timer_query';
var EXT_disjoint_timer_query_webgl2 = 'EXT_disjoint_timer_query_webgl2';
var EXT_texture_filter_anisotropic = 'EXT_texture_filter_anisotropic';
var ERR_VAO_NOT_SUPPORTED = 'VertexArray requires WebGL2 or OES_vertex_array_object extension'; // Return true if WebGL2 context

function isWebGL2(gl) {
  return gl && 32874 === 32874;
} // Return object with webgl2 flag and an extension


function getExtensionData(gl, extension) {
  return {
    webgl2: isWebGL2(gl),
    ext: gl.getExtension(extension)
  };
} // function mapExtensionConstant(gl, constant) {
//   switch (constant) {
//   case ext.FRAGMENT_SHADER_DERIVATIVE_HINT_OES: return GL.FRAGMENT_SHADER_DERIVATIVE_HINT;
//   }
// }


var WEBGL_CONTEXT_POLYFILLS = (_WEBGL_CONTEXT_POLYFI = {}, (0, _defineProperty2.default)(_WEBGL_CONTEXT_POLYFI, OES_vertex_array_object, {
  meta: {
    suffix: 'OES'
  },
  // NEW METHODS
  createVertexArray: function createVertexArray() {
    assert(false, ERR_VAO_NOT_SUPPORTED);
  },
  deleteVertexArray: function deleteVertexArray() {},
  bindVertexArray: function bindVertexArray() {},
  isVertexArray: function isVertexArray() {
    return false;
  }
}), (0, _defineProperty2.default)(_WEBGL_CONTEXT_POLYFI, ANGLE_instanced_arrays, {
  meta: {
    suffix: 'ANGLE' // constants: {
    //   VERTEX_ATTRIB_ARRAY_DIVISOR: 'VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE'
    // }

  },
  vertexAttribDivisor: function vertexAttribDivisor(location, divisor) {
    // Accept divisor 0 even if instancing is not supported (0 = no instancing)
    assert(divisor === 0, 'WebGL instanced rendering not supported');
  },
  drawElementsInstanced: function drawElementsInstanced() {},
  drawArraysInstanced: function drawArraysInstanced() {}
}), (0, _defineProperty2.default)(_WEBGL_CONTEXT_POLYFI, WEBGL_draw_buffers, {
  meta: {
    suffix: 'WEBGL'
  },
  drawBuffers: function drawBuffers() {
    assert(false);
  }
}), (0, _defineProperty2.default)(_WEBGL_CONTEXT_POLYFI, EXT_disjoint_timer_query, {
  meta: {
    suffix: 'EXT'
  },
  // WebGL1: Polyfills the WebGL2 Query API
  createQuery: function createQuery() {
    assert(false);
  },
  deleteQuery: function deleteQuery() {
    assert(false);
  },
  beginQuery: function beginQuery() {
    assert(false);
  },
  endQuery: function endQuery() {},
  getQuery: function getQuery(handle, pname) {
    return this.getQueryObject(handle, pname);
  },
  // The WebGL1 extension uses getQueryObject rather then getQueryParameter
  getQueryParameter: function getQueryParameter(handle, pname) {
    return this.getQueryObject(handle, pname);
  },
  // plus the additional `queryCounter` method
  queryCounter: function queryCounter() {},
  getQueryObject: function getQueryObject() {}
}), (0, _defineProperty2.default)(_WEBGL_CONTEXT_POLYFI, EXT_disjoint_timer_query_webgl2, {
  meta: {
    suffix: 'EXT'
  },
  // install `queryCounter`
  // `null` avoids overwriting WebGL1 `queryCounter` if the WebGL2 extension is not available
  queryCounter: null
}), (0, _defineProperty2.default)(_WEBGL_CONTEXT_POLYFI, "OVERRIDES", {
  // Ensure readBuffer is a no-op
  readBuffer: function readBuffer(gl, originalFunc, attachment) {
    if (isWebGL2(gl)) {
      originalFunc(attachment);
    } else {// assert(attachment !== GL_COLOR_ATTACHMENT0 && attachment !== GL_FRONT);
    }
  },
  // Override for getVertexAttrib that returns sane values for non-WebGL1 constants
  getVertexAttrib: function getVertexAttrib(gl, originalFunc, location, pname) {
    // const gl = this; // eslint-disable-line
    var _getExtensionData = getExtensionData(gl, ANGLE_instanced_arrays),
        webgl2 = _getExtensionData.webgl2,
        ext = _getExtensionData.ext;

    var result;

    switch (pname) {
      // WebGL1 attributes will never be integer
      case 35069:
        result = !webgl2 ? false : undefined;
        break;
      // if instancing is not available, return 0 meaning divisor has not been set

      case 35070:
        result = !webgl2 && !ext ? 0 : undefined;
        break;

      default:
    }

    return result !== undefined ? result : originalFunc(location, pname);
  },
  // Handle transform feedback and uniform block queries in WebGL1
  getProgramParameter: function getProgramParameter(gl, originalFunc, program, pname) {
    if (!isWebGL2(gl)) {
      switch (pname) {
        case 35967:
          return 35981;

        case 35971:
          return 0;

        case 35382:
          return 0;

        default:
      }
    }

    return originalFunc(program, pname);
  },
  getInternalformatParameter: function getInternalformatParameter(gl, originalFunc, target, format, pname) {
    if (!isWebGL2(gl)) {
      switch (pname) {
        case 32937:
          return new Int32Array([0]);

        default:
      }
    }

    return gl.getInternalformatParameter(target, format, pname);
  },
  getTexParameter: function getTexParameter(gl, originalFunc, target, pname) {
    switch (pname) {
      case 34046:
        var extensions = gl.luma.extensions;
        var ext = extensions[EXT_texture_filter_anisotropic];
        pname = ext && ext.TEXTURE_MAX_ANISOTROPY_EXT || 34046;
        break;

      default:
    }

    return originalFunc(target, pname);
  },
  getParameter: _polyfillGetParameter.getParameterPolyfill,
  hint: function hint(gl, originalFunc, pname, value) {
    // TODO - handle GL.FRAGMENT_SHADER_DERIVATIVE_HINT:
    // switch (pname) {
    // case GL.FRAGMENT_SHADER_DERIVATIVE_HINT:
    // }
    return originalFunc(pname, value);
  }
}), _WEBGL_CONTEXT_POLYFI);

function initializeExtensions(gl) {
  gl.luma.extensions = {}; // `getSupportedExtensions` can return null when context is lost.

  var EXTENSIONS = gl.getSupportedExtensions() || [];
  var _iteratorNormalCompletion = true;
  var _didIteratorError = false;
  var _iteratorError = undefined;

  try {
    for (var _iterator = EXTENSIONS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
      var extension = _step.value;
      gl.luma[extension] = gl.getExtension(extension);
    }
  } catch (err) {
    _didIteratorError = true;
    _iteratorError = err;
  } finally {
    try {
      if (!_iteratorNormalCompletion && _iterator.return != null) {
        _iterator.return();
      }
    } finally {
      if (_didIteratorError) {
        throw _iteratorError;
      }
    }
  }
} // Polyfills a single WebGL extension into the `target` object


function polyfillExtension(gl, _ref) {
  var extension = _ref.extension,
      target = _ref.target,
      target2 = _ref.target2;
  var defaults = WEBGL_CONTEXT_POLYFILLS[extension];
  assert(defaults);
  var _defaults$meta = defaults.meta,
      meta = _defaults$meta === void 0 ? {} : _defaults$meta;
  var _meta$suffix = meta.suffix,
      suffix = _meta$suffix === void 0 ? '' : _meta$suffix;
  var ext = gl.getExtension(extension);
  Object.keys(defaults).forEach(function (key) {
    var extKey = "".concat(key).concat(suffix);
    var polyfill = null;

    if (key === 'meta') {// ignore
    } else if (typeof gl[key] === 'function') {// WebGL2 implementation is already
    } else if (ext && typeof ext[extKey] === 'function') {
      // pick extension implemenentation,if available
      polyfill = function polyfill() {
        return ext[extKey].apply(ext, arguments);
      };
    } else if (typeof defaults[key] === 'function') {
      // pick the mock implementation, if no implementation was detected
      polyfill = defaults[key].bind(target);
    }

    if (polyfill) {
      target[key] = polyfill;
      target2[key] = polyfill;
    }
  });
} // Install simple overrides (mostly get* functions)


function installOverrides(gl, _ref2) {
  var target = _ref2.target,
      target2 = _ref2.target2;
  var OVERRIDES = WEBGL_CONTEXT_POLYFILLS.OVERRIDES;
  Object.keys(OVERRIDES).forEach(function (key) {
    if (typeof OVERRIDES[key] === 'function') {
      // install an override, if no implementation was detected
      var originalFunc = gl[key] ? gl[key].bind(gl) : function () {};
      var polyfill = OVERRIDES[key].bind(null, gl, originalFunc);
      target[key] = polyfill;
      target2[key] = polyfill;
    }
  });
} // Registers polyfill or mock functions for all known extensions


function polyfillContext(gl) {
  // polyfillVertexArrayObject(WebGLRenderingContext, gl);
  gl.luma = gl.luma || {};
  initializeExtensions(gl);

  if (!gl.luma.polyfilled) {
    for (var extension in WEBGL_CONTEXT_POLYFILLS) {
      if (extension !== 'overrides') {
        polyfillExtension(gl, {
          extension: extension,
          target: gl.luma,
          target2: gl
        });
      }
    }

    installOverrides(gl, {
      target: gl.luma,
      target2: gl
    });
    gl.luma.polyfilled = true;
  }

  return gl;
}
/* global window, global */


var global_ = typeof global !== 'undefined' ? global : window;
global_.polyfillContext = polyfillContext;
},{"@babel/runtime/helpers/esm/defineProperty":"DOnw","./polyfill-get-parameter":"VoGG"}],"aBzw":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "polyfillContext", {
  enumerable: true,
  get: function () {
    return _polyfillContext.default;
  }
});

var _polyfillContext = _interopRequireDefault(require("./polyfill-context"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./polyfill-context":"HbLk"}],"OBdb":[function(require,module,exports) {

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "global", {
  enumerable: true,
  get: function () {
    return _globals.global;
  }
});
exports.default = void 0;

var _isBrowser = _interopRequireDefault(require("./utils/is-browser"));

var _globals = require("./utils/globals");

var _log = _interopRequireDefault(require("./utils/log"));

require("./webgl1");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// TODO - when webgl2 gets ubiquitous, remove default support for webgl1 by dropping next line
// Version detection using babel plugin

/* global __VERSION__ */
var VERSION = typeof "6.4.3" !== 'undefined' ? "6.4.3" : 'untranspiled source';
var STARTUP_MESSAGE = 'set luma.log.priority=1 (or higher) to trace rendering'; // Assign luma.log.priority in console to control logging: \
// 0: none, 1: minimal, 2: verbose, 3: attribute/uniforms, 4: gl logs
// luma.log.break[], set to gl funcs, luma.log.profile[] set to model names`;

if (_globals.global.luma && _globals.global.luma.VERSION !== VERSION) {
  throw new Error("luma.gl - multiple VERSIONs detected: ".concat(_globals.global.luma.VERSION, " vs ").concat(VERSION));
}

if (!_globals.global.luma) {
  if (_isBrowser.default) {
    _log.default.log(0, "luma.gl ".concat(VERSION, " - ").concat(STARTUP_MESSAGE))();
  }

  _globals.global.luma = _globals.global.luma || {
    VERSION: VERSION,
    version: VERSION,
    log: _log.default,
    // A global stats object that various components can add information to
    // E.g. see webgl/resource.js
    stats: {},
    // Keep some luma globals in a sub-object
    // This allows us to dynamically detect if certain modules have been
    // included (such as IO and headless) and enable related functionality,
    // without unconditionally requiring and thus bundling big dependencies
    // into the app.
    globals: {
      modules: {},
      nodeIO: {}
    }
  };
}

var _default = _globals.global.luma;
exports.default = _default;
},{"./utils/is-browser":"noZ1","./utils/globals":"AlqY","./utils/log":"na3T","./webgl1":"aBzw"}],"hUHf":[function(require,module,exports) {

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.WebGL2RenderingContext = exports.WebGLShaderPrecisionFormat = exports.WebGLActiveInfo = exports.WebGLUniformLocation = exports.WebGLTexture = exports.WebGLRenderbuffer = exports.WebGLFramebuffer = exports.WebGLBuffer = exports.WebGLShader = exports.WebGLProgram = exports.WebGLRenderingContext = exports.Image = exports.webGLTypesAvailable = exports.headlessGL = exports.headlessTypes = exports.ERR_HEADLESSGL_LOAD = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _globals = require("../utils/globals");

var _isBrowser = _interopRequireDefault(require("../utils/is-browser"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// WEBGL BUILT-IN TYPES
// 1) Exports all WebGL constants as {GL}
// 2) Enables app to "import" WebGL types
//    - Importing these types makes them known to eslint etc.
//    - Provides dummy types for WebGL2 when not available to streamline
//      library code.
//    - Exports types from headless gl when running under Node.js

/* eslint-disable quotes, no-console */
var ERR_HEADLESSGL_LOAD = "luma.gl: loaded under Node.js without headless gl installed, meaning that WebGL contexts can not be created. This may not be an error. For example, this is a typical configuration for isorender applications running on the server."; // Load headless gl dynamically, if available

exports.ERR_HEADLESSGL_LOAD = ERR_HEADLESSGL_LOAD;
var headlessTypes = null;
exports.headlessTypes = headlessTypes;

var headlessGL = function headlessGL() {
  throw new Error(ERR_HEADLESSGL_LOAD);
};

exports.headlessGL = headlessGL;

if (!_isBrowser.default) {
  try {
    exports.headlessGL = headlessGL = module.require('gl');
    exports.headlessTypes = headlessTypes = module.require('gl/wrap');
  } catch (error) {// /* global console */
    // console.info(ERR_HEADLESSGL_LOAD);
  }
}

var DummyType = function DummyType() {
  (0, _classCallCheck2.default)(this, DummyType);
};

var _ref = headlessTypes || _globals.global,
    _ref$WebGLRenderingCo = _ref.WebGLRenderingContext,
    WebGLRenderingContext = _ref$WebGLRenderingCo === void 0 ? DummyType : _ref$WebGLRenderingCo,
    _ref$WebGLProgram = _ref.WebGLProgram,
    WebGLProgram = _ref$WebGLProgram === void 0 ? DummyType : _ref$WebGLProgram,
    _ref$WebGLShader = _ref.WebGLShader,
    WebGLShader = _ref$WebGLShader === void 0 ? DummyType : _ref$WebGLShader,
    _ref$WebGLBuffer = _ref.WebGLBuffer,
    WebGLBuffer = _ref$WebGLBuffer === void 0 ? DummyType : _ref$WebGLBuffer,
    _ref$WebGLFramebuffer = _ref.WebGLFramebuffer,
    WebGLFramebuffer = _ref$WebGLFramebuffer === void 0 ? DummyType : _ref$WebGLFramebuffer,
    _ref$WebGLRenderbuffe = _ref.WebGLRenderbuffer,
    WebGLRenderbuffer = _ref$WebGLRenderbuffe === void 0 ? DummyType : _ref$WebGLRenderbuffe,
    _ref$WebGLTexture = _ref.WebGLTexture,
    WebGLTexture = _ref$WebGLTexture === void 0 ? DummyType : _ref$WebGLTexture,
    _ref$WebGLUniformLoca = _ref.WebGLUniformLocation,
    WebGLUniformLocation = _ref$WebGLUniformLoca === void 0 ? DummyType : _ref$WebGLUniformLoca,
    _ref$WebGLActiveInfo = _ref.WebGLActiveInfo,
    WebGLActiveInfo = _ref$WebGLActiveInfo === void 0 ? DummyType : _ref$WebGLActiveInfo,
    _ref$WebGLShaderPreci = _ref.WebGLShaderPrecisionFormat,
    WebGLShaderPrecisionFormat = _ref$WebGLShaderPreci === void 0 ? DummyType : _ref$WebGLShaderPreci;

exports.WebGLShaderPrecisionFormat = WebGLShaderPrecisionFormat;
exports.WebGLActiveInfo = WebGLActiveInfo;
exports.WebGLUniformLocation = WebGLUniformLocation;
exports.WebGLTexture = WebGLTexture;
exports.WebGLRenderbuffer = WebGLRenderbuffer;
exports.WebGLFramebuffer = WebGLFramebuffer;
exports.WebGLBuffer = WebGLBuffer;
exports.WebGLShader = WebGLShader;
exports.WebGLProgram = WebGLProgram;
exports.WebGLRenderingContext = WebGLRenderingContext;
var webGLTypesAvailable = WebGLRenderingContext !== DummyType && WebGLProgram !== DummyType && WebGLShader !== DummyType && WebGLBuffer !== DummyType && WebGLFramebuffer !== DummyType && WebGLRenderbuffer !== DummyType && WebGLTexture !== DummyType && WebGLUniformLocation !== DummyType && WebGLActiveInfo !== DummyType && WebGLShaderPrecisionFormat !== DummyType; // Ensures that WebGL2RenderingContext is defined in non-WebGL2 environments
// so that apps can test their gl contexts with instanceof
// E.g. if (gl instanceof WebGL2RenderingContext) { }

exports.webGLTypesAvailable = webGLTypesAvailable;

function getWebGL2RenderingContext() {
  var WebGL2RenderingContextNotSupported = function WebGL2RenderingContextNotSupported() {
    (0, _classCallCheck2.default)(this, WebGL2RenderingContextNotSupported);
  };

  return _globals.global.WebGL2RenderingContext || WebGL2RenderingContextNotSupported;
} // Ensure that Image is defined under Node.js


function getImage() {
  var ImageNotSupported = function ImageNotSupported() {
    (0, _classCallCheck2.default)(this, ImageNotSupported);
  };

  return _globals.global.Image || ImageNotSupported;
}

var WebGL2RenderingContext = getWebGL2RenderingContext();
exports.WebGL2RenderingContext = WebGL2RenderingContext;
var Image = getImage(); // Export the standard WebGL types

exports.Image = Image;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","../utils/globals":"AlqY","../utils/is-browser":"noZ1"}],"wYRU":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = assert;

// Recommendation is to ignore message but current test suite checks agains the
// message so keep it for now.
function assert(condition, message) {
  if (!condition) {
    throw new Error(message || 'luma.gl: assertion failed.');
  }
}
},{}],"D8hV":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.isWebGL = isWebGL;
exports.isWebGL2 = isWebGL2;
exports.assertWebGLContext = assertWebGLContext;
exports.assertWebGL2Context = assertWebGL2Context;
exports.ERR_WEBGL2 = exports.ERR_WEBGL = exports.ERR_CONTEXT = void 0;

var _webglTypes = require("./webgl-types");

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Heuristic testing of contexts (to indentify debug wrappers around gl contexts)
var GL_ARRAY_BUFFER = 0x8892;
var GL_TEXTURE_BINDING_3D = 0x806a;
var ERR_CONTEXT = 'Invalid WebGLRenderingContext';
exports.ERR_CONTEXT = ERR_CONTEXT;
var ERR_WEBGL = ERR_CONTEXT;
exports.ERR_WEBGL = ERR_WEBGL;
var ERR_WEBGL2 = 'Requires WebGL2';
exports.ERR_WEBGL2 = ERR_WEBGL2;

function isWebGL(glAlias) {
  return Boolean(glAlias && (glAlias instanceof _webglTypes.WebGLRenderingContext || // `glAlias` name prevents gl constant inliner from making this always true
  glAlias.ARRAY_BUFFER === GL_ARRAY_BUFFER));
}

function isWebGL2(glAlias) {
  return Boolean(glAlias && (glAlias instanceof _webglTypes.WebGL2RenderingContext || // `glAlias` name prevents gl constant inliner from making this always true
  glAlias.TEXTURE_BINDING_3D === GL_TEXTURE_BINDING_3D));
}

function assertWebGLContext(gl) {
  // Need to handle debug context
  (0, _assert.default)(isWebGL(gl), ERR_CONTEXT);
}

function assertWebGL2Context(gl) {
  // Need to handle debug context
  (0, _assert.default)(isWebGL2(gl), ERR_WEBGL2);
}
},{"./webgl-types":"hUHf","../utils/assert":"wYRU"}],"b9Zy":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _assertThisInitialized;

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}
},{}],"pQSE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _possibleConstructorReturn;

var _typeof2 = _interopRequireDefault(require("../../helpers/esm/typeof"));

var _assertThisInitialized = _interopRequireDefault(require("./assertThisInitialized"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _possibleConstructorReturn(self, call) {
  if (call && ((0, _typeof2.default)(call) === "object" || typeof call === "function")) {
    return call;
  }

  return (0, _assertThisInitialized.default)(self);
}
},{"../../helpers/esm/typeof":"Izky","./assertThisInitialized":"b9Zy"}],"i2He":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _getPrototypeOf;

function _getPrototypeOf(o) {
  exports.default = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}
},{}],"spGh":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _setPrototypeOf;

function _setPrototypeOf(o, p) {
  exports.default = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
}
},{}],"NNOi":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _inherits;

var _setPrototypeOf = _interopRequireDefault(require("./setPrototypeOf"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

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) (0, _setPrototypeOf.default)(subClass, superClass);
}
},{"./setPrototypeOf":"spGh"}],"iRt6":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.requestAnimationFrame = requestAnimationFrame;
exports.cancelAnimationFrame = cancelAnimationFrame;

// Node.js polyfills for requestAnimationFrame and cancelAnimationFrame

/* global window, setTimeout, clearTimeout */
function requestAnimationFrame(callback) {
  return typeof window !== 'undefined' && window.requestAnimationFrame ? window.requestAnimationFrame(callback) : setTimeout(callback, 1000 / 60);
}

function cancelAnimationFrame(timerId) {
  return typeof window !== 'undefined' && window.cancelAnimationFrame ? window.cancelAnimationFrame(timerId) : clearTimeout(timerId);
}
},{}],"ASRs":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = getShaderName;
exports.getShaderTypeName = getShaderTypeName;
var GL_FRAGMENT_SHADER = 0x8b30;
var GL_VERTEX_SHADER = 0x8b31; // Supports GLSLIFY style naming of shaders
// #define SHADER_NAME ...

function getShaderName(shader) {
  var defaultName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'unnamed';
  var SHADER_NAME_REGEXP = /#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/;
  var match = shader.match(SHADER_NAME_REGEXP);
  return match ? match[1] : defaultName;
}

function getShaderTypeName(type) {
  switch (type) {
    case GL_FRAGMENT_SHADER:
      return 'fragment';

    case GL_VERTEX_SHADER:
      return 'vertex';

    default:
      return 'unknown type';
  }
}
},{}],"wy7m":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.parseGLSLCompilerError = parseGLSLCompilerError;
exports.default = formatGLSLCompilerError;

var _getShaderName = _interopRequireWildcard(require("./get-shader-name"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// TODO - formatGLSLCompilerError should not depend on this

/**
 * Parse a GLSL compiler error log into a string showing the source code around each error.
 * Based on https://github.com/wwwtyro/gl-format-compiler-error (public domain)
 */

/* eslint-disable no-continue, max-statements */
function parseGLSLCompilerError(errLog, src, shaderType, shaderName) {
  var errorStrings = errLog.split(/\r?\n/);
  var errors = {};
  var warnings = {}; // Patch the shader name

  var name = shaderName || (0, _getShaderName.default)(src) || '(unnamed)';
  var shaderDescription = "".concat((0, _getShaderName.getShaderTypeName)(shaderType), " shader ").concat(name); // Parse the error - note: browser and driver dependent

  for (var i = 0; i < errorStrings.length; i++) {
    var errorString = errorStrings[i];

    if (errorString.length <= 1) {
      continue;
    }

    var segments = errorString.split(':');
    var type = segments[0];
    var line = parseInt(segments[2], 10);

    if (isNaN(line)) {
      throw new Error("GLSL compilation error in ".concat(shaderDescription, ": ").concat(errLog));
    }

    if (type !== 'WARNING') {
      errors[line] = errorString;
    } else {
      warnings[line] = errorString;
    }
  } // Format the error inline with the code


  var lines = addLineNumbers(src);
  return {
    shaderName: shaderDescription,
    errors: formatErrors(errors, lines),
    warnings: formatErrors(warnings, lines)
  };
} // Formats GLSL compiler error log into single string


function formatGLSLCompilerError(errLog, src, shaderType) {
  var _parseGLSLCompilerErr = parseGLSLCompilerError(errLog, src, shaderType),
      shaderName = _parseGLSLCompilerErr.shaderName,
      errors = _parseGLSLCompilerErr.errors,
      warnings = _parseGLSLCompilerErr.warnings;

  return "GLSL compilation error in ".concat(shaderName, "\n\n").concat(errors, "\n").concat(warnings);
} // helper function, outputs annotated errors or warnings


function formatErrors(errors, lines) {
  var message = '';

  for (var i = 0; i < lines.length; i++) {
    var line = lines[i];

    if (!errors[i + 3] && !errors[i + 2] && !errors[i + 1]) {
      continue;
    }

    message += "".concat(line, "\n");

    if (errors[i + 1]) {
      var error = errors[i + 1];
      var segments = error.split(':', 3);
      var type = segments[0];
      var column = parseInt(segments[1], 10) || 0;
      var err = error.substring(segments.join(':').length + 1).trim();
      message += padLeft("^^^ ".concat(type, ": ").concat(err, "\n\n"), column);
    }
  }

  return message;
}
/**
 * Prepends line numbers to each line of a string.
 * The line numbers will be left-padded with spaces to ensure an
 * aligned layout when rendered using monospace fonts.
 * @param {String} string - multi-line string to add line numbers to
 * @param {Number} start=1 - number of spaces to add
 * @param {String} delim =': ' - injected between line number and original line
 * @return {String[]} strings - array of string, one per line, with line numbers added
 */


function addLineNumbers(string) {
  var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
  var delim = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ': ';
  var lines = string.split(/\r?\n/);
  var maxDigits = String(lines.length + start - 1).length;
  return lines.map(function (line, i) {
    var lineNumber = i + start;
    var digits = String(lineNumber).length;
    var prefix = padLeft(lineNumber, maxDigits - digits);
    return prefix + delim + line;
  });
}
/**
 * Pads a string with a number of spaces (space characters) to the left
 * @param {String} string - string to pad
 * @param {Number} digits - number of spaces to add
 * @return {String} string - The padded string
 */


function padLeft(string, digits) {
  var result = '';

  for (var i = 0; i < digits; ++i) {
    result += ' ';
  }

  return "".concat(result).concat(string);
}
},{"./get-shader-name":"ASRs"}],"Btp1":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getGLTypeFromTypedArray = getGLTypeFromTypedArray;
exports.getTypedArrayFromGLType = getTypedArrayFromGLType;
exports.flipRows = flipRows;
exports.scalePixels = scalePixels;
var ERR_TYPE_DEDUCTION = 'Failed to deduce GL constant from typed array'; // Converts TYPED ARRAYS to corresponding GL constant
// Used to auto deduce gl parameter types

function getGLTypeFromTypedArray(arrayOrType) {
  // If typed array, look up constructor
  var type = ArrayBuffer.isView(arrayOrType) ? arrayOrType.constructor : arrayOrType;

  switch (type) {
    case Float32Array:
      return 5126;

    case Uint16Array:
      return 5123;

    case Uint32Array:
      return 5125;

    case Uint8Array:
      return 5121;

    case Uint8ClampedArray:
      return 5121;

    case Int8Array:
      return 5120;

    case Int16Array:
      return 5122;

    case Int32Array:
      return 5124;

    default:
      throw new Error(ERR_TYPE_DEDUCTION);
  }
} // Converts GL constant to corresponding TYPED ARRAY
// Used to auto deduce gl parameter types

/* eslint-disable complexity */


function getTypedArrayFromGLType(glType) {
  var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
      _ref$clamped = _ref.clamped,
      clamped = _ref$clamped === void 0 ? true : _ref$clamped; // Sorted in some order of likelihood to reduce amount of comparisons


  switch (glType) {
    case 5126:
      return Float32Array;

    case 5123:
    case 33635:
    case 32819:
    case 32820:
      return Uint16Array;

    case 5125:
      return Uint32Array;

    case 5121:
      return clamped ? Uint8ClampedArray : Uint8Array;

    case 5120:
      return Int8Array;

    case 5122:
      return Int16Array;

    case 5124:
      return Int32Array;

    default:
      throw new Error('Failed to deduce typed array type from GL constant');
  }
}
/* eslint-enable complexity */
// Flip rows (can be used on arrays returned from `Framebuffer.readPixels`)
// https://stackoverflow.com/questions/41969562/
// how-can-i-flip-the-result-of-webglrenderingcontext-readpixels


function flipRows(_ref2) {
  var data = _ref2.data,
      width = _ref2.width,
      height = _ref2.height,
      _ref2$bytesPerPixel = _ref2.bytesPerPixel,
      bytesPerPixel = _ref2$bytesPerPixel === void 0 ? 4 : _ref2$bytesPerPixel,
      temp = _ref2.temp;
  var bytesPerRow = width * bytesPerPixel; // make a temp buffer to hold one row

  temp = temp || new Uint8Array(bytesPerRow);

  for (var y = 0; y < height / 2; ++y) {
    var topOffset = y * bytesPerRow;
    var bottomOffset = (height - y - 1) * bytesPerRow; // make copy of a row on the top half

    temp.set(data.subarray(topOffset, topOffset + bytesPerRow)); // copy a row from the bottom half to the top

    data.copyWithin(topOffset, bottomOffset, bottomOffset + bytesPerRow); // copy the copy of the top half row to the bottom half

    data.set(temp, bottomOffset);
  }
}

function scalePixels(_ref3) {
  var data = _ref3.data,
      width = _ref3.width,
      height = _ref3.height;
  var newWidth = Math.round(width / 2);
  var newHeight = Math.round(height / 2);
  var newData = new Uint8Array(newWidth * newHeight * 4);

  for (var y = 0; y < newHeight; y++) {
    for (var x = 0; x < newWidth; x++) {
      for (var c = 0; c < 4; c++) {
        newData[(y * newWidth + x) * 4 + c] = data[(y * 2 * width + x * 2) * 4 + c];
      }
    }
  }

  return {
    data: newData,
    width: newWidth,
    height: newHeight
  };
}
},{}],"OZ1B":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getKeyValue = getKeyValue;
exports.getKey = getKey;
exports.getKeyType = getKeyType;
exports.glGet = glGet;
exports.glKey = glKey;
exports.glKeyType = glKeyType;

var _assert = _interopRequireDefault(require("../utils/assert"));

var _log = _interopRequireDefault(require("../utils/log"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Resolve a WebGL enumeration name (returns itself if already a number)
function getKeyValue(gl, name) {
  // If not a string, return (assume number)
  if (typeof name !== 'string') {
    return name;
  } // If string converts to number, return number


  var number = Number(name);

  if (!isNaN(number)) {
    return number;
  } // Look up string, after removing any 'GL.' or 'gl.' prefix


  name = name.replace(/^.*\./, '');
  var value = gl[name];
  (0, _assert.default)(value !== undefined, "Accessing undefined constant GL.".concat(name));
  return value;
}

function getKey(gl, value) {
  value = Number(value);

  for (var key in gl) {
    if (gl[key] === value) {
      return "GL.".concat(key);
    }
  }

  return String(value);
}

function getKeyType(gl, value) {
  (0, _assert.default)(value !== undefined, 'undefined key');
  value = Number(value);

  for (var key in gl) {
    if (gl[key] === value) {
      return "GL.".concat(key);
    }
  }

  return String(value);
} // Public methods
// Resolve a WebGL enumeration name (returns itself if already a number)
// TODO - unify with methods above


function glGet(gl, name) {
  if (!name) {
    _log.default.removed('glGet(name)', 'glGet(gl, name)', '6.0')();
  }

  return getKeyValue(gl, name);
}

function glKey(gl, value) {
  if (value === undefined) {
    _log.default.removed('glKey(value)', 'glKey(gl, value)', '6.0')();
  }

  return getKey(gl, value);
}

function glKeyType(gl, value) {
  if (value === undefined) {
    _log.default.removed('glKeyType(value)', 'glKeyType(gl, value)', '6.0')();
  }

  return getKeyType(gl, value);
}
},{"../utils/assert":"wYRU","../utils/log":"na3T"}],"wwLG":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getShaderVersion = getShaderVersion;

// returns GLSL shader version of given shader string
function getShaderVersion(source) {
  var version = 100;
  var words = source.match(/[^\s]+/g);

  if (words.length >= 2 && words[0] === '#version') {
    var v = parseInt(words[1], 10);

    if (Number.isFinite(v)) {
      version = v;
    }
  }

  return version;
}
},{}],"PmJk":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "Image", {
  enumerable: true,
  get: function () {
    return _webglTypes.Image;
  }
});
Object.defineProperty(exports, "WebGLRenderingContext", {
  enumerable: true,
  get: function () {
    return _webglTypes.WebGLRenderingContext;
  }
});
Object.defineProperty(exports, "WebGL2RenderingContext", {
  enumerable: true,
  get: function () {
    return _webglTypes.WebGL2RenderingContext;
  }
});
Object.defineProperty(exports, "WebGLProgram", {
  enumerable: true,
  get: function () {
    return _webglTypes.WebGLProgram;
  }
});
Object.defineProperty(exports, "WebGLShader", {
  enumerable: true,
  get: function () {
    return _webglTypes.WebGLShader;
  }
});
Object.defineProperty(exports, "WebGLBuffer", {
  enumerable: true,
  get: function () {
    return _webglTypes.WebGLBuffer;
  }
});
Object.defineProperty(exports, "WebGLFramebuffer", {
  enumerable: true,
  get: function () {
    return _webglTypes.WebGLFramebuffer;
  }
});
Object.defineProperty(exports, "WebGLRenderbuffer", {
  enumerable: true,
  get: function () {
    return _webglTypes.WebGLRenderbuffer;
  }
});
Object.defineProperty(exports, "WebGLTexture", {
  enumerable: true,
  get: function () {
    return _webglTypes.WebGLTexture;
  }
});
Object.defineProperty(exports, "WebGLUniformLocation", {
  enumerable: true,
  get: function () {
    return _webglTypes.WebGLUniformLocation;
  }
});
Object.defineProperty(exports, "WebGLActiveInfo", {
  enumerable: true,
  get: function () {
    return _webglTypes.WebGLActiveInfo;
  }
});
Object.defineProperty(exports, "WebGLShaderPrecisionFormat", {
  enumerable: true,
  get: function () {
    return _webglTypes.WebGLShaderPrecisionFormat;
  }
});
Object.defineProperty(exports, "webGLTypesAvailable", {
  enumerable: true,
  get: function () {
    return _webglTypes.webGLTypesAvailable;
  }
});
Object.defineProperty(exports, "isWebGL", {
  enumerable: true,
  get: function () {
    return _webglChecks.isWebGL;
  }
});
Object.defineProperty(exports, "isWebGL2", {
  enumerable: true,
  get: function () {
    return _webglChecks.isWebGL2;
  }
});
Object.defineProperty(exports, "assertWebGLContext", {
  enumerable: true,
  get: function () {
    return _webglChecks.assertWebGLContext;
  }
});
Object.defineProperty(exports, "assertWebGL2Context", {
  enumerable: true,
  get: function () {
    return _webglChecks.assertWebGL2Context;
  }
});
Object.defineProperty(exports, "requestAnimationFrame", {
  enumerable: true,
  get: function () {
    return _requestAnimationFrame.requestAnimationFrame;
  }
});
Object.defineProperty(exports, "cancelAnimationFrame", {
  enumerable: true,
  get: function () {
    return _requestAnimationFrame.cancelAnimationFrame;
  }
});
Object.defineProperty(exports, "formatGLSLCompilerError", {
  enumerable: true,
  get: function () {
    return _formatGlslError.default;
  }
});
Object.defineProperty(exports, "parseGLSLCompilerError", {
  enumerable: true,
  get: function () {
    return _formatGlslError.parseGLSLCompilerError;
  }
});
Object.defineProperty(exports, "getShaderName", {
  enumerable: true,
  get: function () {
    return _getShaderName.default;
  }
});
Object.defineProperty(exports, "getGLTypeFromTypedArray", {
  enumerable: true,
  get: function () {
    return _typedArrayUtils.getGLTypeFromTypedArray;
  }
});
Object.defineProperty(exports, "getTypedArrayFromGLType", {
  enumerable: true,
  get: function () {
    return _typedArrayUtils.getTypedArrayFromGLType;
  }
});
Object.defineProperty(exports, "flipRows", {
  enumerable: true,
  get: function () {
    return _typedArrayUtils.flipRows;
  }
});
Object.defineProperty(exports, "scalePixels", {
  enumerable: true,
  get: function () {
    return _typedArrayUtils.scalePixels;
  }
});
Object.defineProperty(exports, "getKeyValue", {
  enumerable: true,
  get: function () {
    return _constantsToKeys.getKeyValue;
  }
});
Object.defineProperty(exports, "getKey", {
  enumerable: true,
  get: function () {
    return _constantsToKeys.getKey;
  }
});
Object.defineProperty(exports, "getKeyType", {
  enumerable: true,
  get: function () {
    return _constantsToKeys.getKeyType;
  }
});
Object.defineProperty(exports, "getShaderVersion", {
  enumerable: true,
  get: function () {
    return _shaderUtils.getShaderVersion;
  }
});
Object.defineProperty(exports, "cloneTextureFrom", {
  enumerable: true,
  get: function () {
    return _textureUtils.cloneTextureFrom;
  }
});

var _webglTypes = require("./webgl-types");

var _webglChecks = require("./webgl-checks");

var _requestAnimationFrame = require("./request-animation-frame");

var _formatGlslError = _interopRequireWildcard(require("./format-glsl-error"));

var _getShaderName = _interopRequireDefault(require("./get-shader-name"));

var _typedArrayUtils = require("./typed-array-utils");

var _constantsToKeys = require("./constants-to-keys");

var _shaderUtils = require("./shader-utils");

var _textureUtils = require("./texture-utils");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
},{"./webgl-types":"hUHf","./webgl-checks":"D8hV","./request-animation-frame":"iRt6","./format-glsl-error":"wy7m","./get-shader-name":"ASRs","./typed-array-utils":"Btp1","./constants-to-keys":"OZ1B","./shader-utils":"wwLG","./texture-utils":"r7vO"}],"kIcs":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = isOldIE;

var _globals = require("./globals");

// opts allows user agent to be overridden for testing
function isOldIE() {
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  var navigator = _globals.window.navigator || {};
  var userAgent = opts.userAgent || navigator.userAgent || ''; // We only care about older versions of IE (IE 11 and below). Newer versions of IE (Edge)
  // have much better web standards support.

  var isMSIE = userAgent.indexOf('MSIE ') !== -1;
  var isTrident = userAgent.indexOf('Trident/') !== -1;
  return isMSIE || isTrident;
}
},{"./globals":"AlqY"}],"u0lQ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.promisify = promisify;

/**
 * Converts a function that accepts a node style (err, result) callback
 * as the last argument into a function that takes the same arguments
 * and returns a promise that resolves or rejects with the values provided
 * by the original callback
 * @param {Function} func - function to wrap
 * @return {Function} promisified function
 */

/* eslint-disable no-try-catch */
function promisify(func) {
  return function promisifiedFunction() {
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    return new Promise(function (resolve, reject) {
      function callback(error, data) {
        try {
          if (error) {
            reject(error);
          } else {
            resolve(data);
          }
        } catch (e) {
          reject(e);
        }
      }

      func.apply(void 0, args.concat([callback]));
    });
  };
}
/* eslint-enable no-try-catch */
},{}],"LG9a":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.uid = uid;
exports.isPowerOfTwo = isPowerOfTwo;
exports.isObjectEmpty = isObjectEmpty;

var _assert = _interopRequireDefault(require("./assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var uidCounters = {};
/**
 * Returns a UID.
 * @param {String} id= - Identifier base name
 * @return {number} uid
 **/

function uid() {
  var id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'id';
  uidCounters[id] = uidCounters[id] || 1;
  var count = uidCounters[id]++;
  return "".concat(id, "-").concat(count);
}
/**
 * Verifies if a given number is power of two or not.
 * @param {object} n - The number to check.
 * @return {Array} Returns true if the given number is power of 2, false otherwise.
 **/


function isPowerOfTwo(n) {
  (0, _assert.default)(typeof n === 'number', 'Input must be a number');
  return n && (n & n - 1) === 0;
} // Returns true if given object is empty, false otherwise.


function isObjectEmpty(obj) {
  var isEmpty = true;
  /* eslint-disable no-unused-vars  */

  for (var key in obj) {
    isEmpty = false;
    break;
  }
  /* eslint-enable no-unused-vars  */


  return isEmpty;
}
},{"./assert":"wYRU"}],"N7fF":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.formatValue = formatValue;

// TODO / DEPRECATED - delete when confident that probe.gl logging implements all opts

/* eslint-disable no-console */
function formatArrayValue(v, opts) {
  var _opts$maxElts = opts.maxElts,
      maxElts = _opts$maxElts === void 0 ? 16 : _opts$maxElts,
      _opts$size = opts.size,
      size = _opts$size === void 0 ? 1 : _opts$size;
  var string = '[';

  for (var i = 0; i < v.length && i < maxElts; ++i) {
    if (i > 0) {
      string += ",".concat(i % size === 0 ? ' ' : '');
    }

    string += formatValue(v[i], opts);
  }

  var terminator = v.length > maxElts ? '...' : ']';
  return "".concat(string).concat(terminator);
}

function formatValue(v) {
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  var EPSILON = 1e-16;
  var _opts$isInteger = opts.isInteger,
      isInteger = _opts$isInteger === void 0 ? false : _opts$isInteger;

  if (Array.isArray(v) || ArrayBuffer.isView(v)) {
    return formatArrayValue(v, opts);
  }

  if (!Number.isFinite(v)) {
    return String(v);
  }

  if (Math.abs(v) < EPSILON) {
    return isInteger ? '0' : '0.';
  }

  if (isInteger) {
    return v.toFixed(0);
  }

  if (Math.abs(v) > 100 && Math.abs(v) < 10000) {
    return v.toFixed(0);
  }

  var string = v.toPrecision(2);
  var decimal = string.indexOf('.0');
  return decimal === string.length - 2 ? string.slice(0, -1) : string;
}
},{}],"kw5T":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.stubRemovedMethods = stubRemovedMethods;

var _log = _interopRequireDefault(require("./log"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Install stubs for removed methods
function stubRemovedMethods(instance, className, version, methodNames) {
  var upgradeMessage = "See luma.gl ".concat(version, " Upgrade Guide at http://uber.github.io/luma.gl/#/documentation/overview/upgrade-guide");
  var prototype = Object.getPrototypeOf(instance);
  methodNames.forEach(function (methodName) {
    if (prototype.methodName) {
      return;
    }

    prototype[methodName] = function () {
      _log.default.removed("Calling removed method ".concat(className, ".").concat(methodName, ": "), upgradeMessage);

      throw new Error(methodName);
    };
  });
}
},{"./log":"na3T"}],"PFG0":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "isBrowser", {
  enumerable: true,
  get: function () {
    return _isBrowser.default;
  }
});
Object.defineProperty(exports, "isOldIE", {
  enumerable: true,
  get: function () {
    return _isOldIe.default;
  }
});
Object.defineProperty(exports, "promisify", {
  enumerable: true,
  get: function () {
    return _promiseUtils.promisify;
  }
});
Object.defineProperty(exports, "uid", {
  enumerable: true,
  get: function () {
    return _utils.uid;
  }
});
Object.defineProperty(exports, "isPowerOfTwo", {
  enumerable: true,
  get: function () {
    return _utils.isPowerOfTwo;
  }
});
Object.defineProperty(exports, "isObjectEmpty", {
  enumerable: true,
  get: function () {
    return _utils.isObjectEmpty;
  }
});
Object.defineProperty(exports, "log", {
  enumerable: true,
  get: function () {
    return _log.default;
  }
});
Object.defineProperty(exports, "formatValue", {
  enumerable: true,
  get: function () {
    return _formatValue.formatValue;
  }
});
Object.defineProperty(exports, "assert", {
  enumerable: true,
  get: function () {
    return _assert.default;
  }
});
Object.defineProperty(exports, "stubRemovedMethods", {
  enumerable: true,
  get: function () {
    return _stubMethods.stubRemovedMethods;
  }
});

var _isBrowser = _interopRequireDefault(require("./is-browser"));

var _isOldIe = _interopRequireDefault(require("./is-old-ie"));

var _promiseUtils = require("./promise-utils");

var _utils = require("./utils");

var _log = _interopRequireDefault(require("./log"));

var _formatValue = require("./format-value");

var _assert = _interopRequireDefault(require("./assert"));

var _stubMethods = require("./stub-methods");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./is-browser":"noZ1","./is-old-ie":"kIcs","./promise-utils":"u0lQ","./utils":"LG9a","./log":"na3T","./format-value":"N7fF","./assert":"wYRU","./stub-methods":"kw5T"}],"Uazl":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _init = _interopRequireDefault(require("../init"));

var _webglUtils = require("../webgl-utils");

var _utils = require("../utils");

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var ERR_RESOURCE_METHOD_UNDEFINED = 'Resource subclass must define virtual methods'; // TODO - Handle context loss
// function glGetContextLossCount(gl) {
//   return (gl.luma && gl.luma.glCount) || 0;
// }

var Resource =
/*#__PURE__*/
function () {
  function Resource(gl) {
    var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, Resource);
    (0, _webglUtils.assertWebGLContext)(gl);
    var id = opts.id,
        _opts$userData = opts.userData,
        userData = _opts$userData === void 0 ? {} : _opts$userData;
    this.gl = gl; // this.ext = polyfillContext(gl);

    this.id = id || (0, _utils.uid)(this.constructor.name);
    this.userData = userData;
    this._bound = false; // Set the handle
    // If handle was provided, use it, otherwise create a new handle
    // TODO - Stores the handle with context loss information
    // this.glCount = glGetContextLossCount(this.gl);
    // Default VertexArray needs to be created with null handle, so compare against undefined

    this._handle = opts.handle;

    if (this._handle === undefined) {
      this._handle = this._createHandle();
    }

    this._addStats();
  }

  (0, _createClass2.default)(Resource, [{
    key: "toString",
    value: function toString() {
      return "".concat(this.constructor.name, "(").concat(this.id, ")");
    }
  }, {
    key: "delete",
    value: function _delete() {
      var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          _ref$deleteChildren = _ref.deleteChildren,
          deleteChildren = _ref$deleteChildren === void 0 ? false : _ref$deleteChildren; // Delete this object, and get refs to any children


      var children = this._handle && this._deleteHandle(this._handle);

      this._handle = null;

      this._removeStats(); // Optionally, recursively delete the children


      if (children && deleteChildren) {
        children.filter(Boolean).forEach(function (child) {
          child.delete();
        });
      }

      return this;
    }
  }, {
    key: "bind",
    value: function bind() {
      var funcOrHandle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.handle;

      if (typeof funcOrHandle !== 'function') {
        this._bindHandle(funcOrHandle);

        return this;
      }

      var value;

      if (!this._bound) {
        this._bindHandle(this.handle);

        this._bound = true;
        value = funcOrHandle();
        this._bound = false;

        this._bindHandle(null);
      } else {
        value = funcOrHandle();
      }

      return value;
    }
  }, {
    key: "unbind",
    value: function unbind() {
      this.bind(null);
    }
    /**
     * Query a Resource parameter
     *
     * @param {GLenum} pname
     * @return {GLint|GLfloat|GLenum} param
     */

  }, {
    key: "getParameter",
    value: function getParameter(pname) {
      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      pname = (0, _webglUtils.getKeyValue)(this.gl, pname);
      (0, _assert.default)(pname);
      var parameters = this.constructor.PARAMETERS || {}; // Use parameter definitions to handle unsupported parameters

      var parameter = parameters[pname];

      if (parameter) {
        var isWebgl2 = (0, _webglUtils.isWebGL2)(this.gl); // Check if we can query for this parameter

        var parameterAvailable = (!('webgl2' in parameter) || isWebgl2) && (!('extension' in parameter) || this.gl.getExtension(parameter.extension));

        if (!parameterAvailable) {
          var webgl1Default = parameter.webgl1;
          var webgl2Default = 'webgl2' in parameter ? parameter.webgl2 : parameter.webgl1;
          var defaultValue = isWebgl2 ? webgl2Default : webgl1Default;
          return defaultValue;
        }
      } // If unknown parameter - Could be a valid parameter not covered by PARAMS
      // Attempt to query for it and let WebGL report errors


      return this._getParameter(pname, opts);
    } // Many resources support a getParameter call -
    // getParameters will get all parameters - slow but useful for debugging
    // eslint-disable-next-line complexity

  }, {
    key: "getParameters",
    value: function getParameters() {
      var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      var _ref2 = {},
          parameters = _ref2.parameters,
          keys = _ref2.keys; // Get parameter definitions for this Resource

      var PARAMETERS = this.constructor.PARAMETERS || {};
      var isWebgl2 = (0, _webglUtils.isWebGL2)(this.gl);
      var values = {}; // Query all parameters if no list provided

      var parameterKeys = parameters || Object.keys(PARAMETERS); // WEBGL limits

      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = parameterKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var pname = _step.value;
          var parameter = PARAMETERS[pname]; // Check if this parameter is available on this platform

          var parameterAvailable = parameter && (!('webgl2' in parameter) || isWebgl2) && (!('extension' in parameter) || this.gl.getExtension(parameter.extension));

          if (parameterAvailable) {
            var key = keys ? (0, _webglUtils.getKey)(this.gl, pname) : pname;
            values[key] = this.getParameter(pname, opts);

            if (keys && parameter.type === 'GLenum') {
              values[key] = (0, _webglUtils.getKey)(this.gl, values[key]);
            }
          }
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return != null) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }

      return values;
    }
    /**
     * Update a Resource setting
     *
     * @todo - cache parameter to avoid issuing WebGL calls?
     *
     * @param {GLenum} pname - parameter (GL constant, value or key)
     * @param {GLint|GLfloat|GLenum} value
     * @return {Resource} returns self to enable chaining
     */

  }, {
    key: "setParameter",
    value: function setParameter(pname, value) {
      pname = (0, _webglUtils.getKeyValue)(this.gl, pname);
      (0, _assert.default)(pname);
      var parameters = this.constructor.PARAMETERS || {};
      var parameter = parameters[pname];

      if (parameter) {
        var isWebgl2 = (0, _webglUtils.isWebGL2)(this.gl); // Check if this parameter is available on this platform

        var parameterAvailable = (!('webgl2' in parameter) || isWebgl2) && (!('extension' in parameter) || this.gl.getExtension(parameter.extension));

        if (!parameterAvailable) {
          throw new Error('Parameter not available on this platform');
        } // Handle string keys


        if (parameter.type === 'GLenum') {
          value = (0, _webglUtils.getKeyValue)(value);
        }
      } // If unknown parameter - Could be a valid parameter not covered by PARAMS
      // attempt to set it and let WebGL report errors


      this._setParameter(pname, value);

      return this;
    }
    /*
     * Batch update resource parameters
     * Assumes the subclass supports a setParameter call
     */

  }, {
    key: "setParameters",
    value: function setParameters(parameters) {
      for (var pname in parameters) {
        this.setParameter(pname, parameters[pname]);
      }

      return this;
    } // Install stubs for removed methods

  }, {
    key: "stubRemovedMethods",
    value: function stubRemovedMethods(className, version, methodNames) {
      return (0, _utils.stubRemovedMethods)(this, className, version, methodNames);
    } // PUBLIC VIRTUAL METHODS

  }, {
    key: "initialize",
    value: function initialize(opts) {} // PROTECTED METHODS - These must be overridden by subclass

  }, {
    key: "_createHandle",
    value: function _createHandle() {
      throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
    }
  }, {
    key: "_deleteHandle",
    value: function _deleteHandle() {
      throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
    }
  }, {
    key: "_bindHandle",
    value: function _bindHandle() {
      throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
    }
  }, {
    key: "_getOptsFromHandle",
    value: function _getOptsFromHandle() {
      throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
    }
  }, {
    key: "_getParameter",
    value: function _getParameter(pname, opts) {
      throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
    }
    /**
     * @param {GLenum} pname
     * @param {GLint|GLfloat|GLenum} param
     * @return {Sampler} returns self to enable chaining
     */

  }, {
    key: "_setParameter",
    value: function _setParameter(pname, value) {
      throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
    } // PRIVATE METHODS

  }, {
    key: "_context",
    value: function _context() {
      this.gl.luma = this.gl.luma || {};
      return this.gl.luma;
    }
  }, {
    key: "_addStats",
    value: function _addStats() {
      var name = this.constructor.name;
      var stats = _init.default.stats;
      stats.resourceCount = stats.resourceCount || 0;
      stats.resourceMap = stats.resourceMap || {}; // Resource creation stats

      stats.resourceCount++;
      stats.resourceMap[name] = stats.resourceMap[name] || {
        created: 0,
        active: 0
      };
      stats.resourceMap[name].created++;
      stats.resourceMap[name].active++;
    }
  }, {
    key: "_removeStats",
    value: function _removeStats() {
      var name = this.constructor.name;
      var stats = _init.default.stats;
      stats.resourceMap[name].active--;
    }
  }, {
    key: "handle",
    get: function get() {
      // TODO - Add context loss handling
      // Will regenerate and reinitialize the handle if necessary
      // const glCount = glGetContextLossCount(this.gl);
      // if (this.glCount !== glCount) {
      //   this._handle = this._createHandle(this.opts);
      //   this._glCount = glCount;
      //   // Reinitialize object
      //   this.initialize(this.opts);
      // }
      return this._handle;
    }
  }]);
  return Resource;
}();

exports.default = Resource;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","../init":"OBdb","../webgl-utils":"PmJk","../utils":"PFG0","../utils/assert":"wYRU"}],"fwwN":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _construct;

var _setPrototypeOf = _interopRequireDefault(require("./setPrototypeOf"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function isNativeReflectConstruct() {
  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
  if (Reflect.construct.sham) return false;
  if (typeof Proxy === "function") return true;

  try {
    Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
    return true;
  } catch (e) {
    return false;
  }
}

function _construct(Parent, args, Class) {
  if (isNativeReflectConstruct()) {
    exports.default = _construct = Reflect.construct;
  } else {
    exports.default = _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) (0, _setPrototypeOf.default)(instance, Class.prototype);
      return instance;
    };
  }

  return _construct.apply(null, arguments);
}
},{"./setPrototypeOf":"spGh"}],"SwrD":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.DEFAULT_ACCESSOR_VALUES = exports.default = void 0;

var _construct2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/construct"));

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _typedArrayUtils = require("../webgl-utils/typed-array-utils");

var _log = _interopRequireDefault(require("../utils/log"));

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var DEFAULT_ACCESSOR_VALUES = {
  offset: 0,
  stride: 0,
  type: 5126,
  size: 1,
  divisor: 0,
  normalized: false,
  integer: false
};
exports.DEFAULT_ACCESSOR_VALUES = DEFAULT_ACCESSOR_VALUES;

var Accessor =
/*#__PURE__*/
function () {
  (0, _createClass2.default)(Accessor, null, [{
    key: "getBytesPerElement",
    value: function getBytesPerElement(accessor) {
      // TODO: using `FLOAT` when type is not specified,
      // ensure this assumption is valid or force API to specify type.
      var ArrayType = (0, _typedArrayUtils.getTypedArrayFromGLType)(accessor.type || 5126);
      return ArrayType.BYTES_PER_ELEMENT;
    }
  }, {
    key: "getBytesPerVertex",
    value: function getBytesPerVertex(accessor) {
      (0, _assert.default)(accessor.size); // TODO: using `FLOAT` when type is not specified,
      // ensure this assumption is valid or force API to specify type.

      var ArrayType = (0, _typedArrayUtils.getTypedArrayFromGLType)(accessor.type || 5126);
      return ArrayType.BYTES_PER_ELEMENT * accessor.size;
    } // Combines (merges) a list of accessors. On top of default values
    // Usually [programAccessor, bufferAccessor, appAccessor]
    // All props will be set in the returned object.
    // TODO check for conflicts between values in the supplied accessors

  }, {
    key: "resolve",
    value: function resolve() {
      for (var _len = arguments.length, accessors = new Array(_len), _key = 0; _key < _len; _key++) {
        accessors[_key] = arguments[_key];
      }

      return (0, _construct2.default)(Accessor, [DEFAULT_ACCESSOR_VALUES].concat(accessors)); // Default values
    }
  }]);

  function Accessor() {
    var _this = this;

    (0, _classCallCheck2.default)(this, Accessor);

    for (var _len2 = arguments.length, accessors = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
      accessors[_key2] = arguments[_key2];
    }

    accessors.forEach(function (accessor) {
      return _this._assign(accessor);
    }); // Merge in sequence

    Object.freeze(this);
  }

  (0, _createClass2.default)(Accessor, [{
    key: "toString",
    value: function toString() {
      return JSON.stringify(this);
    } // ACCESSORS
    // TODO - remove>

  }, {
    key: "_assign",
    // PRIVATE

    /* eslint-disable complexity, max-statements */
    value: function _assign() {
      var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; // TYPE - not expected to be overridden

      if (props.type !== undefined) {
        if (this.type !== props.type) {
          _log.default.warn('accessor type mismatch');
        }

        this.type = props.type; // Auto-deduce integer type?

        if (props.type === 5124 || props.type === 5125) {
          this.integer = true;
        }
      } // SIZE - not expected to be overridden


      if (props.size !== undefined) {
        if (this.size !== props.size) {
          _log.default.warn('accessor size mismatch');
        }

        this.size = props.size;
      } // INSTANCE DIVISOR


      if (props.divisor !== undefined) {
        this.divisor = props.divisor;
      }

      if (props.offset !== undefined) {
        this.offset = props.offset;
      }

      if (props.stride !== undefined) {
        this.stride = props.stride;
      }

      if (props.normalized !== undefined) {
        this.normalized = props.normalized;
      }

      if (props.integer !== undefined) {
        this.integer = props.integer;
      } // Backwards compatibility


      if (props.instanced !== undefined) {
        _log.default.deprecated('Accessor.instanced', 'Accessor.divisor');

        this.divisor = props.instanced ? 1 : 0;
      }

      if (props.isInstanced !== undefined) {
        _log.default.deprecated('Accessor.isInstanced', 'Accessor.divisor');

        this.divisor = props.isInstanced ? 1 : 0;
      } // TODO - should this be supported?


      if (props.index !== undefined) {
        this.index = props.index ? 1 : 0;
      }

      return this;
    }
    /* eslint-enable complexity, max-statements */

  }, {
    key: "BYTES_PER_ELEMENT",
    get: function get() {
      return Accessor.getBytesPerElement(this);
    }
  }, {
    key: "BYTES_PER_VERTEX",
    get: function get() {
      return Accessor.getBytesPerVertex(this);
    }
  }]);
  return Accessor;
}(); // TEST EXPORTS


exports.default = Accessor;
},{"@babel/runtime/helpers/esm/construct":"fwwN","@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","../webgl-utils/typed-array-utils":"Btp1","../utils/log":"na3T","../utils/assert":"wYRU"}],"Rc9V":[function(require,module,exports) {

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/assertThisInitialized"));

var _resource = _interopRequireDefault(require("./resource"));

var _accessor = _interopRequireDefault(require("./accessor"));

var _webglUtils = require("../webgl-utils");

var _typedArrayUtils = require("../webgl-utils/typed-array-utils");

var _utils = require("../utils");

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var DEBUG_DATA_LENGTH = 10;

var Buffer =
/*#__PURE__*/
function (_Resource) {
  (0, _inherits2.default)(Buffer, _Resource);

  function Buffer(gl) {
    var _this;

    var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, Buffer);
    _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Buffer).call(this, gl, props));

    _this.stubRemovedMethods('Buffer', 'v6.0', ['layout', 'setLayout', 'getIndexedParameter']); // In WebGL1, need to make sure we use GL.ELEMENT_ARRAY_BUFFER when initializing element buffers
    // otherwise buffer type will lock to generic (non-element) buffer
    // In WebGL2, we can use GL.COPY_READ_BUFFER which avoids locking the type here


    _this.target = props.target || (_this.gl.webgl2 ? 36662 : 34962);

    _this._initialize(props);

    Object.seal((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
    return _this;
  } // returns number of elements in the buffer (assuming that the full buffer is used)


  (0, _createClass2.default)(Buffer, [{
    key: "getElementCount",
    value: function getElementCount() {
      var accessor = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.accessor;
      return Math.round(this.byteLength / _accessor.default.getBytesPerElement(accessor));
    } // returns number of vertices in the buffer (assuming that the full buffer is used)

  }, {
    key: "getVertexCount",
    value: function getVertexCount() {
      var accessor = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.accessor;
      return Math.round(this.byteLength / _accessor.default.getBytesPerVertex(accessor));
    } // Creates and initializes the buffer object's data store.

  }, {
    key: "initialize",
    value: function initialize(props) {
      return this._initialize(props);
    }
  }, {
    key: "setProps",
    value: function setProps(props) {
      if ('data' in props) {
        this.setData(props);
      }

      return this;
    } // Stores the accessor of data with the buffer, makes it easy to e.g. set it as an attribute later
    // {accessor,type,size = 1,offset = 0,stride = 0,normalized = false,integer = false,divisor = 0}

  }, {
    key: "setAccessor",
    value: function setAccessor(opts) {
      this.accessor = opts;
      return this;
    } // Allocate a bigger GPU buffer (if the current buffer is not big enough).
    // If a reallocation is triggered it clears the buffer
    // Returns:
    //  `true`: buffer was reallocated, data was cleared
    //  `false`: buffer was big enough, data is intact

  }, {
    key: "reallocate",
    value: function reallocate(byteLength) {
      if (byteLength > this.byteLength) {
        this._setByteLength(byteLength);

        return true;
      }

      this.bytesUsed = byteLength;
      return false;
    } // Update with new data

  }, {
    key: "setData",
    value: function setData(opts) {
      return this.initialize(opts);
    } // Updates a subset of a buffer object's data store.
    // Data (Typed Array or ArrayBuffer), length is inferred unless provided
    // Offset into buffer
    // WebGL2 only: Offset into srcData
    // WebGL2 only: Number of bytes to be copied

  }, {
    key: "subData",
    value: function subData(props) {
      // Signature: buffer.subData(new Float32Array([...]))
      if (ArrayBuffer.isView(props)) {
        props = {
          data: props
        };
      }

      var _props = props,
          data = _props.data,
          _props$offset = _props.offset,
          offset = _props$offset === void 0 ? 0 : _props$offset,
          _props$srcOffset = _props.srcOffset,
          srcOffset = _props$srcOffset === void 0 ? 0 : _props$srcOffset;
      var byteLength = props.byteLength || props.length; // if (byteLength > this.byteLength) {
      //   byteLength = this.byteLength;
      // }

      (0, _assert.default)(data); // Create the buffer - binding it here for the first time locks the type
      // In WebGL2, use GL.COPY_WRITE_BUFFER to avoid locking the type

      var target = this.gl.webgl2 ? 36663 : this.target;
      this.gl.bindBuffer(target, this.handle); // WebGL2: subData supports additional srcOffset and length parameters

      if (srcOffset !== 0 || byteLength !== undefined) {
        (0, _webglUtils.assertWebGL2Context)(this.gl);
        this.gl.bufferSubData(this.target, offset, data, srcOffset, byteLength);
      } else {
        this.gl.bufferSubData(target, offset, data);
      }

      this.gl.bindBuffer(target, null); // TODO - update local `data` if offsets are right

      this.debugData = null;

      if (!this.accessor.type) {
        this.setAccessor(new _accessor.default(this.accessor, {
          type: (0, _typedArrayUtils.getGLTypeFromTypedArray)(data)
        }));
      }

      return this;
    } // WEBGL2 ONLY: Copies part of the data of another buffer into this buffer

  }, {
    key: "copyData",
    value: function copyData(_ref) {
      var sourceBuffer = _ref.sourceBuffer,
          _ref$readOffset = _ref.readOffset,
          readOffset = _ref$readOffset === void 0 ? 0 : _ref$readOffset,
          _ref$writeOffset = _ref.writeOffset,
          writeOffset = _ref$writeOffset === void 0 ? 0 : _ref$writeOffset,
          size = _ref.size;
      var gl = this.gl;
      (0, _webglUtils.assertWebGL2Context)(gl); // Use GL.COPY_READ_BUFFER+GL.COPY_WRITE_BUFFER avoid disturbing other targets and locking type

      gl.bindBuffer(36662, sourceBuffer.handle);
      gl.bindBuffer(36663, this.handle);
      gl.copyBufferSubData(36662, 36663, readOffset, writeOffset, size);
      gl.bindBuffer(36662, null);
      gl.bindBuffer(36663, null); // TODO - update local `data` if offsets are 0

      this.debugData = null;
      return this;
    } // WEBGL2 ONLY: Reads data from buffer into an ArrayBufferView or SharedArrayBuffer.

  }, {
    key: "getData",
    value: function getData() {
      var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          _ref2$dstData = _ref2.dstData,
          dstData = _ref2$dstData === void 0 ? null : _ref2$dstData,
          _ref2$srcByteOffset = _ref2.srcByteOffset,
          srcByteOffset = _ref2$srcByteOffset === void 0 ? 0 : _ref2$srcByteOffset,
          _ref2$dstOffset = _ref2.dstOffset,
          dstOffset = _ref2$dstOffset === void 0 ? 0 : _ref2$dstOffset,
          _ref2$length = _ref2.length,
          length = _ref2$length === void 0 ? 0 : _ref2$length;

      (0, _webglUtils.assertWebGL2Context)(this.gl);
      var ArrayType = (0, _typedArrayUtils.getTypedArrayFromGLType)(this.accessor.type || 5126, {
        clamped: false
      });

      var sourceAvailableElementCount = this._getAvailableElementCount(srcByteOffset);

      var dstElementOffset = dstOffset;
      var dstAvailableElementCount;
      var dstElementCount;

      if (dstData) {
        dstElementCount = dstData.length;
        dstAvailableElementCount = dstElementCount - dstElementOffset;
      } else {
        // Allocate ArrayBufferView with enough size to copy all eligible data.
        dstAvailableElementCount = Math.min(sourceAvailableElementCount, length || sourceAvailableElementCount);
        dstElementCount = dstElementOffset + dstAvailableElementCount;
      }

      var copyElementCount = Math.min(sourceAvailableElementCount, dstAvailableElementCount);
      length = length || copyElementCount;
      (0, _assert.default)(length <= copyElementCount);
      dstData = dstData || new ArrayType(dstElementCount); // Use GL.COPY_READ_BUFFER to avoid disturbing other targets and locking type

      this.gl.bindBuffer(36662, this.handle);
      this.gl.getBufferSubData(36662, srcByteOffset, dstData, dstOffset, length);
      this.gl.bindBuffer(36662, null); // TODO - update local `data` if offsets are 0

      return dstData;
    }
    /**
     * Binds a buffer to a given binding point (target).
     *   GL.TRANSFORM_FEEDBACK_BUFFER and GL.UNIFORM_BUFFER take an index, and optionally a range.
     * @param {Glenum} target - target for the bind operation.
     * @param {GLuint} index= - the index of the target.
     *   - GL.TRANSFORM_FEEDBACK_BUFFER and GL.UNIFORM_BUFFER need an index to affect state
     * @param {GLuint} offset=0 - the index of the target.
     *   - GL.UNIFORM_BUFFER: `offset` must be aligned to GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT.
     * @param {GLuint} size= - the index of the target.
     *   - GL.UNIFORM_BUFFER: `size` must be a minimum of GL.UNIFORM_BLOCK_SIZE_DATA.
     * @returns {Buffer} - Returns itself for chaining.
     */

  }, {
    key: "bind",
    value: function bind() {
      var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          _ref3$target = _ref3.target,
          target = _ref3$target === void 0 ? this.target : _ref3$target,
          _ref3$index = _ref3.index,
          index = _ref3$index === void 0 ? this.accessor && this.accessor.index : _ref3$index,
          _ref3$offset = _ref3.offset,
          offset = _ref3$offset === void 0 ? 0 : _ref3$offset,
          size = _ref3.size; // NOTE: While GL.TRANSFORM_FEEDBACK_BUFFER and GL.UNIFORM_BUFFER could
      // be used as direct binding points, they will not affect transform feedback or
      // uniform buffer state. Instead indexed bindings need to be made.


      if (target === 35345 || target === 35982) {
        if (size !== undefined) {
          this.gl.bindBufferRange(target, index, this.handle, offset, size);
        } else {
          (0, _assert.default)(offset === 0); // Make sure offset wasn't supplied

          this.gl.bindBufferBase(target, index, this.handle);
        }
      } else {
        this.gl.bindBuffer(target, this.handle);
      }

      return this;
    }
  }, {
    key: "unbind",
    value: function unbind() {
      var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          _ref4$target = _ref4.target,
          target = _ref4$target === void 0 ? this.target : _ref4$target,
          _ref4$index = _ref4.index,
          index = _ref4$index === void 0 ? this.accessor && this.accessor.index : _ref4$index;

      var isIndexedBuffer = target === 35345 || target === 35982;

      if (isIndexedBuffer) {
        this.gl.bindBufferBase(target, index, null);
      } else {
        this.gl.bindBuffer(target, null);
      }

      return this;
    } // DEPRECATED/REMOVED METHODS

  }, {
    key: "getDebugData",
    // PROTECTED METHODS (INTENDED FOR USE BY OTHER FRAMEWORK CODE ONLY)
    // Returns a short initial data array
    value: function getDebugData() {
      if (!this.debugData) {
        this.debugData = this.getData({
          length: DEBUG_DATA_LENGTH
        });
        return {
          data: this.debugData,
          changed: true
        };
      }

      return {
        data: this.debugData,
        changed: false
      };
    }
  }, {
    key: "invalidateDebugData",
    value: function invalidateDebugData() {
      this.debugData = null;
    } // PRIVATE METHODS
    // Signature: `new Buffer(gl, {data: new Float32Array(...)})`
    // Signature: `new Buffer(gl, new Float32Array(...))`
    // Signature: `new Buffer(gl, 100)`

  }, {
    key: "_initialize",
    value: function _initialize() {
      var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; // Signature `new Buffer(gl, new Float32Array(...)`

      if (ArrayBuffer.isView(props)) {
        props = {
          data: props
        };
      } // Signature: `new Buffer(gl, 100)`


      if (Number.isFinite(props)) {
        props = {
          byteLength: props
        };
      }

      if (props.bytes) {
        _utils.log.deprecated('bytes', 'byteLength');
      }

      var byteLength = props.byteLength || props.bytes || 0; // assert(props.data || byteLength);

      this.usage = props.usage || 35044; // DEPRECATE - remove `props` from this list in next major release

      this.setAccessor(new _accessor.default(props, props.accessor));
      return props.data ? this._setData(props.data) : this._setByteLength(byteLength);
    } // Allocate a new buffer and initialize to contents of typed array

  }, {
    key: "_setData",
    value: function _setData(data) {
      var usage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.usage;
      (0, _assert.default)(ArrayBuffer.isView(data));

      var target = this._getTarget();

      this.gl.bindBuffer(target, this.handle);
      this.gl.bufferData(target, data, usage);
      this.gl.bindBuffer(target, null);
      this.usage = usage;
      this.debugData = data.slice(0, DEBUG_DATA_LENGTH);
      this.byteLength = data.byteLength;
      this.bytesUsed = data.byteLength; // infer GL type from supplied typed array

      var type = (0, _typedArrayUtils.getGLTypeFromTypedArray)(data);
      (0, _assert.default)(type);
      this.setAccessor(new _accessor.default(this.accessor, {
        type: type
      }));
      return this;
    } // Allocate a GPU buffer of specified size.

  }, {
    key: "_setByteLength",
    value: function _setByteLength(byteLength) {
      var usage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.usage;
      (0, _assert.default)(byteLength >= 0); // Workaround needed for Safari (#291):
      // gl.bufferData with size equal to 0 crashes. Instead create zero sized array.

      var data = byteLength;

      if (byteLength === 0) {
        data = new Float32Array(0);
      }

      var target = this._getTarget();

      this.gl.bindBuffer(target, this.handle);
      this.gl.bufferData(target, data, usage);
      this.gl.bindBuffer(target, null);
      this.usage = usage;
      this.debugData = null;
      this.byteLength = byteLength;
      this.bytesUsed = byteLength;
      return this;
    } // Binding a buffer for the first time locks the type
    // In WebGL2, use GL.COPY_WRITE_BUFFER to avoid locking the type

  }, {
    key: "_getTarget",
    value: function _getTarget() {
      return this.gl.webgl2 ? 36663 : this.target;
    }
  }, {
    key: "_getAvailableElementCount",
    value: function _getAvailableElementCount(srcByteOffset) {
      var ArrayType = (0, _typedArrayUtils.getTypedArrayFromGLType)(this.accessor.type || 5126, {
        clamped: false
      });
      var sourceElementOffset = srcByteOffset / ArrayType.BYTES_PER_ELEMENT;
      return this.getElementCount() - sourceElementOffset;
    } // RESOURCE METHODS

  }, {
    key: "_createHandle",
    value: function _createHandle() {
      return this.gl.createBuffer();
    }
  }, {
    key: "_deleteHandle",
    value: function _deleteHandle() {
      this.gl.deleteBuffer(this.handle);
    }
  }, {
    key: "_getParameter",
    value: function _getParameter(pname) {
      this.gl.bindBuffer(this.target, this.handle);
      var value = this.gl.getBufferParameter(this.target, pname);
      this.gl.bindBuffer(this.target, null);
      return value;
    } // DEPRECATED

  }, {
    key: "updateAccessor",
    value: function updateAccessor(opts) {
      _utils.log.deprecated('updateAccessor(...)', 'setAccessor(new Accessor(buffer.accessor, ...)');

      this.accessor = new _accessor.default(this.accessor, opts);
      return this;
    }
  }, {
    key: "setByteLength",
    value: function setByteLength(byteLength) {
      _utils.log.deprecated('setByteLength', 'reallocate');

      return this.reallocate(byteLength);
    }
  }, {
    key: "data",
    get: function get() {
      _utils.log.removed('Buffer.data', 'N/A', 'v6.0');
    }
  }, {
    key: "bytes",
    get: function get() {
      _utils.log.deprecated('Buffer.bytes', 'Buffer.byteLength', 'v6.1');

      return this.byteLength;
    }
  }]);
  return Buffer;
}(_resource.default);

exports.default = Buffer;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","@babel/runtime/helpers/esm/assertThisInitialized":"b9Zy","./resource":"Uazl","./accessor":"SwrD","../webgl-utils":"PmJk","../webgl-utils/typed-array-utils":"Btp1","../utils":"PFG0","../utils/assert":"wYRU"}],"xk2h":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _arrayWithHoles;

function _arrayWithHoles(arr) {
  if (Array.isArray(arr)) return arr;
}
},{}],"gUlx":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _iterableToArrayLimit;

function _iterableToArrayLimit(arr, i) {
  if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
    return;
  }

  var _arr = [];
  var _n = true;
  var _d = false;
  var _e = undefined;

  try {
    for (var _i = arr[Symbol.iterator](), _s; !(_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;
}
},{}],"o2nT":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _nonIterableRest;

function _nonIterableRest() {
  throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
},{}],"U1JK":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _slicedToArray;

var _arrayWithHoles = _interopRequireDefault(require("./arrayWithHoles"));

var _iterableToArrayLimit = _interopRequireDefault(require("./iterableToArrayLimit"));

var _nonIterableRest = _interopRequireDefault(require("./nonIterableRest"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _slicedToArray(arr, i) {
  return (0, _arrayWithHoles.default)(arr) || (0, _iterableToArrayLimit.default)(arr, i) || (0, _nonIterableRest.default)();
}
},{"./arrayWithHoles":"xk2h","./iterableToArrayLimit":"gUlx","./nonIterableRest":"o2nT"}],"fcUb":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.setParameter = setParameter;
exports.setParameters = setParameters;
exports.getParameter = getParameter;
exports.getParameters = getParameters;
exports.getDefaultParameters = getDefaultParameters;
exports.resetParameters = resetParameters;
exports.getModifiedParameters = getModifiedParameters;
exports.GL_PARAMETER_GETTERS = exports.GL_PARAMETER_SETTERS = exports.GL_PARAMETER_DEFAULTS = void 0;

var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));

var _webglUtils = require("../webgl-utils");

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _GL_PARAMETER_DEFAULT, _GL_PARAMETER_SETTERS, _GL_PARAMETER_GETTERS; // Provides a unified API for getting and setting any WebGL parameter
// Also knows default values of all parameters, enabling fast cache initialization
// Provides base functionality for the state caching.


// DEFAULT SETTINGS - FOR FAST CACHE INITIALIZATION AND CONTEXT RESETS
var GL_PARAMETER_DEFAULTS = (_GL_PARAMETER_DEFAULT = {}, (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 3042, false), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 32773, new Float32Array([0, 0, 0, 0])), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 32777, 32774), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 34877, 32774), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 32969, 1), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 32968, 0), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 32971, 1), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 32970, 0), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 3106, new Float32Array([0, 0, 0, 0])), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 3107, [true, true, true, true]), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 2884, false), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 2885, 1029), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 2929, false), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 2931, 1), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 2932, 513), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 2928, new Float32Array([0, 1])), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 2930, true), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 3024, true), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 36006, null), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 2886, 2305), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 33170, 4352), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 2849, 1), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 32823, false), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 32824, 0), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 10752, 0), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 32938, 1.0), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 32939, false), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 3089, false), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 3088, new Int32Array([0, 0, 1024, 1024])), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 2960, false), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 2961, 0), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 2968, 0xffffffff), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 36005, 0xffffffff), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 2962, 519), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 2967, 0), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 2963, 0xffffffff), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 34816, 519), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 36003, 0), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 36004, 0xffffffff), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 2964, 7680), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 2965, 7680), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 2966, 7680), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 34817, 7680), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 34818, 7680), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 34819, 7680), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 2978, new Int32Array([0, 0, 1024, 1024])), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 3333, 4), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 3317, 4), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 37440, false), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 37441, false), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 37443, 37444), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 35723, 4352), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 36010, null), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 35977, false), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 3330, 0), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 3332, 0), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 3331, 0), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 3314, 0), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 32878, 0), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 3316, 0), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 3315, 0), (0, _defineProperty2.default)(_GL_PARAMETER_DEFAULT, 32877, 0), _GL_PARAMETER_DEFAULT); // SETTER TABLES - ENABLES SETTING ANY PARAMETER WITH A COMMON API

exports.GL_PARAMETER_DEFAULTS = GL_PARAMETER_DEFAULTS;

var enable = function enable(gl, value, key) {
  return value ? gl.enable(key) : gl.disable(key);
};

var hint = function hint(gl, value, key) {
  return gl.hint(key, value);
};

var pixelStorei = function pixelStorei(gl, value, key) {
  return gl.pixelStorei(key, value);
};

var drawFramebuffer = function drawFramebuffer(gl, value) {
  var target = (0, _webglUtils.isWebGL2)(gl) ? 36009 : 36160;
  return gl.bindFramebuffer(target, value);
};

var readFramebuffer = function readFramebuffer(gl, value) {
  return gl.bindFramebuffer(36008, value);
}; // Map from WebGL parameter names to corresponding WebGL setter functions
// WegGL constants are read by parameter names, but set by function names
// NOTE: When value type is a string, it will be handled by 'COMPOSITE_GL_PARAMETER_SETTERS'


var GL_PARAMETER_SETTERS = (_GL_PARAMETER_SETTERS = {}, (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 3042, enable), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 32773, function (gl, value) {
  return gl.blendColor.apply(gl, (0, _toConsumableArray2.default)(value));
}), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 32777, 'blendEquation'), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 34877, 'blendEquation'), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 32969, 'blendFunc'), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 32968, 'blendFunc'), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 32971, 'blendFunc'), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 32970, 'blendFunc'), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 3106, function (gl, value) {
  return gl.clearColor.apply(gl, (0, _toConsumableArray2.default)(value));
}), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 3107, function (gl, value) {
  return gl.colorMask.apply(gl, (0, _toConsumableArray2.default)(value));
}), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 2884, enable), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 2885, function (gl, value) {
  return gl.cullFace(value);
}), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 2929, enable), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 2931, function (gl, value) {
  return gl.clearDepth(value);
}), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 2932, function (gl, value) {
  return gl.depthFunc(value);
}), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 2928, function (gl, value) {
  return gl.depthRange.apply(gl, (0, _toConsumableArray2.default)(value));
}), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 2930, function (gl, value) {
  return gl.depthMask(value);
}), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 3024, enable), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 35723, hint), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 36006, drawFramebuffer), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 2886, function (gl, value) {
  return gl.frontFace(value);
}), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 33170, hint), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 2849, function (gl, value) {
  return gl.lineWidth(value);
}), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 32823, enable), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 32824, 'polygonOffset'), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 10752, 'polygonOffset'), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 35977, enable), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 32938, 'sampleCoverage'), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 32939, 'sampleCoverage'), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 3089, enable), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 3088, function (gl, value) {
  return gl.scissor.apply(gl, (0, _toConsumableArray2.default)(value));
}), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 2960, enable), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 2961, function (gl, value) {
  return gl.clearStencil(value);
}), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 2968, function (gl, value) {
  return gl.stencilMaskSeparate(1028, value);
}), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 36005, function (gl, value) {
  return gl.stencilMaskSeparate(1029, value);
}), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 2962, 'stencilFuncFront'), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 2967, 'stencilFuncFront'), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 2963, 'stencilFuncFront'), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 34816, 'stencilFuncBack'), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 36003, 'stencilFuncBack'), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 36004, 'stencilFuncBack'), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 2964, 'stencilOpFront'), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 2965, 'stencilOpFront'), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 2966, 'stencilOpFront'), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 34817, 'stencilOpBack'), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 34818, 'stencilOpBack'), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 34819, 'stencilOpBack'), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 2978, function (gl, value) {
  return gl.viewport.apply(gl, (0, _toConsumableArray2.default)(value));
}), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 3333, pixelStorei), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 3317, pixelStorei), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 37440, pixelStorei), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 37441, pixelStorei), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 37443, pixelStorei), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 3330, pixelStorei), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 3332, pixelStorei), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 3331, pixelStorei), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 36010, readFramebuffer), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 3314, pixelStorei), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 32878, pixelStorei), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 3316, pixelStorei), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 3315, pixelStorei), (0, _defineProperty2.default)(_GL_PARAMETER_SETTERS, 32877, pixelStorei), _GL_PARAMETER_SETTERS); // COMPOSITE_WEBGL_PARAMETER_

exports.GL_PARAMETER_SETTERS = GL_PARAMETER_SETTERS;
var COMPOSITE_GL_PARAMETER_SETTERS = {
  blendEquation: function blendEquation(gl, values) {
    return gl.blendEquationSeparate(values[32777], values[34877]);
  },
  blendFunc: function blendFunc(gl, values) {
    return gl.blendFuncSeparate(values[32969], values[32968], values[32971], values[32970]);
  },
  polygonOffset: function polygonOffset(gl, values) {
    return gl.polygonOffset(values[32824], values[10752]);
  },
  sampleCoverage: function sampleCoverage(gl, values) {
    return gl.sampleCoverage(values[32938], values[32939]);
  },
  stencilFuncFront: function stencilFuncFront(gl, values) {
    return gl.stencilFuncSeparate(1028, values[2962], values[2967], values[2963]);
  },
  stencilFuncBack: function stencilFuncBack(gl, values) {
    return gl.stencilFuncSeparate(1029, values[34816], values[36003], values[36004]);
  },
  stencilOpFront: function stencilOpFront(gl, values) {
    return gl.stencilOpSeparate(1028, values[2964], values[2965], values[2966]);
  },
  stencilOpBack: function stencilOpBack(gl, values) {
    return gl.stencilOpSeparate(1029, values[34817], values[34818], values[34819]);
  }
}; // GETTER TABLE - FOR READING OUT AN ENTIRE CONTEXT

var isEnabled = function isEnabled(gl, key) {
  return gl.isEnabled(key);
}; // Exceptions for any keys that cannot be queried by gl.getParameters


var GL_PARAMETER_GETTERS = (_GL_PARAMETER_GETTERS = {}, (0, _defineProperty2.default)(_GL_PARAMETER_GETTERS, 3042, isEnabled), (0, _defineProperty2.default)(_GL_PARAMETER_GETTERS, 2884, isEnabled), (0, _defineProperty2.default)(_GL_PARAMETER_GETTERS, 2929, isEnabled), (0, _defineProperty2.default)(_GL_PARAMETER_GETTERS, 3024, isEnabled), (0, _defineProperty2.default)(_GL_PARAMETER_GETTERS, 32823, isEnabled), (0, _defineProperty2.default)(_GL_PARAMETER_GETTERS, 32926, isEnabled), (0, _defineProperty2.default)(_GL_PARAMETER_GETTERS, 32928, isEnabled), (0, _defineProperty2.default)(_GL_PARAMETER_GETTERS, 3089, isEnabled), (0, _defineProperty2.default)(_GL_PARAMETER_GETTERS, 2960, isEnabled), (0, _defineProperty2.default)(_GL_PARAMETER_GETTERS, 35977, isEnabled), _GL_PARAMETER_GETTERS); // HELPER METHODS

exports.GL_PARAMETER_GETTERS = GL_PARAMETER_GETTERS;

var deepArrayEqual = function deepArrayEqual(x, y) {
  if (x === y) {
    return true;
  }

  var isArrayX = Array.isArray(x) || ArrayBuffer.isView(x);
  var isArrayY = Array.isArray(y) || ArrayBuffer.isView(y);

  if (isArrayX && isArrayY && x.length === y.length) {
    for (var i = 0; i < x.length; ++i) {
      if (x[i] !== y[i]) {
        return false;
      }
    }

    return true;
  }

  return false;
}; // PUBLIC METHODS
// Sets any single GL parameter regardless of function (gl.getParameter/gl.isEnabled...)
// Returns the previous value
// Note: limited to parameter values


function setParameter(gl, key, value) {
  var getter = GL_PARAMETER_GETTERS[key];
  var prevValue = getter ? getter(gl, Number(key)) : gl.getParameter(Number(key));
  var setter = GL_PARAMETER_SETTERS[key];
  (0, _assert.default)(typeof setter === 'function');
  setter(gl, value, Number(key));
  return prevValue;
} // Sets any GL parameter regardless of function (gl.blendMode, ...)
// Note: requires a `cache` object to be set on the context (gl.state.cache)
// This object is used to fill in any missing values for composite setter functions


function setParameters(gl, values) {
  var compositeSetters = {}; // HANDLE PRIMITIVE SETTERS (and make note of any composite setters)

  for (var key in values) {
    var glConstant = Number(key);
    var setter = GL_PARAMETER_SETTERS[key];

    if (setter) {
      // Composite setters should only be called once, so save them
      if (typeof setter === 'string') {
        compositeSetters[setter] = true;
      } else {
        // if (gl[glConstant] !== undefined) {
        // TODO - added above check since this is being called on WebGL2 values in WebGL1...
        // TODO - deep equal on values? only call setter if value has changed?
        // NOTE - the setter will automatically update this.state
        setter(gl, values[key], glConstant);
      }
    }
  } // HANDLE COMPOSITE SETTERS
  // NOTE: any non-provided values needed by composite setters are filled in from state cache
  // The cache parameter is automatically retrieved from the context
  // This depends on `trackContextState`, which is technically a "circular" dependency.
  // But it is too inconvenient to always require a cache parameter here.
  // This is the ONLY external dependency in this module/


  var cache = gl.state && gl.state.cache;

  if (cache) {
    var mergedValues = Object.assign({}, cache, values);

    for (var _key in compositeSetters) {
      // TODO - avoid calling composite setters if values have not changed.
      var compositeSetter = COMPOSITE_GL_PARAMETER_SETTERS[_key]; // Note - if `trackContextState` has been called,
      // the setter will automatically update this.state.cache

      compositeSetter(gl, mergedValues);
    }
  } // Add a log for the else case?

} // Queries any single GL parameter regardless of function (gl.getParameter/gl.isEnabled...)


function getParameter(gl, key) {
  var getter = GL_PARAMETER_GETTERS[key];
  return getter ? getter(gl, Number(key)) : gl.getParameter(Number(key));
} // Copies the state from a context (gl.getParameter should not be overriden)
// Reads the entire WebGL state from a context
// Caveat: This generates a huge amount of synchronous driver roundtrips and should be
// considered a very slow operation, to be used only if/when a context already manipulated
// by external code needs to be synchronized for the first time
// @return {Object} - a newly created map, with values keyed by GL parameters


function getParameters(gl, parameters) {
  // default to querying all parameters
  parameters = parameters || GL_PARAMETER_DEFAULTS; // support both arrays of parameters and objects (keys represent parameters)

  var parameterKeys = Array.isArray(parameters) ? parameters : Object.keys(parameters);
  var state = {};
  var _iteratorNormalCompletion = true;
  var _didIteratorError = false;
  var _iteratorError = undefined;

  try {
    for (var _iterator = parameterKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
      var key = _step.value;
      state[key] = getParameter(gl, key);
    }
  } catch (err) {
    _didIteratorError = true;
    _iteratorError = err;
  } finally {
    try {
      if (!_iteratorNormalCompletion && _iterator.return != null) {
        _iterator.return();
      }
    } finally {
      if (_didIteratorError) {
        throw _iteratorError;
      }
    }
  }

  return state;
}

function getDefaultParameters(gl) {
  // TODO - Query GL.VIEWPORT and GL.SCISSOR_BOX since these are dynamic
  return Object.assign({}, GL_PARAMETER_DEFAULTS, {// TODO: For viewport and scissor default values are set at the time of
    // context creation based on canvas size, we can query them here but it will
    // not match with what we have in GL_PARAMETER_DEFAULTS table, we should revisit.
    // [GL.VIEWPORT]: gl.constructor.prototype.getParameter.call(gl, GL.VIEWPORT),
    // [GL.SCISSOR_BOX]: gl.constructor.prototype.getParameter.call(gl, GL.SCISSOR_BOX)
  });
} // Reset all parameters to a pure context state


function resetParameters(gl) {
  setParameters(gl, getDefaultParameters(gl));
} // Get all parameters that have been modified from a pure context state


function getModifiedParameters(gl) {
  var values = getParameters(GL_PARAMETER_DEFAULTS);
  var modified = {};

  for (var key in GL_PARAMETER_DEFAULTS) {
    if (!deepArrayEqual(values[key], GL_PARAMETER_DEFAULTS[key])) {
      modified[key] = values[key];
    }
  }

  return modified;
}
},{"@babel/runtime/helpers/esm/toConsumableArray":"lA6S","@babel/runtime/helpers/esm/defineProperty":"DOnw","../webgl-utils":"PmJk","../utils/assert":"wYRU"}],"N55U":[function(require,module,exports) {
var global = arguments[3];
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = trackContextState;
exports.pushContextState = pushContextState;
exports.popContextState = popContextState;
exports.GL_STATE_SETTERS = exports.deepEqual = exports.clone = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));

var _setParameters = require("./set-parameters");

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Support for listening to context state changes and intercepting state queries
//
// NOTE: this system does not handle buffer bindings
var clone = function clone(x) {
  return Array.isArray(x) || ArrayBuffer.isView(x) ? x.slice() : x;
};

exports.clone = clone;

var deepEqual = function deepEqual(x, y) {
  var isArrayX = Array.isArray(x) || ArrayBuffer.isView(x);
  var isArrayY = Array.isArray(y) || ArrayBuffer.isView(y);

  if (isArrayX && isArrayY && x.length === y.length) {
    for (var i = 0; i < x.length; ++i) {
      if (x[i] !== y[i]) {
        return false;
      }
    }

    return true;
  }

  return x === y;
}; // interceptors for WEBGL FUNCTIONS that set WebGLRenderingContext state
// These "setters" map functions to gl parameters


exports.deepEqual = deepEqual;
var GL_STATE_SETTERS = {
  // GENERIC SETTERS
  enable: function enable(update, cap) {
    return update((0, _defineProperty2.default)({}, cap, true));
  },
  disable: function disable(update, cap) {
    return update((0, _defineProperty2.default)({}, cap, false));
  },
  pixelStorei: function pixelStorei(update, pname, param) {
    return update((0, _defineProperty2.default)({}, pname, param));
  },
  hint: function hint(update, pname, _hint) {
    return update((0, _defineProperty2.default)({}, pname, _hint));
  },
  // SPECIFIC SETTERS
  bindFramebuffer: function bindFramebuffer(update, target, fb) {
    var _update5;

    switch (target) {
      case 36160:
        return update((_update5 = {}, (0, _defineProperty2.default)(_update5, 36006, fb), (0, _defineProperty2.default)(_update5, 36010, fb), _update5));

      case 36009:
        return update((0, _defineProperty2.default)({}, 36006, fb));

      case 36008:
        return update((0, _defineProperty2.default)({}, 36010, fb));

      default:
        return null;
    }
  },
  blendColor: function blendColor(update, r, g, b, a) {
    return update((0, _defineProperty2.default)({}, 32773, new Float32Array([r, g, b, a])));
  },
  blendEquation: function blendEquation(update, mode) {
    var _update9;

    return update((_update9 = {}, (0, _defineProperty2.default)(_update9, 32777, mode), (0, _defineProperty2.default)(_update9, 34877, mode), _update9));
  },
  blendEquationSeparate: function blendEquationSeparate(update, modeRGB, modeAlpha) {
    var _update10;

    return update((_update10 = {}, (0, _defineProperty2.default)(_update10, 32777, modeRGB), (0, _defineProperty2.default)(_update10, 34877, modeAlpha), _update10));
  },
  blendFunc: function blendFunc(update, src, dst) {
    var _update11;

    return update((_update11 = {}, (0, _defineProperty2.default)(_update11, 32969, src), (0, _defineProperty2.default)(_update11, 32968, dst), (0, _defineProperty2.default)(_update11, 32971, src), (0, _defineProperty2.default)(_update11, 32970, dst), _update11));
  },
  blendFuncSeparate: function blendFuncSeparate(update, srcRGB, dstRGB, srcAlpha, dstAlpha) {
    var _update12;

    return update((_update12 = {}, (0, _defineProperty2.default)(_update12, 32969, srcRGB), (0, _defineProperty2.default)(_update12, 32968, dstRGB), (0, _defineProperty2.default)(_update12, 32971, srcAlpha), (0, _defineProperty2.default)(_update12, 32970, dstAlpha), _update12));
  },
  clearColor: function clearColor(update, r, g, b, a) {
    return update((0, _defineProperty2.default)({}, 3106, new Float32Array([r, g, b, a])));
  },
  clearDepth: function clearDepth(update, depth) {
    return update((0, _defineProperty2.default)({}, 2931, depth));
  },
  clearStencil: function clearStencil(update, s) {
    return update((0, _defineProperty2.default)({}, 2961, s));
  },
  colorMask: function colorMask(update, r, g, b, a) {
    return update((0, _defineProperty2.default)({}, 3107, [r, g, b, a]));
  },
  cullFace: function cullFace(update, mode) {
    return update((0, _defineProperty2.default)({}, 2885, mode));
  },
  depthFunc: function depthFunc(update, func) {
    return update((0, _defineProperty2.default)({}, 2932, func));
  },
  depthRange: function depthRange(update, zNear, zFar) {
    return update((0, _defineProperty2.default)({}, 2928, new Float32Array([zNear, zFar])));
  },
  depthMask: function depthMask(update, mask) {
    return update((0, _defineProperty2.default)({}, 2930, mask));
  },
  frontFace: function frontFace(update, face) {
    return update((0, _defineProperty2.default)({}, 2886, face));
  },
  lineWidth: function lineWidth(update, width) {
    return update((0, _defineProperty2.default)({}, 2849, width));
  },
  polygonOffset: function polygonOffset(update, factor, units) {
    var _update23;

    return update((_update23 = {}, (0, _defineProperty2.default)(_update23, 32824, factor), (0, _defineProperty2.default)(_update23, 10752, units), _update23));
  },
  sampleCoverage: function sampleCoverage(update, value, invert) {
    var _update24;

    return update((_update24 = {}, (0, _defineProperty2.default)(_update24, 32938, value), (0, _defineProperty2.default)(_update24, 32939, invert), _update24));
  },
  scissor: function scissor(update, x, y, width, height) {
    return update((0, _defineProperty2.default)({}, 3088, new Int32Array([x, y, width, height])));
  },
  stencilMask: function stencilMask(update, mask) {
    var _update26;

    return update((_update26 = {}, (0, _defineProperty2.default)(_update26, 2968, mask), (0, _defineProperty2.default)(_update26, 36005, mask), _update26));
  },
  stencilMaskSeparate: function stencilMaskSeparate(update, face, mask) {
    return update((0, _defineProperty2.default)({}, face === 1028 ? 2968 : 36005, mask));
  },
  stencilFunc: function stencilFunc(update, func, ref, mask) {
    var _update28;

    return update((_update28 = {}, (0, _defineProperty2.default)(_update28, 2962, func), (0, _defineProperty2.default)(_update28, 2967, ref), (0, _defineProperty2.default)(_update28, 2963, mask), (0, _defineProperty2.default)(_update28, 34816, func), (0, _defineProperty2.default)(_update28, 36003, ref), (0, _defineProperty2.default)(_update28, 36004, mask), _update28));
  },
  stencilFuncSeparate: function stencilFuncSeparate(update, face, func, ref, mask) {
    var _update29;

    return update((_update29 = {}, (0, _defineProperty2.default)(_update29, face === 1028 ? 2962 : 34816, func), (0, _defineProperty2.default)(_update29, face === 1028 ? 2967 : 36003, ref), (0, _defineProperty2.default)(_update29, face === 1028 ? 2963 : 36004, mask), _update29));
  },
  stencilOp: function stencilOp(update, fail, zfail, zpass) {
    var _update30;

    return update((_update30 = {}, (0, _defineProperty2.default)(_update30, 2964, fail), (0, _defineProperty2.default)(_update30, 2965, zfail), (0, _defineProperty2.default)(_update30, 2966, zpass), (0, _defineProperty2.default)(_update30, 34817, fail), (0, _defineProperty2.default)(_update30, 34818, zfail), (0, _defineProperty2.default)(_update30, 34819, zpass), _update30));
  },
  stencilOpSeparate: function stencilOpSeparate(update, face, fail, zfail, zpass) {
    var _update31;

    return update((_update31 = {}, (0, _defineProperty2.default)(_update31, face === 1028 ? 2964 : 34817, fail), (0, _defineProperty2.default)(_update31, face === 1028 ? 2965 : 34818, zfail), (0, _defineProperty2.default)(_update31, face === 1028 ? 2966 : 34819, zpass), _update31));
  },
  viewport: function viewport(update, x, y, width, height) {
    return update((0, _defineProperty2.default)({}, 2978, new Int32Array([x, y, width, height])));
  }
}; // HELPER FUNCTIONS - INSTALL GET/SET INTERCEPTORS (SPYS) ON THE CONTEXT
// Overrides a WebGLRenderingContext state "getter" function
// to return values directly from cache

exports.GL_STATE_SETTERS = GL_STATE_SETTERS;

function installGetterOverride(gl, functionName) {
  // Get the original function from the WebGLRenderingContext
  var originalGetterFunc = gl[functionName].bind(gl); // Wrap it with a spy so that we can update our state cache when it gets called

  gl[functionName] = function get() {
    var pname = arguments.length <= 0 ? undefined : arguments[0]; // WebGL limits are not prepopulated in the cache, we must
    // query first time. They are all primitive (single value)

    if (!(pname in gl.state.cache)) {
      gl.state.cache[pname] = originalGetterFunc.apply(void 0, arguments);
    } // Optionally call the original function to do a "hard" query from the WebGLRenderingContext


    return gl.state.enable ? // Call the getter the params so that it can e.g. serve from a cache
    gl.state.cache[pname] : // Optionally call the original function to do a "hard" query from the WebGLRenderingContext
    originalGetterFunc.apply(void 0, arguments);
  }; // Set the name of this anonymous function to help in debugging and profiling


  Object.defineProperty(gl[functionName], 'name', {
    value: "".concat(functionName, "-from-cache"),
    configurable: false
  });
} // Overrides a WebGLRenderingContext state "setter" function
// to call a setter spy before the actual setter. Allows us to keep a cache
// updated with a copy of the WebGL context state.


function installSetterSpy(gl, functionName, setter) {
  // Get the original function from the WebGLRenderingContext
  var originalSetterFunc = gl[functionName].bind(gl); // Wrap it with a spy so that we can update our state cache when it gets called

  gl[functionName] = function set() {
    for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
      params[_key] = arguments[_key];
    } // Update the value
    // Call the setter with the state cache and the params so that it can store the parameters


    var _setter = setter.apply(void 0, [gl.state._updateCache].concat(params)),
        valueChanged = _setter.valueChanged,
        oldValue = _setter.oldValue; // Call the original WebGLRenderingContext func to make sure the context actually gets updated


    if (valueChanged) {
      var _gl$state;

      (_gl$state = gl.state).log.apply(_gl$state, ["gl.".concat(functionName)].concat(params)); // eslint-disable-line


      originalSetterFunc.apply(void 0, params);
    } // Note: if the original function fails to set the value, our state cache will be bad
    // No solution for this at the moment, but assuming that this is unlikely to be a real problem
    // We could call the setter after the originalSetterFunc. Concern is that this would
    // cause different behavior in debug mode, where originalSetterFunc can throw exceptions


    return oldValue;
  }; // Set the name of this anonymous function to help in debugging and profiling


  Object.defineProperty(gl[functionName], 'name', {
    value: "".concat(functionName, "-to-cache"),
    configurable: false
  });
} // HELPER CLASS - GLState

/* eslint-disable no-shadow */


var GLState =
/*#__PURE__*/
function () {
  function GLState(gl) {
    var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
        _ref$copyState = _ref.copyState,
        copyState = _ref$copyState === void 0 ? false : _ref$copyState,
        _ref$log = _ref.log,
        log = _ref$log === void 0 ? function () {} : _ref$log;

    (0, _classCallCheck2.default)(this, GLState);
    this.gl = gl;
    this.stateStack = [];
    this.enable = true;
    this.cache = copyState ? (0, _setParameters.getParameters)(gl) : Object.assign({}, _setParameters.GL_PARAMETER_DEFAULTS);
    this.log = log;
    this._updateCache = this._updateCache.bind(this);
    Object.seal(this);
  }

  (0, _createClass2.default)(GLState, [{
    key: "push",
    value: function push() {
      var values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      this.stateStack.push({});
    }
  }, {
    key: "pop",
    value: function pop() {
      (0, _assert.default)(this.stateStack.length > 0); // Use the saved values in the state stack to restore parameters

      var oldValues = this.stateStack[this.stateStack.length - 1];
      (0, _setParameters.setParameters)(this.gl, oldValues, this.cache); // Don't pop until we have reset parameters (to make sure other "stack frames" are not affected)

      this.stateStack.pop();
    } // interceptor for context set functions - update our cache and our stack
    // values (Object) - the key values for this setter

  }, {
    key: "_updateCache",
    value: function _updateCache(values) {
      var valueChanged = false;
      var oldValue; // = undefined

      var oldValues = this.stateStack.length > 0 && this.stateStack[this.stateStack.length - 1];

      for (var key in values) {
        (0, _assert.default)(key !== undefined); // Check that value hasn't already been shadowed

        if (!deepEqual(values[key], this.cache[key])) {
          valueChanged = true;
          oldValue = this.cache[key]; // First, save current value being shadowed
          // If a state stack frame is active, save the current parameter values for pop
          // but first check that value hasn't already been shadowed and saved

          if (oldValues && !(key in oldValues)) {
            oldValues[key] = this.cache[key];
          } // Save current value being shadowed


          this.cache[key] = values[key];
        }
      }

      return {
        valueChanged: valueChanged,
        oldValue: oldValue
      };
    }
  }]);
  return GLState;
}(); // PUBLIC API

/**
 * Initialize WebGL state caching on a context
 * can be called multiple times to enable/disable
 * @param {WebGLRenderingContext} - context
 */
// After calling this function, context state will be cached
// gl.state.push() and gl.state.pop() will be available for saving,
// temporarily modifying, and then restoring state.


function trackContextState(gl) {
  var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
      _ref2$enable = _ref2.enable,
      enable = _ref2$enable === void 0 ? true : _ref2$enable,
      copyState = _ref2.copyState;

  (0, _assert.default)(copyState !== undefined);

  if (!gl.state) {
    /* global window, global */
    var global_ = typeof global !== 'undefined' ? global : window;

    if (global_.polyfillContext) {
      global_.polyfillContext(gl);
    } // Create a state cache


    gl.state = new GLState(gl, {
      copyState: copyState,
      enable: enable
    }); // intercept all setter functions in the table

    for (var key in GL_STATE_SETTERS) {
      var setter = GL_STATE_SETTERS[key];
      installSetterSpy(gl, key, setter);
    } // intercept all getter functions in the table


    installGetterOverride(gl, 'getParameter');
    installGetterOverride(gl, 'isEnabled');
  }

  gl.state.enable = enable;
  return gl;
}

function pushContextState(gl) {
  if (!gl.state) {
    trackContextState(gl, {
      copyState: false
    });
  }

  gl.state.push();
}

function popContextState(gl) {
  (0, _assert.default)(gl.state);
  gl.state.pop();
}
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/defineProperty":"DOnw","./set-parameters":"fcUb","../utils/assert":"wYRU"}],"cIIw":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.setParameters = setParameters;
exports.withParameters = withParameters;
Object.defineProperty(exports, "getParameter", {
  enumerable: true,
  get: function () {
    return _setParameters.getParameter;
  }
});
Object.defineProperty(exports, "getParameters", {
  enumerable: true,
  get: function () {
    return _setParameters.getParameters;
  }
});
Object.defineProperty(exports, "setParameter", {
  enumerable: true,
  get: function () {
    return _setParameters.setParameter;
  }
});
Object.defineProperty(exports, "resetParameters", {
  enumerable: true,
  get: function () {
    return _setParameters.resetParameters;
  }
});
Object.defineProperty(exports, "getModifiedParameters", {
  enumerable: true,
  get: function () {
    return _setParameters.getModifiedParameters;
  }
});
exports.LUMA_SETTERS = void 0;

var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));

var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));

var _trackContextState = require("../webgl-context/track-context-state");

var _setParameters = require("../webgl-context/set-parameters");

var _utils = require("../utils");

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/* eslint-disable no-inline-comments, max-len */
// map of parameter setter function names, parameter constants, default values and types
// - Uses gl function names, except when setter function exist that are named differently
// - When the WebGL api offers <setter> and <setter>Separate (e.g. blendEquation and
//   blendEquationSeparate, we use non-separate name, but accept both non-separate and
//   separate arguments. Thus, a `getParameter` call will always return all the separate values
//   in an array, in a form that can be accepted by the setter.
var LUMA_SETTERS = {
  framebuffer: function framebuffer(gl, _framebuffer) {
    // accepts 1) a WebGLFramebuffer 2) null (default framebuffer), or 3) luma.gl Framebuffer class
    // framebuffer is null when restoring to default framebuffer, otherwise use the WebGL handle.
    var handle = _framebuffer && 'handle' in _framebuffer ? _framebuffer.handle : _framebuffer;
    return gl.bindFramebuffer(36160, handle);
  },
  blend: function blend(gl, value) {
    return value ? gl.enable(3042) : gl.disable(3042);
  },
  blendColor: function blendColor(gl, value) {
    return gl.blendColor.apply(gl, (0, _toConsumableArray2.default)(value));
  },
  blendEquation: function blendEquation(gl, args) {
    args = isArray(args) ? args : [args, args];
    gl.blendEquationSeparate.apply(gl, (0, _toConsumableArray2.default)(args));
  },
  blendFunc: function blendFunc(gl, args) {
    args = isArray(args) && args.length === 2 ? (0, _toConsumableArray2.default)(args).concat((0, _toConsumableArray2.default)(args)) : args;
    gl.blendFuncSeparate.apply(gl, (0, _toConsumableArray2.default)(args));
  },
  clearColor: function clearColor(gl, value) {
    return gl.clearColor.apply(gl, (0, _toConsumableArray2.default)(value));
  },
  clearDepth: function clearDepth(gl, value) {
    return gl.clearDepth(value);
  },
  clearStencil: function clearStencil(gl, value) {
    return gl.clearStencil(value);
  },
  colorMask: function colorMask(gl, value) {
    return gl.colorMask.apply(gl, (0, _toConsumableArray2.default)(value));
  },
  cull: function cull(gl, value) {
    return value ? gl.enable(2884) : gl.disable(2884);
  },
  cullFace: function cullFace(gl, value) {
    return gl.cullFace(value);
  },
  depthTest: function depthTest(gl, value) {
    return value ? gl.enable(2929) : gl.disable(2929);
  },
  depthFunc: function depthFunc(gl, value) {
    return gl.depthFunc(value);
  },
  depthMask: function depthMask(gl, value) {
    return gl.depthMask(value);
  },
  depthRange: function depthRange(gl, value) {
    return gl.depthRange.apply(gl, (0, _toConsumableArray2.default)(value));
  },
  dither: function dither(gl, value) {
    return value ? gl.enable(3024) : gl.disable(3024);
  },
  derivativeHint: function derivativeHint(gl, value) {
    // gl1: 'OES_standard_derivatives'
    gl.hint(35723, value);
  },
  frontFace: function frontFace(gl, value) {
    return gl.frontFace(value);
  },
  mipmapHint: function mipmapHint(gl, value) {
    return gl.hint(33170, value);
  },
  lineWidth: function lineWidth(gl, value) {
    return gl.lineWidth(value);
  },
  polygonOffsetFill: function polygonOffsetFill(gl, value) {
    return value ? gl.enable(32823) : gl.disable(32823);
  },
  polygonOffset: function polygonOffset(gl, value) {
    return gl.polygonOffset.apply(gl, (0, _toConsumableArray2.default)(value));
  },
  sampleCoverage: function sampleCoverage(gl, value) {
    return gl.sampleCoverage.apply(gl, (0, _toConsumableArray2.default)(value));
  },
  scissorTest: function scissorTest(gl, value) {
    return value ? gl.enable(3089) : gl.disable(3089);
  },
  scissor: function scissor(gl, value) {
    return gl.scissor.apply(gl, (0, _toConsumableArray2.default)(value));
  },
  stencilTest: function stencilTest(gl, value) {
    return value ? gl.enable(2960) : gl.disable(2960);
  },
  stencilMask: function stencilMask(gl, value) {
    value = isArray(value) ? value : [value, value];

    var _value = value,
        _value2 = (0, _slicedToArray2.default)(_value, 2),
        mask = _value2[0],
        backMask = _value2[1];

    gl.stencilMaskSeparate(1028, mask);
    gl.stencilMaskSeparate(1029, backMask);
  },
  stencilFunc: function stencilFunc(gl, args) {
    args = isArray(args) && args.length === 3 ? (0, _toConsumableArray2.default)(args).concat((0, _toConsumableArray2.default)(args)) : args;

    var _args = args,
        _args2 = (0, _slicedToArray2.default)(_args, 6),
        func = _args2[0],
        ref = _args2[1],
        mask = _args2[2],
        backFunc = _args2[3],
        backRef = _args2[4],
        backMask = _args2[5];

    gl.stencilFuncSeparate(1028, func, ref, mask);
    gl.stencilFuncSeparate(1029, backFunc, backRef, backMask);
  },
  stencilOp: function stencilOp(gl, args) {
    args = isArray(args) && args.length === 3 ? (0, _toConsumableArray2.default)(args).concat((0, _toConsumableArray2.default)(args)) : args;

    var _args3 = args,
        _args4 = (0, _slicedToArray2.default)(_args3, 6),
        sfail = _args4[0],
        dpfail = _args4[1],
        dppass = _args4[2],
        backSfail = _args4[3],
        backDpfail = _args4[4],
        backDppass = _args4[5];

    gl.stencilOpSeparate(1028, sfail, dpfail, dppass);
    gl.stencilOpSeparate(1029, backSfail, backDpfail, backDppass);
  },
  viewport: function viewport(gl, value) {
    return gl.viewport.apply(gl, (0, _toConsumableArray2.default)(value));
  }
}; // HELPERS

exports.LUMA_SETTERS = LUMA_SETTERS;

function isArray(array) {
  return Array.isArray(array) || ArrayBuffer.isView(array);
} // GETTERS AND SETTERS
// Get the parameter value(s) from the context


// Note: "setParameters" is given extra treatment below
// Set the parameter value(s) by key to the context
// Sets value with key to context.
// Value may be "normalized" (in case a short form is supported). In that case
// the normalized value is retured.
function setParameters(gl, parameters) {
  (0, _setParameters.setParameters)(gl, parameters);

  for (var key in parameters) {
    var setter = LUMA_SETTERS[key];

    if (setter) {
      setter(gl, parameters[key], key);
    }
  }
} // VERY LIMITED / BASIC GL STATE MANAGEMENT
// Executes a function with gl states temporarily set, exception safe
// Currently support pixelStorage, scissor test and framebuffer binding


function withParameters(gl, parameters, func) {
  // assertWebGLContext(gl);
  if ((0, _utils.isObjectEmpty)(parameters)) {
    // Avoid setting state if no parameters provided. Just call and return
    return func(gl);
  }

  var _parameters$nocatch = parameters.nocatch,
      nocatch = _parameters$nocatch === void 0 ? true : _parameters$nocatch; // frameBuffer not supported use framebuffer

  (0, _assert.default)(!parameters.frameBuffer);
  (0, _trackContextState.pushContextState)(gl);
  setParameters(gl, parameters); // Setup is done, call the function

  var value;

  if (nocatch) {
    // Avoid try catch to minimize stack size impact for safe execution paths
    value = func(gl);
    (0, _trackContextState.popContextState)(gl);
  } else {
    // Wrap in a try-catch to ensure that parameters are restored on exceptions
    try {
      value = func(gl);
    } finally {
      (0, _trackContextState.popContextState)(gl);
    }
  }

  return value;
}
},{"@babel/runtime/helpers/esm/slicedToArray":"U1JK","@babel/runtime/helpers/esm/toConsumableArray":"lA6S","../webgl-context/track-context-state":"N55U","../webgl-context/set-parameters":"fcUb","../utils":"PFG0","../utils/assert":"wYRU"}],"kZKt":[function(require,module,exports) {

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.TEXTURE_FORMATS = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));

var _resource = _interopRequireDefault(require("./resource"));

var _buffer = _interopRequireDefault(require("./buffer"));

var _contextState = require("../webgl-context/context-state");

var _webglUtils = require("../webgl-utils");

var _utils = require("../utils");

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _TEXTURE_FORMATS;
/* eslint-disable no-inline-comments, max-len */


// Supported min filters for NPOT texture.
var NPOT_MIN_FILTERS = [9729, 9728]; // const S3TC = 'WEBGL_compressed_texture_s3tc';
// const PVRTC = 'WEBGL_compressed_texture_pvrtc';
// const ES3 = 'WEBGL_compressed_texture_es3';
// const ETC1 = 'WEBGL_compressed_texture_etc1';
// const SRGB = 'EXT_sRGB';
// const DEPTH = 'WEBGL_depth_texture';
// Legal combinations for internalFormat, format and type

var TEXTURE_FORMATS = (_TEXTURE_FORMATS = {}, (0, _defineProperty2.default)(_TEXTURE_FORMATS, 6407, {
  dataFormat: 6407,
  types: [5121, 33635]
}), (0, _defineProperty2.default)(_TEXTURE_FORMATS, 6408, {
  dataFormat: 6408,
  types: [5121, 32819, 32820]
}), (0, _defineProperty2.default)(_TEXTURE_FORMATS, 6406, {
  dataFormat: 6406,
  types: [5121]
}), (0, _defineProperty2.default)(_TEXTURE_FORMATS, 6409, {
  dataFormat: 6409,
  types: [5121]
}), (0, _defineProperty2.default)(_TEXTURE_FORMATS, 6410, {
  dataFormat: 6410,
  types: [5121]
}), (0, _defineProperty2.default)(_TEXTURE_FORMATS, 33326, {
  dataFormat: 6403,
  types: [5126],
  gl2: true
}), (0, _defineProperty2.default)(_TEXTURE_FORMATS, 33328, {
  dataFormat: 33319,
  types: [5126],
  gl2: true
}), (0, _defineProperty2.default)(_TEXTURE_FORMATS, 34837, {
  dataFormat: 6407,
  types: [5126],
  gl2: true
}), (0, _defineProperty2.default)(_TEXTURE_FORMATS, 34836, {
  dataFormat: 6408,
  types: [5126],
  gl2: true // [GL.DEPTH_COMPONENT]: {types: [GL.UNSIGNED_SHORT, GL.UNSIGNED_INT, GL.UNSIGNED_INT_24_8], gl1: DEPTH},
  // [GL.DEPTH_STENCIL]: {gl1: DEPTH},
  // Sized texture format - more performance
  // R
  // [GL.R8]: {dataFormat: GL.RED, types: [GL.UNSIGNED_BYTE], gl2: true},
  // [GL.R16F]: {dataFormat: GL.RED, types: [GL.HALF_FLOAT, GL.FLOAT], gl2: true},
  // [GL.R8UI]: {dataFormat: GL.RED_INTEGER, types: [GL.UNSIGNED_BYTE], gl2: true},
  // // RG
  // [GL.RG8]: {dataFormat: GL.RG, types: [GL.UNSIGNED_BYTE], gl2: true},
  // [GL.RG16F]: {dataFormat: GL.RG, types: [GL.HALF_FLOAT, GL.FLOAT], gl2: true},
  // [GL.RG8UI]: {dataFormat: GL.RG_INTEGER, types: [GL.UNSIGNED_BYTE], gl2: true},
  // // RGB
  // [GL.RGB8]: {dataFormat: GL.RGB, types: [GL.UNSIGNED_BYTE], gl2: true, gl1: SRGB},
  // [GL.SRGB8]: {dataFormat: GL.RGB, types: [GL.UNSIGNED_BYTE], gl2: true, gl1: SRGB},
  // [GL.RGB565]: {dataFormat: GL.RGB, types: [GL.UNSIGNED_BYTE, GL.UNSIGNED_SHORT_5_6_5], gl2: true},
  // [GL.R11F_G11F_B10F]: {dataFormat: GL.RGB, types: [GL.UNSIGNED_INT_10F_11F_11F_REV, GL.HALF_FLOAT, GL.FLOAT], gl2: true},
  // [GL.RGB9_E5]: {dataFormat: GL.RGB, types: [GL.HALF_FLOAT, GL.FLOAT], gl2: true, gl1: 'WEBGL_color_buffer_half_float'},
  // [GL.RGB16F]: {dataFormat: GL.RGB, types: [GL.HALF_FLOAT, GL.FLOAT], gl2: true, gl1: 'WEBGL_color_buffer_float'},
  // [GL.RGB8UI]: {dataFormat: GL.RGB_INTEGER, types: [GL.UNSIGNED_BYTE], gl2: true},
  // // RGBA
  // [GL.RGBA8]: {dataFormat: GL.RGBA, types: [GL.UNSIGNED_BYTE], gl2: true, gl1: SRGB},
  // [GL.SRGB8_ALPHA8]: {dataFormat: GL.RGBA, types: [GL.UNSIGNED_BYTE], gl2: true, gl1: SRGB},
  // [GL.RGB5_A1]: {dataFormat: GL.RGBA, types: [GL.UNSIGNED_BYTE, GL.UNSIGNED_SHORT_5_5_5_1], gl2: true},
  // [GL.RGBA4]: {dataFormat: GL.RGBA, types: [GL.UNSIGNED_BYTE, GL.UNSIGNED_SHORT_4_4_4_4], gl2: true},
  // [GL.RGBA16F]: {dataFormat: GL.RGBA, types: [GL.HALF_FLOAT, GL.FLOAT], gl2: true},
  // [GL.RGBA8UI]: {dataFormat: GL.RGBA_INTEGER, types: [GL.UNSIGNED_BYTE], gl2: true}
  // Compressed formats
  // WEBGL_compressed_texture_s3tc
  // [GL.COMPRESSED_RGB_S3TC_DXT1_EXT]: {compressed: true, gl1: S3TC},
  // [GL.COMPRESSED_RGBA_S3TC_DXT1_EXT]: {compressed: true, gl1: S3TC},
  // [GL.COMPRESSED_RGBA_S3TC_DXT3_EXT]: {compressed: true, gl1: S3TC},
  // [GL.COMPRESSED_RGBA_S3TC_DXT5_EXT]: {compressed: true, gl1: S3TC},
  // WEBGL_compressed_texture_es3
  // [GL.COMPRESSED_R11_EAC]: {compressed: true, gl1: ES3}, // RED
  // [GL.COMPRESSED_SIGNED_R11_EAC]: {compressed: true, gl1: ES3}, // RED
  // [GL.COMPRESSED_RG11_EAC]: {compressed: true, gl1: ES3}, // RG
  // [GL.COMPRESSED_SIGNED_RG11_EAC]: {compressed: true, gl1: ES3}, // RG
  // [GL.COMPRESSED_RGB8_ETC2]: {compressed: true, gl1: ES3}, // RGB
  // [GL.COMPRESSED_RGBA8_ETC2_EAC]: {compressed: true, gl1: ES3}, // RBG
  // [GL.COMPRESSED_SRGB8_ETC2]: {compressed: true, gl1: ES3}, // RGB
  // [GL.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]: {compressed: true, gl1: ES3}, // RGBA
  // [GL.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]: {compressed: true, gl1: ES3}, // RGBA
  // [GL.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]: {compressed: true, gl1: ES3}, // RGBA

  /* WebGL2 guaranteed availability compressed formats?
  COMPRESSED_R11_EAC RED
  COMPRESSED_SIGNED_R11_EAC RED
  COMPRESSED_RG11_EAC RG
  COMPRESSED_SIGNED_RG11_EAC RG
  COMPRESSED_RGB8_ETC2 RGB
  COMPRESSED_SRGB8_ETC2 RGB
  COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 RGBA
  COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 RGBA
  COMPRESSED_RGBA8_ETC2_EAC RGBA
  COMPRESSED_SRGB8_ALPHA8_ETC2_EAC
  */
  // WEBGL_compressed_texture_pvrtc
  // [GL.COMPRESSED_RGB_PVRTC_4BPPV1_IMG]: {compressed: true, gl1: PVRTC},
  // [GL.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]: {compressed: true, gl1: PVRTC},
  // [GL.COMPRESSED_RGB_PVRTC_2BPPV1_IMG]: {compressed: true, gl1: PVRTC},
  // [GL.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]: {compressed: true, gl1: PVRTC},
  // WEBGL_compressed_texture_etc1
  // [GL.COMPRESSED_RGB_ETC1_WEBGL]: {compressed: true, gl1: ETC1},
  // WEBGL_compressed_texture_atc
  // [GL.COMPRESSED_RGB_ATC_WEBGL]: {compressed: true, gl1: ETC1},
  // [GL.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]: {compressed: true, gl1: ETC1},
  // [GL.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]: {compressed: true, gl1: ETC1}

}), _TEXTURE_FORMATS);
exports.TEXTURE_FORMATS = TEXTURE_FORMATS;

function isFormatSupported(gl, format) {
  var info = TEXTURE_FORMATS[format];

  if (!info) {
    return false;
  }

  if (info.gl1 === undefined && info.gl2 === undefined) {
    // No info - always supported
    return true;
  }

  var value = (0, _webglUtils.isWebGL2)(gl) ? info.gl2 || info.gl1 : info.gl1;
  return typeof value === 'string' ? gl.getExtension(value) : value;
}

function isLinearFilteringSupported(gl, format) {
  var info = TEXTURE_FORMATS[format];

  switch (info && info.types[0]) {
    // Both WebGL1 and WebGL2?
    case 5126:
      return gl.getExtension('OES_texture_float_linear');
    // Not in WebGL2?

    case 5131:
      return gl.getExtension('OES_texture_half_float_linear');

    default:
      return true;
  }
}

var Texture =
/*#__PURE__*/
function (_Resource) {
  (0, _inherits2.default)(Texture, _Resource);
  (0, _createClass2.default)(Texture, null, [{
    key: "isSupported",
    value: function isSupported(gl) {
      var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
          format = _ref.format,
          linearFiltering = _ref.linearFiltering;

      var supported = true;

      if (format) {
        supported = supported && isFormatSupported(gl, format);
        supported = supported && (!linearFiltering || isLinearFilteringSupported(gl, format));
      }

      return supported;
    } // target cannot be modified by bind:
    // textures are special because when you first bind them to a target,
    // they get special information. When you first bind a texture as a
    // GL_TEXTURE_2D, you are actually setting special state in the texture.
    // You are saying that this texture is a 2D texture.
    // And it will always be a 2D texture; this state cannot be changed ever.
    // If you have a texture that was first bound as a GL_TEXTURE_2D,
    // you must always bind it as a GL_TEXTURE_2D;
    // attempting to bind it as GL_TEXTURE_1D will give rise to an error
    // (while run-time).

  }]);

  function Texture(gl, opts) {
    var _this;

    (0, _classCallCheck2.default)(this, Texture);
    var _opts$id = opts.id,
        id = _opts$id === void 0 ? (0, _utils.uid)('texture') : _opts$id,
        handle = opts.handle,
        target = opts.target;
    _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Texture).call(this, gl, {
      id: id,
      handle: handle
    }));
    _this.target = target;
    _this.hasFloatTexture = gl.getExtension('OES_texture_float');
    _this.textureUnit = undefined;
    return _this;
  }

  (0, _createClass2.default)(Texture, [{
    key: "toString",
    value: function toString() {
      return "Texture(".concat(this.id, ",").concat(this.width, "x").concat(this.height, ")");
    }
    /* eslint-disable max-len, max-statements */

  }, {
    key: "initialize",
    value: function initialize() {
      var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      var data = opts.data;
      var _opts$pixels = opts.pixels,
          pixels = _opts$pixels === void 0 ? null : _opts$pixels,
          _opts$format = opts.format,
          format = _opts$format === void 0 ? 6408 : _opts$format,
          _opts$type = opts.type,
          type = _opts$type === void 0 ? 5121 : _opts$type,
          _opts$border = opts.border,
          border = _opts$border === void 0 ? 0 : _opts$border,
          _opts$recreate = opts.recreate,
          recreate = _opts$recreate === void 0 ? false : _opts$recreate,
          _opts$parameters = opts.parameters,
          parameters = _opts$parameters === void 0 ? {} : _opts$parameters,
          _opts$pixelStore = opts.pixelStore,
          pixelStore = _opts$pixelStore === void 0 ? {} : _opts$pixelStore,
          _opts$textureUnit = opts.textureUnit,
          textureUnit = _opts$textureUnit === void 0 ? undefined : _opts$textureUnit,
          _opts$unpackFlipY = opts.unpackFlipY,
          unpackFlipY = _opts$unpackFlipY === void 0 ? true : _opts$unpackFlipY;
      var _opts$mipmaps = opts.mipmaps,
          mipmaps = _opts$mipmaps === void 0 ? true : _opts$mipmaps; // pixels variable is for API compatibility purpose

      if (!data) {
        // TODO - This looks backwards? Commenting out for now until we decide
        // which prop to use
        // log.deprecated('data', 'pixels')();
        data = pixels;
      }

      var width = opts.width,
          height = opts.height,
          dataFormat = opts.dataFormat; // Deduce width and height

      var _this$_deduceParamete = this._deduceParameters({
        format: format,
        type: type,
        dataFormat: dataFormat,
        compressed: false,
        data: data,
        width: width,
        height: height
      });

      width = _this$_deduceParamete.width;
      height = _this$_deduceParamete.height;
      dataFormat = _this$_deduceParamete.dataFormat; // Store opts for accessors

      this.width = width;
      this.height = height;
      this.format = format;
      this.type = type;
      this.dataFormat = dataFormat;
      this.border = border;
      this.textureUnit = textureUnit;

      if (Number.isFinite(this.textureUnit)) {
        this.gl.activeTexture(33984 + this.textureUnit);
        this.gl.bindTexture(this.target, this.handle);
      } // Note: luma.gl defaults to GL.UNPACK_FLIP_Y_WEBGL = true;
      // TODO - compare v4 and v3


      var DEFAULT_TEXTURE_SETTINGS = (0, _defineProperty2.default)({}, 37440, unpackFlipY);
      var glSettings = Object.assign({}, DEFAULT_TEXTURE_SETTINGS, pixelStore);

      if (this._isNPOT() && mipmaps) {
        _utils.log.warn("texture: ".concat(this, " is Non-Power-Of-Two, disabling mipmaping"))();

        mipmaps = false;

        this._updateForNPOT(parameters);
      }

      this.mipmaps = mipmaps;
      this.setImageData({
        data: data,
        width: width,
        height: height,
        format: format,
        type: type,
        dataFormat: dataFormat,
        border: border,
        mipmaps: mipmaps,
        parameters: glSettings
      });

      if (mipmaps) {
        this.generateMipmap();
      } // Set texture sampler parameters


      this.setParameters(parameters); // TODO - Store data to enable auto recreate on context loss

      if (recreate) {
        this.data = data;
      }
    } // If size has changed, reinitializes with current format
    // note clears image and mipmaps

  }, {
    key: "resize",
    value: function resize(_ref2) {
      var width = _ref2.width,
          height = _ref2.height;

      if (width !== this.width || height !== this.height) {
        return this.initialize({
          width: width,
          height: height,
          format: this.format,
          type: this.type,
          dataFormat: this.dataFormat,
          border: this.border,
          mipmaps: false
        });
      }

      return this;
    } // Call to regenerate mipmaps after modifying texture(s)

  }, {
    key: "generateMipmap",
    value: function generateMipmap() {
      var _this2 = this;

      var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      this.gl.bindTexture(this.target, this.handle);
      (0, _contextState.withParameters)(this.gl, params, function () {
        _this2.gl.generateMipmap(_this2.target);
      });
      this.gl.bindTexture(this.target, null);
      return this;
    }
    /*
     * Allocates storage
     * @param {*} pixels -
     *  null - create empty texture of specified format
     *  Typed array - init from image data in typed array
     *  Buffer|WebGLBuffer - (WEBGL2) init from image data in WebGLBuffer
     *  HTMLImageElement|Image - Inits with content of image. Auto width/height
     *  HTMLCanvasElement - Inits with contents of canvas. Auto width/height
     *  HTMLVideoElement - Creates video texture. Auto width/height
     *
     * @param {GLint} width -
     * @param {GLint} height -
     * @param {GLint} mipMapLevel -
     * @param {GLenum} format - format of image data.
     * @param {GLenum} type
     *  - format of array (autodetect from type) or
     *  - (WEBGL2) format of buffer
     * @param {Number} offset - (WEBGL2) offset from start of buffer
     * @param {GLint} border - must be 0.
     * @parameters - temporary settings to be applied, can be used to supply pixel store settings.
     */

    /* eslint-disable max-len, max-statements, complexity */

  }, {
    key: "setImageData",
    value: function setImageData(_ref3) {
      var _ref3$target = _ref3.target,
          target = _ref3$target === void 0 ? this.target : _ref3$target,
          _ref3$pixels = _ref3.pixels,
          pixels = _ref3$pixels === void 0 ? null : _ref3$pixels,
          _ref3$data = _ref3.data,
          data = _ref3$data === void 0 ? null : _ref3$data,
          _ref3$width = _ref3.width,
          width = _ref3$width === void 0 ? this.width : _ref3$width,
          _ref3$height = _ref3.height,
          height = _ref3$height === void 0 ? this.height : _ref3$height,
          _ref3$level = _ref3.level,
          level = _ref3$level === void 0 ? 0 : _ref3$level,
          _ref3$format = _ref3.format,
          format = _ref3$format === void 0 ? this.format : _ref3$format,
          _ref3$type = _ref3.type,
          type = _ref3$type === void 0 ? this.type : _ref3$type,
          _ref3$dataFormat = _ref3.dataFormat,
          dataFormat = _ref3$dataFormat === void 0 ? this.dataFormat : _ref3$dataFormat,
          _ref3$offset = _ref3.offset,
          offset = _ref3$offset === void 0 ? 0 : _ref3$offset,
          _ref3$border = _ref3.border,
          border = _ref3$border === void 0 ? this.border : _ref3$border,
          _ref3$compressed = _ref3.compressed,
          compressed = _ref3$compressed === void 0 ? false : _ref3$compressed,
          _ref3$parameters = _ref3.parameters,
          parameters = _ref3$parameters === void 0 ? {} : _ref3$parameters; // pixels variable is  for API compatibility purpose

      if (!data) {
        data = pixels;
      }

      var _this$_deduceParamete2 = this._deduceParameters({
        format: format,
        type: type,
        dataFormat: dataFormat,
        compressed: compressed,
        data: data,
        width: width,
        height: height
      });

      type = _this$_deduceParamete2.type;
      dataFormat = _this$_deduceParamete2.dataFormat;
      compressed = _this$_deduceParamete2.compressed;
      width = _this$_deduceParamete2.width;
      height = _this$_deduceParamete2.height;
      var gl = this.gl;
      gl.bindTexture(this.target, this.handle);
      var dataType = null;

      var _this$_getDataType = this._getDataType({
        data: data,
        compressed: compressed
      });

      data = _this$_getDataType.data;
      dataType = _this$_getDataType.dataType;
      (0, _contextState.withParameters)(this.gl, parameters, function () {
        switch (dataType) {
          case 'null':
            gl.texImage2D(target, level, format, width, height, border, dataFormat, type, data);
            break;

          case 'typed-array':
            // Looks like this assert is not necessary, as offset is ignored under WebGL1
            // assert((offset === 0 || isWebGL2(gl)), 'offset supported in WebGL2 only');
            gl.texImage2D(target, level, format, width, height, border, dataFormat, type, data, offset);
            break;

          case 'buffer':
            // WebGL2 enables creating textures directly from a WebGL buffer
            (0, _webglUtils.assertWebGL2Context)(gl);
            gl.bindBuffer(35052, data.handle || data);
            gl.texImage2D(target, level, format, width, height, border, dataFormat, type, offset);
            gl.bindBuffer(35052, null);
            break;

          case 'browser-object':
            if ((0, _webglUtils.isWebGL2)(gl)) {
              gl.texImage2D(target, level, format, width, height, border, dataFormat, type, data);
            } else {
              gl.texImage2D(target, level, format, dataFormat, type, data);
            }

            break;

          case 'compressed':
            gl.compressedTexImage2D(target, level, format, width, height, border, data);
            break;

          default:
            (0, _assert.default)(false, 'Unknown image data type');
        }
      });
    }
    /* eslint-enable max-len, max-statements, complexity */

    /**
     * Redefines an area of an existing texture
     * Note: does not allocate storage
     */

    /*
     * Redefines an area of an existing texture
     * @param {*} pixels, data -
     *  null - create empty texture of specified format
     *  Typed array - init from image data in typed array
     *  Buffer|WebGLBuffer - (WEBGL2) init from image data in WebGLBuffer
     *  HTMLImageElement|Image - Inits with content of image. Auto width/height
     *  HTMLCanvasElement - Inits with contents of canvas. Auto width/height
     *  HTMLVideoElement - Creates video texture. Auto width/height
     *
     * @param {GLint} x - xOffset from where texture to be updated
     * @param {GLint} y - yOffset from where texture to be updated
     * @param {GLint} width - width of the sub image to be updated
     * @param {GLint} height - height of the sub image to be updated
     * @param {GLint} level - mip level to be updated
     * @param {GLenum} format - internal format of image data.
     * @param {GLenum} type
     *  - format of array (autodetect from type) or
     *  - (WEBGL2) format of buffer or ArrayBufferView
     * @param {GLenum} dataFormat - format of image data.
     * @param {Number} offset - (WEBGL2) offset from start of buffer
     * @param {GLint} border - must be 0.
     * @parameters - temporary settings to be applied, can be used to supply pixel store settings.
     */

  }, {
    key: "setSubImageData",
    value: function setSubImageData(_ref4) {
      var _this3 = this;

      var _ref4$target = _ref4.target,
          target = _ref4$target === void 0 ? this.target : _ref4$target,
          _ref4$pixels = _ref4.pixels,
          pixels = _ref4$pixels === void 0 ? null : _ref4$pixels,
          _ref4$data = _ref4.data,
          data = _ref4$data === void 0 ? null : _ref4$data,
          _ref4$x = _ref4.x,
          x = _ref4$x === void 0 ? 0 : _ref4$x,
          _ref4$y = _ref4.y,
          y = _ref4$y === void 0 ? 0 : _ref4$y,
          _ref4$width = _ref4.width,
          width = _ref4$width === void 0 ? this.width : _ref4$width,
          _ref4$height = _ref4.height,
          height = _ref4$height === void 0 ? this.height : _ref4$height,
          _ref4$level = _ref4.level,
          level = _ref4$level === void 0 ? 0 : _ref4$level,
          _ref4$format = _ref4.format,
          format = _ref4$format === void 0 ? this.format : _ref4$format,
          _ref4$type = _ref4.type,
          type = _ref4$type === void 0 ? this.type : _ref4$type,
          _ref4$dataFormat = _ref4.dataFormat,
          dataFormat = _ref4$dataFormat === void 0 ? this.dataFormat : _ref4$dataFormat,
          _ref4$compressed = _ref4.compressed,
          compressed = _ref4$compressed === void 0 ? false : _ref4$compressed,
          _ref4$offset = _ref4.offset,
          offset = _ref4$offset === void 0 ? 0 : _ref4$offset,
          _ref4$border = _ref4.border,
          border = _ref4$border === void 0 ? this.border : _ref4$border,
          _ref4$parameters = _ref4.parameters,
          parameters = _ref4$parameters === void 0 ? {} : _ref4$parameters;

      var _this$_deduceParamete3 = this._deduceParameters({
        format: format,
        type: type,
        dataFormat: dataFormat,
        compressed: compressed,
        data: data,
        width: width,
        height: height
      });

      type = _this$_deduceParamete3.type;
      dataFormat = _this$_deduceParamete3.dataFormat;
      compressed = _this$_deduceParamete3.compressed;
      width = _this$_deduceParamete3.width;
      height = _this$_deduceParamete3.height; // pixels variable is  for API compatibility purpose

      if (!data) {
        data = pixels;
      } // Support ndarrays


      if (data && data.data) {
        var ndarray = data;
        data = ndarray.data;
        width = ndarray.shape[0];
        height = ndarray.shape[1];
      } // Support buffers


      if (data instanceof _buffer.default) {
        data = data.handle;
      }

      this.gl.bindTexture(this.target, this.handle);
      (0, _contextState.withParameters)(this.gl, parameters, function () {
        // TODO - x,y parameters
        if (compressed) {
          _this3.gl.compressedTexSubImage2D(target, level, x, y, width, height, format, data);
        } else if (data === null) {
          _this3.gl.texSubImage2D(target, level, x, y, width, height, dataFormat, type, null);
        } else if (ArrayBuffer.isView(data)) {
          _this3.gl.texSubImage2D(target, level, x, y, width, height, dataFormat, type, data, offset);
        } else if (data instanceof _webglUtils.WebGLBuffer) {
          // WebGL2 allows us to create texture directly from a WebGL buffer
          (0, _webglUtils.assertWebGL2Context)(_this3.gl); // This texImage2D signature uses currently bound GL.PIXEL_UNPACK_BUFFER

          _this3.gl.bindBuffer(35052, data);

          _this3.gl.texSubImage2D(target, level, x, y, width, height, dataFormat, type, offset);

          _this3.gl.bindBuffer(35052, null);
        } else if ((0, _webglUtils.isWebGL2)(_this3.gl)) {
          // Assume data is a browser supported object (ImageData, Canvas, ...)
          _this3.gl.texSubImage2D(target, level, x, y, width, height, dataFormat, type, data);
        } else {
          _this3.gl.texSubImage2D(target, level, x, y, dataFormat, type, data);
        }
      });
      this.gl.bindTexture(this.target, null);
    }
    /* eslint-enable max-len, max-statements, complexity */

    /**
     * Defines a two-dimensional texture image or cube-map texture image with
     * pixels from the current framebuffer (rather than from client memory).
     * (gl.copyTexImage2D wrapper)
     *
     * Note that binding a texture into a Framebuffer's color buffer and
     * rendering can be faster.
     */

  }, {
    key: "copyFramebuffer",
    value: function copyFramebuffer(_ref5) {
      var _ref5$target = _ref5.target,
          target = _ref5$target === void 0 ? this.target : _ref5$target,
          framebuffer = _ref5.framebuffer,
          _ref5$x = _ref5.x,
          x = _ref5$x === void 0 ? 0 : _ref5$x,
          _ref5$y = _ref5.y,
          y = _ref5$y === void 0 ? 0 : _ref5$y,
          width = _ref5.width,
          height = _ref5.height,
          _ref5$level = _ref5.level,
          level = _ref5$level === void 0 ? 0 : _ref5$level,
          _ref5$internalFormat = _ref5.internalFormat,
          internalFormat = _ref5$internalFormat === void 0 ? 6408 : _ref5$internalFormat,
          _ref5$border = _ref5.border,
          border = _ref5$border === void 0 ? 0 : _ref5$border;

      if (framebuffer) {
        framebuffer.bind();
      } // target


      this.bind(0);
      this.gl.copyTexImage2D(this.target, level, internalFormat, x, y, width, height, border);
      this.unbind();

      if (framebuffer) {
        framebuffer.unbind();
      }
    }
  }, {
    key: "getActiveUnit",
    value: function getActiveUnit() {
      return this.gl.getParameter(34016) - 33984;
    } // target cannot be modified by bind:
    // textures are special because when you first bind them to a target,
    // they get special information. When you first bind a texture as a
    // GL_TEXTURE_2D, you are actually setting special state in the texture.
    // You are saying that this texture is a 2D texture.
    // And it will always be a 2D texture; this state cannot be changed ever.
    // If you have a texture that was first bound as a GL_TEXTURE_2D,
    // you must always bind it as a GL_TEXTURE_2D;
    // attempting to bind it as GL_TEXTURE_1D will give rise to an error
    // (while run-time).

  }, {
    key: "bind",
    value: function bind() {
      var textureUnit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.textureUnit;

      if (textureUnit === undefined) {
        throw new Error('Texture.bind: must specify texture unit');
      }

      this.textureUnit = textureUnit;
      this.gl.activeTexture(33984 + textureUnit);
      this.gl.bindTexture(this.target, this.handle);
      return textureUnit;
    }
  }, {
    key: "unbind",
    value: function unbind() {
      if (this.textureUnit === undefined) {
        throw new Error('Texture.unbind: texture unit not specified');
      }

      this.gl.activeTexture(33984 + this.textureUnit);
      this.gl.bindTexture(this.target, null);
      return this.textureUnit;
    } // PRIVATE METHODS

  }, {
    key: "_getDataType",
    value: function _getDataType(_ref6) {
      var data = _ref6.data,
          _ref6$compressed = _ref6.compressed,
          compressed = _ref6$compressed === void 0 ? false : _ref6$compressed;

      if (compressed) {
        return {
          data: data,
          dataType: 'compressed'
        };
      }

      if (data === null) {
        return {
          data: data,
          dataType: 'null'
        };
      }

      if (ArrayBuffer.isView(data)) {
        return {
          data: data,
          dataType: 'typed-array'
        };
      }

      if (data instanceof _buffer.default) {
        return {
          data: data.handle,
          dataType: 'buffer'
        };
      }

      if (data instanceof _webglUtils.WebGLBuffer) {
        return {
          data: data,
          dataType: 'buffer'
        };
      } // Assume data is a browser supported object (ImageData, Canvas, ...)


      return {
        data: data,
        dataType: 'browser-object'
      };
    } // Image 3D copies from Typed Array or WebGLBuffer

  }, {
    key: "setImage3D",
    value: function setImage3D(_ref7) {
      var _ref7$level = _ref7.level,
          level = _ref7$level === void 0 ? 0 : _ref7$level,
          _ref7$internalformat = _ref7.internalformat,
          internalformat = _ref7$internalformat === void 0 ? 6408 : _ref7$internalformat,
          width = _ref7.width,
          height = _ref7.height,
          _ref7$depth = _ref7.depth,
          depth = _ref7$depth === void 0 ? 1 : _ref7$depth,
          _ref7$border = _ref7.border,
          border = _ref7$border === void 0 ? 0 : _ref7$border,
          format = _ref7.format,
          _ref7$type = _ref7.type,
          type = _ref7$type === void 0 ? 5121 : _ref7$type,
          _ref7$offset = _ref7.offset,
          offset = _ref7$offset === void 0 ? 0 : _ref7$offset,
          pixels = _ref7.pixels;

      if (ArrayBuffer.isView(pixels)) {
        this.gl.texImage3D(this.target, level, internalformat, width, height, depth, border, format, type, pixels);
        return this;
      }

      if (pixels instanceof _buffer.default) {
        this.gl.bindBuffer(35052, pixels.handle);
        this.gl.texImage3D(this.target, level, internalformat, width, height, depth, border, format, type, offset);
      }

      return this;
    }
    /* Copied from texture-2d.js
    // WebGL2
    setPixels(opts = {}) {
      const {
        buffer,
        width = null,
        height = null,
        mipmapLevel = 0,
        format = GL.RGBA,
        type = GL.UNSIGNED_BYTE,
        border = 0
      } = opts;
       const {gl} = this;
       // This signature of texImage2D uses currently bound GL.PIXEL_UNPACK_BUFFER
      gl.bindBuffer(GL.PIXEL_UNPACK_BUFFER, buffer.target);
      // And as always, we must also bind the texture itself
      this.bind();
       gl.texImage2D(gl.TEXTURE_2D,
        mipmapLevel, format, width, height, border, format, type, buffer.target);
       this.unbind();
      gl.bindBuffer(GL.GL.PIXEL_UNPACK_BUFFER, null);
      return this;
    }
     setImageDataFromCompressedBuffer(opts) {
      const {
        buffer,
        // offset = 0,
        width = null,
        height = null,
        mipmapLevel = 0,
        internalFormat = GL.RGBA,
        // format = GL.RGBA,
        // type = GL.UNSIGNED_BYTE,
        border = 0
      } = opts;
       const {gl} = this;
      gl.compressedTexImage2D(this.target,
        mipmapLevel, internalFormat, width, height, border, buffer);
      // gl.compressedTexSubImage2D(target,
      //   level, xoffset, yoffset, width, height, format, ArrayBufferView? pixels);
      return this;
    }
     copySubImage(opts) {
      const {
        // pixels,
        // offset = 0,
        // x,
        // y,
        // width,
        // height,
        // mipmapLevel = 0,
        // internalFormat = GL.RGBA,
        // type = GL.UNSIGNED_BYTE,
        // border = 0
      } = opts;
       // if (pixels instanceof ArrayBufferView) {
      //   gl.texSubImage2D(target, level, x, y, width, height, format, type, pixels);
      // }
      // gl.texSubImage2D(target, level, x, y, format, type, ? pixels);
      // gl.texSubImage2D(target, level, x, y, format, type, HTMLImageElement pixels);
      // gl.texSubImage2D(target, level, x, y, format, type, HTMLCanvasElement pixels);
      // gl.texSubImage2D(target, level, x, y, format, type, HTMLVideoElement pixels);
      // // Additional signature in a WebGL 2 context:
      // gl.texSubImage2D(target, level, x, y, format, type, GLintptr offset);
    }
    */
    // HELPER METHODS

  }, {
    key: "_deduceParameters",
    value: function _deduceParameters(opts) {
      var format = opts.format,
          data = opts.data;
      var width = opts.width,
          height = opts.height,
          dataFormat = opts.dataFormat,
          type = opts.type,
          compressed = opts.compressed; // Deduce format and type from format

      var textureFormat = TEXTURE_FORMATS[format];
      dataFormat = dataFormat || textureFormat && textureFormat.dataFormat;
      type = type || textureFormat && textureFormat.types[0]; // Deduce compression from format

      compressed = compressed || textureFormat && textureFormat.compressed;

      var _this$_deduceImageSiz = this._deduceImageSize(data, width, height);

      width = _this$_deduceImageSiz.width;
      height = _this$_deduceImageSiz.height;
      return {
        dataFormat: dataFormat,
        type: type,
        compressed: compressed,
        width: width,
        height: height,
        format: format,
        data: data
      };
    }
    /* global ImageData, HTMLImageElement, HTMLCanvasElement, HTMLVideoElement */
    // eslint-disable-next-line complexity

  }, {
    key: "_deduceImageSize",
    value: function _deduceImageSize(data, width, height) {
      var size;

      if (typeof ImageData !== 'undefined' && data instanceof ImageData) {
        size = {
          width: data.width,
          height: data.height
        };
      } else if (typeof HTMLImageElement !== 'undefined' && data instanceof HTMLImageElement) {
        size = {
          width: data.naturalWidth,
          height: data.naturalHeight
        };
      } else if (typeof HTMLCanvasElement !== 'undefined' && data instanceof HTMLCanvasElement) {
        size = {
          width: data.width,
          height: data.height
        };
      } else if (typeof HTMLVideoElement !== 'undefined' && data instanceof HTMLVideoElement) {
        size = {
          width: data.videoWidth,
          height: data.videoHeight
        };
      } else if (!data) {
        size = {
          width: width >= 0 ? width : 1,
          height: height >= 0 ? height : 1
        };
      } else {
        size = {
          width: width,
          height: height
        };
      }

      (0, _assert.default)(size, 'Could not deduced texture size');
      (0, _assert.default)(width === undefined || size.width === width, 'Deduced texture width does not match supplied width');
      (0, _assert.default)(height === undefined || size.height === height, 'Deduced texture height does not match supplied height');
      return size;
    } // RESOURCE METHODS

  }, {
    key: "_createHandle",
    value: function _createHandle() {
      return this.gl.createTexture();
    }
  }, {
    key: "_deleteHandle",
    value: function _deleteHandle() {
      this.gl.deleteTexture(this.handle);
    }
  }, {
    key: "_getParameter",
    value: function _getParameter(pname) {
      switch (pname) {
        case 4096:
          return this.width;

        case 4097:
          return this.height;

        default:
          this.gl.bindTexture(this.target, this.handle);
          var value = this.gl.getTexParameter(this.target, pname);
          this.gl.bindTexture(this.target, null);
          return value;
      }
    }
  }, {
    key: "_setParameter",
    value: function _setParameter(pname, param) {
      this.gl.bindTexture(this.target, this.handle); // NOTE: Apply NPOT workaround

      param = this._getNPOTParam(pname, param); // Apparently there are some integer/float conversion rules that made
      // the WebGL committe expose two parameter setting functions in JavaScript.
      // For now, pick the float version for parameters specified as GLfloat.

      switch (pname) {
        case 33082:
        case 33083:
          this.gl.texParameterf(this.handle, pname, param);
          break;

        case 4096:
        case 4097:
          (0, _assert.default)(false);
          break;

        default:
          this.gl.texParameteri(this.target, pname, param);
          break;
      }

      this.gl.bindTexture(this.target, null);
      return this;
    }
  }, {
    key: "_isNPOT",
    value: function _isNPOT() {
      return !(0, _webglUtils.isWebGL2)(this.gl) && (!(0, _utils.isPowerOfTwo)(this.width) || !(0, _utils.isPowerOfTwo)(this.height));
    } // Update default settings which are not supported by NPOT textures.

  }, {
    key: "_updateForNPOT",
    value: function _updateForNPOT(parameters) {
      if (parameters[this.gl.TEXTURE_MIN_FILTER] === undefined) {
        // log.warn(`texture: ${this} is Non-Power-Of-Two, forcing TEXTURE_MIN_FILTER to LINEAR`)();
        parameters[this.gl.TEXTURE_MIN_FILTER] = this.gl.LINEAR;
      }

      if (parameters[this.gl.TEXTURE_WRAP_S] === undefined) {
        // log.warn(`texture: ${this} is Non-Power-Of-Two, forcing TEXTURE_WRAP_S to CLAMP_TO_EDGE`)();
        parameters[this.gl.TEXTURE_WRAP_S] = this.gl.CLAMP_TO_EDGE;
      }

      if (parameters[this.gl.TEXTURE_WRAP_T] === undefined) {
        // log.warn(`texture: ${this} is Non-Power-Of-Two, forcing TEXTURE_WRAP_T to CLAMP_TO_EDGE`)();
        parameters[this.gl.TEXTURE_WRAP_T] = this.gl.CLAMP_TO_EDGE;
      }
    }
  }, {
    key: "_getNPOTParam",
    value: function _getNPOTParam(pname, param) {
      if (this._isNPOT()) {
        switch (pname) {
          case 10241:
            if (NPOT_MIN_FILTERS.indexOf(param) === -1) {
              // log.warn(`texture: ${this} is Non-Power-Of-Two, forcing TEXTURE_MIN_FILTER to LINEAR`)();
              param = 9729;
            }

            break;

          case 10242:
          case 10243:
            if (param !== 33071) {
              // log.warn(`texture: ${this} is Non-Power-Of-Two, ${getKey(this.gl, pname)} to CLAMP_TO_EDGE`)();
              param = 33071;
            }

            break;

          default:
            break;
        }
      }

      return param;
    }
  }]);
  return Texture;
}(_resource.default);

exports.default = Texture;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/inherits":"NNOi","@babel/runtime/helpers/esm/defineProperty":"DOnw","./resource":"Uazl","./buffer":"Rc9V","../webgl-context/context-state":"cIIw","../webgl-utils":"PmJk","../utils":"PFG0","../utils/assert":"wYRU"}],"jx3X":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/assertThisInitialized"));

var _texture = _interopRequireDefault(require("./texture"));

var _webglUtils = require("../webgl-utils");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Texture2D =
/*#__PURE__*/
function (_Texture) {
  (0, _inherits2.default)(Texture2D, _Texture);
  (0, _createClass2.default)(Texture2D, null, [{
    key: "isSupported",
    value: function isSupported(gl, opts) {
      return _texture.default.isSupported(gl, opts);
    }
    /**
     * @classdesc
     * 2D WebGL Texture
     * Note: Constructor will initialize your texture.
     *
     * @class
     * @param {WebGLRenderingContext} gl - gl context
     * @param {Image|ArrayBuffer|null} opts= - named options
     * @param {Image|ArrayBuffer|null} opts.data= - buffer
     * @param {GLint} width - width of texture
     * @param {GLint} height - height of texture
     */

  }]);

  function Texture2D(gl) {
    var _this;

    var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, Texture2D);
    (0, _webglUtils.assertWebGLContext)(gl);
    _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Texture2D).call(this, gl, Object.assign({}, opts, {
      target: 3553
    })));

    _this.initialize(opts);

    Object.seal((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
    return _this;
  } // target cannot be modified by bind:
  // textures are special because when you first bind them to a target,
  // they get special information. When you first bind a texture as a
  // GL_TEXTURE_2D, you are actually setting special state in the texture.
  // You are saying that this texture is a 2D texture.
  // And it will always be a 2D texture; this state cannot be changed ever.
  // If you have a texture that was first bound as a GL_TEXTURE_2D,
  // you must always bind it as a GL_TEXTURE_2D;
  // attempting to bind it as GL_TEXTURE_1D will give rise to an error
  // (while run-time).


  (0, _createClass2.default)(Texture2D, [{
    key: "bind",
    value: function bind() {
      var textureUnit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.textureUnit;
      var gl = this.gl;

      if (textureUnit === undefined) {
        throw new Error('Texture.bind: must specify texture unit');
      }

      this.textureUnit = textureUnit;
      gl.activeTexture(33984 + textureUnit);
      gl.bindTexture(this.target, this.handle);
      return textureUnit;
    }
  }, {
    key: "unbind",
    value: function unbind() {
      var gl = this.gl;

      if (this.textureUnit === undefined) {
        throw new Error('Texture.unbind: texture unit not specified');
      }

      gl.activeTexture(33984 + this.textureUnit);
      gl.bindTexture(this.target, null);
      return this.textureUnit;
    }
  }, {
    key: "getActiveUnit",
    value: function getActiveUnit() {
      return this.gl.getParameter(34016) - 33984;
    }
  }]);
  return Texture2D;
}(_texture.default);

exports.default = Texture2D;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/inherits":"NNOi","@babel/runtime/helpers/esm/assertThisInitialized":"b9Zy","./texture":"kZKt","../webgl-utils":"PmJk"}],"Bnce":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/assertThisInitialized"));

var _texture = _interopRequireDefault(require("./texture"));

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var FACES = [34069, 34070, 34071, 34072, 34073, 34074];

var TextureCube =
/*#__PURE__*/
function (_Texture) {
  (0, _inherits2.default)(TextureCube, _Texture);

  function TextureCube(gl) {
    var _this;

    var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, TextureCube);
    _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(TextureCube).call(this, gl, Object.assign({}, opts, {
      target: 34067
    })));

    _this.initialize(opts);

    Object.seal((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
    return _this;
  }
  /* eslint-disable max-len, max-statements */


  (0, _createClass2.default)(TextureCube, [{
    key: "initialize",
    value: function initialize() {
      var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      var _opts$format = opts.format,
          format = _opts$format === void 0 ? 6408 : _opts$format,
          _opts$mipmaps = opts.mipmaps,
          mipmaps = _opts$mipmaps === void 0 ? true : _opts$mipmaps;
      var _opts$width = opts.width,
          width = _opts$width === void 0 ? 1 : _opts$width,
          _opts$height = opts.height,
          height = _opts$height === void 0 ? 1 : _opts$height,
          _opts$type = opts.type,
          type = _opts$type === void 0 ? 5121 : _opts$type,
          dataFormat = opts.dataFormat; // Deduce width and height based on one of the faces

      var _this$_deduceParamete = this._deduceParameters({
        format: format,
        type: type,
        dataFormat: dataFormat
      });

      type = _this$_deduceParamete.type;
      dataFormat = _this$_deduceParamete.dataFormat;

      var _this$_deduceImageSiz = this._deduceImageSize({
        data: opts[34069],
        width: width,
        height: height
      });

      width = _this$_deduceImageSiz.width;
      height = _this$_deduceImageSiz.height; // Enforce cube

      (0, _assert.default)(width === height); // Temporarily apply any pixel store paramaters and build textures
      // withParameters(this.gl, opts, () => {
      //   for (const face of CUBE_MAP_FACES) {
      //     this.setImageData({
      //       target: face,
      //       data: opts[face],
      //       width, height, format, type, dataFormat, border, mipmaps
      //     });
      //   }
      // });

      this.setCubeMapImageData(opts); // Called here so that GL.
      // TODO - should genMipmap() be called on the cubemap or on the faces?

      if (mipmaps) {
        this.generateMipmap(opts);
      } // Store opts for accessors


      this.opts = opts;
    }
  }, {
    key: "subImage",
    value: function subImage(_ref) {
      var face = _ref.face,
          data = _ref.data,
          _ref$x = _ref.x,
          x = _ref$x === void 0 ? 0 : _ref$x,
          _ref$y = _ref.y,
          y = _ref$y === void 0 ? 0 : _ref$y,
          _ref$mipmapLevel = _ref.mipmapLevel,
          mipmapLevel = _ref$mipmapLevel === void 0 ? 0 : _ref$mipmapLevel;
      return this._subImage({
        target: face,
        data: data,
        x: x,
        y: y,
        mipmapLevel: mipmapLevel
      });
    }
    /* eslint-disable max-statements, max-len */

  }, {
    key: "setCubeMapImageData",
    value: function setCubeMapImageData(_ref2) {
      var width = _ref2.width,
          height = _ref2.height,
          pixels = _ref2.pixels,
          data = _ref2.data,
          _ref2$border = _ref2.border,
          border = _ref2$border === void 0 ? 0 : _ref2$border,
          _ref2$format = _ref2.format,
          format = _ref2$format === void 0 ? 6408 : _ref2$format,
          _ref2$type = _ref2.type,
          type = _ref2$type === void 0 ? 5121 : _ref2$type,
          _ref2$generateMipmap = _ref2.generateMipmap,
          generateMipmap = _ref2$generateMipmap === void 0 ? false : _ref2$generateMipmap;
      var gl = this.gl;
      pixels = pixels || data;
      this.bind();

      if (this.width || this.height) {
        for (var _i = 0; _i < FACES.length; _i++) {
          var face = FACES[_i];
          gl.texImage2D(face, 0, format, width, height, border, format, type, pixels[face]);
        }
      } else {
        for (var _i2 = 0; _i2 < FACES.length; _i2++) {
          var _face = FACES[_i2];
          gl.texImage2D(_face, 0, format, format, type, pixels[_face]);
        }
      }
    }
  }, {
    key: "bind",
    value: function bind() {
      var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          index = _ref3.index;

      if (index !== undefined) {
        this.gl.activeTexture(33984 + index);
      }

      this.gl.bindTexture(34067, this.handle);
      return index;
    }
  }, {
    key: "unbind",
    value: function unbind() {
      this.gl.bindTexture(34067, null);
      return this;
    }
  }]);
  return TextureCube;
}(_texture.default);

exports.default = TextureCube;
TextureCube.FACES = FACES;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","@babel/runtime/helpers/esm/assertThisInitialized":"b9Zy","./texture":"kZKt","../utils/assert":"wYRU"}],"q4cN":[function(require,module,exports) {

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/assertThisInitialized"));

var _webglUtils = require("../webgl-utils");

var _contextState = require("../webgl-context/context-state");

var _texture = _interopRequireDefault(require("../webgl/texture"));

var _buffer = _interopRequireDefault(require("./buffer"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Texture3D =
/*#__PURE__*/
function (_Texture) {
  (0, _inherits2.default)(Texture3D, _Texture);
  (0, _createClass2.default)(Texture3D, null, [{
    key: "isSupported",
    value: function isSupported(gl) {
      return (0, _webglUtils.isWebGL2)(gl);
    }
    /**
     * @classdesc
     * 3D WebGL Texture
     * Note: Constructor will initialize your texture.
     *
     * @class
     * @param {WebGLRenderingContext} gl - gl context
     * @param {Image|ArrayBuffer|null} opts= - named options
     * @param {Image|ArrayBuffer|null} opts.data= - buffer
     * @param {GLint} width - width of texture
     * @param {GLint} height - height of texture
     */

  }]);

  function Texture3D(gl) {
    var _this;

    var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, Texture3D);
    (0, _webglUtils.assertWebGL2Context)(gl);
    _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Texture3D).call(this, gl, Object.assign({}, opts, {
      target: opts.target || 32879
    })));
    _this.width = null;
    _this.height = null;
    _this.depth = null;
    Object.seal((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));

    _this.setImageData(opts);

    if (opts.generateMipmap) {
      _this.generateMipmap();
    }

    return _this;
  }

  (0, _createClass2.default)(Texture3D, [{
    key: "initialize",
    value: function initialize() {
      var _this2 = this;

      var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      this.opts = Object.assign({}, this.opts, opts);
      var _this$opts = this.opts,
          pixels = _this$opts.pixels,
          settings = _this$opts.settings;

      if (settings) {
        (0, _contextState.withParameters)(settings, function () {
          if (pixels) {
            _this2.setImage3D(_this2.opts);
          }
        });
        this.setParameters(opts);
      }
    } // WebGL2
    // Image 3D copies from Typed Array or WebGLBuffer

  }, {
    key: "setImage3D",
    value: function setImage3D(_ref) {
      var _ref$level = _ref.level,
          level = _ref$level === void 0 ? 0 : _ref$level,
          _ref$internalformat = _ref.internalformat,
          internalformat = _ref$internalformat === void 0 ? 6408 : _ref$internalformat,
          width = _ref.width,
          height = _ref.height,
          _ref$depth = _ref.depth,
          depth = _ref$depth === void 0 ? 1 : _ref$depth,
          _ref$border = _ref.border,
          border = _ref$border === void 0 ? 0 : _ref$border,
          format = _ref.format,
          _ref$type = _ref.type,
          type = _ref$type === void 0 ? 5121 : _ref$type,
          _ref$offset = _ref.offset,
          offset = _ref$offset === void 0 ? 0 : _ref$offset,
          pixels = _ref.pixels;

      if (ArrayBuffer.isView(pixels)) {
        this.gl.texImage3D(this.target, level, internalformat, width, height, depth, border, format, type, pixels);
        return;
      }

      if (pixels instanceof _buffer.default) {
        this.gl.bindBuffer(35052, pixels.handle);
        this.gl.texImage3D(this.target, level, internalformat, width, height, depth, border, format, type, offset);
        this.gl.bindBuffer(35052, pixels.handle);
      }
    }
  }]);
  return Texture3D;
}(_texture.default);

exports.default = Texture3D;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/inherits":"NNOi","@babel/runtime/helpers/esm/assertThisInitialized":"b9Zy","../webgl-utils":"PmJk","../webgl-context/context-state":"cIIw","../webgl/texture":"kZKt","./buffer":"Rc9V"}],"yheg":[function(require,module,exports) {
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
'use strict';
/* eslint-disable no-unused-vars */

var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var propIsEnumerable = Object.prototype.propertyIsEnumerable;

function toObject(val) {
  if (val === null || val === undefined) {
    throw new TypeError('Object.assign cannot be called with null or undefined');
  }

  return Object(val);
}

function shouldUseNative() {
  try {
    if (!Object.assign) {
      return false;
    } // Detect buggy property enumeration order in older V8 versions.
    // https://bugs.chromium.org/p/v8/issues/detail?id=4118


    var test1 = new String('abc'); // eslint-disable-line no-new-wrappers

    test1[5] = 'de';

    if (Object.getOwnPropertyNames(test1)[0] === '5') {
      return false;
    } // https://bugs.chromium.org/p/v8/issues/detail?id=3056


    var test2 = {};

    for (var i = 0; i < 10; i++) {
      test2['_' + String.fromCharCode(i)] = i;
    }

    var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
      return test2[n];
    });

    if (order2.join('') !== '0123456789') {
      return false;
    } // https://bugs.chromium.org/p/v8/issues/detail?id=3056


    var test3 = {};
    'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
      test3[letter] = letter;
    });

    if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') {
      return false;
    }

    return true;
  } catch (err) {
    // We don't expect any of the above to throw, but better to be safe.
    return false;
  }
}

module.exports = shouldUseNative() ? Object.assign : function (target, source) {
  var from;
  var to = toObject(target);
  var symbols;

  for (var s = 1; s < arguments.length; s++) {
    from = Object(arguments[s]);

    for (var key in from) {
      if (hasOwnProperty.call(from, key)) {
        to[key] = from[key];
      }
    }

    if (getOwnPropertySymbols) {
      symbols = getOwnPropertySymbols(from);

      for (var i = 0; i < symbols.length; i++) {
        if (propIsEnumerable.call(from, symbols[i])) {
          to[symbols[i]] = from[symbols[i]];
        }
      }
    }
  }

  return to;
};
},{}],"f4zi":[function(require,module,exports) {
module.exports = function isBuffer(arg) {
  return arg && typeof arg === 'object'
    && typeof arg.copy === 'function'
    && typeof arg.fill === 'function'
    && typeof arg.readUInt8 === 'function';
}
},{}],"xJ8m":[function(require,module,exports) {
if (typeof Object.create === 'function') {
  // implementation from standard node.js 'util' module
  module.exports = function inherits(ctor, superCtor) {
    ctor.super_ = superCtor
    ctor.prototype = Object.create(superCtor.prototype, {
      constructor: {
        value: ctor,
        enumerable: false,
        writable: true,
        configurable: true
      }
    });
  };
} else {
  // old school shim for old browsers
  module.exports = function inherits(ctor, superCtor) {
    ctor.super_ = superCtor
    var TempCtor = function () {}
    TempCtor.prototype = superCtor.prototype
    ctor.prototype = new TempCtor()
    ctor.prototype.constructor = ctor
  }
}

},{}],"xow5":[function(require,module,exports) {
var global = arguments[3];
var process = require("process");
// 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.
var formatRegExp = /%[sdj%]/g;

exports.format = function (f) {
  if (!isString(f)) {
    var objects = [];

    for (var i = 0; i < arguments.length; i++) {
      objects.push(inspect(arguments[i]));
    }

    return objects.join(' ');
  }

  var i = 1;
  var args = arguments;
  var len = args.length;
  var str = String(f).replace(formatRegExp, function (x) {
    if (x === '%%') return '%';
    if (i >= len) return x;

    switch (x) {
      case '%s':
        return String(args[i++]);

      case '%d':
        return Number(args[i++]);

      case '%j':
        try {
          return JSON.stringify(args[i++]);
        } catch (_) {
          return '[Circular]';
        }

      default:
        return x;
    }
  });

  for (var x = args[i]; i < len; x = args[++i]) {
    if (isNull(x) || !isObject(x)) {
      str += ' ' + x;
    } else {
      str += ' ' + inspect(x);
    }
  }

  return str;
}; // Mark that a method should not be used.
// Returns a modified function which warns once by default.
// If --no-deprecation is set, then it is a no-op.


exports.deprecate = function (fn, msg) {
  // Allow for deprecating things in the process of starting up.
  if (isUndefined(global.process)) {
    return function () {
      return exports.deprecate(fn, msg).apply(this, arguments);
    };
  }

  if (process.noDeprecation === true) {
    return fn;
  }

  var warned = false;

  function deprecated() {
    if (!warned) {
      if (process.throwDeprecation) {
        throw new Error(msg);
      } else if (process.traceDeprecation) {
        console.trace(msg);
      } else {
        console.error(msg);
      }

      warned = true;
    }

    return fn.apply(this, arguments);
  }

  return deprecated;
};

var debugs = {};
var debugEnviron;

exports.debuglog = function (set) {
  if (isUndefined(debugEnviron)) debugEnviron = undefined || '';
  set = set.toUpperCase();

  if (!debugs[set]) {
    if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
      var pid = process.pid;

      debugs[set] = function () {
        var msg = exports.format.apply(exports, arguments);
        console.error('%s %d: %s', set, pid, msg);
      };
    } else {
      debugs[set] = function () {};
    }
  }

  return debugs[set];
};
/**
 * Echos the value of a value. Trys to print the value out
 * in the best way possible given the different types.
 *
 * @param {Object} obj The object to print out.
 * @param {Object} opts Optional options object that alters the output.
 */

/* legacy: obj, showHidden, depth, colors*/


function inspect(obj, opts) {
  // default options
  var ctx = {
    seen: [],
    stylize: stylizeNoColor
  }; // legacy...

  if (arguments.length >= 3) ctx.depth = arguments[2];
  if (arguments.length >= 4) ctx.colors = arguments[3];

  if (isBoolean(opts)) {
    // legacy...
    ctx.showHidden = opts;
  } else if (opts) {
    // got an "options" object
    exports._extend(ctx, opts);
  } // set default options


  if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
  if (isUndefined(ctx.depth)) ctx.depth = 2;
  if (isUndefined(ctx.colors)) ctx.colors = false;
  if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
  if (ctx.colors) ctx.stylize = stylizeWithColor;
  return formatValue(ctx, obj, ctx.depth);
}

exports.inspect = inspect; // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics

inspect.colors = {
  'bold': [1, 22],
  'italic': [3, 23],
  'underline': [4, 24],
  'inverse': [7, 27],
  'white': [37, 39],
  'grey': [90, 39],
  'black': [30, 39],
  'blue': [34, 39],
  'cyan': [36, 39],
  'green': [32, 39],
  'magenta': [35, 39],
  'red': [31, 39],
  'yellow': [33, 39]
}; // Don't use 'blue' not visible on cmd.exe

inspect.styles = {
  'special': 'cyan',
  'number': 'yellow',
  'boolean': 'yellow',
  'undefined': 'grey',
  'null': 'bold',
  'string': 'green',
  'date': 'magenta',
  // "name": intentionally not styling
  'regexp': 'red'
};

function stylizeWithColor(str, styleType) {
  var style = inspect.styles[styleType];

  if (style) {
    return '\u001b[' + inspect.colors[style][0] + 'm' + str + '\u001b[' + inspect.colors[style][1] + 'm';
  } else {
    return str;
  }
}

function stylizeNoColor(str, styleType) {
  return str;
}

function arrayToHash(array) {
  var hash = {};
  array.forEach(function (val, idx) {
    hash[val] = true;
  });
  return hash;
}

function formatValue(ctx, value, recurseTimes) {
  // Provide a hook for user-specified inspect functions.
  // Check that value is an object with an inspect function on it
  if (ctx.customInspect && value && isFunction(value.inspect) && // Filter out the util module, it's inspect function is special
  value.inspect !== exports.inspect && // Also filter out any prototype objects using the circular check.
  !(value.constructor && value.constructor.prototype === value)) {
    var ret = value.inspect(recurseTimes, ctx);

    if (!isString(ret)) {
      ret = formatValue(ctx, ret, recurseTimes);
    }

    return ret;
  } // Primitive types cannot have properties


  var primitive = formatPrimitive(ctx, value);

  if (primitive) {
    return primitive;
  } // Look up the keys of the object.


  var keys = Object.keys(value);
  var visibleKeys = arrayToHash(keys);

  if (ctx.showHidden) {
    keys = Object.getOwnPropertyNames(value);
  } // IE doesn't make error fields non-enumerable
  // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx


  if (isError(value) && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
    return formatError(value);
  } // Some type of object without properties can be shortcutted.


  if (keys.length === 0) {
    if (isFunction(value)) {
      var name = value.name ? ': ' + value.name : '';
      return ctx.stylize('[Function' + name + ']', 'special');
    }

    if (isRegExp(value)) {
      return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
    }

    if (isDate(value)) {
      return ctx.stylize(Date.prototype.toString.call(value), 'date');
    }

    if (isError(value)) {
      return formatError(value);
    }
  }

  var base = '',
      array = false,
      braces = ['{', '}']; // Make Array say that they are Array

  if (isArray(value)) {
    array = true;
    braces = ['[', ']'];
  } // Make functions say that they are functions


  if (isFunction(value)) {
    var n = value.name ? ': ' + value.name : '';
    base = ' [Function' + n + ']';
  } // Make RegExps say that they are RegExps


  if (isRegExp(value)) {
    base = ' ' + RegExp.prototype.toString.call(value);
  } // Make dates with properties first say the date


  if (isDate(value)) {
    base = ' ' + Date.prototype.toUTCString.call(value);
  } // Make error with message first say the error


  if (isError(value)) {
    base = ' ' + formatError(value);
  }

  if (keys.length === 0 && (!array || value.length == 0)) {
    return braces[0] + base + braces[1];
  }

  if (recurseTimes < 0) {
    if (isRegExp(value)) {
      return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
    } else {
      return ctx.stylize('[Object]', 'special');
    }
  }

  ctx.seen.push(value);
  var output;

  if (array) {
    output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
  } else {
    output = keys.map(function (key) {
      return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
    });
  }

  ctx.seen.pop();
  return reduceToSingleString(output, base, braces);
}

function formatPrimitive(ctx, value) {
  if (isUndefined(value)) return ctx.stylize('undefined', 'undefined');

  if (isString(value)) {
    var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '').replace(/'/g, "\\'").replace(/\\"/g, '"') + '\'';
    return ctx.stylize(simple, 'string');
  }

  if (isNumber(value)) return ctx.stylize('' + value, 'number');
  if (isBoolean(value)) return ctx.stylize('' + value, 'boolean'); // For some reason typeof null is "object", so special case here.

  if (isNull(value)) return ctx.stylize('null', 'null');
}

function formatError(value) {
  return '[' + Error.prototype.toString.call(value) + ']';
}

function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
  var output = [];

  for (var i = 0, l = value.length; i < l; ++i) {
    if (hasOwnProperty(value, String(i))) {
      output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true));
    } else {
      output.push('');
    }
  }

  keys.forEach(function (key) {
    if (!key.match(/^\d+$/)) {
      output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key, true));
    }
  });
  return output;
}

function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
  var name, str, desc;
  desc = Object.getOwnPropertyDescriptor(value, key) || {
    value: value[key]
  };

  if (desc.get) {
    if (desc.set) {
      str = ctx.stylize('[Getter/Setter]', 'special');
    } else {
      str = ctx.stylize('[Getter]', 'special');
    }
  } else {
    if (desc.set) {
      str = ctx.stylize('[Setter]', 'special');
    }
  }

  if (!hasOwnProperty(visibleKeys, key)) {
    name = '[' + key + ']';
  }

  if (!str) {
    if (ctx.seen.indexOf(desc.value) < 0) {
      if (isNull(recurseTimes)) {
        str = formatValue(ctx, desc.value, null);
      } else {
        str = formatValue(ctx, desc.value, recurseTimes - 1);
      }

      if (str.indexOf('\n') > -1) {
        if (array) {
          str = str.split('\n').map(function (line) {
            return '  ' + line;
          }).join('\n').substr(2);
        } else {
          str = '\n' + str.split('\n').map(function (line) {
            return '   ' + line;
          }).join('\n');
        }
      }
    } else {
      str = ctx.stylize('[Circular]', 'special');
    }
  }

  if (isUndefined(name)) {
    if (array && key.match(/^\d+$/)) {
      return str;
    }

    name = JSON.stringify('' + key);

    if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
      name = name.substr(1, name.length - 2);
      name = ctx.stylize(name, 'name');
    } else {
      name = name.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'");
      name = ctx.stylize(name, 'string');
    }
  }

  return name + ': ' + str;
}

function reduceToSingleString(output, base, braces) {
  var numLinesEst = 0;
  var length = output.reduce(function (prev, cur) {
    numLinesEst++;
    if (cur.indexOf('\n') >= 0) numLinesEst++;
    return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
  }, 0);

  if (length > 60) {
    return braces[0] + (base === '' ? '' : base + '\n ') + ' ' + output.join(',\n  ') + ' ' + braces[1];
  }

  return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
} // NOTE: These type checking functions intentionally don't use `instanceof`
// because it is fragile and can be easily faked with `Object.create()`.


function isArray(ar) {
  return Array.isArray(ar);
}

exports.isArray = isArray;

function isBoolean(arg) {
  return typeof arg === 'boolean';
}

exports.isBoolean = isBoolean;

function isNull(arg) {
  return arg === null;
}

exports.isNull = isNull;

function isNullOrUndefined(arg) {
  return arg == null;
}

exports.isNullOrUndefined = isNullOrUndefined;

function isNumber(arg) {
  return typeof arg === 'number';
}

exports.isNumber = isNumber;

function isString(arg) {
  return typeof arg === 'string';
}

exports.isString = isString;

function isSymbol(arg) {
  return typeof arg === 'symbol';
}

exports.isSymbol = isSymbol;

function isUndefined(arg) {
  return arg === void 0;
}

exports.isUndefined = isUndefined;

function isRegExp(re) {
  return isObject(re) && objectToString(re) === '[object RegExp]';
}

exports.isRegExp = isRegExp;

function isObject(arg) {
  return typeof arg === 'object' && arg !== null;
}

exports.isObject = isObject;

function isDate(d) {
  return isObject(d) && objectToString(d) === '[object Date]';
}

exports.isDate = isDate;

function isError(e) {
  return isObject(e) && (objectToString(e) === '[object Error]' || e instanceof Error);
}

exports.isError = isError;

function isFunction(arg) {
  return typeof arg === 'function';
}

exports.isFunction = isFunction;

function isPrimitive(arg) {
  return arg === null || typeof arg === 'boolean' || typeof arg === 'number' || typeof arg === 'string' || typeof arg === 'symbol' || // ES6 symbol
  typeof arg === 'undefined';
}

exports.isPrimitive = isPrimitive;
exports.isBuffer = require('./support/isBuffer');

function objectToString(o) {
  return Object.prototype.toString.call(o);
}

function pad(n) {
  return n < 10 ? '0' + n.toString(10) : n.toString(10);
}

var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; // 26 Feb 16:19:34

function timestamp() {
  var d = new Date();
  var time = [pad(d.getHours()), pad(d.getMinutes()), pad(d.getSeconds())].join(':');
  return [d.getDate(), months[d.getMonth()], time].join(' ');
} // log is just a thin wrapper to console.log that prepends a timestamp


exports.log = function () {
  console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
};
/**
 * Inherit the prototype methods from one constructor into another.
 *
 * The Function.prototype.inherits from lang.js rewritten as a standalone
 * function (not on Function.prototype). NOTE: If this file is to be loaded
 * during bootstrapping this function needs to be rewritten using some native
 * functions as prototype setup using normal JavaScript does not work as
 * expected during bootstrapping (see mirror.js in r114903).
 *
 * @param {function} ctor Constructor function which needs to inherit the
 *     prototype.
 * @param {function} superCtor Constructor function to inherit prototype from.
 */


exports.inherits = require('inherits');

exports._extend = function (origin, add) {
  // Don't do anything if add isn't an object
  if (!add || !isObject(add)) return origin;
  var keys = Object.keys(add);
  var i = keys.length;

  while (i--) {
    origin[keys[i]] = add[keys[i]];
  }

  return origin;
};

function hasOwnProperty(obj, prop) {
  return Object.prototype.hasOwnProperty.call(obj, prop);
}
},{"./support/isBuffer":"f4zi","inherits":"xJ8m","process":"r7L2"}],"AoLc":[function(require,module,exports) {
var global = arguments[3];
'use strict';

var objectAssign = require('object-assign');

// compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js
// original notice:

/*!
 * The buffer module from node.js, for the browser.
 *
 * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
 * @license  MIT
 */
function compare(a, b) {
  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;
}
function isBuffer(b) {
  if (global.Buffer && typeof global.Buffer.isBuffer === 'function') {
    return global.Buffer.isBuffer(b);
  }
  return !!(b != null && b._isBuffer);
}

// based on node assert, original notice:
// NB: The URL to the CommonJS spec is kept just for tradition.
//     node-assert has evolved a lot since then, both in API and behavior.

// http://wiki.commonjs.org/wiki/Unit_Testing/1.0
//
// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
//
// Originally from narwhal.js (http://narwhaljs.org)
// Copyright (c) 2009 Thomas Robinson <280north.com>
//
// 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 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.

var util = require('util/');
var hasOwn = Object.prototype.hasOwnProperty;
var pSlice = Array.prototype.slice;
var functionsHaveNames = (function () {
  return function foo() {}.name === 'foo';
}());
function pToString (obj) {
  return Object.prototype.toString.call(obj);
}
function isView(arrbuf) {
  if (isBuffer(arrbuf)) {
    return false;
  }
  if (typeof global.ArrayBuffer !== 'function') {
    return false;
  }
  if (typeof ArrayBuffer.isView === 'function') {
    return ArrayBuffer.isView(arrbuf);
  }
  if (!arrbuf) {
    return false;
  }
  if (arrbuf instanceof DataView) {
    return true;
  }
  if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) {
    return true;
  }
  return false;
}
// 1. The assert module provides functions that throw
// AssertionError's when particular conditions are not met. The
// assert module must conform to the following interface.

var assert = module.exports = ok;

// 2. The AssertionError is defined in assert.
// new assert.AssertionError({ message: message,
//                             actual: actual,
//                             expected: expected })

var regex = /\s*function\s+([^\(\s]*)\s*/;
// based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js
function getName(func) {
  if (!util.isFunction(func)) {
    return;
  }
  if (functionsHaveNames) {
    return func.name;
  }
  var str = func.toString();
  var match = str.match(regex);
  return match && match[1];
}
assert.AssertionError = function AssertionError(options) {
  this.name = 'AssertionError';
  this.actual = options.actual;
  this.expected = options.expected;
  this.operator = options.operator;
  if (options.message) {
    this.message = options.message;
    this.generatedMessage = false;
  } else {
    this.message = getMessage(this);
    this.generatedMessage = true;
  }
  var stackStartFunction = options.stackStartFunction || fail;
  if (Error.captureStackTrace) {
    Error.captureStackTrace(this, stackStartFunction);
  } else {
    // non v8 browsers so we can have a stacktrace
    var err = new Error();
    if (err.stack) {
      var out = err.stack;

      // try to strip useless frames
      var fn_name = getName(stackStartFunction);
      var idx = out.indexOf('\n' + fn_name);
      if (idx >= 0) {
        // once we have located the function frame
        // we need to strip out everything before it (and its line)
        var next_line = out.indexOf('\n', idx + 1);
        out = out.substring(next_line + 1);
      }

      this.stack = out;
    }
  }
};

// assert.AssertionError instanceof Error
util.inherits(assert.AssertionError, Error);

function truncate(s, n) {
  if (typeof s === 'string') {
    return s.length < n ? s : s.slice(0, n);
  } else {
    return s;
  }
}
function inspect(something) {
  if (functionsHaveNames || !util.isFunction(something)) {
    return util.inspect(something);
  }
  var rawname = getName(something);
  var name = rawname ? ': ' + rawname : '';
  return '[Function' +  name + ']';
}
function getMessage(self) {
  return truncate(inspect(self.actual), 128) + ' ' +
         self.operator + ' ' +
         truncate(inspect(self.expected), 128);
}

// At present only the three keys mentioned above are used and
// understood by the spec. Implementations or sub modules can pass
// other keys to the AssertionError's constructor - they will be
// ignored.

// 3. All of the following functions must throw an AssertionError
// when a corresponding condition is not met, with a message that
// may be undefined if not provided.  All assertion methods provide
// both the actual and expected values to the assertion error for
// display purposes.

function fail(actual, expected, message, operator, stackStartFunction) {
  throw new assert.AssertionError({
    message: message,
    actual: actual,
    expected: expected,
    operator: operator,
    stackStartFunction: stackStartFunction
  });
}

// EXTENSION! allows for well behaved errors defined elsewhere.
assert.fail = fail;

// 4. Pure assertion tests whether a value is truthy, as determined
// by !!guard.
// assert.ok(guard, message_opt);
// This statement is equivalent to assert.equal(true, !!guard,
// message_opt);. To test strictly for the value true, use
// assert.strictEqual(true, guard, message_opt);.

function ok(value, message) {
  if (!value) fail(value, true, message, '==', assert.ok);
}
assert.ok = ok;

// 5. The equality assertion tests shallow, coercive equality with
// ==.
// assert.equal(actual, expected, message_opt);

assert.equal = function equal(actual, expected, message) {
  if (actual != expected) fail(actual, expected, message, '==', assert.equal);
};

// 6. The non-equality assertion tests for whether two objects are not equal
// with != assert.notEqual(actual, expected, message_opt);

assert.notEqual = function notEqual(actual, expected, message) {
  if (actual == expected) {
    fail(actual, expected, message, '!=', assert.notEqual);
  }
};

// 7. The equivalence assertion tests a deep equality relation.
// assert.deepEqual(actual, expected, message_opt);

assert.deepEqual = function deepEqual(actual, expected, message) {
  if (!_deepEqual(actual, expected, false)) {
    fail(actual, expected, message, 'deepEqual', assert.deepEqual);
  }
};

assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {
  if (!_deepEqual(actual, expected, true)) {
    fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual);
  }
};

function _deepEqual(actual, expected, strict, memos) {
  // 7.1. All identical values are equivalent, as determined by ===.
  if (actual === expected) {
    return true;
  } else if (isBuffer(actual) && isBuffer(expected)) {
    return compare(actual, expected) === 0;

  // 7.2. If the expected value is a Date object, the actual value is
  // equivalent if it is also a Date object that refers to the same time.
  } else if (util.isDate(actual) && util.isDate(expected)) {
    return actual.getTime() === expected.getTime();

  // 7.3 If the expected value is a RegExp object, the actual value is
  // equivalent if it is also a RegExp object with the same source and
  // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
  } else if (util.isRegExp(actual) && util.isRegExp(expected)) {
    return actual.source === expected.source &&
           actual.global === expected.global &&
           actual.multiline === expected.multiline &&
           actual.lastIndex === expected.lastIndex &&
           actual.ignoreCase === expected.ignoreCase;

  // 7.4. Other pairs that do not both pass typeof value == 'object',
  // equivalence is determined by ==.
  } else if ((actual === null || typeof actual !== 'object') &&
             (expected === null || typeof expected !== 'object')) {
    return strict ? actual === expected : actual == expected;

  // If both values are instances of typed arrays, wrap their underlying
  // ArrayBuffers in a Buffer each to increase performance
  // This optimization requires the arrays to have the same type as checked by
  // Object.prototype.toString (aka pToString). Never perform binary
  // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their
  // bit patterns are not identical.
  } else if (isView(actual) && isView(expected) &&
             pToString(actual) === pToString(expected) &&
             !(actual instanceof Float32Array ||
               actual instanceof Float64Array)) {
    return compare(new Uint8Array(actual.buffer),
                   new Uint8Array(expected.buffer)) === 0;

  // 7.5 For all other Object pairs, including Array objects, equivalence is
  // determined by having the same number of owned properties (as verified
  // with Object.prototype.hasOwnProperty.call), the same set of keys
  // (although not necessarily the same order), equivalent values for every
  // corresponding key, and an identical 'prototype' property. Note: this
  // accounts for both named and indexed properties on Arrays.
  } else if (isBuffer(actual) !== isBuffer(expected)) {
    return false;
  } else {
    memos = memos || {actual: [], expected: []};

    var actualIndex = memos.actual.indexOf(actual);
    if (actualIndex !== -1) {
      if (actualIndex === memos.expected.indexOf(expected)) {
        return true;
      }
    }

    memos.actual.push(actual);
    memos.expected.push(expected);

    return objEquiv(actual, expected, strict, memos);
  }
}

function isArguments(object) {
  return Object.prototype.toString.call(object) == '[object Arguments]';
}

function objEquiv(a, b, strict, actualVisitedObjects) {
  if (a === null || a === undefined || b === null || b === undefined)
    return false;
  // if one is a primitive, the other must be same
  if (util.isPrimitive(a) || util.isPrimitive(b))
    return a === b;
  if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b))
    return false;
  var aIsArgs = isArguments(a);
  var bIsArgs = isArguments(b);
  if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))
    return false;
  if (aIsArgs) {
    a = pSlice.call(a);
    b = pSlice.call(b);
    return _deepEqual(a, b, strict);
  }
  var ka = objectKeys(a);
  var kb = objectKeys(b);
  var key, i;
  // having the same number of owned properties (keys incorporates
  // hasOwnProperty)
  if (ka.length !== kb.length)
    return false;
  //the same set of keys (although not necessarily the same order),
  ka.sort();
  kb.sort();
  //~~~cheap key test
  for (i = ka.length - 1; i >= 0; i--) {
    if (ka[i] !== kb[i])
      return false;
  }
  //equivalent values for every corresponding key, and
  //~~~possibly expensive deep test
  for (i = ka.length - 1; i >= 0; i--) {
    key = ka[i];
    if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects))
      return false;
  }
  return true;
}

// 8. The non-equivalence assertion tests for any deep inequality.
// assert.notDeepEqual(actual, expected, message_opt);

assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
  if (_deepEqual(actual, expected, false)) {
    fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual);
  }
};

assert.notDeepStrictEqual = notDeepStrictEqual;
function notDeepStrictEqual(actual, expected, message) {
  if (_deepEqual(actual, expected, true)) {
    fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual);
  }
}


// 9. The strict equality assertion tests strict equality, as determined by ===.
// assert.strictEqual(actual, expected, message_opt);

assert.strictEqual = function strictEqual(actual, expected, message) {
  if (actual !== expected) {
    fail(actual, expected, message, '===', assert.strictEqual);
  }
};

// 10. The strict non-equality assertion tests for strict inequality, as
// determined by !==.  assert.notStrictEqual(actual, expected, message_opt);

assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
  if (actual === expected) {
    fail(actual, expected, message, '!==', assert.notStrictEqual);
  }
};

function expectedException(actual, expected) {
  if (!actual || !expected) {
    return false;
  }

  if (Object.prototype.toString.call(expected) == '[object RegExp]') {
    return expected.test(actual);
  }

  try {
    if (actual instanceof expected) {
      return true;
    }
  } catch (e) {
    // Ignore.  The instanceof check doesn't work for arrow functions.
  }

  if (Error.isPrototypeOf(expected)) {
    return false;
  }

  return expected.call({}, actual) === true;
}

function _tryBlock(block) {
  var error;
  try {
    block();
  } catch (e) {
    error = e;
  }
  return error;
}

function _throws(shouldThrow, block, expected, message) {
  var actual;

  if (typeof block !== 'function') {
    throw new TypeError('"block" argument must be a function');
  }

  if (typeof expected === 'string') {
    message = expected;
    expected = null;
  }

  actual = _tryBlock(block);

  message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
            (message ? ' ' + message : '.');

  if (shouldThrow && !actual) {
    fail(actual, expected, 'Missing expected exception' + message);
  }

  var userProvidedMessage = typeof message === 'string';
  var isUnwantedException = !shouldThrow && util.isError(actual);
  var isUnexpectedException = !shouldThrow && actual && !expected;

  if ((isUnwantedException &&
      userProvidedMessage &&
      expectedException(actual, expected)) ||
      isUnexpectedException) {
    fail(actual, expected, 'Got unwanted exception' + message);
  }

  if ((shouldThrow && actual && expected &&
      !expectedException(actual, expected)) || (!shouldThrow && actual)) {
    throw actual;
  }
}

// 11. Expected to throw an error:
// assert.throws(block, Error_opt, message_opt);

assert.throws = function(block, /*optional*/error, /*optional*/message) {
  _throws(true, block, error, message);
};

// EXTENSION! This is annoying to write outside this module.
assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) {
  _throws(false, block, error, message);
};

assert.ifError = function(err) { if (err) throw err; };

// Expose a strict only variant of assert
function strict(value, message) {
  if (!value) fail(value, true, message, '==', strict);
}
assert.strict = objectAssign(strict, assert, {
  equal: assert.strictEqual,
  deepEqual: assert.deepStrictEqual,
  notEqual: assert.notStrictEqual,
  notDeepEqual: assert.notDeepStrictEqual
});
assert.strict.strict = assert.strict;

var objectKeys = Object.keys || function (obj) {
  var keys = [];
  for (var key in obj) {
    if (hasOwn.call(obj, key)) keys.push(key);
  }
  return keys;
};

},{"object-assign":"yheg","util/":"xow5"}],"r7vO":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.cloneTextureFrom = cloneTextureFrom;

var _texture2d = _interopRequireDefault(require("../webgl/texture-2d"));

var _textureCube = _interopRequireDefault(require("../webgl/texture-cube"));

var _texture3d = _interopRequireDefault(require("../webgl/texture-3d"));

var _assert = _interopRequireDefault(require("assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Clone a new texture object from a reference texture object.
function cloneTextureFrom(refTexture, overrides) {
  (0, _assert.default)(refTexture instanceof _texture2d.default || refTexture instanceof _textureCube.default || refTexture instanceof _texture3d.default);
  var TextureType = refTexture.constructor;
  var gl = refTexture.gl,
      width = refTexture.width,
      height = refTexture.height,
      format = refTexture.format,
      type = refTexture.type,
      dataFormat = refTexture.dataFormat,
      border = refTexture.border,
      mipmaps = refTexture.mipmaps;
  var textureOptions = Object.assign({
    width: width,
    height: height,
    format: format,
    type: type,
    dataFormat: dataFormat,
    border: border,
    mipmaps: mipmaps
  }, overrides); // TODO: move this to `Texture` class as instance method and use this.constructor

  return new TextureType(gl, textureOptions);
}
},{"../webgl/texture-2d":"jx3X","../webgl/texture-cube":"Bnce","../webgl/texture-3d":"q4cN","assert":"AoLc"}],"drCT":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.createHeadlessContext = createHeadlessContext;

var _webglTypes = require("../webgl-utils/webgl-types");

var ERR_HEADLESSGL_NOT_AVAILABLE = 'Failed to create WebGL context in Node.js, headless gl not available';
var ERR_HEADLESSGL_FAILED = 'Failed to create WebGL context in Node.js, headless gl returned null'; // Create headless gl context (for running under Node.js)

function createHeadlessContext(_ref) {
  var width = _ref.width,
      height = _ref.height,
      opts = _ref.opts,
      onError = _ref.onError;
  var webgl1 = opts.webgl1,
      webgl2 = opts.webgl2;

  if (webgl2 && !webgl1) {
    return onError('headless-gl does not support WebGL2');
  }

  if (!_webglTypes.headlessGL) {
    return onError(ERR_HEADLESSGL_NOT_AVAILABLE);
  }

  var gl = (0, _webglTypes.headlessGL)(width, height, opts);

  if (!gl) {
    return onError(ERR_HEADLESSGL_FAILED);
  }

  return gl;
}
},{"../webgl-utils/webgl-types":"hUHf"}],"PNHV":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getPageLoadPromise = getPageLoadPromise;
exports.createCanvas = createCanvas;
exports.getCanvas = getCanvas;

var _utils = require("../utils");

// Resizing a webgl canvas

/* global window, document */
var isPage = _utils.isBrowser && typeof document !== 'undefined';
var isPageLoaded = isPage && document.readyState === 'complete';
var pageLoadPromise;
/**
 * Returns a promise that resolves when the page is loaded
 * at this point the DOM can be manipulated, and e.g. a new canvas can be inserted
 * @return {Promise} - resolves when the page is loaded
 */

function getPageLoadPromise() {
  if (!pageLoadPromise) {
    pageLoadPromise = isPage ? new Promise(function (resolve, reject) {
      if (isPage && document.readyState === 'complete') {
        isPageLoaded = true;
        resolve(document);
        return;
      }

      window.onload = function () {
        isPageLoaded = true;
        resolve(document);
      };
    }) : Promise.resolve({});
  }

  return pageLoadPromise;
}
/**
 * Create a canvas
 * @param {Number} width - set to 100%
 * @param {Number} height - set to 100%
 */


function createCanvas(_ref) {
  var _ref$width = _ref.width,
      width = _ref$width === void 0 ? 800 : _ref$width,
      _ref$height = _ref.height,
      height = _ref$height === void 0 ? 600 : _ref$height,
      _ref$id = _ref.id,
      id = _ref$id === void 0 ? 'gl-canvas' : _ref$id,
      _ref$insert = _ref.insert,
      insert = _ref$insert === void 0 ? true : _ref$insert;
  var canvas = document.createElement('canvas');
  canvas.id = id;
  canvas.style.width = Number.isFinite(width) ? "".concat(width, "px") : '100%';
  canvas.style.height = Number.isFinite(height) ? "".concat(height, "px") : '100%'; // add the canvas to the body element once the page has loaded

  if (insert) {
    var body = document.body;
    body.insertBefore(canvas, body.firstChild); // getPageLoadPromise().then(document => {});
  }

  return canvas;
}

function getCanvas(_ref2) {
  var canvas = _ref2.canvas,
      width = _ref2.width,
      height = _ref2.height,
      _ref2$onError = _ref2.onError,
      onError = _ref2$onError === void 0 ? function () {} : _ref2$onError;
  var targetCanvas;

  if (typeof canvas === 'string') {
    if (!isPageLoaded) {
      onError("createGLContext called on canvas '".concat(canvas, "' before page was loaded"));
    }

    targetCanvas = document.getElementById(canvas);
  } else if (canvas) {
    targetCanvas = canvas;
  } else {
    targetCanvas = createCanvas({
      id: 'lumagl-canvas',
      width: width,
      height: height,
      onError: onError
    });
  }

  return targetCanvas;
}
},{"../utils":"PFG0"}],"mtVl":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.createBrowserContext = createBrowserContext;

/**
 * Create a WebGL context for a canvas
 * Note calling this multiple time on the same canvas does return the same context
 */
function createBrowserContext(_ref) {
  var canvas = _ref.canvas,
      _ref$opts = _ref.opts,
      opts = _ref$opts === void 0 ? {} : _ref$opts,
      _ref$onError = _ref.onError,
      onError = _ref$onError === void 0 ? function (message) {
    return null;
  } : _ref$onError; // Try to extract any extra information about why context creation failed

  function onContextCreationError(error) {
    onError("WebGL context: ".concat(error.statusMessage || 'Unknown error'));
  }

  canvas.addEventListener('webglcontextcreationerror', onContextCreationError, false);
  var _opts$webgl = opts.webgl1,
      webgl1 = _opts$webgl === void 0 ? true : _opts$webgl,
      _opts$webgl2 = opts.webgl2,
      webgl2 = _opts$webgl2 === void 0 ? true : _opts$webgl2;
  var gl = null; // Prefer webgl2 over webgl1, prefer conformant over experimental

  if (webgl2) {
    gl = gl || canvas.getContext('webgl2', opts);
    gl = gl || canvas.getContext('experimental-webgl2', opts);
  }

  if (webgl1) {
    gl = gl || canvas.getContext('webgl', opts);
    gl = gl || canvas.getContext('experimental-webgl', opts);
  }

  canvas.removeEventListener('webglcontextcreationerror', onContextCreationError, false);

  if (!gl) {
    return onError("Failed to create ".concat(webgl2 && !webgl1 ? 'WebGL2' : 'WebGL', " context"));
  }

  return gl;
}
},{}],"lVQr":[function(require,module,exports) {

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.enableDebug = enableDebug;
exports.makeDebugContext = makeDebugContext;
exports.getRealContext = getRealContext;
exports.getDebugContext = getDebugContext;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _globals = require("../utils/globals");

var _utils = require("../utils");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Depends on Khronos Debug support module being imported via "luma.gl/debug"
// Helper to get shared context data
function getContextData(gl) {
  gl.luma = gl.luma || {};
  return gl.luma;
} // Enable or disable debug checks in debug contexts
// Non-debug contexts do not have checks (to ensure performance)
// Turning off debug for debug contexts removes most of the performance penalty


function enableDebug(debug) {
  _utils.log.debug = debug;
} // Returns (a potentially new) context with debug instrumentation turned off or on.
// Note that this actually returns a new context


function makeDebugContext(gl) {
  var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
      _ref$debug = _ref.debug,
      debug = _ref$debug === void 0 ? true : _ref$debug;

  if (gl === null) {
    // Return to ensure we don't create a context in this case.
    return null;
  }

  return debug ? getDebugContext(gl) : getRealContext(gl);
} // Returns the real context from either of the real/debug contexts


function getRealContext(gl) {
  if (gl === null) {
    // Return to ensure we don't create a context in this case.
    return null;
  }

  var data = getContextData(gl); // If the context has a realContext member, it is a debug context so return the realContext

  return data.realContext ? data.realContext : gl;
} // Returns the debug context from either of the real/debug contexts


function getDebugContext(gl) {
  if (gl === null) {
    // Return to ensure we don't create a context in this case.
    return null;
  }

  if (!_globals.global.WebGLDebug) {
    _utils.log.warn('WebGL debug mode not activated. import "luma.gl/debug" to enable.')();

    return gl;
  }

  var data = getContextData(gl); // If this *is* a debug context, return itself

  if (data.realContext) {
    return gl;
  } // If this already has a debug context, return it.


  if (data.debugContext) {
    return data.debugContext;
  } // Create a new debug context


  var WebGLDebugContext = function WebGLDebugContext() {
    (0, _classCallCheck2.default)(this, WebGLDebugContext);
  };

  var debugContext = _globals.global.WebGLDebug.makeDebugContext(gl, onGLError, onValidateGLFunc);

  Object.assign(WebGLDebugContext.prototype, debugContext); // Store the debug context

  data.debugContext = debugContext;
  debugContext.debug = true;
  debugContext.gl = gl;

  _utils.log.info('debug context actived.'); // Return it


  return debugContext;
} // DEBUG TRACING


function getFunctionString(functionName, functionArgs) {
  var args = _globals.global.WebGLDebug.glFunctionArgsToString(functionName, functionArgs);

  args = "".concat(args.slice(0, 100)).concat(args.length > 100 ? '...' : '');
  return "gl.".concat(functionName, "(").concat(args, ")");
}

function onGLError(err, functionName, args) {
  var errorMessage = _globals.global.WebGLDebug.glEnumToString(err);

  var functionArgs = _globals.global.WebGLDebug.glFunctionArgsToString(functionName, args);

  var message = "".concat(errorMessage, " in gl.").concat(functionName, "(").concat(functionArgs, ")");

  if (_utils.log.throw) {
    throw new Error(message);
  } else {
    _utils.log.error(message)();

    debugger; // eslint-disable-line
  }
} // Don't generate function string until it is needed


function onValidateGLFunc(functionName, functionArgs) {
  var functionString;

  if (_utils.log.priority >= 4) {
    functionString = getFunctionString(functionName, functionArgs);

    _utils.log.log(4, functionString)();
  }

  if (_utils.log.break) {
    functionString = functionString || getFunctionString(functionName, functionArgs);

    var isBreakpoint = _utils.log.break && _utils.log.break.every(function (breakOn) {
      return functionString.indexOf(breakOn) !== -1;
    });

    if (isBreakpoint) {
      debugger; // eslint-disable-line
    }
  }

  var _iteratorNormalCompletion = true;
  var _didIteratorError = false;
  var _iteratorError = undefined;

  try {
    for (var _iterator = functionArgs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
      var arg = _step.value;

      if (arg === undefined) {
        functionString = functionString || getFunctionString(functionName, functionArgs);

        if (_utils.log.throw) {
          throw new Error("Undefined argument: ".concat(functionString));
        } else {
          _utils.log.error("Undefined argument: ".concat(functionString));

          debugger; // eslint-disable-line
        }
      }
    }
  } catch (err) {
    _didIteratorError = true;
    _iteratorError = err;
  } finally {
    try {
      if (!_iteratorNormalCompletion && _iterator.return != null) {
        _iterator.return();
      }
    } finally {
      if (_didIteratorError) {
        throw _iteratorError;
      }
    }
  }
}
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","../utils/globals":"AlqY","../utils":"PFG0"}],"fdIS":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getContextLimits = getContextLimits;
exports.getGLContextInfo = getGLContextInfo;
exports.getGLContextInfo2 = getGLContextInfo2;
exports.getContextInfo = getContextInfo;
exports.glGetDebugInfo = glGetDebugInfo;
exports.TEST_EXPORTS = void 0;

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));

var _webglUtils = require("../webgl-utils");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _WEBGL_LIMITS;
/* eslint-disable no-inline-comments, max-len */


var WEBGL_LIMITS = (_WEBGL_LIMITS = {}, (0, _defineProperty2.default)(_WEBGL_LIMITS, 33902, {
  gl1: new Float32Array([1, 1])
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 33901, {
  gl1: new Float32Array([1, 1])
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 3379, {
  gl1: 64,
  gl2: 2048
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 34076, {
  gl1: 16
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 34930, {
  gl1: 8
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 35661, {
  gl1: 8
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 35660, {
  gl1: 0
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 34024, {
  gl1: 1
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 36348, {
  gl1: 8
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 34921, {
  gl1: 8
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 36347, {
  gl1: 128
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 36349, {
  gl1: 16
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 3386, {
  gl1: new Int32Array([0, 0])
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 32883, {
  gl1: 0,
  gl2: 256
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 35071, {
  gl1: 0,
  gl2: 256
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 37447, {
  gl1: 0,
  gl2: 0
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 36063, {
  gl1: 0,
  gl2: 4
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 35379, {
  gl1: 0,
  gl2: 0
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 35374, {
  gl1: 0,
  gl2: 0
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 35377, {
  gl1: 0,
  gl2: 0
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 34852, {
  gl1: 0,
  gl2: 4
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 36203, {
  gl1: 0,
  gl2: 0
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 33001, {
  gl1: 0,
  gl2: 0
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 33000, {
  gl1: 0,
  gl2: 0
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 37157, {
  gl1: 0,
  gl2: 0
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 35373, {
  gl1: 0,
  gl2: 0
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 35657, {
  gl1: 0,
  gl2: 0
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 36183, {
  gl1: 0,
  gl2: 0
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 37137, {
  gl1: 0,
  gl2: 0
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 34045, {
  gl1: 0,
  gl2: 0
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 35978, {
  gl1: 0,
  gl2: 0
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 35979, {
  gl1: 0,
  gl2: 0
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 35968, {
  gl1: 0,
  gl2: 0
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 35376, {
  gl1: 0,
  gl2: 0
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 35375, {
  gl1: 0,
  gl2: 0
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 35659, {
  gl1: 0,
  gl2: 0
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 37154, {
  gl1: 0,
  gl2: 0
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 35371, {
  gl1: 0,
  gl2: 0
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 35658, {
  gl1: 0,
  gl2: 0
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 35076, {
  gl1: 0,
  gl2: -8,
  negative: true
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 35077, {
  gl1: 0,
  gl2: 7
}), (0, _defineProperty2.default)(_WEBGL_LIMITS, 35380, {
  gl1: 0,
  gl2: 0 // GLint

}), _WEBGL_LIMITS);

function getContextLimits(gl) {
  gl.luma = gl.luma || {};

  if (!gl.luma.limits) {
    gl.luma.limits = {};
    gl.luma.webgl1MinLimits = {};
    gl.luma.webgl2MinLimits = {};
    var isWebgl2 = (0, _webglUtils.isWebGL2)(gl); // WEBGL limits

    for (var parameter in WEBGL_LIMITS) {
      var limit = WEBGL_LIMITS[parameter];
      var webgl1MinLimit = limit.gl1;
      var webgl2MinLimit = 'gl2' in limit ? limit.gl2 : limit.gl1;
      var minLimit = isWebgl2 ? webgl2MinLimit : webgl1MinLimit; // Check if we can query for this limit

      var limitNotAvailable = 'gl2' in limit && !isWebgl2 || 'extension' in limit && !gl.getExtension(limit.extension);
      var value = limitNotAvailable ? minLimit : gl.getParameter(parameter);
      gl.luma.limits[parameter] = value;
      gl.luma.webgl1MinLimits[parameter] = webgl1MinLimit;
      gl.luma.webgl2MinLimits[parameter] = webgl2MinLimit;
    }
  }

  return gl.luma.limits;
}

function getGLContextInfo(gl) {
  gl.luma = gl.luma || {};

  if (!gl.luma.info) {
    var _gl$luma$info;

    var info = gl.getExtension('WEBGL_debug_renderer_info');
    gl.luma.info = (_gl$luma$info = {}, (0, _defineProperty2.default)(_gl$luma$info, 7936, gl.getParameter(7936)), (0, _defineProperty2.default)(_gl$luma$info, 7937, gl.getParameter(7937)), (0, _defineProperty2.default)(_gl$luma$info, 37445, gl.getParameter(info && info.UNMASKED_VENDOR_WEBGL || 7936)), (0, _defineProperty2.default)(_gl$luma$info, 37446, gl.getParameter(info && info.UNMASKED_RENDERER_WEBGL || 7937)), (0, _defineProperty2.default)(_gl$luma$info, 7938, gl.getParameter(7938)), (0, _defineProperty2.default)(_gl$luma$info, 35724, gl.getParameter(35724)), _gl$luma$info);
  }

  return gl.luma.info;
}

var GL_UNMASKED_VENDOR_WEBGL = 0x9245; // vendor string of the graphics driver.

var GL_UNMASKED_RENDERER_WEBGL = 0x9246; // renderer string of the graphics driver.

function getGLContextInfo2(gl) {
  var vendorMasked = gl.getParameter(7936);
  var rendererMasked = gl.getParameter(7937);
  var ext = gl.getExtension('WEBGL_debug_renderer_info');
  var vendorUnmasked = ext && gl.getParameter(ext.UNMASKED_VENDOR_WEBGL || 7936);
  var rendererUnmasked = ext && gl.getParameter(ext.UNMASKED_RENDERER_WEBGL || 7937);
  return {
    vendor: vendorUnmasked || vendorMasked,
    renderer: rendererUnmasked || rendererMasked,
    vendorMasked: vendorMasked,
    rendererMasked: rendererMasked,
    version: gl.getParameter(7938),
    shadingLanguageVersion: gl.getParameter(35724)
  };
}

function getContextInfo(gl) {
  var limits = getContextLimits(gl);
  var info = getGLContextInfo(gl);
  return {
    // basic information
    vendor: info[GL_UNMASKED_VENDOR_WEBGL] || info[7936],
    renderer: info[GL_UNMASKED_RENDERER_WEBGL] || info[7937],
    version: info[7938],
    shadingLanguageVersion: info[35724],
    // info, caps and limits
    info: info,
    limits: limits,
    webgl1MinLimits: gl.luma.webgl1MinLimits,
    webgl2MinLimits: gl.luma.webgl2MinLimits
  };
} // DEBUG INFO

/**
 * Provides strings identifying the GPU vendor and driver.
 * https://www.khronos.org/registry/webgl/extensions/WEBGL_debug_renderer_info/
 * @param {WebGLRenderingContext} gl - context
 * @return {Object} - 'vendor' and 'renderer' string fields.
 */


function glGetDebugInfo(gl) {
  return getGLContextInfo2(gl); // const info = gl.getExtension('WEBGL_debug_renderer_info');
  // // We can't determine if 'WEBGL_debug_renderer_info' is supported by
  // // checking whether info is null here. Firefox doesn't follow the
  // // specs by returning null for unsupported extension. Instead,
  // // it returns an object without GL_UNMASKED_VENDOR_WEBGL and GL_UNMASKED_RENDERER_WEBGL.
  // return {
  //   vendor: (info && info.UNMASKED_VENDOR_WEBGL) ?
  //     gl.getParameter(info.UNMASKED_VENDOR_WEBGL) : 'unknown',
  //   renderer: (info && info.UNMASKED_RENDERER_WEBGL) ?
  //     gl.getParameter(info.UNMASKED_RENDERER_WEBGL) : 'unknown'
  // };
}

var TEST_EXPORTS = {
  WEBGL_LIMITS: WEBGL_LIMITS
};
exports.TEST_EXPORTS = TEST_EXPORTS;
},{"@babel/runtime/helpers/esm/defineProperty":"DOnw","../webgl-utils":"PmJk"}],"KGvr":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

//
// Internal class that helps "asynchronous WebGL query objects" manage
// pending requests (e.g. for EXT_disjoint_timer_query and WebGL2 queries)
//
// Creates and manages promises for the queries.
// Tracks pending queries enabling polling.
// Tracks pending queries enabling invalidation.
// Provides some standard error messages.
//
// Remarks:
// - Maintains a minimal list of pending queries only to minimize GC impact
// - Exported as a singleton class instance.
var ERR_DELETED = 'Query was deleted before result was available';
var ERR_CANCEL = 'Query was canceled before result was available';

var noop = function noop(x) {
  return x;
};

var QueryManager =
/*#__PURE__*/
function () {
  function QueryManager() {
    (0, _classCallCheck2.default)(this, QueryManager);
    this.pendingQueries = new Set();
    this.invalidQueryType = null;
    this.invalidErrorMessage = '';

    this.checkInvalid = function () {
      return false;
    };
  } // API THAT SHOULD BE EXPOSED TO APPLICATION
  // Checks invalidation callback and then all pending queries for completion
  // Should only be called once per tick


  (0, _createClass2.default)(QueryManager, [{
    key: "poll",
    value: function poll(gl) {
      this.cancelInvalidQueries(gl); // Now check availability of results and resolve promises as appropriate

      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = this.pendingQueries.values()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var query = _step.value;
          var resultAvailable = query.isResultAvailable();

          if (resultAvailable) {
            var result = query.getResult();
            this.resolveQuery(query, result);
          }
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return != null) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }
    } // API FOR MANAGED QUERY CLASSES
    // Registers query invalidation method - used to detect disjoint timer queries

  }, {
    key: "setInvalidator",
    value: function setInvalidator(_ref) {
      var queryType = _ref.queryType,
          errorMessage = _ref.errorMessage,
          checkInvalid = _ref.checkInvalid;
      this.invalidQueryType = queryType;
      this.invalidErrorMessage = errorMessage;
      this.checkInvalid = checkInvalid;
    } // Starts a query, sets up a new promise

  }, {
    key: "beginQuery",
    value: function beginQuery(query) {
      var onComplete = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
      var onError = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : noop; // Make sure disjoint state is cleared, so that this query starts fresh
      // Cancel other queries if needed

      this.cancelInvalidQueries(query.gl); // Cancel current promise - noop if already resolved or rejected

      this.cancelQuery(query); // Create a new promise with attached resolve and reject methods

      var resolvers = {};
      query.promise = new Promise(function (resolve, reject) {
        resolvers.resolve = resolve;
        resolvers.reject = reject;
      });
      Object.assign(query.promise, resolvers); // Add this query to the pending queries

      this.pendingQueries.add(query); // Register the callbacks

      return query.promise.then(onComplete).catch(onError);
    } // Resolves a query with a result

  }, {
    key: "resolveQuery",
    value: function resolveQuery(query, result) {
      this.pendingQueries.delete(query);
      query.promise.resolve(result);
    } // Rejects the promise

  }, {
    key: "rejectQuery",
    value: function rejectQuery(query, errorMessage) {
      this.pendingQueries.delete(query);

      if (query.promise) {
        query.promise.reject(new Error(errorMessage));
      }
    } // Rejects promise with standard message for Query.delete()

  }, {
    key: "deleteQuery",
    value: function deleteQuery(query) {
      return this.rejectQuery(query, ERR_DELETED);
    } // Rejects promise with standard message for Query.cancel()

  }, {
    key: "cancelQuery",
    value: function cancelQuery(query) {
      return this.rejectQuery(query, ERR_CANCEL);
    } // Rejects promise with registered message for invalidation

  }, {
    key: "invalidateQuery",
    value: function invalidateQuery(query) {
      if (query instanceof this.invalidQueryType) {
        this.rejectQuery(query, this.invalidErrorMessage);
      }
    } // Checks all queries to see if need to be invalidated

  }, {
    key: "cancelInvalidQueries",
    value: function cancelInvalidQueries(gl) {
      // We assume that we can cancel queries for all context.
      // Should be OK since this is used to check for "disjoint" GPU state
      if (this.checkInvalid(gl)) {
        var _iteratorNormalCompletion2 = true;
        var _didIteratorError2 = false;
        var _iteratorError2 = undefined;

        try {
          for (var _iterator2 = this.pendingQueries.values()[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
            var query = _step2.value;
            this.invalidateQuery(query);
          }
        } catch (err) {
          _didIteratorError2 = true;
          _iteratorError2 = err;
        } finally {
          try {
            if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
              _iterator2.return();
            }
          } finally {
            if (_didIteratorError2) {
              throw _iteratorError2;
            }
          }
        }
      }
    }
  }]);
  return QueryManager;
}();

var _default = new QueryManager();

exports.default = _default;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky"}],"P3M9":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.isWebGL = isWebGL;
exports.isWebGL2 = isWebGL2;
exports.assertWebGLContext = assertWebGLContext;
exports.assertWebGL2Context = assertWebGL2Context;
exports.setContextDefaults = setContextDefaults;
exports.createGLContext = createGLContext;
exports.destroyGLContext = destroyGLContext;
exports.resizeGLContext = resizeGLContext;
exports.pollGLContext = pollGLContext;
exports.ERR_WEBGL2 = exports.ERR_WEBGL = exports.ERR_CONTEXT = void 0;

var _webglUtils = require("../webgl-utils");

var _createHeadlessContext = require("./create-headless-context");

var _createCanvas = require("./create-canvas");

var _createBrowserContext = require("./create-browser-context");

var _trackContextState = _interopRequireDefault(require("./track-context-state"));

var _debugContext = require("./debug-context");

var _contextLimits = require("./context-limits");

var _queryManager = _interopRequireDefault(require("../webgl-utils/query-manager"));

var _utils = require("../utils");

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/* eslint-disable quotes */
// WebGLRenderingContext related methods
// Heuristic testing of contexts (to indentify debug wrappers around gl contexts)
var GL_ARRAY_BUFFER = 0x8892;
var GL_TEXTURE_BINDING_3D = 0x806a;
var ERR_CONTEXT = 'Invalid WebGLRenderingContext';
exports.ERR_CONTEXT = ERR_CONTEXT;
var ERR_WEBGL = ERR_CONTEXT;
exports.ERR_WEBGL = ERR_WEBGL;
var ERR_WEBGL2 = 'Requires WebGL2'; // HACK: avoid use of `gl` parameter name to defeat GL constant inliner, which invalidates check

exports.ERR_WEBGL2 = ERR_WEBGL2;

function isWebGL(glContext) {
  return Boolean(glContext && (glContext instanceof _webglUtils.WebGLRenderingContext || glContext.ARRAY_BUFFER === GL_ARRAY_BUFFER));
} // HACK: avoid use of `gl` parameter name to defeat GL constant inliner, which invalidates check


function isWebGL2(glContext) {
  return Boolean(glContext && (glContext instanceof _webglUtils.WebGL2RenderingContext || glContext.TEXTURE_BINDING_3D === GL_TEXTURE_BINDING_3D));
}

function assertWebGLContext(gl) {
  // Need to handle debug context
  (0, _assert.default)(isWebGL(gl), ERR_CONTEXT);
}

function assertWebGL2Context(gl) {
  // Need to handle debug context
  (0, _assert.default)(isWebGL2(gl), ERR_WEBGL2);
}

var contextDefaults = {
  // COMMON CONTEXT PARAMETERS
  // Attempt to allocate WebGL2 context
  webgl2: true,
  // Attempt to create a WebGL2 context (false to force webgl1)
  webgl1: true,
  // Attempt to create a WebGL1 context (false to fail if webgl2 not available)
  throwOnFailure: true,
  manageState: true,
  // BROWSER CONTEXT PARAMETERS
  canvas: null,
  // A canvas element or a canvas string id
  debug: false,
  // Instrument context (at the expense of performance)
  // HEADLESS CONTEXT PARAMETERS
  width: 800,
  // width are height are only used by headless gl
  height: 600 // WEBGL/HEADLESS CONTEXT PARAMETERS
  // Remaining options are passed through to context creator

};
/*
 * Change default context creation parameters.
 * Main use case is regression test suite.
 */

function setContextDefaults() {
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  Object.assign(contextDefaults, {
    width: 1,
    height: 1
  }, opts);
}
/*
 * Creates a context giving access to the WebGL API
 */

/* eslint-disable complexity, max-statements */


function createGLContext() {
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  opts = Object.assign({}, contextDefaults, opts);
  var _opts = opts,
      canvas = _opts.canvas,
      width = _opts.width,
      height = _opts.height,
      throwOnError = _opts.throwOnError,
      manageState = _opts.manageState,
      debug = _opts.debug; // Error reporting function, enables exceptions to be disabled

  function onError(message) {
    if (throwOnError) {
      throw new Error(message);
    } // log.log(0, message)();


    return null;
  }

  var gl;

  if (_utils.isBrowser) {
    // Get or create a canvas
    var targetCanvas = (0, _createCanvas.getCanvas)({
      canvas: canvas,
      width: width,
      height: height,
      onError: onError
    }); // Create a WebGL context in the canvas

    gl = (0, _createBrowserContext.createBrowserContext)({
      canvas: targetCanvas,
      opts: opts
    });
  } else {
    // Create a headless-gl context under Node.js
    gl = (0, _createHeadlessContext.createHeadlessContext)({
      width: width,
      height: height,
      opts: opts,
      onError: onError
    });
  }

  if (!gl) {
    return null;
  } // Install context state tracking


  if (manageState) {
    (0, _trackContextState.default)(gl, {
      copyState: false,
      log: function log() {
        for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
          args[_key] = arguments[_key];
        }

        return _utils.log.log.apply(_utils.log, [1].concat(args))();
      }
    });
  } // Add debug instrumentation to the context


  if (_utils.isBrowser && debug) {
    gl = (0, _debugContext.makeDebugContext)(gl, {
      debug: debug
    }); // Debug forces log level to at least 1

    _utils.log.priority = Math.max(_utils.log.priority, 1); // Log some debug info about the context
  } // Log context information


  logInfo(gl); // Add to seer integration

  return gl;
}

function destroyGLContext(gl) {
  // TODO - Remove from seer integration
  // TODO - Unregister any tracking/polyfills
  // There is no way to delete browser based context
  // Destroy headless gl context
  var ext = gl.getExtension('STACKGL_destroy_context');

  if (ext) {
    ext.destroy();
  }
}
/**
 * Resize the canvas' drawing buffer.
 *
 * Can match the canvas CSS size, and optionally also consider devicePixelRatio
 * Can be called every frame
 *
 * Regardless of size, the drawing buffer will always be scaled to the viewport, but
 * for best visual results, usually set to either:
 *  canvas CSS width x canvas CSS height
 *  canvas CSS width * devicePixelRatio x canvas CSS height * devicePixelRatio
 * See http://webgl2fundamentals.org/webgl/lessons/webgl-resizing-the-canvas.html
 *
 * resizeGLContext(gl, {width, height, useDevicePixels})
 */


function resizeGLContext(gl) {
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; // Resize browser context

  if (gl.canvas) {
    /* global window */
    var devicePixelRatio = opts.useDevicePixels ? window.devicePixelRatio || 1 : 1;
    var width = "width" in opts ? opts.width : gl.canvas.clientWidth;
    var height = "height" in opts ? opts.height : gl.canvas.clientHeight;
    gl.canvas.width = width * devicePixelRatio;
    gl.canvas.height = height * devicePixelRatio;
    return;
  } // Resize headless gl context


  var ext = gl.getExtension('STACKGL_resize_drawingbuffer');

  if (ext && "width" in opts && "height" in opts) {
    ext.resize(opts.width, opts.height);
  }
} // POLLING FOR PENDING QUERIES
// Calling this function checks all pending queries for completion


function pollGLContext(gl) {
  _queryManager.default.poll(gl);
} // HELPER METHODS


function logInfo(gl) {
  var webGL = isWebGL2(gl) ? 'WebGL2' : 'WebGL1';
  var info = (0, _contextLimits.glGetDebugInfo)(gl);
  var driver = info ? "(".concat(info.vendor, ",").concat(info.renderer, ")") : '';
  var debug = gl.debug ? ' debug' : '';

  _utils.log.once(0, "".concat(webGL).concat(debug, " context ").concat(driver))();
}
},{"../webgl-utils":"PmJk","./create-headless-context":"drCT","./create-canvas":"PNHV","./create-browser-context":"mtVl","./track-context-state":"N55U","./debug-context":"lVQr","./context-limits":"fdIS","../webgl-utils/query-manager":"KGvr","../utils":"PFG0","../utils/assert":"wYRU"}],"id7L":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "createGLContext", {
  enumerable: true,
  get: function () {
    return _context.createGLContext;
  }
});
Object.defineProperty(exports, "destroyGLContext", {
  enumerable: true,
  get: function () {
    return _context.destroyGLContext;
  }
});
Object.defineProperty(exports, "resizeGLContext", {
  enumerable: true,
  get: function () {
    return _context.resizeGLContext;
  }
});
Object.defineProperty(exports, "pollGLContext", {
  enumerable: true,
  get: function () {
    return _context.pollGLContext;
  }
});
Object.defineProperty(exports, "withParameters", {
  enumerable: true,
  get: function () {
    return _contextState.withParameters;
  }
});
Object.defineProperty(exports, "resetParameters", {
  enumerable: true,
  get: function () {
    return _contextState.resetParameters;
  }
});
Object.defineProperty(exports, "getContextInfo", {
  enumerable: true,
  get: function () {
    return _contextLimits.getContextInfo;
  }
});
Object.defineProperty(exports, "getPageLoadPromise", {
  enumerable: true,
  get: function () {
    return _createCanvas.getPageLoadPromise;
  }
});
Object.defineProperty(exports, "createCanvas", {
  enumerable: true,
  get: function () {
    return _createCanvas.createCanvas;
  }
});
Object.defineProperty(exports, "getCanvas", {
  enumerable: true,
  get: function () {
    return _createCanvas.getCanvas;
  }
});
Object.defineProperty(exports, "createHeadlessContext", {
  enumerable: true,
  get: function () {
    return _createHeadlessContext.createHeadlessContext;
  }
});
Object.defineProperty(exports, "createBrowserContext", {
  enumerable: true,
  get: function () {
    return _createBrowserContext.createBrowserContext;
  }
});
Object.defineProperty(exports, "trackContextState", {
  enumerable: true,
  get: function () {
    return _trackContextState.default;
  }
});

var _context = require("./context");

var _contextState = require("./context-state");

var _contextLimits = require("./context-limits");

var _createCanvas = require("./create-canvas");

var _createHeadlessContext = require("./create-headless-context");

var _createBrowserContext = require("./create-browser-context");

var _trackContextState = _interopRequireDefault(require("./track-context-state"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./context":"P3M9","./context-state":"cIIw","./context-limits":"fdIS","./create-canvas":"PNHV","./create-headless-context":"drCT","./create-browser-context":"mtVl","./track-context-state":"N55U"}],"pWl5":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.canCompileGLGSExtension = canCompileGLGSExtension;
exports.hasFeature = hasFeature;
exports.hasFeatures = hasFeatures;
exports.getFeatures = getFeatures;
exports.TEST_EXPORTS = exports.FEATURES = void 0;

var _webglUtils = require("../webgl-utils");

var _utils = require("../utils");

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Feature detection for WebGL
//
// Provides a function that enables simple checking of which WebGL features are
// available in an WebGL1 or WebGL2 environment.

/* eslint-disable no-inline-comments, max-len */
// Defines luma.gl "feature" names and semantics
var WEBGL_FEATURES = {
  // API SUPPORT
  VERTEX_ARRAY_OBJECT: ['OES_vertex_array_object', true],
  TIMER_QUERY: ['EXT_disjoint_timer_query', 'EXT_disjoint_timer_query_webgl2'],
  INSTANCED_RENDERING: ['ANGLE_instanced_arrays', true],
  MULTIPLE_RENDER_TARGETS: ['WEBGL_draw_buffers', true],
  // FEATURES
  ELEMENT_INDEX_UINT32: ['OES_element_index_uint', true],
  BLEND_EQUATION_MINMAX: ['EXT_blend_minmax', true],
  // TEXTURES, RENDERBUFFERS
  COLOR_ENCODING_SRGB: ['EXT_sRGB', true],
  // TEXTURES
  TEXTURE_DEPTH: ['WEBGL_depth_texture', true],
  TEXTURE_FLOAT: ['OES_texture_float', true],
  TEXTURE_HALF_FLOAT: ['OES_texture_half_float', true],
  TEXTURE_FILTER_LINEAR_FLOAT: ['OES_texture_float_linear'],
  TEXTURE_FILTER_LINEAR_HALF_FLOAT: ['OES_texture_half_float_linear'],
  TEXTURE_FILTER_ANISOTROPIC: ['EXT_texture_filter_anisotropic'],
  // FRAMEBUFFERS, TEXTURES AND RENDERBUFFERS
  COLOR_ATTACHMENT_RGBA32F: ['WEBGL_color_buffer_float', 'EXT_color_buffer_float'],
  COLOR_ATTACHMENT_FLOAT: [false, 'EXT_color_buffer_float'],
  COLOR_ATTACHMENT_HALF_FLOAT: [false, 'EXT_color_buffer_half_float'],
  // GLSL extensions
  GLSL_FRAG_DATA: ['WEBGL_draw_buffers', true],
  GLSL_FRAG_DEPTH: ['EXT_frag_depth', true],
  GLSL_DERIVATIVES: ['OES_standard_derivatives', true],
  GLSL_TEXTURE_LOD: ['EXT_shader_texture_lod', true]
}; // Create a key-mirrored FEATURES array

var FEATURES = {};
exports.FEATURES = FEATURES;
Object.keys(WEBGL_FEATURES).forEach(function (key) {
  FEATURES[key] = key;
});
// Enables feature detection in IE11 due to a bug where gl.getExtension may return true
// but fail to compile when the extension is enabled in the shader. Specifically,
// the OES_standard_derivatives extension fails to compile in IE11 even though its included
// in the list of supported extensions.
var compiledGlslExtensions = {}; // opts allows user agent to be overridden for testing

function canCompileGLGSExtension(gl, cap) {
  var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  var feature = WEBGL_FEATURES[cap];
  (0, _assert.default)(feature, cap);

  if (!(0, _utils.isOldIE)(opts)) {
    return true;
  }

  if (cap in compiledGlslExtensions) {
    return compiledGlslExtensions[cap];
  }

  var extensionName = feature[0];
  var source = "#extension GL_".concat(extensionName, " : enable\nvoid main(void) {}");
  var shader = gl.createShader(35633);
  gl.shaderSource(shader, source);
  gl.compileShader(shader);
  var canCompile = gl.getShaderParameter(shader, 35713);
  gl.deleteShader(shader);
  compiledGlslExtensions[cap] = canCompile;
  return canCompile;
} // TODO - cache the value


function getFeature(gl, cap) {
  var feature = WEBGL_FEATURES[cap];
  (0, _assert.default)(feature, cap); // Get extension name from table

  var extensionName = (0, _webglUtils.isWebGL2)(gl) ? feature[1] || feature[0] : feature[0]; // Check if the value is dependent on checking an extension

  var value = typeof extensionName === 'string' ? Boolean(gl.getExtension(extensionName)) : extensionName;
  (0, _assert.default)(value === false || value === true);
  return value;
} // capability can be a WebGL extension name or a luma capability name


function hasFeature(gl, feature) {
  return hasFeatures(gl, feature);
}

function hasFeatures(gl, features) {
  features = Array.isArray(features) ? features : [features];
  return features.every(function (feature) {
    return getFeature(gl, feature);
  });
}

function getFeatures(gl) {
  gl.luma = gl.luma || {};

  if (!gl.luma.caps) {
    gl.luma.caps = {};
    gl.luma.caps.webgl2 = (0, _webglUtils.isWebGL2)(gl);

    for (var cap in WEBGL_FEATURES) {
      gl.luma.caps[cap] = getFeature(gl, cap);
    }
  }

  return gl.luma.caps;
}

var TEST_EXPORTS = {
  WEBGL_FEATURES: WEBGL_FEATURES
};
exports.TEST_EXPORTS = TEST_EXPORTS;
},{"../webgl-utils":"PmJk","../utils":"PFG0","../utils/assert":"wYRU"}],"pOhm":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.FragmentShader = exports.VertexShader = exports.Shader = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _resource = _interopRequireDefault(require("./resource"));

var _webglUtils = require("../webgl-utils");

var _utils = require("../utils");

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var ERR_SOURCE = 'Shader: GLSL source code must be a JavaScript string';
var GL_FRAGMENT_SHADER = 0x8b30;
var GL_VERTEX_SHADER = 0x8b31;
var GL_COMPILE_STATUS = 0x8b81;
var GL_SHADER_TYPE = 0x8b4f; // For now this is an internal class

var Shader =
/*#__PURE__*/
function (_Resource) {
  (0, _inherits2.default)(Shader, _Resource);
  (0, _createClass2.default)(Shader, null, [{
    key: "getTypeName",
    value: function getTypeName(shaderType) {
      switch (shaderType) {
        case GL_VERTEX_SHADER:
          return 'vertex-shader';

        case GL_FRAGMENT_SHADER:
          return 'fragment-shader';

        default:
          (0, _assert.default)(false);
          return 'unknown';
      }
    }
    /* eslint-disable max-statements */

  }]);

  function Shader(gl, props) {
    var _this;

    (0, _classCallCheck2.default)(this, Shader);
    (0, _webglUtils.assertWebGLContext)(gl); // Validate arguments

    (0, _assert.default)(typeof props.source === 'string', ERR_SOURCE); // Deduce an id, from shader source, or supplied id, or shader type

    var id = (0, _webglUtils.getShaderName)(props.source, null) || props.id || (0, _utils.uid)("unnamed ".concat(Shader.getTypeName(props.shaderType)));
    _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Shader).call(this, gl, {
      id: id
    }));
    _this.shaderType = props.shaderType;
    _this.source = props.source;

    _this.initialize(props);

    return _this;
  }

  (0, _createClass2.default)(Shader, [{
    key: "initialize",
    value: function initialize(_ref) {
      var source = _ref.source;
      var shaderName = (0, _webglUtils.getShaderName)(source, null);

      if (shaderName) {
        this.id = (0, _utils.uid)(shaderName);
      }

      this._compile(source);
    } // Accessors

  }, {
    key: "getParameter",
    value: function getParameter(pname) {
      return this.gl.getShaderParameter(this.handle, pname);
    }
  }, {
    key: "toString",
    value: function toString() {
      return "".concat(this.getTypeName(this.shaderType), ":").concat(this.id);
    }
  }, {
    key: "getName",
    value: function getName() {
      return (0, _webglUtils.getShaderName)(this.source) || 'unnamed-shader';
    }
  }, {
    key: "getSource",
    value: function getSource() {
      return this.gl.getShaderSource(this.handle);
    } // Debug method - Returns translated source if available

  }, {
    key: "getTranslatedSource",
    value: function getTranslatedSource() {
      var extension = this.gl.getExtension('WEBGL_debug_shaders');
      return extension ? extension.getTranslatedShaderSource(this.handle) : 'No translated source available. WEBGL_debug_shaders not implemented';
    } // PRIVATE METHODS

  }, {
    key: "_compile",
    value: function _compile() {
      this.gl.shaderSource(this.handle, this.source);
      this.gl.compileShader(this.handle); // TODO - For performance reasons, avoid checking shader compilation errors on production?
      // TODO - Load log even when no error reported, to catch warnings?
      // https://gamedev.stackexchange.com/questions/30429/how-to-detect-glsl-warnings

      var compileStatus = this.getParameter(GL_COMPILE_STATUS);

      if (!compileStatus) {
        var infoLog = this.gl.getShaderInfoLog(this.handle);

        var _parseGLSLCompilerErr = (0, _webglUtils.parseGLSLCompilerError)(infoLog, this.source, this.shaderType, this.id),
            shaderName = _parseGLSLCompilerErr.shaderName,
            errors = _parseGLSLCompilerErr.errors,
            warnings = _parseGLSLCompilerErr.warnings;

        _utils.log.error("GLSL compilation errors in ".concat(shaderName, "\n").concat(errors))();

        _utils.log.warn("GLSL compilation warnings in ".concat(shaderName, "\n").concat(warnings))();

        throw new Error("GLSL compilation errors in ".concat(shaderName));
      }
    }
  }, {
    key: "_deleteHandle",
    value: function _deleteHandle() {
      this.gl.deleteShader(this.handle);
    }
  }, {
    key: "_getOptsFromHandle",
    value: function _getOptsFromHandle() {
      return {
        type: this.getParameter(GL_SHADER_TYPE),
        source: this.getSource()
      };
    }
  }]);
  return Shader;
}(_resource.default);

exports.Shader = Shader;

var VertexShader =
/*#__PURE__*/
function (_Shader) {
  (0, _inherits2.default)(VertexShader, _Shader);

  function VertexShader(gl, props) {
    (0, _classCallCheck2.default)(this, VertexShader); // DEPRECATED: Support old constructor signature: VertexShader(gl, source)

    if (typeof props === 'string') {
      _utils.log.deprecated('new FragmentShader(gl, source)', 'new FragmentShader(gl, {source})', '6.1');

      props = {
        source: props
      };
    }

    return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(VertexShader).call(this, gl, Object.assign({}, props, {
      shaderType: GL_VERTEX_SHADER
    })));
  } // PRIVATE METHODS


  (0, _createClass2.default)(VertexShader, [{
    key: "_createHandle",
    value: function _createHandle() {
      return this.gl.createShader(GL_VERTEX_SHADER);
    }
  }]);
  return VertexShader;
}(Shader);

exports.VertexShader = VertexShader;

var FragmentShader =
/*#__PURE__*/
function (_Shader2) {
  (0, _inherits2.default)(FragmentShader, _Shader2);

  function FragmentShader(gl, props) {
    (0, _classCallCheck2.default)(this, FragmentShader); // DEPRECATED: Support old constructor signature: FragmentShader(gl, source)

    if (typeof props === 'string') {
      _utils.log.deprecated('new FragmentShader(gl, source)', 'new FragmentShader(gl, {source})', '6.1');

      props = {
        source: props
      };
    }

    return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(FragmentShader).call(this, gl, Object.assign({}, props, {
      shaderType: GL_FRAGMENT_SHADER
    })));
  } // PRIVATE METHODS


  (0, _createClass2.default)(FragmentShader, [{
    key: "_createHandle",
    value: function _createHandle() {
      return this.gl.createShader(GL_FRAGMENT_SHADER);
    }
  }]);
  return FragmentShader;
}(Shader);

exports.FragmentShader = FragmentShader;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/inherits":"NNOi","./resource":"Uazl","../webgl-utils":"PmJk","../utils":"PFG0","../utils/assert":"wYRU"}],"whuc":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _superPropBase;

var _getPrototypeOf = _interopRequireDefault(require("./getPrototypeOf"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _superPropBase(object, property) {
  while (!Object.prototype.hasOwnProperty.call(object, property)) {
    object = (0, _getPrototypeOf.default)(object);
    if (object === null) break;
  }

  return object;
}
},{"./getPrototypeOf":"i2He"}],"Q3cA":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _get;

var _superPropBase = _interopRequireDefault(require("./superPropBase"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _get(target, property, receiver) {
  if (typeof Reflect !== "undefined" && Reflect.get) {
    exports.default = _get = Reflect.get;
  } else {
    exports.default = _get = function _get(target, property, receiver) {
      var base = (0, _superPropBase.default)(target, property);
      if (!base) return;
      var desc = Object.getOwnPropertyDescriptor(base, property);

      if (desc.get) {
        return desc.get.call(receiver);
      }

      return desc.value;
    };
  }

  return _get(target, property, receiver || target);
}
},{"./superPropBase":"whuc"}],"jd4o":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.RENDERBUFFER_FORMATS = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/assertThisInitialized"));

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));

var _webglUtils = require("../webgl-utils");

var _resource = _interopRequireDefault(require("./resource"));

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _RENDERBUFFER_FORMATS;
/* eslint-disable no-inline-comments */


// Define local GL constants to optimize minification
var GL_RENDERBUFFER = 0x8d41;
var GL_SAMPLES = 0x80a9;
var GL_RENDERBUFFER_WIDTH = 0x8d42;
var GL_RENDERBUFFER_HEIGHT = 0x8d43;
var GL_RENDERBUFFER_INTERNAL_FORMAT = 0x8d44;
var GL_RENDERBUFFER_SAMPLES = 0x8cab; // Define local extension strings to optimize minification
// const SRGB = 'EXT_sRGB';
// const CB_FLOAT_WEBGL1 = 'WEBGL_color_buffer_float';

var CB_FLOAT_WEBGL2 = 'EXT_color_buffer_float'; // const CB_HALF_FLOAT_WEBGL1 = 'EXT_color_buffer_half_float';

var RENDERBUFFER_FORMATS = (_RENDERBUFFER_FORMATS = {}, (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 33189, {}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 33190, {
  gl2: true
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 36012, {
  gl2: true
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 36168, {}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 34041, {}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 35056, {
  gl2: true
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 36013, {
  gl2: true
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 32854, {}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 36194, {}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 32855, {}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 33321, {
  gl2: true
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 33330, {
  gl2: true
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 33329, {
  gl2: true
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 33332, {
  gl2: true
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 33331, {
  gl2: true
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 33334, {
  gl2: true
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 33333, {
  gl2: true
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 33323, {
  gl2: true
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 33336, {
  gl2: true
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 33335, {
  gl2: true
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 33338, {
  gl2: true
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 33337, {
  gl2: true
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 33340, {
  gl2: true
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 33339, {
  gl2: true
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 32849, {
  gl2: true
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 32856, {
  gl2: true
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 32857, {
  gl2: true
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 36220, {
  gl2: true
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 36238, {
  gl2: true
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 36975, {
  gl2: true
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 36214, {
  gl2: true
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 36232, {
  gl2: true
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 36226, {
  gl2: true
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 36208, {
  gl2: true
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 33325, {
  gl2: CB_FLOAT_WEBGL2
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 33327, {
  gl2: CB_FLOAT_WEBGL2
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 34842, {
  gl2: CB_FLOAT_WEBGL2
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 33326, {
  gl2: CB_FLOAT_WEBGL2
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 33328, {
  gl2: CB_FLOAT_WEBGL2
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 34836, {
  gl2: CB_FLOAT_WEBGL2
}), (0, _defineProperty2.default)(_RENDERBUFFER_FORMATS, 35898, {
  gl2: CB_FLOAT_WEBGL2
}), _RENDERBUFFER_FORMATS);
exports.RENDERBUFFER_FORMATS = RENDERBUFFER_FORMATS;

function isFormatSupported(gl, format, formats) {
  var info = formats[format];

  if (!info) {
    return false;
  }

  var value = (0, _webglUtils.isWebGL2)(gl) ? info.gl2 || info.gl1 : info.gl1;

  if (typeof value === 'string') {
    return gl.getExtension(value);
  }

  return value;
}

var Renderbuffer =
/*#__PURE__*/
function (_Resource) {
  (0, _inherits2.default)(Renderbuffer, _Resource);
  (0, _createClass2.default)(Renderbuffer, null, [{
    key: "isSupported",
    value: function isSupported(gl) {
      var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
          format = _ref.format;

      return !format || isFormatSupported(gl, format, RENDERBUFFER_FORMATS);
    }
  }, {
    key: "getSamplesForFormat",
    value: function getSamplesForFormat(gl, _ref2) {
      var format = _ref2.format; // Polyfilled to return [0] under WebGL1

      return gl.getInternalformatParameter(GL_RENDERBUFFER, format, GL_SAMPLES);
    }
  }]);

  function Renderbuffer(gl) {
    var _this;

    var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, Renderbuffer);
    _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Renderbuffer).call(this, gl, opts));

    _this.initialize(opts);

    Object.seal((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
    return _this;
  } // Creates and initializes a renderbuffer object's data store


  (0, _createClass2.default)(Renderbuffer, [{
    key: "initialize",
    value: function initialize(_ref3) {
      var format = _ref3.format,
          _ref3$width = _ref3.width,
          width = _ref3$width === void 0 ? 1 : _ref3$width,
          _ref3$height = _ref3.height,
          height = _ref3$height === void 0 ? 1 : _ref3$height,
          _ref3$samples = _ref3.samples,
          samples = _ref3$samples === void 0 ? 0 : _ref3$samples;
      (0, _assert.default)(format, 'Needs format');
      this.gl.bindRenderbuffer(GL_RENDERBUFFER, this.handle);

      if (samples !== 0 && (0, _webglUtils.isWebGL2)(this.gl)) {
        this.gl.renderbufferStorageMultisample(GL_RENDERBUFFER, samples, format, width, height);
      } else {
        this.gl.renderbufferStorage(GL_RENDERBUFFER, format, width, height);
      } // this.gl.bindRenderbuffer(GL_RENDERBUFFER, null);


      this.format = format;
      this.width = width;
      this.height = height;
      this.samples = samples;
      return this;
    }
  }, {
    key: "resize",
    value: function resize(_ref4) {
      var width = _ref4.width,
          height = _ref4.height; // Don't resize if width/height haven't changed

      if (width !== this.width || height !== this.height) {
        return this.initialize({
          width: width,
          height: height,
          format: this.format,
          samples: this.samples
        });
      }

      return this;
    } // PRIVATE METHODS

  }, {
    key: "_createHandle",
    value: function _createHandle() {
      return this.gl.createRenderbuffer();
    }
  }, {
    key: "_deleteHandle",
    value: function _deleteHandle() {
      this.gl.deleteRenderbuffer(this.handle);
    }
  }, {
    key: "_bindHandle",
    value: function _bindHandle(handle) {
      this.gl.bindRenderbuffer(GL_RENDERBUFFER, handle);
    }
  }, {
    key: "_syncHandle",
    value: function _syncHandle(handle) {
      this.format = this.getParameter(GL_RENDERBUFFER_INTERNAL_FORMAT);
      this.width = this.getParameter(GL_RENDERBUFFER_WIDTH);
      this.height = this.getParameter(GL_RENDERBUFFER_HEIGHT);
      this.samples = this.getParameter(GL_RENDERBUFFER_SAMPLES);
    } // @param {Boolean} opt.autobind=true - method call will bind/unbind object
    // @returns {GLenum|GLint} - depends on pname

  }, {
    key: "_getParameter",
    value: function _getParameter(pname) {
      this.gl.bindRenderbuffer(GL_RENDERBUFFER, this.handle);
      var value = this.gl.getRenderbufferParameter(GL_RENDERBUFFER, pname); // this.gl.bindRenderbuffer(GL_RENDERBUFFER, null);

      return value;
    }
  }]);
  return Renderbuffer;
}(_resource.default);

exports.default = Renderbuffer;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/inherits":"NNOi","@babel/runtime/helpers/esm/assertThisInitialized":"b9Zy","@babel/runtime/helpers/esm/defineProperty":"DOnw","../webgl-utils":"PmJk","./resource":"Uazl","../utils/assert":"wYRU"}],"Zd9V":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.clear = clear;
exports.clearBuffer = clearBuffer;

var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));

var _contextState = require("../webgl-context/context-state");

var _webglUtils = require("../webgl-utils");

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Should collapse during minification
var GL_DEPTH_BUFFER_BIT = 0x00000100;
var GL_STENCIL_BUFFER_BIT = 0x00000400;
var GL_COLOR_BUFFER_BIT = 0x00004000;
var GL_COLOR = 0x1800;
var GL_DEPTH = 0x1801;
var GL_STENCIL = 0x1802;
var GL_DEPTH_STENCIL = 0x84f9; // Should disappear if asserts are removed

var ERR_ARGUMENTS = 'clear: bad arguments'; // Optionally clears depth, color and stencil buffers

function clear(gl) {
  var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
      _ref$framebuffer = _ref.framebuffer,
      framebuffer = _ref$framebuffer === void 0 ? null : _ref$framebuffer,
      _ref$color = _ref.color,
      color = _ref$color === void 0 ? null : _ref$color,
      _ref$depth = _ref.depth,
      depth = _ref$depth === void 0 ? null : _ref$depth,
      _ref$stencil = _ref.stencil,
      stencil = _ref$stencil === void 0 ? null : _ref$stencil;

  var parameters = {};

  if (framebuffer) {
    parameters.framebuffer = framebuffer;
  }

  var clearFlags = 0;

  if (color) {
    clearFlags |= GL_COLOR_BUFFER_BIT;

    if (color !== true) {
      parameters.clearColor = color;
    }
  }

  if (depth) {
    clearFlags |= GL_DEPTH_BUFFER_BIT;

    if (depth !== true) {
      parameters.clearDepth = depth;
    }
  }

  if (stencil) {
    clearFlags |= GL_STENCIL_BUFFER_BIT;

    if (depth !== true) {
      parameters.clearStencil = depth;
    }
  }

  (0, _assert.default)(clearFlags !== 0, ERR_ARGUMENTS); // Temporarily set any clear "colors" and call clear

  (0, _contextState.withParameters)(gl, parameters, function () {
    gl.clear(clearFlags);
  });
} // WebGL2 - clear a specific drawing buffer


function clearBuffer(gl) {
  var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
      _ref2$framebuffer = _ref2.framebuffer,
      framebuffer = _ref2$framebuffer === void 0 ? null : _ref2$framebuffer,
      _ref2$buffer = _ref2.buffer,
      buffer = _ref2$buffer === void 0 ? GL_COLOR : _ref2$buffer,
      _ref2$drawBuffer = _ref2.drawBuffer,
      drawBuffer = _ref2$drawBuffer === void 0 ? 0 : _ref2$drawBuffer,
      _ref2$value = _ref2.value,
      value = _ref2$value === void 0 ? [0, 0, 0, 0] : _ref2$value;

  (0, _webglUtils.assertWebGL2Context)(gl);
  (0, _contextState.withParameters)(gl, {
    framebuffer: framebuffer
  }, function () {
    // Method selection per OpenGL ES 3 docs
    switch (buffer) {
      case GL_COLOR:
        switch (value.constructor) {
          case Int32Array:
            gl.clearBufferiv(buffer, drawBuffer, value);
            break;

          case Uint32Array:
            gl.clearBufferuiv(buffer, drawBuffer, value);
            break;

          case Float32Array:
          default:
            gl.clearBufferfv(buffer, drawBuffer, value);
        }

        break;

      case GL_DEPTH:
        gl.clearBufferfv(GL_DEPTH, 0, [value]);
        break;

      case GL_STENCIL:
        gl.clearBufferiv(GL_STENCIL, 0, [value]);
        break;

      case GL_DEPTH_STENCIL:
        var _value = (0, _slicedToArray2.default)(value, 2),
            depth = _value[0],
            stencil = _value[1];

        gl.clearBufferfi(GL_DEPTH_STENCIL, 0, depth, stencil);
        break;

      default:
        (0, _assert.default)(false, ERR_ARGUMENTS);
    }
  });
}
},{"@babel/runtime/helpers/esm/slicedToArray":"U1JK","../webgl-context/context-state":"cIIw","../webgl-utils":"PmJk","../utils/assert":"wYRU"}],"VJKg":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.glFormatToComponents = glFormatToComponents;
exports.glTypeToBytes = glTypeToBytes;

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Returns number of components in a specific readPixels WebGL format
function glFormatToComponents(format) {
  switch (format) {
    case 6406:
    case 33326:
    case 6403:
      return 1;

    case 33328:
    case 33319:
      return 2;

    case 6407:
    case 34837:
      return 3;

    case 6408:
    case 34836:
      return 4;
    // TODO: Add support for additional WebGL2 formats

    default:
      (0, _assert.default)(false);
      return 0;
  }
} // Return byte count for given readPixels WebGL type


function glTypeToBytes(type) {
  switch (type) {
    case 5121:
      return 1;

    case 33635:
    case 32819:
    case 32820:
      return 2;

    case 5126:
      return 4;
    // TODO: Add support for additional WebGL2 types

    default:
      (0, _assert.default)(false);
      return 0;
  }
}
},{"../utils/assert":"wYRU"}],"RDBm":[function(require,module,exports) {

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.FRAMEBUFFER_ATTACHMENT_PARAMETERS = exports.default = void 0;

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));

var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/assertThisInitialized"));

var _resource = _interopRequireDefault(require("./resource"));

var _texture2d = _interopRequireDefault(require("./texture-2d"));

var _renderbuffer = _interopRequireDefault(require("./renderbuffer"));

var _buffer = _interopRequireDefault(require("./buffer"));

var _clear2 = require("./clear");

var _webglContext = require("../webgl-context");

var _contextFeatures = require("../webgl-context/context-features");

var _typedArrayUtils = require("../webgl-utils/typed-array-utils");

var _formatUtils = require("../webgl-utils/format-utils");

var _webglUtils = require("../webgl-utils");

var _constantsToKeys = require("../webgl-utils/constants-to-keys");

var _utils = require("../utils");

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var ERR_MULTIPLE_RENDERTARGETS = 'Multiple render targets not supported';

var Framebuffer =
/*#__PURE__*/
function (_Resource) {
  (0, _inherits2.default)(Framebuffer, _Resource);
  (0, _createClass2.default)(Framebuffer, [{
    key: "MAX_COLOR_ATTACHMENTS",
    get: function get() {
      return this.gl.getParameter(this.gl.MAX_COLOR_ATTACHMENTS);
    }
  }, {
    key: "MAX_DRAW_BUFFERS",
    get: function get() {
      return this.gl.getParameter(this.gl.MAX_DRAW_BUFFERS);
    }
  }], [{
    key: "isSupported",
    value: function isSupported(gl) {
      var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
          colorBufferFloat = _ref.colorBufferFloat,
          colorBufferHalfFloat = _ref.colorBufferHalfFloat;

      var supported = true;
      supported = colorBufferFloat && gl.getExtension((0, _webglUtils.isWebGL2)(gl) ? 'EXT_color_buffer_float' : 'WEBGL.color_buffer_float');
      supported = colorBufferHalfFloat && gl.getExtension((0, _webglUtils.isWebGL2)(gl) ? 'EXT_color_buffer_float' : 'EXT_color_buffer_half_float');
      return supported;
    } // Create a Framebuffer wrapper for the default framebuffer (target === null)

  }, {
    key: "getDefaultFramebuffer",
    value: function getDefaultFramebuffer(gl) {
      gl.luma = gl.luma || {};
      gl.luma.defaultFramebuffer = gl.luma.defaultFramebuffer || new Framebuffer(gl, {
        id: 'default-framebuffer',
        handle: null,
        attachments: {}
      }); // TODO - can we query for and get a handle to the GL.FRONT renderbuffer?

      return gl.luma.defaultFramebuffer;
    }
  }]);

  function Framebuffer(gl) {
    var _this;

    var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, Framebuffer);
    _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Framebuffer).call(this, gl, opts)); // Public members

    _this.width = null;
    _this.height = null;
    _this.attachments = {};
    _this.readBuffer = 36064;
    _this.drawBuffers = [36064];

    _this.initialize(opts);

    Object.seal((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
    return _this;
  }

  (0, _createClass2.default)(Framebuffer, [{
    key: "initialize",
    value: function initialize(_ref2) {
      var _ref2$width = _ref2.width,
          width = _ref2$width === void 0 ? 1 : _ref2$width,
          _ref2$height = _ref2.height,
          height = _ref2$height === void 0 ? 1 : _ref2$height,
          _ref2$attachments = _ref2.attachments,
          attachments = _ref2$attachments === void 0 ? null : _ref2$attachments,
          _ref2$color = _ref2.color,
          color = _ref2$color === void 0 ? true : _ref2$color,
          _ref2$depth = _ref2.depth,
          depth = _ref2$depth === void 0 ? true : _ref2$depth,
          _ref2$stencil = _ref2.stencil,
          stencil = _ref2$stencil === void 0 ? false : _ref2$stencil,
          _ref2$check = _ref2.check,
          check = _ref2$check === void 0 ? true : _ref2$check,
          readBuffer = _ref2.readBuffer,
          drawBuffers = _ref2.drawBuffers;
      (0, _assert.default)(width >= 0 && height >= 0, 'Width and height need to be integers'); // Store actual width and height for diffing

      this.width = width;
      this.height = height; // Resize any provided attachments - note that resize only resizes if needed
      // Note: A framebuffer has no separate size, it is defined by its attachments (which must agree)

      if (attachments) {
        for (var attachment in attachments) {
          var target = attachments[attachment];
          var object = Array.isArray(target) ? target[0] : target;
          object.resize({
            width: width,
            height: height
          });
        }
      } else {
        // Create any requested default attachments
        attachments = this._createDefaultAttachments(color, depth, stencil, width, height);
      }

      this.update({
        clearAttachments: true,
        attachments: attachments,
        readBuffer: readBuffer,
        drawBuffers: drawBuffers
      }); // Checks that framebuffer was properly set up, if not, throws an explanatory error

      if (attachments && check) {
        this.checkStatus();
      }
    }
  }, {
    key: "update",
    value: function update(_ref3) {
      var _ref3$attachments = _ref3.attachments,
          attachments = _ref3$attachments === void 0 ? {} : _ref3$attachments,
          readBuffer = _ref3.readBuffer,
          drawBuffers = _ref3.drawBuffers,
          _ref3$clearAttachment = _ref3.clearAttachments,
          clearAttachments = _ref3$clearAttachment === void 0 ? false : _ref3$clearAttachment,
          _ref3$resizeAttachmen = _ref3.resizeAttachments,
          resizeAttachments = _ref3$resizeAttachmen === void 0 ? true : _ref3$resizeAttachmen;
      this.attach(attachments, {
        clearAttachments: clearAttachments,
        resizeAttachments: resizeAttachments
      });
      var gl = this.gl; // Multiple render target support, set read buffer and draw buffers

      var prevHandle = gl.bindFramebuffer(36160, this.handle);

      if (readBuffer) {
        this._setReadBuffer(readBuffer);
      }

      if (drawBuffers) {
        this._setDrawBuffers(drawBuffers);
      }

      gl.bindFramebuffer(36160, prevHandle || null);
      return this;
    } // Attachment resize is expected to be a noop if size is same

  }, {
    key: "resize",
    value: function resize() {
      var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          width = _ref4.width,
          height = _ref4.height; // for default framebuffer, just update the stored size


      if (this.handle === null) {
        (0, _assert.default)(width === undefined && height === undefined);
        this.width = this.gl.drawingBufferWidth;
        this.height = this.gl.drawingBufferHeight;
        return this;
      }

      if (width === undefined) {
        width = this.gl.drawingBufferWidth;
      }

      if (height === undefined) {
        height = this.gl.drawingBufferHeight;
      }

      if (width !== this.width && height !== this.height) {
        _utils.log.log(2, "Resizing framebuffer ".concat(this.id, " to ").concat(width, "x").concat(height));
      }

      for (var attachmentPoint in this.attachments) {
        this.attachments[attachmentPoint].resize({
          width: width,
          height: height
        });
      }

      this.width = width;
      this.height = height;
      return this;
    } // Attach from a map of attachments

  }, {
    key: "attach",
    value: function attach(attachments) {
      var _this2 = this;

      var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
          _ref5$clearAttachment = _ref5.clearAttachments,
          clearAttachments = _ref5$clearAttachment === void 0 ? false : _ref5$clearAttachment,
          _ref5$resizeAttachmen = _ref5.resizeAttachments,
          resizeAttachments = _ref5$resizeAttachmen === void 0 ? true : _ref5$resizeAttachmen;

      var newAttachments = {}; // Any current attachments need to be removed, add null values to map

      if (clearAttachments) {
        Object.keys(this.attachments).forEach(function (key) {
          newAttachments[key] = null;
        });
      } // Overlay the new attachments


      Object.assign(newAttachments, attachments);
      var prevHandle = this.gl.bindFramebuffer(36160, this.handle); // Walk the attachments

      for (var key in newAttachments) {
        // Ensure key is not undefined
        (0, _assert.default)(key !== undefined, 'Misspelled framebuffer binding point?');
        var attachment = Number(key);
        var descriptor = newAttachments[attachment];
        var object = descriptor;

        if (!object) {
          this._unattach(attachment);
        } else if (object instanceof _renderbuffer.default) {
          this._attachRenderbuffer({
            attachment: attachment,
            renderbuffer: object
          });
        } else if (Array.isArray(descriptor)) {
          var _descriptor = (0, _slicedToArray2.default)(descriptor, 3),
              texture = _descriptor[0],
              _descriptor$ = _descriptor[1],
              layer = _descriptor$ === void 0 ? 0 : _descriptor$,
              _descriptor$2 = _descriptor[2],
              level = _descriptor$2 === void 0 ? 0 : _descriptor$2;

          object = texture;

          this._attachTexture({
            attachment: attachment,
            texture: texture,
            layer: layer,
            level: level
          });
        } else {
          this._attachTexture({
            attachment: attachment,
            texture: object,
            layer: 0,
            level: 0
          });
        } // Resize objects


        if (resizeAttachments && object) {
          object.resize({
            width: this.width,
            height: this.height
          });
        }
      }

      this.gl.bindFramebuffer(36160, prevHandle || null); // Assign to attachments and remove any nulls to get a clean attachment map

      Object.assign(this.attachments, attachments);
      Object.keys(this.attachments).filter(function (key) {
        return !_this2.attachments[key];
      }).forEach(function (key) {
        delete _this2.attachments[key];
      });
    }
  }, {
    key: "checkStatus",
    value: function checkStatus() {
      var gl = this.gl;
      var prevHandle = gl.bindFramebuffer(36160, this.handle);
      var status = gl.checkFramebufferStatus(36160);
      gl.bindFramebuffer(36160, prevHandle || null);

      if (status !== 36053) {
        throw new Error(_getFrameBufferStatus(status));
      }

      return this;
    }
  }, {
    key: "clear",
    value: function clear() {
      var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          color = _ref6.color,
          depth = _ref6.depth,
          stencil = _ref6.stencil,
          _ref6$drawBuffers = _ref6.drawBuffers,
          drawBuffers = _ref6$drawBuffers === void 0 ? [] : _ref6$drawBuffers; // Bind framebuffer and delegate to global clear functions


      var prevHandle = this.gl.bindFramebuffer(36160, this.handle);

      if (color || depth || stencil) {
        (0, _clear2.clear)(this.gl, {
          color: color,
          depth: depth,
          stencil: stencil
        });
      }

      drawBuffers.forEach(function (value, drawBuffer) {
        (0, _clear2.clearBuffer)({
          drawBuffer: drawBuffer,
          value: value
        });
      });
      this.gl.bindFramebuffer(36160, prevHandle || null);
      return this;
    } // NOTE: Slow requires roundtrip to GPU
    // App can provide pixelArray or have it auto allocated by this method
    // @returns {Uint8Array|Uint16Array|FloatArray} - pixel array,
    //  newly allocated by this method unless provided by app.

  }, {
    key: "readPixels",
    value: function readPixels() {
      var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          _ref7$x = _ref7.x,
          x = _ref7$x === void 0 ? 0 : _ref7$x,
          _ref7$y = _ref7.y,
          y = _ref7$y === void 0 ? 0 : _ref7$y,
          _ref7$width = _ref7.width,
          width = _ref7$width === void 0 ? this.width : _ref7$width,
          _ref7$height = _ref7.height,
          height = _ref7$height === void 0 ? this.height : _ref7$height,
          _ref7$format = _ref7.format,
          format = _ref7$format === void 0 ? 6408 : _ref7$format,
          type = _ref7.type,
          _ref7$pixelArray = _ref7.pixelArray,
          pixelArray = _ref7$pixelArray === void 0 ? null : _ref7$pixelArray,
          _ref7$attachment = _ref7.attachment,
          attachment = _ref7$attachment === void 0 ? 36064 : _ref7$attachment;

      var gl = this.gl; // TODO - Set and unset gl.readBuffer

      if (attachment === 36064 && this.handle === null) {
        attachment = 1028;
      }

      (0, _assert.default)(this.attachments[attachment]); // Deduce the type from color attachment if not provided.

      type = type || this.attachments[attachment].type; // Deduce type and allocated pixelArray if needed

      if (!pixelArray) {
        // Allocate pixel array if not already available, using supplied type
        type = type || 5121;
        var ArrayType = (0, _typedArrayUtils.getTypedArrayFromGLType)(type, {
          clamped: false
        });
        var components = (0, _formatUtils.glFormatToComponents)(format); // TODO - check for composite type (components = 1).

        pixelArray = pixelArray || new ArrayType(width * height * components);
      } // Pixel array available, if necessary, deduce type from it.


      type = type || (0, _typedArrayUtils.getGLTypeFromTypedArray)(pixelArray);
      var prevHandle = this.gl.bindFramebuffer(36160, this.handle);
      this.gl.readPixels(x, y, width, height, format, type, pixelArray);
      this.gl.bindFramebuffer(36160, prevHandle || null);
      return pixelArray;
    } // Reads data into provided buffer object asynchronously
    // This function doesn't wait for copy to be complete, it programs GPU to perform a DMA transffer.

  }, {
    key: "readPixelsToBuffer",
    value: function readPixelsToBuffer(_ref8) {
      var _ref8$x = _ref8.x,
          x = _ref8$x === void 0 ? 0 : _ref8$x,
          _ref8$y = _ref8.y,
          y = _ref8$y === void 0 ? 0 : _ref8$y,
          _ref8$width = _ref8.width,
          width = _ref8$width === void 0 ? this.width : _ref8$width,
          _ref8$height = _ref8.height,
          height = _ref8$height === void 0 ? this.height : _ref8$height,
          _ref8$format = _ref8.format,
          format = _ref8$format === void 0 ? 6408 : _ref8$format,
          type = _ref8.type,
          _ref8$buffer = _ref8.buffer,
          buffer = _ref8$buffer === void 0 ? null : _ref8$buffer,
          _ref8$byteOffset = _ref8.byteOffset,
          byteOffset = _ref8$byteOffset === void 0 ? 0 : _ref8$byteOffset;
      var gl = this.gl; // Asynchronus read (PIXEL_PACK_BUFFER) is WebGL2 only feature

      (0, _webglUtils.assertWebGL2Context)(gl); // deduce type if not available.

      type = type || (buffer ? buffer.type : 5121);

      if (!buffer) {
        // Create new buffer with enough size
        var components = (0, _formatUtils.glFormatToComponents)(format);
        var byteCount = (0, _formatUtils.glTypeToBytes)(type);
        var bytes = byteOffset + width * height * components * byteCount;
        buffer = new _buffer.default(gl, {
          bytes: bytes,
          type: type,
          size: components
        });
      }

      buffer.bind({
        target: 35051
      });
      (0, _webglContext.withParameters)(gl, {
        framebuffer: this
      }, function () {
        gl.readPixels(x, y, width, height, format, type, byteOffset);
      });
      buffer.unbind({
        target: 35051
      });
      return buffer;
    } // Reads pixels as a dataUrl

  }, {
    key: "copyToDataUrl",
    value: function copyToDataUrl() {
      var _ref9 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          _ref9$attachment = _ref9.attachment,
          attachment = _ref9$attachment === void 0 ? 36064 : _ref9$attachment,
          _ref9$maxHeight = _ref9.maxHeight,
          maxHeight = _ref9$maxHeight === void 0 ? Number.MAX_SAFE_INTEGER : _ref9$maxHeight;

      var data = this.readPixels({
        attachment: attachment
      }); // Scale down

      var width = this.width,
          height = this.height;

      while (height > maxHeight) {
        var _scalePixels = (0, _webglUtils.scalePixels)({
          data: data,
          width: width,
          height: height
        });

        data = _scalePixels.data;
        width = _scalePixels.width;
        height = _scalePixels.height;
      } // Flip to top down coordinate system


      (0, _webglUtils.flipRows)({
        data: data,
        width: width,
        height: height
      });
      /* global document */

      var canvas = document.createElement('canvas');
      canvas.width = width;
      canvas.height = height;
      var context = canvas.getContext('2d'); // Copy the pixels to a 2D canvas

      var imageData = context.createImageData(width, height);
      imageData.data.set(data);
      context.putImageData(imageData, 0, 0);
      return canvas.toDataURL();
    } // Reads pixels into an HTML Image

  }, {
    key: "copyToImage",
    value: function copyToImage() {
      var _ref10 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          _ref10$image = _ref10.image,
          image = _ref10$image === void 0 ? null : _ref10$image,
          _ref10$attachment = _ref10.attachment,
          attachment = _ref10$attachment === void 0 ? 36064 : _ref10$attachment,
          _ref10$maxHeight = _ref10.maxHeight,
          maxHeight = _ref10$maxHeight === void 0 ? Number.MAX_SAFE_INTEGER : _ref10$maxHeight;
      /* global Image */


      var dataUrl = this.readDataUrl({
        attachment: attachment
      });
      image = image || new Image();
      image.src = dataUrl;
      return image;
    } // copyToFramebuffer({width, height}) {
    //   const scaleX = width / this.width;
    //   const scaleY = height / this.height;
    //   const scale = Math.min(scaleX, scaleY);
    //   width = width * scale;
    //   height = height * scale;
    //   const scaledFramebuffer = new Framebuffer(this.gl, {width, height});
    //   this.blit();
    // }
    // Copy a rectangle from a framebuffer attachment into a texture (at an offset)
    // NOTE: assumes texture has enough storage allocated
    // eslint-disable-next-line complexity

  }, {
    key: "copyToTexture",
    value: function copyToTexture(_ref11) {
      var texture = _ref11.texture,
          target = _ref11.target,
          _ref11$xoffset = _ref11.xoffset,
          xoffset = _ref11$xoffset === void 0 ? 0 : _ref11$xoffset,
          _ref11$yoffset = _ref11.yoffset,
          yoffset = _ref11$yoffset === void 0 ? 0 : _ref11$yoffset,
          _ref11$zoffset = _ref11.zoffset,
          zoffset = _ref11$zoffset === void 0 ? 0 : _ref11$zoffset,
          _ref11$mipmapLevel = _ref11.mipmapLevel,
          mipmapLevel = _ref11$mipmapLevel === void 0 ? 0 : _ref11$mipmapLevel,
          _ref11$attachment = _ref11.attachment,
          attachment = _ref11$attachment === void 0 ? 36064 : _ref11$attachment,
          _ref11$x = _ref11.x,
          x = _ref11$x === void 0 ? 0 : _ref11$x,
          _ref11$y = _ref11.y,
          y = _ref11$y === void 0 ? 0 : _ref11$y,
          width = _ref11.width,
          height = _ref11.height;
      var gl = this.gl;
      var prevHandle = gl.bindFramebuffer(36160, this.handle); // TODO - support gl.readBuffer (WebGL2 only)
      // const prevBuffer = gl.readBuffer(attachment);

      (0, _assert.default)(target || texture); // target

      if (texture) {
        width = Number.isFinite(width) ? width : texture.width;
        height = Number.isFinite(height) ? height : texture.height;
        texture.bind(0);
      }

      switch (texture.target) {
        case 3553:
        case 34067:
          gl.copyTexSubImage2D(target || texture.target, mipmapLevel, xoffset, yoffset, x, y, width, height);
          break;

        case 35866:
        case 32879:
          gl.copyTexSubImage3D(target || texture.target, mipmapLevel, xoffset, yoffset, zoffset, x, y, width, height);
          break;

        default:
      }

      if (texture) {
        texture.unbind();
      }

      gl.bindFramebuffer(36160, prevHandle || null);
      return texture;
    } // WEBGL2 INTERFACE
    // Copies a rectangle of pixels between framebuffers
    // eslint-disable-next-line complexity

  }, {
    key: "blit",
    value: function blit(_ref12) {
      var srcFramebuffer = _ref12.srcFramebuffer,
          _ref12$attachment = _ref12.attachment,
          attachment = _ref12$attachment === void 0 ? 36064 : _ref12$attachment,
          _ref12$srcX = _ref12.srcX0,
          srcX0 = _ref12$srcX === void 0 ? 0 : _ref12$srcX,
          _ref12$srcY = _ref12.srcY0,
          srcY0 = _ref12$srcY === void 0 ? 0 : _ref12$srcY,
          srcX1 = _ref12.srcX1,
          srcY1 = _ref12.srcY1,
          _ref12$dstX = _ref12.dstX0,
          dstX0 = _ref12$dstX === void 0 ? 0 : _ref12$dstX,
          _ref12$dstY = _ref12.dstY0,
          dstY0 = _ref12$dstY === void 0 ? 0 : _ref12$dstY,
          dstX1 = _ref12.dstX1,
          dstY1 = _ref12.dstY1,
          _ref12$color = _ref12.color,
          color = _ref12$color === void 0 ? true : _ref12$color,
          _ref12$depth = _ref12.depth,
          depth = _ref12$depth === void 0 ? false : _ref12$depth,
          _ref12$stencil = _ref12.stencil,
          stencil = _ref12$stencil === void 0 ? false : _ref12$stencil,
          _ref12$mask = _ref12.mask,
          mask = _ref12$mask === void 0 ? 0 : _ref12$mask,
          _ref12$filter = _ref12.filter,
          filter = _ref12$filter === void 0 ? 9728 : _ref12$filter;
      var gl = this.gl;
      (0, _webglUtils.assertWebGL2Context)(gl);

      if (!srcFramebuffer.handle && attachment === 36064) {
        attachment = 1028;
      }

      if (color) {
        mask |= 16384;
      }

      if (depth) {
        mask |= 256;
      }

      if (stencil) {
        mask |= 1024;
      }

      (0, _assert.default)(mask);
      srcX1 = srcX1 === undefined ? srcFramebuffer.width : srcX1;
      srcY1 = srcY1 === undefined ? srcFramebuffer.height : srcY1;
      dstX1 = dstX1 === undefined ? this.width : dstX1;
      dstY1 = dstY1 === undefined ? this.height : dstY1;
      var prevDrawHandle = gl.bindFramebuffer(36009, this.handle);
      var prevReadHandle = gl.bindFramebuffer(36008, srcFramebuffer.handle);
      gl.readBuffer(attachment);
      gl.blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
      gl.readBuffer(this.readBuffer);
      gl.bindFramebuffer(36008, prevReadHandle || null);
      gl.bindFramebuffer(36009, prevDrawHandle || null);
      return this;
    } // signals to the GL that it need not preserve all pixels of a specified region of the framebuffer

  }, {
    key: "invalidate",
    value: function invalidate(_ref13) {
      var _ref13$attachments = _ref13.attachments,
          attachments = _ref13$attachments === void 0 ? [] : _ref13$attachments,
          _ref13$x = _ref13.x,
          x = _ref13$x === void 0 ? 0 : _ref13$x,
          _ref13$y = _ref13.y,
          y = _ref13$y === void 0 ? 0 : _ref13$y,
          width = _ref13.width,
          height = _ref13.height;
      var gl = this.gl;
      (0, _webglUtils.assertWebGL2Context)(gl);
      var prevHandle = gl.bindFramebuffer(36008, this.handle);
      var invalidateAll = x === 0 && y === 0 && width === undefined && height === undefined;

      if (invalidateAll) {
        gl.invalidateFramebuffer(36008, attachments);
      } else {
        gl.invalidateFramebuffer(36008, attachments, x, y, width, height);
      }

      gl.bindFramebuffer(36008, prevHandle);
      return this;
    } // Return the value for `pname` of the specified attachment.
    // The type returned is the type of the requested pname

  }, {
    key: "getAttachmentParameter",
    value: function getAttachmentParameter(attachment, pname, keys) {
      var value = this._getAttachmentParameterFallback(pname);

      if (value === null) {
        this.gl.bindFramebuffer(36160, this.handle);
        value = this.gl.getFramebufferAttachmentParameter(36160, attachment, pname);
        this.gl.bindFramebuffer(36160, null);
      }

      if (keys && value > 1000) {
        value = (0, _constantsToKeys.glKey)(this.gl, value);
      }

      return value;
    }
  }, {
    key: "getAttachmentParameters",
    value: function getAttachmentParameters() {
      var attachment = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 36064;
      var keys = arguments.length > 1 ? arguments[1] : undefined;
      var parameters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.constructor.ATTACHMENT_PARAMETERS || [];
      var values = {};
      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = parameters[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var pname = _step.value;
          var key = keys ? (0, _constantsToKeys.glKey)(this.gl, pname) : pname;
          values[key] = this.getAttachmentParameter(attachment, pname, keys);
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return != null) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }

      return values;
    }
  }, {
    key: "getParameters",
    value: function getParameters() {
      var keys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
      var attachments = Object.keys(this.attachments); // if (this === this.gl.luma.defaultFramebuffer) {
      //   attachments = [GL.COLOR_ATTACHMENT0, GL.DEPTH_STENCIL_ATTACHMENT];
      // }

      var parameters = {};

      for (var _i = 0; _i < attachments.length; _i++) {
        var attachmentName = attachments[_i];
        var attachment = Number(attachmentName);
        var key = keys ? (0, _constantsToKeys.glKey)(this.gl, attachment) : attachment;
        parameters[key] = this.getAttachmentParameters(attachment, keys);
      }

      return parameters;
    } // DEBUG
    // Note: Will only work when called in an event handler

  }, {
    key: "show",
    value: function show() {
      /* global window */
      if (typeof window !== 'undefined') {
        window.open(this.copyToDataUrl(), 'luma-debug-texture');
      }

      return this;
    }
  }, {
    key: "log",
    value: function log() {
      var priority = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
      var message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';

      if (priority > _utils.log.priority || typeof window === 'undefined') {
        return this;
      }

      message = message || "Framebuffer ".concat(this.id);
      var image = this.copyToDataUrl({
        maxHeight: 100
      });

      _utils.log.image({
        priority: priority,
        message: message,
        image: image
      }, message)();

      return this;
    } // WEBGL INTERFACE

  }, {
    key: "bind",
    value: function bind() {
      var _ref14 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          _ref14$target = _ref14.target,
          target = _ref14$target === void 0 ? 36160 : _ref14$target;

      this.gl.bindFramebuffer(target, this.handle);
      return this;
    }
  }, {
    key: "unbind",
    value: function unbind() {
      var _ref15 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          _ref15$target = _ref15.target,
          target = _ref15$target === void 0 ? 36160 : _ref15$target;

      this.gl.bindFramebuffer(target, null);
      return this;
    } // PRIVATE METHODS

  }, {
    key: "_createDefaultAttachments",
    value: function _createDefaultAttachments(color, depth, stencil, width, height) {
      var defaultAttachments = null; // Add a color buffer if requested and not supplied

      if (color) {
        var _parameters;

        defaultAttachments = defaultAttachments || {};
        defaultAttachments[36064] = new _texture2d.default(this.gl, {
          id: "".concat(this.id, "-color0"),
          pixels: null,
          // reserves texture memory, but texels are undefined
          format: 6408,
          type: 5121,
          width: width,
          height: height,
          // Note: Mipmapping can be disabled by texture resource when we resize the texture
          // to a non-power-of-two dimenstion (NPOT texture) under WebGL1. To have consistant
          // behavior we always disable mipmaps.
          mipmaps: false,
          // Set MIN and MAG filtering parameters so mipmaps are not used in sampling.
          // Set WRAP modes that support NPOT textures too.
          parameters: (_parameters = {}, (0, _defineProperty2.default)(_parameters, 10241, 9728), (0, _defineProperty2.default)(_parameters, 10240, 9728), (0, _defineProperty2.default)(_parameters, 10242, 33071), (0, _defineProperty2.default)(_parameters, 10243, 33071), _parameters)
        });
      }

      if (depth && stencil) {
        // TODO - handle separate stencil
        defaultAttachments = defaultAttachments || {};
        defaultAttachments[33306] = new _renderbuffer.default(this.gl, {
          id: "".concat(this.id, "-depth-stencil"),
          format: 35056,
          width: width,
          height: 111
        }); // TODO - optional texture
        // new Texture2D(this.gl, {
        //   id: `${this.id}-depth-stencil`,
        //   format: GL.DEPTH24_STENCIL8,
        //   dataFormat: GL.DEPTH_STENCIL,
        //   type: GL.UNSIGNED_INT_24_8,
        //   width,
        //   height,
        //   mipmaps: false
        // });
      } else if (depth) {
        // Add a depth buffer if requested and not supplied
        defaultAttachments = defaultAttachments || {};
        defaultAttachments[36096] = new _renderbuffer.default(this.gl, {
          id: "".concat(this.id, "-depth"),
          format: 33189,
          width: width,
          height: height
        });
      } else if (stencil) {
        // TODO - handle separate stencil
        (0, _assert.default)(false);
      }

      return defaultAttachments;
    }
  }, {
    key: "_unattach",
    value: function _unattach(attachment) {
      var oldAttachment = this.attachments[attachment];

      if (!oldAttachment) {
        return;
      }

      if (oldAttachment instanceof _renderbuffer.default) {
        // render buffer
        this.gl.framebufferRenderbuffer(36160, attachment, 36161, null);
      } else {
        // Must be a texture attachment
        this.gl.framebufferTexture2D(36160, attachment, 3553, null, 0);
      }

      delete this.attachments[attachment];
    }
  }, {
    key: "_attachRenderbuffer",
    value: function _attachRenderbuffer(_ref16) {
      var _ref16$attachment = _ref16.attachment,
          attachment = _ref16$attachment === void 0 ? 36064 : _ref16$attachment,
          renderbuffer = _ref16.renderbuffer;
      var gl = this.gl; // TODO - is the bind needed?
      // gl.bindRenderbuffer(GL.RENDERBUFFER, renderbuffer.handle);

      gl.framebufferRenderbuffer(36160, attachment, 36161, renderbuffer.handle); // TODO - is the unbind needed?
      // gl.bindRenderbuffer(GL.RENDERBUFFER, null);

      this.attachments[attachment] = renderbuffer;
    } // layer = 0 - index into Texture2DArray and Texture3D or face for `TextureCubeMap`
    // level = 0 - mipmapLevel (must be 0 in WebGL1)

  }, {
    key: "_attachTexture",
    value: function _attachTexture(_ref17) {
      var _ref17$attachment = _ref17.attachment,
          attachment = _ref17$attachment === void 0 ? 36064 : _ref17$attachment,
          texture = _ref17.texture,
          layer = _ref17.layer,
          level = _ref17.level;
      var gl = this.gl;
      gl.bindTexture(texture.target, texture.handle);

      switch (texture.target) {
        case 35866:
        case 32879:
          gl.framebufferTextureLayer(36160, attachment, texture.target, level, layer);
          break;

        case 34067:
          // layer must be a cubemap face (or if index, converted to cube map face)
          var face = mapIndexToCubeMapFace(layer);
          gl.framebufferTexture2D(36160, attachment, face, texture.handle, level);
          break;

        case 3553:
          gl.framebufferTexture2D(36160, attachment, 3553, texture.handle, level);
          break;

        default:
          (0, _assert.default)(false, 'Illegal texture type');
      }

      gl.bindTexture(texture.target, null);
      this.attachments[attachment] = texture;
    } // Expects framebuffer to be bound

  }, {
    key: "_setReadBuffer",
    value: function _setReadBuffer(gl, readBuffer) {
      if ((0, _webglUtils.isWebGL2)(gl)) {
        gl.readBuffer(readBuffer);
      } else {
        // Setting to color attachment 0 is a noop, so allow it in WebGL1
        (0, _assert.default)(readBuffer === 36064 || readBuffer === 1029, ERR_MULTIPLE_RENDERTARGETS);
      }

      this.readBuffer = readBuffer;
    } // Expects framebuffer to be bound

  }, {
    key: "_setDrawBuffers",
    value: function _setDrawBuffers(gl, drawBuffers) {
      if ((0, _webglUtils.isWebGL2)(gl)) {
        gl.drawBuffers(drawBuffers);
      } else {
        var ext = gl.getExtension('WEBGL.draw_buffers');

        if (ext) {
          ext.drawBuffersWEBGL(drawBuffers);
        } else {
          // Setting a single draw buffer to color attachment 0 is a noop, allow in WebGL1
          (0, _assert.default)(drawBuffers.length === 1 && (drawBuffers[0] === 36064 || drawBuffers[0] === 1029), ERR_MULTIPLE_RENDERTARGETS);
        }
      }

      this.drawBuffers = drawBuffers;
    } // Attempt to provide workable defaults for WebGL2 symbols under WebGL1
    // null means OK to query
    // TODO - move to webgl1 polyfills

    /* eslint-disable complexity */

  }, {
    key: "_getAttachmentParameterFallback",
    value: function _getAttachmentParameterFallback(pname) {
      var caps = (0, _contextFeatures.getFeatures)(this.gl);

      switch (pname) {
        case 36052:
          // GLint
          return !caps.webgl2 ? 0 : null;

        case 33298: // GLint

        case 33299: // GLint

        case 33300: // GLint

        case 33301: // GLint

        case 33302: // GLint

        case 33303:
          // GLint
          return !caps.webgl2 ? 8 : null;

        case 33297:
          // GLenum
          return !caps.webgl2 ? 5125 : null;

        case 33296:
          return !caps.webgl2 && !caps.EXT_sRGB ? 9729 : null;

        default:
          return null;
      }
    }
    /* eslint-enable complexity */
    // RESOURCE METHODS

  }, {
    key: "_createHandle",
    value: function _createHandle() {
      return this.gl.createFramebuffer();
    }
  }, {
    key: "_deleteHandle",
    value: function _deleteHandle() {
      this.gl.deleteFramebuffer(this.handle);
    }
  }, {
    key: "_bindHandle",
    value: function _bindHandle(handle) {
      return this.gl.bindFramebuffer(36160, handle);
    }
  }, {
    key: "color",
    get: function get() {
      return this.attachments[36064] || null;
    }
  }, {
    key: "texture",
    get: function get() {
      return this.attachments[36064] || null;
    }
  }, {
    key: "depth",
    get: function get() {
      return this.attachments[36096] || this.attachments[33306] || null;
    }
  }, {
    key: "stencil",
    get: function get() {
      return this.attachments[36128] || this.attachments[33306] || null;
    }
  }]);
  return Framebuffer;
}(_resource.default); // PUBLIC METHODS
// Map an index to a cube map face constant


exports.default = Framebuffer;

function mapIndexToCubeMapFace(layer) {
  // TEXTURE_CUBE_MAP_POSITIVE_X is a big value (0x8515)
  // if smaller assume layer is index, otherwise assume it is already a cube map face constant
  return layer < 34069 ? layer + 34069 : layer;
} // Helper METHODS
// Get a string describing the framebuffer error if installed


function _getFrameBufferStatus(status) {
  // Use error mapping if installed
  var STATUS = Framebuffer.STATUS || {};
  return STATUS[status] || "Framebuffer error ".concat(status);
}

var FRAMEBUFFER_ATTACHMENT_PARAMETERS = [36049, // WebGLRenderbuffer or WebGLTexture
36048, // GL.RENDERBUFFER, GL.TEXTURE, GL.NONE
// GL.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE, // GL.TEXTURE_CUBE_MAP_POSITIVE_X, etc.
// GL.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL, // GLint
// EXT_sRGB or WebGL2
33296, // GL.LINEAR, GL.SRBG
// WebGL2
// GL.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER, // GLint
33298, // GLint
33299, // GLint
33300, // GLint
33301, // GLint
33302, // GLint
33303 // GLint
// GL.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE
// GL.FLOAT, GL.INT, GL.UNSIGNED_INT, GL.SIGNED_NORMALIZED, OR GL.UNSIGNED_NORMALIZED.
];
exports.FRAMEBUFFER_ATTACHMENT_PARAMETERS = FRAMEBUFFER_ATTACHMENT_PARAMETERS;
Framebuffer.ATTACHMENT_PARAMETERS = FRAMEBUFFER_ATTACHMENT_PARAMETERS;
},{"@babel/runtime/helpers/esm/defineProperty":"DOnw","@babel/runtime/helpers/esm/slicedToArray":"U1JK","@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/inherits":"NNOi","@babel/runtime/helpers/esm/assertThisInitialized":"b9Zy","./resource":"Uazl","./texture-2d":"jx3X","./renderbuffer":"jd4o","./buffer":"Rc9V","./clear":"Zd9V","../webgl-context":"id7L","../webgl-context/context-features":"pWl5","../webgl-utils/typed-array-utils":"Btp1","../webgl-utils/format-utils":"VJKg","../webgl-utils":"PmJk","../webgl-utils/constants-to-keys":"OZ1B","../utils":"PFG0","../utils/assert":"wYRU"}],"ZcU1":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/assertThisInitialized"));

var _webglUtils = require("../webgl-utils");

var _resource = _interopRequireDefault(require("./resource"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/* eslint-disable no-inline-comments */
var Sampler =
/*#__PURE__*/
function (_Resource) {
  (0, _inherits2.default)(Sampler, _Resource);
  (0, _createClass2.default)(Sampler, null, [{
    key: "isSupported",
    value: function isSupported(gl) {
      return (0, _webglUtils.isWebGL2)(gl);
    }
  }]);

  function Sampler(gl, opts) {
    var _this;

    (0, _classCallCheck2.default)(this, Sampler);
    (0, _webglUtils.assertWebGL2Context)(gl);
    _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Sampler).call(this, gl, opts));
    Object.seal((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
    return _this;
  } // Bind to the same texture unit as a texture to control sampling for that texture
  // @param {GLuint} unit - texture unit index


  (0, _createClass2.default)(Sampler, [{
    key: "bind",
    value: function bind(unit) {
      this.gl.bindSampler(unit, this.handle);
      return this;
    }
  }, {
    key: "unbind",
    value: function unbind(unit) {
      this.gl.bindSampler(unit, null);
      return this;
    } // RESOURCE METHODS

  }, {
    key: "_createHandle",
    value: function _createHandle() {
      return this.gl.createSampler();
    }
  }, {
    key: "_deleteHandle",
    value: function _deleteHandle() {
      this.gl.deleteSampler(this.handle);
    }
  }, {
    key: "_getParameter",
    value: function _getParameter(pname) {
      return this.gl.getSamplerParameter(this.handle, pname);
    }
  }, {
    key: "_setParameter",
    value: function _setParameter(pname, param) {
      // Apparently there are some conversion integer/float rules that made
      // the WebGL committe expose two parameter setting functions in JavaScript.
      // For now, pick the float version for parameters specified as GLfloat.
      switch (pname) {
        case 33082:
        case 33083:
          this.gl.samplerParameterf(this.handle, pname, param);
          break;

        default:
          this.gl.samplerParameteri(this.handle, pname, param);
          break;
      }

      return this;
    }
  }]);
  return Sampler;
}(_resource.default);

exports.default = Sampler;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/inherits":"NNOi","@babel/runtime/helpers/esm/assertThisInitialized":"b9Zy","../webgl-utils":"PmJk","./resource":"Uazl"}],"Eopn":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.parseUniformName = parseUniformName;
exports.getUniformSetter = getUniformSetter;
exports.checkUniformValues = checkUniformValues;
exports.areUniformsEqual = areUniformsEqual;
exports.getUniformCopy = getUniformCopy;

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));

var _framebuffer = _interopRequireDefault(require("./framebuffer"));

var _renderbuffer = _interopRequireDefault(require("./renderbuffer"));

var _texture = _interopRequireDefault(require("./texture"));

var _sampler = _interopRequireDefault(require("./sampler"));

var _utils = require("../utils");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _UNIFORM_SETTERS;

var UNIFORM_SETTERS = (_UNIFORM_SETTERS = {}, (0, _defineProperty2.default)(_UNIFORM_SETTERS, 5126, function (gl, location, value) {
  return gl.uniform1fv(location, toFloatArray(value, 1));
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 35664, function (gl, location, value) {
  return gl.uniform2fv(location, toFloatArray(value, 2));
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 35665, function (gl, location, value) {
  return gl.uniform3fv(location, toFloatArray(value, 3));
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 35666, function (gl, location, value) {
  return gl.uniform4fv(location, toFloatArray(value, 4));
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 5124, function (gl, location, value) {
  return gl.uniform1iv(location, toIntArray(value, 1));
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 35667, function (gl, location, value) {
  return gl.uniform2iv(location, toIntArray(value, 2));
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 35668, function (gl, location, value) {
  return gl.uniform3iv(location, toIntArray(value, 3));
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 35669, function (gl, location, value) {
  return gl.uniform4iv(location, toIntArray(value, 4));
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 35670, function (gl, location, value) {
  return gl.uniform1iv(location, toIntArray(value, 1));
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 35671, function (gl, location, value) {
  return gl.uniform2iv(location, toIntArray(value, 2));
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 35672, function (gl, location, value) {
  return gl.uniform3iv(location, toIntArray(value, 3));
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 35673, function (gl, location, value) {
  return gl.uniform4iv(location, toIntArray(value, 4));
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 35674, function (gl, location, value) {
  return gl.uniformMatrix2fv(location, false, toFloatArray(value, 4));
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 35675, function (gl, location, value) {
  return gl.uniformMatrix3fv(location, false, toFloatArray(value, 9));
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 35676, function (gl, location, value) {
  return gl.uniformMatrix4fv(location, false, toFloatArray(value, 16));
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 35678, function (gl, location, value) {
  return gl.uniform1i(location, value);
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 35680, function (gl, location, value) {
  return gl.uniform1i(location, value);
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 5125, function (gl, location, value) {
  return gl.uniform1uiv(location, toUIntArray(value, 1));
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 36294, function (gl, location, value) {
  return gl.uniform2uiv(location, toUIntArray(value, 2));
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 36295, function (gl, location, value) {
  return gl.uniform3uiv(location, toUIntArray(value, 3));
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 36296, function (gl, location, value) {
  return gl.uniform4uiv(location, toUIntArray(value, 4));
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 35685, function (gl, location, value) {
  return gl.uniformMatrix2x3fv(location, false, toFloatArray(value, 6));
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 35686, function (gl, location, value) {
  return gl.uniformMatrix2x4fv(location, false, toFloatArray(value, 8));
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 35687, function (gl, location, value) {
  return gl.uniformMatrix3x2fv(location, false, toFloatArray(value, 6));
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 35688, function (gl, location, value) {
  return gl.uniformMatrix3x4fv(location, false, toFloatArray(value, 12));
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 35689, function (gl, location, value) {
  return gl.uniformMatrix4x2fv(location, false, toFloatArray(value, 8));
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 35690, function (gl, location, value) {
  return gl.uniformMatrix4x3fv(location, false, toFloatArray(value, 12));
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 35679, function (gl, location, value) {
  return gl.uniform1i(location, value);
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 35682, function (gl, location, value) {
  return gl.uniform1i(location, value);
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 36289, function (gl, location, value) {
  return gl.uniform1i(location, value);
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 36292, function (gl, location, value) {
  return gl.uniform1i(location, value);
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 36293, function (gl, location, value) {
  return gl.uniform1i(location, value);
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 36298, function (gl, location, value) {
  return gl.uniform1i(location, value);
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 36299, function (gl, location, value) {
  return gl.uniform1i(location, value);
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 36300, function (gl, location, value) {
  return gl.uniform1i(location, value);
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 36303, function (gl, location, value) {
  return gl.uniform1i(location, value);
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 36306, function (gl, location, value) {
  return gl.uniform1i(location, value);
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 36307, function (gl, location, value) {
  return gl.uniform1i(location, value);
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 36308, function (gl, location, value) {
  return gl.uniform1i(location, value);
}), (0, _defineProperty2.default)(_UNIFORM_SETTERS, 36311, function (gl, location, value) {
  return gl.uniform1i(location, value);
}), _UNIFORM_SETTERS); // Pre-allocated typed arrays for temporary conversion

var FLOAT_ARRAY = {};
var INT_ARRAY = {};
var UINT_ARRAY = {};
var array1 = [0]; // Functions to ensure the type of uniform values
// TODO - Why is this necessary? The uniform*v funtions can consume Arrays

function toTypedArray(value, uniformLength, Type, cache) {
  // convert boolean uniforms to Number
  if (uniformLength === 1 && typeof value === 'boolean') {
    value = value ? 1 : 0;
  }

  if (Number.isFinite(value)) {
    array1[0] = value;
    value = array1;
  }

  var length = value.length;

  if (length % uniformLength) {
    _utils.log.warn("Uniform size should be multiples of ".concat(uniformLength), value)();
  }

  if (value instanceof Type) {
    return value;
  }

  var result = cache[length];

  if (!result) {
    result = new Type(length);
    cache[length] = result;
  }

  for (var i = 0; i < length; i++) {
    result[i] = value[i];
  }

  return result;
}

function toFloatArray(value, uniformLength) {
  return toTypedArray(value, uniformLength, Float32Array, FLOAT_ARRAY);
}

function toIntArray(value, uniformLength) {
  return toTypedArray(value, uniformLength, Int32Array, INT_ARRAY);
}

function toUIntArray(value, uniformLength) {
  return toTypedArray(value, uniformLength, Uint32Array, UINT_ARRAY);
}

function parseUniformName(name) {
  // Shortcut to avoid redundant or bad matches
  if (name[name.length - 1] !== ']') {
    return {
      name: name,
      length: 1,
      isArray: false
    };
  } // if array name then clean the array brackets


  var UNIFORM_NAME_REGEXP = /([^\[]*)(\[[0-9]+\])?/;
  var matches = name.match(UNIFORM_NAME_REGEXP);

  if (!matches || matches.length < 2) {
    throw new Error("Failed to parse GLSL uniform name ".concat(name));
  }

  return {
    name: matches[1],
    length: matches[2] || 1,
    isArray: Boolean(matches[2])
  };
} // Returns a Magic Uniform Setter

/* eslint-disable complexity */


function getUniformSetter(gl, location, info) {
  var setter = UNIFORM_SETTERS[info.type];

  if (!setter) {
    throw new Error("Unknown GLSL uniform type ".concat(info.type));
  }

  return setter.bind(null, gl, location);
} // Basic checks of uniform values (with or without knowledge of program)
// To facilitate early detection of e.g. undefined values in JavaScript


function checkUniformValues(uniforms, source, uniformMap) {
  for (var uniformName in uniforms) {
    var value = uniforms[uniformName];
    var shouldCheck = !uniformMap || Boolean(uniformMap[uniformName]);

    if (shouldCheck && !checkUniformValue(value)) {
      // Add space to source
      source = source ? "".concat(source, " ") : ''; // Value could be unprintable so write the object on console

      console.error("".concat(source, " Bad uniform ").concat(uniformName), value); // eslint-disable-line

      /* eslint-enable no-console */

      throw new Error("".concat(source, " Bad uniform ").concat(uniformName));
    }
  }

  return true;
} // TODO use type information during validation


function checkUniformValue(value) {
  if (Array.isArray(value) || ArrayBuffer.isView(value)) {
    return checkUniformArray(value);
  } // Check if single value is a number


  if (isFinite(value)) {
    return true;
  } else if (value === true || value === false) {
    return true;
  } else if (value instanceof _texture.default || value instanceof _sampler.default) {
    return true;
  } else if (value instanceof _renderbuffer.default) {
    return true;
  } else if (value instanceof _framebuffer.default) {
    return Boolean(value.texture);
  }

  return false;
}

function checkUniformArray(value) {
  // Check that every element in array is a number, and at least 1 element
  if (value.length === 0) {
    return false;
  }

  var checkLength = Math.min(value.length, 16);

  for (var i = 0; i < checkLength; ++i) {
    if (!Number.isFinite(value[i])) {
      return false;
    }
  }

  return true;
}
/**
 * Given two values of a uniform, returns `true` if they are equal
 */


function areUniformsEqual(uniform1, uniform2) {
  if (Array.isArray(uniform1) || ArrayBuffer.isView(uniform1)) {
    if (!uniform2) {
      return false;
    }

    var len = uniform1.length;

    if (uniform2.length !== len) {
      return false;
    }

    for (var i = 0; i < len; i++) {
      if (uniform1[i] !== uniform2[i]) {
        return false;
      }
    }

    return true;
  }

  return uniform1 === uniform2;
}
/**
 * Creates a copy of the uniform
 */


function getUniformCopy(uniform) {
  if (Array.isArray(uniform) || ArrayBuffer.isView(uniform)) {
    return uniform.slice();
  }

  return uniform;
}
},{"@babel/runtime/helpers/esm/defineProperty":"DOnw","./framebuffer":"RDBm","./renderbuffer":"jd4o","./texture":"kZKt","./sampler":"ZcU1","../utils":"PFG0"}],"Z0Su":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getPrimitiveDrawMode = getPrimitiveDrawMode;
exports.getPrimitiveCount = getPrimitiveCount;
exports.getVertexCount = getVertexCount;
exports.decomposeCompositeGLType = decomposeCompositeGLType;
exports.getCompositeGLType = getCompositeGLType;

var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _COMPOSITE_GL_TYPES;
/* eslint-disable camelcase */


var GL_BYTE = 0x1400;
var GL_UNSIGNED_BYTE = 0x1401;
var GL_SHORT = 0x1402;
var GL_UNSIGNED_SHORT = 0x1403;
var GL_POINTS = 0x0;
var GL_LINES = 0x1;
var GL_LINE_LOOP = 0x2;
var GL_LINE_STRIP = 0x3;
var GL_TRIANGLES = 0x4;
var GL_TRIANGLE_STRIP = 0x5;
var GL_TRIANGLE_FAN = 0x6; // Local constants - these will "collapse" during minification

var GL_FLOAT = 0x1406;
var GL_FLOAT_VEC2 = 0x8b50;
var GL_FLOAT_VEC3 = 0x8b51;
var GL_FLOAT_VEC4 = 0x8b52;
var GL_INT = 0x1404;
var GL_INT_VEC2 = 0x8b53;
var GL_INT_VEC3 = 0x8b54;
var GL_INT_VEC4 = 0x8b55;
var GL_UNSIGNED_INT = 0x1405;
var GL_UNSIGNED_INT_VEC2 = 0x8dc6;
var GL_UNSIGNED_INT_VEC3 = 0x8dc7;
var GL_UNSIGNED_INT_VEC4 = 0x8dc8;
var GL_BOOL = 0x8b56;
var GL_BOOL_VEC2 = 0x8b57;
var GL_BOOL_VEC3 = 0x8b58;
var GL_BOOL_VEC4 = 0x8b59;
var GL_FLOAT_MAT2 = 0x8b5a;
var GL_FLOAT_MAT3 = 0x8b5b;
var GL_FLOAT_MAT4 = 0x8b5c;
var GL_FLOAT_MAT2x3 = 0x8b65;
var GL_FLOAT_MAT2x4 = 0x8b66;
var GL_FLOAT_MAT3x2 = 0x8b67;
var GL_FLOAT_MAT3x4 = 0x8b68;
var GL_FLOAT_MAT4x2 = 0x8b69;
var GL_FLOAT_MAT4x3 = 0x8b6a; // Composite types table

var COMPOSITE_GL_TYPES = (_COMPOSITE_GL_TYPES = {}, (0, _defineProperty2.default)(_COMPOSITE_GL_TYPES, GL_FLOAT, [GL_FLOAT, 1, 'float']), (0, _defineProperty2.default)(_COMPOSITE_GL_TYPES, GL_FLOAT_VEC2, [GL_FLOAT, 2, 'vec2']), (0, _defineProperty2.default)(_COMPOSITE_GL_TYPES, GL_FLOAT_VEC3, [GL_FLOAT, 3, 'vec3']), (0, _defineProperty2.default)(_COMPOSITE_GL_TYPES, GL_FLOAT_VEC4, [GL_FLOAT, 4, 'vec4']), (0, _defineProperty2.default)(_COMPOSITE_GL_TYPES, GL_INT, [GL_INT, 1, 'int']), (0, _defineProperty2.default)(_COMPOSITE_GL_TYPES, GL_INT_VEC2, [GL_INT, 2, 'ivec2']), (0, _defineProperty2.default)(_COMPOSITE_GL_TYPES, GL_INT_VEC3, [GL_INT, 3, 'ivec3']), (0, _defineProperty2.default)(_COMPOSITE_GL_TYPES, GL_INT_VEC4, [GL_INT, 4, 'ivec4']), (0, _defineProperty2.default)(_COMPOSITE_GL_TYPES, GL_UNSIGNED_INT, [GL_UNSIGNED_INT, 1, 'uint']), (0, _defineProperty2.default)(_COMPOSITE_GL_TYPES, GL_UNSIGNED_INT_VEC2, [GL_UNSIGNED_INT, 2, 'uvec2']), (0, _defineProperty2.default)(_COMPOSITE_GL_TYPES, GL_UNSIGNED_INT_VEC3, [GL_UNSIGNED_INT, 3, 'uvec3']), (0, _defineProperty2.default)(_COMPOSITE_GL_TYPES, GL_UNSIGNED_INT_VEC4, [GL_UNSIGNED_INT, 4, 'uvec4']), (0, _defineProperty2.default)(_COMPOSITE_GL_TYPES, GL_BOOL, [GL_FLOAT, 1, 'bool']), (0, _defineProperty2.default)(_COMPOSITE_GL_TYPES, GL_BOOL_VEC2, [GL_FLOAT, 2, 'bvec2']), (0, _defineProperty2.default)(_COMPOSITE_GL_TYPES, GL_BOOL_VEC3, [GL_FLOAT, 3, 'bvec3']), (0, _defineProperty2.default)(_COMPOSITE_GL_TYPES, GL_BOOL_VEC4, [GL_FLOAT, 4, 'bvec4']), (0, _defineProperty2.default)(_COMPOSITE_GL_TYPES, GL_FLOAT_MAT2, [GL_FLOAT, 8, 'mat2']), (0, _defineProperty2.default)(_COMPOSITE_GL_TYPES, GL_FLOAT_MAT2x3, [GL_FLOAT, 8, 'mat2x3']), (0, _defineProperty2.default)(_COMPOSITE_GL_TYPES, GL_FLOAT_MAT2x4, [GL_FLOAT, 8, 'mat2x4']), (0, _defineProperty2.default)(_COMPOSITE_GL_TYPES, GL_FLOAT_MAT3, [GL_FLOAT, 12, 'mat3']), (0, _defineProperty2.default)(_COMPOSITE_GL_TYPES, GL_FLOAT_MAT3x2, [GL_FLOAT, 12, 'mat3x2']), (0, _defineProperty2.default)(_COMPOSITE_GL_TYPES, GL_FLOAT_MAT3x4, [GL_FLOAT, 12, 'mat3x4']), (0, _defineProperty2.default)(_COMPOSITE_GL_TYPES, GL_FLOAT_MAT4, [GL_FLOAT, 16, 'mat4']), (0, _defineProperty2.default)(_COMPOSITE_GL_TYPES, GL_FLOAT_MAT4x2, [GL_FLOAT, 16, 'mat4x2']), (0, _defineProperty2.default)(_COMPOSITE_GL_TYPES, GL_FLOAT_MAT4x3, [GL_FLOAT, 16, 'mat4x3']), _COMPOSITE_GL_TYPES); // Counts the number of complete primitives given a number of vertices and a drawMode

function getPrimitiveDrawMode(drawMode) {
  switch (drawMode) {
    case GL_POINTS:
      return GL_POINTS;

    case GL_LINES:
      return GL_LINES;

    case GL_LINE_STRIP:
      return GL_LINES;

    case GL_LINE_LOOP:
      return GL_LINES;

    case GL_TRIANGLES:
      return GL_TRIANGLES;

    case GL_TRIANGLE_STRIP:
      return GL_TRIANGLES;

    case GL_TRIANGLE_FAN:
      return GL_TRIANGLES;

    default:
      (0, _assert.default)(false);
      return 0;
  }
} // Counts the number of complete "primitives" given a number of vertices and a drawMode


function getPrimitiveCount(_ref) {
  var drawMode = _ref.drawMode,
      vertexCount = _ref.vertexCount;

  switch (drawMode) {
    case GL_POINTS:
    case GL_LINE_LOOP:
      return vertexCount;

    case GL_LINES:
      return vertexCount / 2;

    case GL_LINE_STRIP:
      return vertexCount - 1;

    case GL_TRIANGLES:
      return vertexCount / 3;

    case GL_TRIANGLE_STRIP:
    case GL_TRIANGLE_FAN:
      return vertexCount - 2;

    default:
      (0, _assert.default)(false);
      return 0;
  }
} // Counts the number of vertices after splitting the vertex stream into separate "primitives"


function getVertexCount(_ref2) {
  var drawMode = _ref2.drawMode,
      vertexCount = _ref2.vertexCount;
  var primitiveCount = getPrimitiveCount({
    drawMode: drawMode,
    vertexCount: vertexCount
  });

  switch (getPrimitiveDrawMode(drawMode)) {
    case GL_POINTS:
      return primitiveCount;

    case GL_LINES:
      return primitiveCount * 2;

    case GL_TRIANGLES:
      return primitiveCount * 3;

    default:
      (0, _assert.default)(false);
      return 0;
  }
} // Decomposes a composite type GL.VEC3 into a basic type (GL.FLOAT) and components (3)


function decomposeCompositeGLType(compositeGLType) {
  var typeAndSize = COMPOSITE_GL_TYPES[compositeGLType];

  if (!typeAndSize) {
    return null;
  }

  var _typeAndSize = (0, _slicedToArray2.default)(typeAndSize, 2),
      type = _typeAndSize[0],
      components = _typeAndSize[1];

  return {
    type: type,
    components: components
  };
}

function getCompositeGLType(type, components) {
  switch (type) {
    case GL_BYTE:
    case GL_UNSIGNED_BYTE:
    case GL_SHORT:
    case GL_UNSIGNED_SHORT:
      type = GL_FLOAT;
      break;

    default:
  }

  for (var glType in COMPOSITE_GL_TYPES) {
    var _COMPOSITE_GL_TYPES$g = (0, _slicedToArray2.default)(COMPOSITE_GL_TYPES[glType], 3),
        compType = _COMPOSITE_GL_TYPES$g[0],
        compComponents = _COMPOSITE_GL_TYPES$g[1],
        name = _COMPOSITE_GL_TYPES$g[2];

    if (compType === type && compComponents === components) {
      return {
        glType: glType,
        name: name
      };
    }
  }

  return null;
}
},{"@babel/runtime/helpers/esm/slicedToArray":"U1JK","@babel/runtime/helpers/esm/defineProperty":"DOnw","../utils/assert":"wYRU"}],"bSGD":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _accessor = _interopRequireDefault(require("./accessor"));

var _webglUtils = require("../webgl-utils");

var _attributeUtils = require("../webgl-utils/attribute-utils");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Contains metadata describing attribute configurations for a program's shaders
// Much of this is automatically extracted from shaders after program linking
var ProgramConfiguration =
/*#__PURE__*/
function () {
  function ProgramConfiguration(program) {
    (0, _classCallCheck2.default)(this, ProgramConfiguration);
    this.id = program.id;
    this.attributeInfos = [];
    this.attributeInfosByName = {};
    this.varyingInfos = [];
    this.varyingInfosByName = {};
    Object.seal(this);

    this._readAttributesFromProgram(program);

    this._readVaryingsFromProgram(program);
  }

  (0, _createClass2.default)(ProgramConfiguration, [{
    key: "getAttributeInfo",
    value: function getAttributeInfo(locationOrName) {
      var location = Number(locationOrName);

      if (Number.isFinite(location)) {
        return this.attributeInfos[location];
      }

      return this.attributeInfosByName[locationOrName] || null;
    } // Resolves an attribute name or index to an index

  }, {
    key: "getAttributeLocation",
    value: function getAttributeLocation(locationOrName) {
      var attributeInfo = this.getAttributeInfo(locationOrName);
      return attributeInfo ? attributeInfo.location : -1;
    }
  }, {
    key: "getAttributeAccessor",
    value: function getAttributeAccessor(locationOrName) {
      var attributeInfo = this.getAttributeInfo(locationOrName);
      return attributeInfo ? attributeInfo.accessor : null;
    }
  }, {
    key: "getVaryingInfo",
    value: function getVaryingInfo(locationOrName) {
      var location = Number(locationOrName);

      if (Number.isFinite(location)) {
        return this.varyingInfos[location];
      }

      return this.varyingInfosByName[locationOrName] || null;
    }
  }, {
    key: "getVaryingIndex",
    value: function getVaryingIndex(locationOrName) {
      var varying = this.getVaryingInfo();
      return varying ? varying.location : -1;
    }
  }, {
    key: "getVaryingAccessor",
    value: function getVaryingAccessor(locationOrName) {
      var varying = this.getVaryingInfo();
      return varying ? varying.accessor : null;
    } // PRIVATE METHODS
    // linkProgram needs to have been called, although linking does not need to have been successful

  }, {
    key: "_readAttributesFromProgram",
    value: function _readAttributesFromProgram(program) {
      var gl = program.gl;
      var count = gl.getProgramParameter(program.handle, 35721);

      for (var index = 0; index < count; index++) {
        var _gl$getActiveAttrib = gl.getActiveAttrib(program.handle, index),
            name = _gl$getActiveAttrib.name,
            type = _gl$getActiveAttrib.type,
            size = _gl$getActiveAttrib.size;

        var location = gl.getAttribLocation(program.handle, name); // Add only user provided attributes, for built-in attributes like
        // `gl_InstanceID` locaiton will be < 0

        if (location >= 0) {
          this._addAttribute(location, name, type, size);
        }
      }

      this.attributeInfos.sort(function (a, b) {
        return a.location - b.location;
      });
    } // linkProgram needs to have been called, although linking does not need to have been successful

  }, {
    key: "_readVaryingsFromProgram",
    value: function _readVaryingsFromProgram(program) {
      var gl = program.gl;

      if (!(0, _webglUtils.isWebGL2)(gl)) {
        return;
      }

      var count = gl.getProgramParameter(program.handle, 35971);

      for (var location = 0; location < count; location++) {
        var _gl$getTransformFeedb = gl.getTransformFeedbackVarying(program.handle, location),
            name = _gl$getTransformFeedb.name,
            type = _gl$getTransformFeedb.type,
            size = _gl$getTransformFeedb.size;

        this._addVarying(location, name, type, size);
      }

      this.varyingInfos.sort(function (a, b) {
        return a.location - b.location;
      });
    }
  }, {
    key: "_addAttribute",
    value: function _addAttribute(location, name, compositeType, size) {
      var _decomposeCompositeGL = (0, _attributeUtils.decomposeCompositeGLType)(compositeType),
          type = _decomposeCompositeGL.type,
          components = _decomposeCompositeGL.components;

      var accessor = {
        type: type,
        size: size * components
      };

      this._inferProperties(location, name, accessor);

      var attributeInfo = {
        location: location,
        name: name,
        accessor: new _accessor.default(accessor)
      }; // Base values

      this.attributeInfos.push(attributeInfo);
      this.attributeInfosByName[attributeInfo.name] = attributeInfo; // For quick name based lookup
    } // Extract additional attribute metadata from shader names (based on attribute naming conventions)

  }, {
    key: "_inferProperties",
    value: function _inferProperties(location, name, accessor) {
      if (/instance/i.test(name)) {
        // Any attribute containing the word "instance" will be assumed to be instanced
        accessor.divisor = 1;
      }
    }
  }, {
    key: "_addVarying",
    value: function _addVarying(location, name, compositeType, size) {
      var _decomposeCompositeGL2 = (0, _attributeUtils.decomposeCompositeGLType)(compositeType),
          type = _decomposeCompositeGL2.type,
          components = _decomposeCompositeGL2.components;

      var accessor = new _accessor.default({
        type: type,
        size: size * components
      });
      var varying = {
        location: location,
        name: name,
        accessor: accessor
      }; // Base values

      this.varyingInfos.push(varying);
      this.varyingInfosByName[varying.name] = varying; // For quick name based lookup
    }
  }]);
  return ProgramConfiguration;
}();

exports.default = ProgramConfiguration;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","./accessor":"SwrD","../webgl-utils":"PmJk","../webgl-utils/attribute-utils":"Z0Su"}],"hOuK":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/get"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/assertThisInitialized"));

var _resource = _interopRequireDefault(require("./resource"));

var _texture = _interopRequireDefault(require("./texture"));

var _framebuffer = _interopRequireDefault(require("./framebuffer"));

var _uniforms = require("./uniforms");

var _shader = require("./shader");

var _programConfiguration = _interopRequireDefault(require("./program-configuration"));

var _contextState = require("../webgl-context/context-state");

var _uniforms2 = require("../webgl/uniforms");

var _webglUtils = require("../webgl-utils");

var _attributeUtils = require("../webgl-utils/attribute-utils");

var _constantsToKeys = require("../webgl-utils/constants-to-keys");

var _utils = require("../utils");

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/* eslint-disable no-inline-comments */
var LOG_PROGRAM_PERF_PRIORITY = 4; // const GL_INTERLEAVED_ATTRIBS = 0x8C8C;

var GL_SEPARATE_ATTRIBS = 0x8c8d;

var Program =
/*#__PURE__*/
function (_Resource) {
  (0, _inherits2.default)(Program, _Resource);

  function Program(gl) {
    var _this;

    var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, Program);
    _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Program).call(this, gl, opts));

    _this.stubRemovedMethods('Program', 'v6.0', ['setVertexArray', 'setAttributes', 'setBuffers', 'unsetBuffers', 'use', 'getUniformCount', 'getUniformInfo', 'getUniformLocation', 'getUniformValue', 'getVarying', 'getFragDataLocation', 'getAttachedShaders', 'getAttributeCount', 'getAttributeLocation', 'getAttributeInfo']); // Experimental flag to avoid deleting Program object while it is cached


    _this._isCached = false;

    _this.initialize(opts);

    Object.seal((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));

    _this._setId(opts.id);

    return _this;
  }

  (0, _createClass2.default)(Program, [{
    key: "initialize",
    value: function initialize() {
      var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      var vs = props.vs,
          fs = props.fs,
          varyings = props.varyings,
          _props$bufferMode = props.bufferMode,
          bufferMode = _props$bufferMode === void 0 ? GL_SEPARATE_ATTRIBS : _props$bufferMode; // Create shaders if needed

      this.vs = typeof vs === 'string' ? new _shader.VertexShader(this.gl, {
        id: "".concat(props.id, "-vs"),
        source: vs
      }) : vs;
      this.fs = typeof fs === 'string' ? new _shader.FragmentShader(this.gl, {
        id: "".concat(props.id, "-fs"),
        source: fs
      }) : fs;
      (0, _assert.default)(this.vs instanceof _shader.VertexShader);
      (0, _assert.default)(this.fs instanceof _shader.FragmentShader); // uniforms

      this.uniforms = {};
      this.samplers = {}; // Setup varyings if supplied

      if (varyings) {
        (0, _webglUtils.assertWebGL2Context)(this.gl);
        this.varyings = varyings;
        this.gl.transformFeedbackVaryings(this.handle, varyings, bufferMode);
      }

      this._compileAndLink();

      this._readUniformLocationsFromLinkedProgram();

      this.configuration = new _programConfiguration.default(this);
      return this.setProps(props);
    }
  }, {
    key: "delete",
    value: function _delete() {
      var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

      if (this._isCached) {
        // This object is cached, do not delete
        return this;
      }

      return (0, _get2.default)((0, _getPrototypeOf2.default)(Program.prototype), "delete", this).call(this, opts);
    }
  }, {
    key: "setProps",
    value: function setProps(props) {
      if ('uniforms' in props) {
        this.setUniforms(props.uniforms, props.samplers);
      }

      return this;
    } // Another thing about the WebGL API is that there are so many ways to draw things.
    // This function unifies those ways into a single call using common parameters with sane defaults

  }, {
    key: "draw",
    value: function draw(_ref) {
      var _this2 = this;

      var logPriority = _ref.logPriority,
          _ref$drawMode = _ref.drawMode,
          drawMode = _ref$drawMode === void 0 ? 4 : _ref$drawMode,
          vertexCount = _ref.vertexCount,
          _ref$offset = _ref.offset,
          offset = _ref$offset === void 0 ? 0 : _ref$offset,
          start = _ref.start,
          end = _ref.end,
          _ref$isIndexed = _ref.isIndexed,
          isIndexed = _ref$isIndexed === void 0 ? false : _ref$isIndexed,
          _ref$indexType = _ref.indexType,
          indexType = _ref$indexType === void 0 ? 5123 : _ref$indexType,
          _ref$isInstanced = _ref.isInstanced,
          isInstanced = _ref$isInstanced === void 0 ? false : _ref$isInstanced,
          _ref$instanceCount = _ref.instanceCount,
          instanceCount = _ref$instanceCount === void 0 ? 0 : _ref$instanceCount,
          _ref$vertexArray = _ref.vertexArray,
          vertexArray = _ref$vertexArray === void 0 ? null : _ref$vertexArray,
          transformFeedback = _ref.transformFeedback,
          framebuffer = _ref.framebuffer,
          _ref$parameters = _ref.parameters,
          parameters = _ref$parameters === void 0 ? {} : _ref$parameters,
          _ref$uniforms = _ref.uniforms,
          uniforms = _ref$uniforms === void 0 ? {} : _ref$uniforms,
          _ref$samplers = _ref.samplers,
          samplers = _ref$samplers === void 0 ? {} : _ref$samplers;

      if (logPriority !== undefined) {
        var fb = framebuffer ? framebuffer.id : 'default';
        var message = "mode=".concat((0, _constantsToKeys.getKey)(this.gl, drawMode), " verts=").concat(vertexCount, " ") + "instances=".concat(instanceCount, " indexType=").concat((0, _constantsToKeys.getKey)(this.gl, indexType), " ") + "isInstanced=".concat(isInstanced, " isIndexed=").concat(isIndexed, " ") + "Framebuffer=".concat(fb);

        _utils.log.log(logPriority, message)();
      }

      this.gl.useProgram(this.handle); // TODO - move vertex array binding and transform feedback binding to withParameters?

      (0, _assert.default)(vertexArray);
      vertexArray.bindForDraw(vertexCount, instanceCount, function () {
        if (uniforms) {
          _utils.log.deprecated('Program.draw({uniforms})', 'Program.setUniforms(uniforms)');

          _this2.setUniforms(uniforms, samplers);
        }

        _this2._bindTextures();

        if (framebuffer !== undefined) {
          parameters = Object.assign({}, parameters, {
            framebuffer: framebuffer
          });
        }

        if (transformFeedback) {
          var primitiveMode = (0, _attributeUtils.getPrimitiveDrawMode)(drawMode);
          transformFeedback.begin(primitiveMode);
        }

        (0, _contextState.withParameters)(_this2.gl, parameters, function () {
          // TODO - Use polyfilled WebGL2RenderingContext instead of ANGLE extension
          if (isIndexed && isInstanced) {
            _this2.gl.drawElementsInstanced(drawMode, vertexCount, indexType, offset, instanceCount);
          } else if (isIndexed && (0, _webglUtils.isWebGL2)(_this2.gl) && !isNaN(start) && !isNaN(end)) {
            _this2.gl.drawRangeElements(drawMode, start, end, vertexCount, indexType, offset);
          } else if (isIndexed) {
            _this2.gl.drawElements(drawMode, vertexCount, indexType, offset);
          } else if (isInstanced) {
            _this2.gl.drawArraysInstanced(drawMode, offset, vertexCount, instanceCount);
          } else {
            _this2.gl.drawArrays(drawMode, offset, vertexCount);
          }
        });

        if (transformFeedback) {
          transformFeedback.end();
        }
      });
      return this;
    }
  }, {
    key: "setSamplers",
    value: function setSamplers(samplers) {
      Object.assign(this.samplers, samplers);
    }
  }, {
    key: "setUniforms",
    value: function setUniforms() {
      var uniforms = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      var samplers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

      var _onChangeCallback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {}; // Simple change detection - if all uniforms are unchanged, do nothing
      // TODO - Disabled since it interferes with textures
      // we must still rebind texture units to current program's textures before drawing
      // If modifying, test with `picking` example on website


      var somethingChanged = false;
      var changedUniforms = {};

      for (var key in uniforms) {
        if (!(0, _uniforms2.areUniformsEqual)(this.uniforms[key], uniforms[key])) {
          somethingChanged = true;
          changedUniforms[key] = uniforms[key];
          this.uniforms[key] = (0, _uniforms2.getUniformCopy)(uniforms[key]);
        }
      }

      if (somethingChanged) {
        _onChangeCallback();

        (0, _uniforms2.checkUniformValues)(changedUniforms, this.id, this._uniformSetters);
        Object.assign(this.samplers, samplers);

        this._setUniforms(changedUniforms);
      }

      return this;
    } // PRIVATE METHODS
    // This needs to be done before every draw call

  }, {
    key: "_bindTextures",
    value: function _bindTextures() {
      for (var uniformName in this.uniforms) {
        var uniformSetter = this._uniformSetters[uniformName];

        if (uniformSetter && uniformSetter.textureIndex !== undefined) {
          var uniform = this.uniforms[uniformName];
          var sampler = this.samplers[uniformName];

          if (uniform instanceof _framebuffer.default) {
            uniform = uniform.texture;
          }

          if (uniform instanceof _texture.default) {
            // Bind texture to index
            uniform.bind(uniformSetter.textureIndex);
          } // Bind a sampler (if supplied) to index


          if (sampler) {
            sampler.bind(uniformSetter.textureIndex);
          }
        }
      }
    } // Apply a set of uniform values to a program
    // Only uniforms actually present in the linked program will be updated.

    /* eslint-disable max-depth */

  }, {
    key: "_setUniforms",
    value: function _setUniforms(uniforms) {
      this.gl.useProgram(this.handle);

      for (var uniformName in uniforms) {
        var uniform = uniforms[uniformName];
        var uniformSetter = this._uniformSetters[uniformName];

        if (uniformSetter) {
          if (uniform instanceof _framebuffer.default) {
            uniform = uniform.texture;
          }

          if (uniform instanceof _texture.default) {
            if (uniformSetter.textureIndex === undefined) {
              uniformSetter.textureIndex = this._textureIndexCounter++;
            } // Bind texture to index


            var texture = uniform;
            var textureIndex = uniformSetter.textureIndex;
            texture.bind(textureIndex); // Set the uniform sampler to the texture index

            uniformSetter(textureIndex);
          } else {
            // Just set the value
            uniformSetter(uniform);
          }
        }
      }

      return this;
    } // RESOURCE METHODS

  }, {
    key: "_createHandle",
    value: function _createHandle() {
      return this.gl.createProgram();
    }
  }, {
    key: "_deleteHandle",
    value: function _deleteHandle() {
      this.gl.deleteProgram(this.handle);
    } // Extract opts needed to initialize a `Program` from an independently created WebGLProgram handle

  }, {
    key: "_getOptionsFromHandle",
    value: function _getOptionsFromHandle(handle) {
      var shaderHandles = this.gl.getAttachedShaders(handle);
      var opts = {};
      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = shaderHandles[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var shaderHandle = _step.value;
          var type = this.gl.getShaderParameter(this.handle, 35663);

          switch (type) {
            case 35633:
              opts.vs = new _shader.VertexShader({
                handle: shaderHandle
              });
              break;

            case 35632:
              opts.fs = new _shader.FragmentShader({
                handle: shaderHandle
              });
              break;

            default:
          }
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return != null) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }

      return opts;
    }
  }, {
    key: "_getParameter",
    value: function _getParameter(pname) {
      return this.gl.getProgramParameter(this.handle, pname);
    } // If program is not named, name it after shader names
    // TODO - this.id will already have been initialized

  }, {
    key: "_setId",
    value: function _setId(id) {
      if (!id) {
        var programName = this._getName();

        this.id = (0, _utils.uid)(programName);
      }
    } // Generate a default name for the program based on names of the shaders

  }, {
    key: "_getName",
    value: function _getName() {
      var programName = this.vs.getName() || this.fs.getName();
      programName = programName.replace(/shader/i, '');
      programName = programName ? "".concat(programName, "-program") : 'program';
      return programName;
    }
  }, {
    key: "_compileAndLink",
    value: function _compileAndLink() {
      var gl = this.gl;
      gl.attachShader(this.handle, this.vs.handle);
      gl.attachShader(this.handle, this.fs.handle);

      _utils.log.time(LOG_PROGRAM_PERF_PRIORITY, "linkProgram for ".concat(this._getName()))();

      gl.linkProgram(this.handle);

      _utils.log.timeEnd(LOG_PROGRAM_PERF_PRIORITY, "linkProgram for ".concat(this._getName()))(); // Avoid checking program linking error in production


      if (gl.debug || _utils.log.priority > 0) {
        gl.validateProgram(this.handle);
        var linked = gl.getProgramParameter(this.handle, 35714);

        if (!linked) {
          throw new Error("Error linking: ".concat(gl.getProgramInfoLog(this.handle)));
        }
      }
    } // query uniform locations and build name to setter map.

  }, {
    key: "_readUniformLocationsFromLinkedProgram",
    value: function _readUniformLocationsFromLinkedProgram() {
      var gl = this.gl;
      this._uniformSetters = {};
      this._uniformCount = this._getParameter(35718);

      for (var i = 0; i < this._uniformCount; i++) {
        var info = this.gl.getActiveUniform(this.handle, i);

        var _parseUniformName = (0, _uniforms.parseUniformName)(info.name),
            name = _parseUniformName.name,
            isArray = _parseUniformName.isArray;

        var location = gl.getUniformLocation(this.handle, name);
        this._uniformSetters[name] = (0, _uniforms.getUniformSetter)(gl, location, info, isArray);
      }

      this._textureIndexCounter = 0;
    } // stub for shader chache, should reset uniforms to default valiues

  }, {
    key: "reset",
    value: function reset() {} // TO BE REMOVED in v7?
    // Rretrieves information about active uniforms identifed by their indices (`uniformIndices`)
    // https://
    // developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/getActiveUniforms

  }, {
    key: "getActiveUniforms",
    value: function getActiveUniforms(uniformIndices, pname) {
      return this.gl.getActiveUniforms(this.handle, uniformIndices, pname);
    } // Retrieves the index of a uniform block

  }, {
    key: "getUniformBlockIndex",
    value: function getUniformBlockIndex(blockName) {
      return this.gl.getUniformBlockIndex(this.handle, blockName);
    } // Retrieves information about an active uniform block (`blockIndex`)
    // https://
    // developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/getActiveUniformBlockParameter

  }, {
    key: "getActiveUniformBlockParameter",
    value: function getActiveUniformBlockParameter(blockIndex, pname) {
      return this.gl.getActiveUniformBlockParameter(this.handle, blockIndex, pname);
    } // Binds a uniform block (`blockIndex`) to a specific binding point (`blockBinding`)

  }, {
    key: "uniformBlockBinding",
    value: function uniformBlockBinding(blockIndex, blockBinding) {
      this.gl.uniformBlockBinding(this.handle, blockIndex, blockBinding);
    }
  }]);
  return Program;
}(_resource.default);

exports.default = Program;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/get":"Q3cA","@babel/runtime/helpers/esm/inherits":"NNOi","@babel/runtime/helpers/esm/assertThisInitialized":"b9Zy","./resource":"Uazl","./texture":"kZKt","./framebuffer":"RDBm","./uniforms":"Eopn","./shader":"pOhm","./program-configuration":"bSGD","../webgl-context/context-state":"cIIw","../webgl/uniforms":"Eopn","../webgl-utils":"PmJk","../webgl-utils/attribute-utils":"Z0Su","../webgl-utils/constants-to-keys":"OZ1B","../utils":"PFG0","../utils/assert":"wYRU"}],"SG5X":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/assertThisInitialized"));

var _resource = _interopRequireDefault(require("./resource"));

var _webglUtils = require("../webgl-utils");

var _queryManager = _interopRequireDefault(require("../webgl-utils/query-manager"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var FenceSync =
/*#__PURE__*/
function (_Resource) {
  (0, _inherits2.default)(FenceSync, _Resource);
  /*
   * @class
   * @param {WebGL2RenderingContext} gl
   */

  function FenceSync(gl, opts) {
    var _this;

    (0, _classCallCheck2.default)(this, FenceSync);
    (0, _webglUtils.assertWebGL2Context)(gl);
    _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(FenceSync).call(this, gl, opts)); // query manager needs a promise field

    _this.promise = null;
    Object.seal((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
    return _this;
  }
  /**
   * The method is a no-op in the absence of the possibility of
   * synchronizing between multiple GL contexts.
   * Prevent commands from being added to GPU command queue.
   * Note: commands can still be buffered in driver.
   *
   * @param {GLbitfield} flags
   * @param {GLint64} timeout
   * @return {Sync} status
   */


  (0, _createClass2.default)(FenceSync, [{
    key: "wait",
    value: function wait() {
      var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          _ref$flags = _ref.flags,
          flags = _ref$flags === void 0 ? 0 : _ref$flags,
          _ref$timeout = _ref.timeout,
          timeout = _ref$timeout === void 0 ? -1 : _ref$timeout;

      this.gl.waitSync(this.handle, flags, timeout);
      return this;
    }
    /**
     * Block all CPU operations until fence is signalled
     * @param {GLbitfield} flags
     * @param {GLint64} timeout
     * @return {GLenum} result
     */

  }, {
    key: "clientWait",
    value: function clientWait(_ref2) {
      var _ref2$flags = _ref2.flags,
          flags = _ref2$flags === void 0 ? 1 : _ref2$flags,
          timeout = _ref2.timeout;
      var result = this.gl.clientWaitSync(this.handle, flags, timeout); // TODO - map to boolean?

      switch (result) {
        case 37146:
          // Indicates that sync object was signaled when this method was called.
          break;

        case 37147:
          // Indicates that timeout time passed, sync object did not become signaled
          break;

        case 37148:
          // Indicates that sync object was signaled before timeout expired.
          break;

        case 37149:
          // Indicates that an error occurred during execution.
          break;

        default:
      }

      return result;
    }
  }, {
    key: "cancel",
    value: function cancel() {
      _queryManager.default.cancelQuery(this);
    }
  }, {
    key: "isSignaled",
    value: function isSignaled() {
      return this.getParameter(37140) === 37145;
    } // TODO - Query manager needs these?

  }, {
    key: "isResultAvailable",
    value: function isResultAvailable() {
      return this.isSignaled();
    }
  }, {
    key: "getResult",
    value: function getResult() {
      return this.isSignaled();
    }
  }, {
    key: "getParameter",
    value: function getParameter(pname) {
      return this.gl.getSyncParameter(this.handle, pname);
    } // PRIVATE METHODS

  }, {
    key: "_createHandle",
    value: function _createHandle() {
      return this.gl.fenceSync(37143, 0);
    }
  }, {
    key: "_deleteHandle",
    value: function _deleteHandle() {
      _queryManager.default.deleteQuery(this);

      this.gl.deleteSync(this.handle);
    }
  }]);
  return FenceSync;
}(_resource.default);

exports.default = FenceSync;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","@babel/runtime/helpers/esm/assertThisInitialized":"b9Zy","./resource":"Uazl","../webgl-utils":"PmJk","../webgl-utils/query-manager":"KGvr"}],"kye1":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/assertThisInitialized"));

var _resource = _interopRequireDefault(require("./resource"));

var _contextFeatures = require("../webgl-context/context-features");

var _webglUtils = require("../webgl-utils");

var _queryManager = _interopRequireDefault(require("../webgl-utils/query-manager"));

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// WebGL2 Query (also handles disjoint timer extensions)
var noop = function noop(x) {
  return x;
};

var ERR_GPU_DISJOINT = 'Disjoint GPU operation invalidated timer queries';
var ERR_TIMER_QUERY_NOT_SUPPORTED = 'Timer queries require "EXT_disjoint_timer_query" extension';
var GL_QUERY_COUNTER_BITS_EXT = 0x8864; // # bits in query result for the given target.

var GL_QUERY_RESULT = 0x8866; // Returns a GLuint containing the query result.

var GL_QUERY_RESULT_AVAILABLE = 0x8867; // whether query result is available.

var GL_TIME_ELAPSED_EXT = 0x88bf; // Elapsed time (in nanoseconds).

var GL_TIMESTAMP_EXT = 0x8e28; // The current time.

var GL_GPU_DISJOINT_EXT = 0x8fbb; // Whether GPU performed any disjoint operation.

var GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 0x8c88; // #primitives written to feedback buffers

var GL_ANY_SAMPLES_PASSED = 0x8c2f; // Occlusion query (if drawing passed depth test)

var GL_ANY_SAMPLES_PASSED_CONSERVATIVE = 0x8d6a; // Occlusion query less accurate/faster version

var Query =
/*#__PURE__*/
function (_Resource) {
  (0, _inherits2.default)(Query, _Resource);
  (0, _createClass2.default)(Query, null, [{
    key: "isSupported",
    // Returns true if Query is supported by the WebGL implementation
    // Can also check whether timestamp queries are available.
    value: function isSupported(gl) {
      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
      var webgl2 = (0, _webglUtils.isWebGL2)(gl); // Initial value

      var hasTimerQuery = (0, _contextFeatures.hasFeatures)(gl, _contextFeatures.FEATURES.TIMER_QUERY);
      var supported = webgl2 || hasTimerQuery;
      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = opts[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var key = _step.value;

          switch (key) {
            case 'queries':
              supported = supported && webgl2;
              break;

            case 'timers':
              supported = supported && hasTimerQuery;
              break;

            case 'timestamps':
              var queryCounterBits = hasTimerQuery ? gl.getQuery(GL_TIMESTAMP_EXT, GL_QUERY_COUNTER_BITS_EXT) : 0;
              supported = supported && queryCounterBits > 0;
              break;

            default:
              (0, _assert.default)(false);
          }
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return != null) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }

      return supported;
    } // Create a query class

  }]);

  function Query(gl) {
    var _this;

    var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, Query);
    _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Query).call(this, gl, opts));
    var _opts$onComplete = opts.onComplete,
        onComplete = _opts$onComplete === void 0 ? noop : _opts$onComplete,
        _opts$onError = opts.onError,
        onError = _opts$onError === void 0 ? noop : _opts$onError;
    _this.target = null;
    _this.onComplete = onComplete;
    _this.onError = onError; // query manager needs a promise field

    _this.promise = null;
    Object.seal((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
    return _this;
  } // Shortcut for timer query (dependent on extension in both WebGL1 and 2)
  // Measures GPU time delta between this call and a matching `end` call in the
  // GPU instruction stream.


  (0, _createClass2.default)(Query, [{
    key: "beginTimeElapsedQuery",
    value: function beginTimeElapsedQuery() {
      return this.begin(GL_TIME_ELAPSED_EXT);
    } // Shortcut for occlusion queries

  }, {
    key: "beginOcclusionQuery",
    value: function beginOcclusionQuery() {
      var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          _ref$conservative = _ref.conservative,
          conservative = _ref$conservative === void 0 ? false : _ref$conservative;

      return this.begin(conservative ? GL_ANY_SAMPLES_PASSED_CONSERVATIVE : GL_ANY_SAMPLES_PASSED);
    } // Shortcut for transformFeedbackQuery

  }, {
    key: "beginTransformFeedbackQuery",
    value: function beginTransformFeedbackQuery() {
      return this.begin(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN);
    } // Generates a GPU time stamp when the GPU instruction stream reaches this instruction.
    // To measure time deltas, two timestamp queries are needed.
    // Note: timestamp() queries may not be available even when the timer query extension is.

  }, {
    key: "getTimestamp",
    value: function getTimestamp() {
      _queryManager.default.beginQuery(this, this.onComplete, this.onError);

      try {
        this.gl.queryCounter(this.handle, GL_TIMESTAMP_EXT);
      } catch (error) {
        _queryManager.default.rejectQuery(this, ERR_TIMER_QUERY_NOT_SUPPORTED);
      }

      return this;
    } // Due to OpenGL API limitations, after calling `begin()` on one Query
    // instance, `end()` must be called on that same instance before
    // calling `begin()` on another query. While there can be multiple
    // outstanding queries representing disjoint `begin()`/`end()` intervals.
    // It is not possible to interleave or overlap `begin` and `end` calls.

  }, {
    key: "begin",
    value: function begin(target) {
      // - Triggering a new query when a Query is already tracking an
      //   unresolved query causes that query to be cancelled.
      _queryManager.default.beginQuery(this, this.onComplete, this.onError);

      this.target = target;

      try {
        this.gl.beginQuery(this.target, this.handle);
      } catch (error) {
        _queryManager.default.rejectQuery(this, 'Query not supported');
      }

      return this;
    } // ends the current query

  }, {
    key: "end",
    value: function end() {
      // Note: calling end does not affect the pending promise
      if (this.target) {
        this.gl.endQuery(this.target);
        this.target = null;
      }

      return this;
    } // Cancels a pending query

  }, {
    key: "cancel",
    value: function cancel() {
      this.end();

      _queryManager.default.cancelQuery(this);

      return this;
    } // Returns true if the query result is available

  }, {
    key: "isResultAvailable",
    value: function isResultAvailable() {
      return this.gl.getQueryParameter(this.handle, GL_QUERY_RESULT_AVAILABLE);
    } // Returns the query result, converted to milliseconds to match JavaScript conventions.
    // TODO - what about non-timer queries

  }, {
    key: "getResult",
    value: function getResult() {
      var result = this.gl.getQueryParameter(this.handle, GL_QUERY_RESULT);
      return Number.isFinite(result) ? result / 1e6 : 0;
    }
  }, {
    key: "_createHandle",
    value: function _createHandle() {
      return Query.isSupported(this.gl) ? this.gl.createQuery() : null;
    }
  }, {
    key: "_deleteHandle",
    value: function _deleteHandle() {
      _queryManager.default.deleteQuery(this);

      this.gl.deleteQuery(this.handle);
    }
  }], [{
    key: "poll",
    value: function poll(gl) {
      _queryManager.default.poll(gl);
    }
  }]);
  return Query;
}(_resource.default); // NOTE: This call lets the queryManager know how to detect disjoint GPU state
// It will check dsjoint state on polls and before adding a new query
// and reject any outstanding TimerQueries with our supplied error message.


exports.default = Query;

_queryManager.default.setInvalidator({
  queryType: Query,
  errorMessage: ERR_GPU_DISJOINT,
  // Note: Querying the disjoint state resets it
  checkInvalid: function checkInvalid(gl) {
    return gl.getParameter(GL_GPU_DISJOINT_EXT);
  }
});
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/inherits":"NNOi","@babel/runtime/helpers/esm/assertThisInitialized":"b9Zy","./resource":"Uazl","../webgl-context/context-features":"pWl5","../webgl-utils":"PmJk","../webgl-utils/query-manager":"KGvr","../utils/assert":"wYRU"}],"LuHO":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _texture = _interopRequireDefault(require("../webgl/texture"));

var _webglUtils = require("../webgl-utils");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Texture2DArray =
/*#__PURE__*/
function (_Texture) {
  (0, _inherits2.default)(Texture2DArray, _Texture);
  (0, _createClass2.default)(Texture2DArray, null, [{
    key: "isSupported",
    value: function isSupported(gl) {
      return (0, _webglUtils.isWebGL2)(gl);
    }
  }]);

  function Texture2DArray(gl) {
    var _this;

    var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, Texture2DArray);
    _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Texture2DArray).call(this, gl, opts));
    throw new Error('Texture2DArray not yet implemented');
    return _this;
  }

  return Texture2DArray;
}(_texture.default);

exports.default = Texture2DArray;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/inherits":"NNOi","../webgl/texture":"kZKt","../webgl-utils":"PmJk"}],"oKAe":[function(require,module,exports) {

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/assertThisInitialized"));

var _resource = _interopRequireDefault(require("./resource"));

var _buffer = _interopRequireDefault(require("./buffer"));

var _webglUtils = require("../webgl-utils");

var _utils = require("../utils");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// NOTE: The `bindOnUse` flag is a major workaround:
// See https://github.com/KhronosGroup/WebGL/issues/2346
var TransformFeedback =
/*#__PURE__*/
function (_Resource) {
  (0, _inherits2.default)(TransformFeedback, _Resource);
  (0, _createClass2.default)(TransformFeedback, null, [{
    key: "isSupported",
    value: function isSupported(gl) {
      return (0, _webglUtils.isWebGL2)(gl);
    }
  }]);

  function TransformFeedback(gl) {
    var _this;

    var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, TransformFeedback);
    (0, _webglUtils.assertWebGL2Context)(gl);
    _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(TransformFeedback).call(this, gl, props));

    _this.initialize(props);

    _this.stubRemovedMethods('TransformFeedback', 'v6.0', ['pause', 'resume']);

    Object.seal((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
    return _this;
  }

  (0, _createClass2.default)(TransformFeedback, [{
    key: "initialize",
    value: function initialize() {
      var _this2 = this;

      var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      this.buffers = {};
      this.unused = {};
      this.configuration = null;
      this.bindOnUse = true; // Unbind any currently bound buffers

      if (!(0, _utils.isObjectEmpty)(this.buffers)) {
        this.bind(function () {
          return _this2._unbindBuffers();
        });
      }

      this.setProps(props);
      return this;
    }
  }, {
    key: "setProps",
    value: function setProps(props) {
      if ('program' in props) {
        this.configuration = props.program && props.program.configuration;
      }

      if ('configuration' in props) {
        this.configuration = props.configuration;
      }

      if ('bindOnUse' in props) {
        props = props.bindOnUse;
      }

      if ('buffers' in props) {
        this.setBuffers(props.buffers);
      }
    }
  }, {
    key: "setBuffers",
    value: function setBuffers() {
      var _this3 = this;

      var buffers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      this.bind(function () {
        for (var bufferName in buffers) {
          _this3.setBuffer(bufferName, buffers[bufferName]);
        }
      });
      return this;
    }
  }, {
    key: "setBuffer",
    value: function setBuffer(locationOrName, bufferOrParams) {
      var _this4 = this;

      var location = this._getVaryingIndex(locationOrName);

      var _this$_getBufferParam = this._getBufferParams(bufferOrParams),
          buffer = _this$_getBufferParam.buffer,
          sizeInBytes = _this$_getBufferParam.sizeInBytes,
          offsetInBytes = _this$_getBufferParam.offsetInBytes;

      if (location < 0) {
        this.unused[locationOrName] = buffer;

        _utils.log.warn(function () {
          return "".concat(_this4.id, " unused varying buffer ").concat(locationOrName);
        })();

        return this;
      }

      this.buffers[location] = bufferOrParams; // Need to avoid chrome bug where buffer that is already bound to a different target
      // cannot be bound to 'TRANSFORM_FEEDBACK_BUFFER' target.

      if (!this.bindOnUse) {
        this._bindBuffer(location, buffer, offsetInBytes, sizeInBytes);
      }

      return this;
    }
  }, {
    key: "begin",
    value: function begin() {
      var primitiveMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
      this.gl.bindTransformFeedback(36386, this.handle);

      this._bindBuffers();

      this.gl.beginTransformFeedback(primitiveMode);
      return this;
    }
  }, {
    key: "end",
    value: function end() {
      this.gl.endTransformFeedback();

      this._unbindBuffers();

      this.gl.bindTransformFeedback(36386, null);
      return this;
    } // PRIVATE METHODS

  }, {
    key: "_getBufferParams",
    value: function _getBufferParams(bufferOrParams) {
      var offsetInBytes;
      var sizeInBytes;
      var buffer;

      if (bufferOrParams instanceof _buffer.default === false) {
        buffer = bufferOrParams.buffer;
        sizeInBytes = bufferOrParams.sizeInBytes;
        offsetInBytes = bufferOrParams.offsetInBytes;
      } else {
        buffer = bufferOrParams;
      } // to use bindBufferRange, either offset or size must be specified, use default value for the other.


      if (offsetInBytes !== undefined || sizeInBytes !== undefined) {
        offsetInBytes = offsetInBytes || 0;
        sizeInBytes = sizeInBytes || buffer.byteLength - offsetInBytes;
      }

      return {
        buffer: buffer,
        offsetInBytes: offsetInBytes,
        sizeInBytes: sizeInBytes
      };
    }
  }, {
    key: "_getVaryingInfo",
    value: function _getVaryingInfo(locationOrName) {
      return this.configuration && this.configuration.getVaryingInfo(locationOrName);
    }
  }, {
    key: "_getVaryingIndex",
    value: function _getVaryingIndex(locationOrName) {
      if (this.configuration) {
        return this.configuration.getVaryingInfo(locationOrName).location;
      }

      var location = Number(locationOrName);
      return Number.isFinite(location) ? location : -1;
    } // Need to avoid chrome bug where buffer that is already bound to a different target
    // cannot be bound to 'TRANSFORM_FEEDBACK_BUFFER' target.

  }, {
    key: "_bindBuffers",
    value: function _bindBuffers() {
      if (this.bindOnUse) {
        for (var bufferIndex in this.buffers) {
          var _this$_getBufferParam2 = this._getBufferParams(this.buffers[bufferIndex]),
              buffer = _this$_getBufferParam2.buffer,
              sizeInBytes = _this$_getBufferParam2.sizeInBytes,
              offsetInBytes = _this$_getBufferParam2.offsetInBytes;

          this._bindBuffer(bufferIndex, buffer, offsetInBytes, sizeInBytes);
        }
      }
    }
  }, {
    key: "_unbindBuffers",
    value: function _unbindBuffers() {
      if (this.bindOnUse) {
        for (var bufferIndex in this.buffers) {
          this._bindBuffer(bufferIndex, null);
        }
      }
    }
  }, {
    key: "_bindBuffer",
    value: function _bindBuffer(index, buffer) {
      var offsetInBytes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
      var sizeInBytes = arguments.length > 3 ? arguments[3] : undefined;
      var handle = buffer && buffer.handle;

      if (!handle || sizeInBytes === undefined) {
        this.gl.bindBufferBase(35982, index, handle);
      } else {
        this.gl.bindBufferRange(35982, index, handle, offsetInBytes, sizeInBytes);
      }

      return this;
    } // RESOURCE METHODS

  }, {
    key: "_createHandle",
    value: function _createHandle() {
      return this.gl.createTransformFeedback();
    }
  }, {
    key: "_deleteHandle",
    value: function _deleteHandle() {
      this.gl.deleteTransformFeedback(this.handle);
    }
  }, {
    key: "_bindHandle",
    value: function _bindHandle(handle) {
      this.gl.bindTransformFeedback(36386, this.handle);
    }
  }]);
  return TransformFeedback;
}(_resource.default);

exports.default = TransformFeedback;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/inherits":"NNOi","@babel/runtime/helpers/esm/assertThisInitialized":"b9Zy","./resource":"Uazl","./buffer":"Rc9V","../webgl-utils":"PmJk","../utils":"PFG0"}],"mIaE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getScratchArrayBuffer = getScratchArrayBuffer;
exports.getScratchArray = getScratchArray;
exports.fillArray = fillArray;
var arrayBuffer = null;

function getScratchArrayBuffer(byteLength) {
  if (!arrayBuffer || arrayBuffer.byteLength < byteLength) {
    arrayBuffer = new ArrayBuffer(byteLength);
  }

  return arrayBuffer;
}

function getScratchArray(Type, length) {
  var scratchArrayBuffer = getScratchArrayBuffer(Type.BYTES_PER_ELEMENT * length);
  return new Type(scratchArrayBuffer, 0, length); // arrayBuffer, byteOffset, length (in elements)
} // Uses copyWithin to significantly speed up typed array value filling


function fillArray(_ref) {
  var target = _ref.target,
      source = _ref.source,
      _ref$start = _ref.start,
      start = _ref$start === void 0 ? 0 : _ref$start,
      _ref$count = _ref.count,
      count = _ref$count === void 0 ? 1 : _ref$count;
  var length = source.length;
  var total = count * length;
  var copied = 0;

  for (var i = start; copied < length; copied++) {
    target[i++] = source[copied];
  }

  while (copied < total) {
    // If we have copied less than half, copy everything we got
    // else copy remaining in one operation
    if (copied < total - copied) {
      target.copyWithin(start + copied, start, start + copied);
      copied *= 2;
    } else {
      target.copyWithin(start + copied, start, start + total - copied);
      copied = total;
    }
  }

  return target;
}
/*

// Creates a new Uint8Array based on two different ArrayBuffers
// @private
// @param {ArrayBuffers} buffer1 The first buffer.
// @param {ArrayBuffers} buffer2 The second buffer.
// @return {ArrayBuffers} The new ArrayBuffer created out of the two.
//
export function copyArrayBuffer(
  targetBuffer, sourceBuffer, byteOffset, byteLength = sourceBuffer.byteLength
) {
  const targetArray = new Uint8Array(targetBuffer, byteOffset, byteLength);
  const sourceArray = new Uint8Array(sourceBuffer);
  targetArray.set(sourceArray);
  return targetBuffer;
}

*/
},{}],"HYHI":[function(require,module,exports) {

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/get"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/assertThisInitialized"));

var _resource = _interopRequireDefault(require("./resource"));

var _buffer = _interopRequireDefault(require("./buffer"));

var _webglUtils = require("../webgl-utils");

var _arrayUtilsFlat = require("../utils/array-utils-flat");

var _utils = require("../utils");

var _probe = require("probe.gl");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// WebGL2 VertexArrayObject class

/* eslint-disable camelcase */
var OES_vertex_array_object = 'OES_vertex_array_object';
var ERR_ELEMENTS = 'elements must be GL.ELEMENT_ARRAY_BUFFER';

var VertexArrayObject =
/*#__PURE__*/
function (_Resource) {
  (0, _inherits2.default)(VertexArrayObject, _Resource);
  (0, _createClass2.default)(VertexArrayObject, null, [{
    key: "isSupported",
    value: function isSupported(gl) {
      var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; // Attribute 0 can not be disable on most desktop OpenGL based browsers
      // and on iOS Safari browser.

      if (options.constantAttributeZero) {
        return (0, _webglUtils.isWebGL2)(gl) || (0, _probe.getBrowser)() === 'Chrome';
      } // Whether additional objects can be created


      return (0, _webglUtils.isWebGL2)(gl) || gl.getExtension(OES_vertex_array_object);
    } // Returns the global (null) vertex array object. Exists even when no extension available

  }, {
    key: "getDefaultArray",
    value: function getDefaultArray(gl) {
      gl.luma = gl.luma || {};

      if (!gl.luma.defaultVertexArray) {
        gl.luma.defaultVertexArray = new VertexArrayObject(gl, {
          handle: null
        });
      }

      return gl.luma.defaultVertexArray;
    }
  }, {
    key: "getMaxAttributes",
    value: function getMaxAttributes(gl) {
      // TODO - should be cached per context
      VertexArrayObject.MAX_ATTRIBUTES = VertexArrayObject.MAX_ATTRIBUTES || gl.getParameter(34921);
      return VertexArrayObject.MAX_ATTRIBUTES;
    } // Note: Constants are stored globally on the WebGL context, not the VAO
    // So they need to be updated before every render
    // TODO - use known type (in configuration or passed in) to allow non-typed arrays?
    // TODO - remember/cache values to avoid setting them unnecessarily?

  }, {
    key: "setConstant",
    value: function setConstant(gl, location, array) {
      switch (array.constructor) {
        case Float32Array:
          VertexArrayObject._setConstantFloatArray(gl, location, array);

          break;

        case Int32Array:
          VertexArrayObject._setConstantIntArray(gl, location, array);

          break;

        case Uint32Array:
          VertexArrayObject._setConstantUintArray(gl, location, array);

          break;

        default:
          (0, _utils.assert)(false);
      }
    } // Create a VertexArray

  }]);

  function VertexArrayObject(gl) {
    var _this;

    var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, VertexArrayObject); // Use program's id if program but no id is supplied

    var id = opts.id || opts.program && opts.program.id;
    _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(VertexArrayObject).call(this, gl, Object.assign({}, opts, {
      id: id
    })));
    _this.hasVertexArrays = VertexArrayObject.isSupported(gl);
    _this.buffer = null;
    _this.bufferValue = null;

    _this.initialize(opts);

    Object.seal((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
    return _this;
  }

  (0, _createClass2.default)(VertexArrayObject, [{
    key: "delete",
    value: function _delete() {
      (0, _get2.default)((0, _getPrototypeOf2.default)(VertexArrayObject.prototype), "delete", this).call(this);

      if (this.buffer) {
        this.buffer.delete();
      }
    }
  }, {
    key: "initialize",
    value: function initialize() {
      var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      return this.setProps(props);
    }
  }, {
    key: "setProps",
    value: function setProps(props) {
      // TODO: decide which props should be supported
      return this;
    } // Set (bind) an elements buffer, for indexed rendering.
    // Must be a Buffer bound to GL.ELEMENT_ARRAY_BUFFER. Constants not supported

  }, {
    key: "setElementBuffer",
    value: function setElementBuffer() {
      var _this2 = this;

      var elementBuffer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      (0, _utils.assert)(!elementBuffer || elementBuffer.target === 34963, ERR_ELEMENTS); // The GL.ELEMENT_ARRAY_BUFFER_BINDING is stored on the VertexArrayObject...

      this.bind(function () {
        _this2.gl.bindBuffer(34963, elementBuffer ? elementBuffer.handle : null);
      });
      return this;
    } // Set a location in vertex attributes array to a bufferk, enables the location, sets divisor

  }, {
    key: "setBuffer",
    value: function setBuffer(location, buffer, accessor) {
      // Check target
      if (buffer.target === 34963) {
        return this.setElementBuffer(buffer, accessor);
      }

      var size = accessor.size,
          type = accessor.type,
          stride = accessor.stride,
          offset = accessor.offset,
          normalized = accessor.normalized,
          integer = accessor.integer,
          divisor = accessor.divisor;
      var gl = this.gl;
      location = Number(location);
      this.bind(function () {
        // A non-zero buffer object must be bound to the GL_ARRAY_BUFFER target
        gl.bindBuffer(34962, buffer.handle); // WebGL2 supports *integer* data formats, i.e. GPU will see integer values

        if (integer) {
          (0, _utils.assert)((0, _webglUtils.isWebGL2)(gl));
          gl.vertexAttribIPointer(location, size, type, stride, offset);
        } else {
          // Attaches ARRAY_BUFFER with specified buffer format to location
          gl.vertexAttribPointer(location, size, type, normalized, stride, offset);
        }

        gl.enableVertexAttribArray(location);
        gl.vertexAttribDivisor(location, divisor || 0); // NOTE We don't unbind buffer here, typically another buffer will be bound just after
      });
      return this;
    } // Enabling an attribute location makes it reference the currently bound buffer
    // Disabling an attribute location makes it reference the global constant value
    // TODO - handle single values for size 1 attributes?
    // TODO - convert classic arrays based on known type?

  }, {
    key: "enable",
    value: function enable(location) {
      var _this3 = this;

      var _enable = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; // Attribute 0 cannot be disabled in most desktop OpenGL based browsers


      var disablingAttributeZero = !_enable && location === 0 && !VertexArrayObject.isSupported(this.gl, {
        constantAttributeZero: true
      });

      if (!disablingAttributeZero) {
        location = Number(location);
        this.bind(function () {
          return _enable ? _this3.gl.enableVertexAttribArray(location) : _this3.gl.disableVertexAttribArray(location);
        });
      }

      return this;
    } // Provide a means to create a buffer that is equivalent to a constant.
    // NOTE: Desktop OpenGL cannot disable attribute 0.
    // https://stackoverflow.com/questions/20305231/webgl-warning-attribute-0-is-disabled-
    // this-has-significant-performance-penalt

  }, {
    key: "getConstantBuffer",
    value: function getConstantBuffer(elementCount, value, accessor) {
      // Create buffer only when needed, and reuse it (avoids inflating buffer creation statistics)
      var constantValue = this._normalizeConstantArrayValue(value, accessor);

      var byteLength = constantValue.byteLength * elementCount;
      var length = constantValue.length * elementCount;
      var updateNeeded = !this.buffer;
      this.buffer = this.buffer || new _buffer.default(this.gl, byteLength);
      updateNeeded = updateNeeded || this.buffer.setByteLength(byteLength); // Reallocate and update contents if needed

      updateNeeded = updateNeeded || !this._compareConstantArrayValues(constantValue, this.bufferValue);

      if (updateNeeded) {
        // Create a typed array that is big enough, and fill it with the required data
        var typedArray = (0, _arrayUtilsFlat.getScratchArray)(value.constructor, length);
        (0, _arrayUtilsFlat.fillArray)({
          target: typedArray,
          source: constantValue,
          start: 0,
          count: length
        });
        this.buffer.subData(typedArray);
        this.bufferValue = value;
      }

      return this.buffer;
    } // PRIVATE
    // TODO - convert Arrays based on known type? (read type from accessor, don't assume Float32Array)
    // TODO - handle single values for size 1 attributes?

  }, {
    key: "_normalizeConstantArrayValue",
    value: function _normalizeConstantArrayValue(arrayValue, accessor) {
      if (Array.isArray(arrayValue)) {
        return new Float32Array(arrayValue);
      }

      return arrayValue;
    }
  }, {
    key: "_compareConstantArrayValues",
    value: function _compareConstantArrayValues(v1, v2) {
      if (!v1 || !v2 || v1.length !== v2.length || v1.constructor !== v2.constructor) {
        return false;
      }

      for (var i = 0; i < v1.length; ++i) {
        if (v1[i] !== v2[i]) {
          return false;
        }
      }

      return true;
    }
  }, {
    key: "_createHandle",
    // RESOURCE IMPLEMENTATION
    value: function _createHandle() {
      this.hasVertexArrays = VertexArrayObject.isSupported(this.gl);

      if (this.hasVertexArrays) {
        return this.gl.createVertexArray();
      }

      return null;
    }
  }, {
    key: "_deleteHandle",
    value: function _deleteHandle(handle) {
      if (this.hasVertexArrays) {
        this.gl.deleteVertexArray(handle);
      }

      return [this.elements]; // return [this.elements, ...this.buffers];
    }
  }, {
    key: "_bindHandle",
    value: function _bindHandle(handle) {
      if (this.hasVertexArrays) {
        this.gl.bindVertexArray(handle);
      }
    } // Generic getter for information about a vertex attribute at a given position

  }, {
    key: "_getParameter",
    value: function _getParameter(pname, _ref) {
      var _this4 = this;

      var location = _ref.location;
      (0, _utils.assert)(Number.isFinite(location));
      return this.bind(function () {
        switch (pname) {
          case 34373:
            return _this4.gl.getVertexAttribOffset(location, pname);

          default:
            return _this4.gl.getVertexAttrib(location, pname);
        }
      });
    } // DEPRECATED

    /*
    setDivisor(location, divisor) {
      location = Number(location);
      this.bind(() => this.gl.vertexAttribDivisor(location, divisor));
      return this;
    }
     // match assumed WebGL defaults
    static resetConstants(gl) {
      const MAX_ATTRIBUTES = VertexArrayObject.getMaxAttributes(gl);
      for (let i = 0; i < MAX_ATTRIBUTES; i++) {
        VertexArrayObject.setConstant(gl, i, [0, 0, 0, 1]);
      }
    }
     // Resets all attributes (to default valued constants)
    resetAttributes() {
      // WebGL offers disabling, but no clear way to set a VertexArray buffer to `null`
      // But Chrome does not like buffers that are bound to several binding points.
      // So we just bind all the attributes to the dummy "attribute zero" buffer
      this.buffer = this.buffer || new Buffer(this.gl, {size: 4});
       for (const location in this.values) {
        if (this.values[location] instanceof Buffer) {
          this.gl.disableVertexAttribArray(location);
          this.gl.bindBuffer(GL.ARRAY_BUFFER, this.buffer.handle);
          this.gl.vertexAttribPointer(location, 1, GL.FLOAT, false, 0, 0);
        }
      }
       this.setElementBuffer(null);
      return this;
    }
    */

  }, {
    key: "MAX_ATTRIBUTES",
    get: function get() {
      return VertexArrayObject.getMaxAttributes(this.gl);
    }
  }], [{
    key: "_setConstantFloatArray",
    value: function _setConstantFloatArray(gl, location, array) {
      switch (array.length) {
        case 1:
          gl.vertexAttrib1fv(location, array);
          break;

        case 2:
          gl.vertexAttrib2fv(location, array);
          break;

        case 3:
          gl.vertexAttrib3fv(location, array);
          break;

        case 4:
          gl.vertexAttrib4fv(location, array);
          break;

        default:
          (0, _utils.assert)(false);
      }
    }
  }, {
    key: "_setConstantIntArray",
    value: function _setConstantIntArray(gl, location, array) {
      (0, _utils.assert)((0, _webglUtils.isWebGL2)(gl));

      switch (array.length) {
        case 1:
          gl.vertexAttribI1iv(location, array);
          break;

        case 2:
          gl.vertexAttribI2iv(location, array);
          break;

        case 3:
          gl.vertexAttribI3iv(location, array);
          break;

        case 4:
          gl.vertexAttribI4iv(location, array);
          break;

        default:
          (0, _utils.assert)(false);
      }
    }
  }, {
    key: "_setConstantUintArray",
    value: function _setConstantUintArray(gl, location, array) {
      (0, _utils.assert)((0, _webglUtils.isWebGL2)(gl));

      switch (array.length) {
        case 1:
          gl.vertexAttribI1uiv(location, array);
          break;

        case 2:
          gl.vertexAttribI2uiv(location, array);
          break;

        case 3:
          gl.vertexAttribI3uiv(location, array);
          break;

        case 4:
          gl.vertexAttribI4uiv(location, array);
          break;

        default:
          (0, _utils.assert)(false);
      }
    }
  }]);
  return VertexArrayObject;
}(_resource.default);

exports.default = VertexArrayObject;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/get":"Q3cA","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/inherits":"NNOi","@babel/runtime/helpers/esm/assertThisInitialized":"b9Zy","./resource":"Uazl","./buffer":"Rc9V","../webgl-utils":"PmJk","../utils/array-utils-flat":"mIaE","../utils":"PFG0","probe.gl":"aapK"}],"yiqH":[function(require,module,exports) {

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _accessor = _interopRequireDefault(require("./accessor"));

var _buffer = _interopRequireDefault(require("./buffer"));

var _vertexArrayObject = _interopRequireDefault(require("./vertex-array-object"));

var _utils = require("../utils");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// VertexArray class
var ERR_ATTRIBUTE_TYPE = 'VertexArray: attributes must be Buffers or constants (i.e. typed array)';

var VertexArray =
/*#__PURE__*/
function () {
  function VertexArray(gl) {
    var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, VertexArray); // Use program's id if program is supplied but no id is supplied

    var id = opts.id || opts.program && opts.program.id; // super(gl, Object.assign({}, opts, {id}));

    this.id = id;
    this.gl = gl;
    this.configuration = null; // Extracted information

    this.elements = null;
    this.values = null;
    this.accessors = null;
    this.unused = null;
    this.drawParams = null;
    this.buffer = null; // For attribute 0 on desktops, and created when unbinding buffers

    this.vertexArrayObject = _vertexArrayObject.default.isSupported(gl) ? new _vertexArrayObject.default(gl) : _vertexArrayObject.default.getDefaultArray(gl); // Issue errors when using removed methods

    (0, _utils.stubRemovedMethods)(this, 'VertexArray', 'v6.0', ['setBuffers', 'setGeneric', 'clearBindings', 'setLocations', 'setGenericValues', 'setDivisor', 'enable', 'disable']);
    this.initialize(opts);
    Object.seal(this);
  }

  (0, _createClass2.default)(VertexArray, [{
    key: "delete",
    value: function _delete() {
      if (this.buffer) {
        this.buffer.delete();
      }
    }
  }, {
    key: "initialize",
    value: function initialize() {
      var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      this.reset();
      this.configuration = null;
      this.bindOnUse = false;
      return this.setProps(props);
    } // Resets all attributes (to default valued constants)

  }, {
    key: "reset",
    value: function reset() {
      // this.vertexArrayObject.reset();
      this.elements = null;
      var MAX_ATTRIBUTES = this.vertexArrayObject.MAX_ATTRIBUTES;
      this.values = new Array(MAX_ATTRIBUTES).fill(null);
      this.accessors = new Array(MAX_ATTRIBUTES).fill(null);
      this.unused = {}; // Auto detects draw params

      this.drawParams = null;
      return this;
    }
  }, {
    key: "setProps",
    value: function setProps(props) {
      if ('program' in props) {
        this.configuration = props.program && props.program.configuration;
      }

      if ('configuration' in props) {
        this.configuration = props.configuration;
      }

      if ('attributes' in props) {
        this.setAttributes(props.attributes);
      }

      if ('elements' in props) {
        this.setElementBuffer(props.elements);
      }

      if ('bindOnUse' in props) {
        props = props.bindOnUse;
      }

      return this;
    } // Automatically called if buffers changed through VertexArray API

  }, {
    key: "clearDrawParams",
    value: function clearDrawParams() {
      this.drawParams = null;
    }
  }, {
    key: "getDrawParams",
    value: function getDrawParams(appParameters) {
      // Auto deduced draw parameters
      this.drawParams = this.drawParams || this._updateDrawParams(); // Override with any application supplied draw parameters

      return Object.assign({}, this.drawParams, appParameters);
    } // Set (bind) an array or map of vertex array buffers, either in numbered or named locations.
    // For names that are not present in `location`, the supplied buffers will be ignored.
    // if a single buffer of type GL.ELEMENT_ARRAY_BUFFER is present, it will be set as elements
    //   Signatures:
    //     {attributeName: buffer}
    //     {attributeName: [buffer, accessor]}
    //     {attributeName: (typed) array} => constant

  }, {
    key: "setAttributes",
    value: function setAttributes(attributes) {
      var _this = this;

      this.vertexArrayObject.bind(function () {
        for (var locationOrName in attributes) {
          var value = attributes[locationOrName];

          if (value instanceof _buffer.default) {
            //  Signature: attributeName: buffer
            _this.setBuffer(locationOrName, value);
          } else if (Array.isArray(value) && value.length && value[0] instanceof _buffer.default) {
            // Signature: attributeName: [buffer, accessor]
            var buffer = value[0];
            var accessor = value[1];

            _this.setBuffer(locationOrName, buffer, accessor);
          } else if (ArrayBuffer.isView(value) || Array.isArray(value)) {
            //  Signature: attributeName: (short) (typed) array => constant
            _this.setConstant(locationOrName, value);
          } else {
            throw new Error(ERR_ATTRIBUTE_TYPE);
          }
        } // Make sure we don't leave any bindings


        _this.gl.bindBuffer(34962, null);
      });
      return this;
    } // Set (bind) an elements buffer, for indexed rendering.
    // Must be a Buffer bound to GL.ELEMENT_ARRAY_BUFFER. Constants not supported

  }, {
    key: "setElementBuffer",
    value: function setElementBuffer() {
      var elementBuffer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
      var accessor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      this.elements = elementBuffer; // Save value for debugging

      this.clearDrawParams(); // Update vertexArray immediately if we have our own array

      if (!this.vertexArrayObject.isDefaultArray) {
        this.vertexArrayObject.setElementBuffer(elementBuffer, accessor);
      }

      return this;
    } // Set a location in vertex attributes array to a buffer

  }, {
    key: "setBuffer",
    value: function setBuffer(locationOrName, buffer) {
      var appAccessor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; // Check target

      if (buffer.target === 34963) {
        return this.setElementBuffer(buffer);
      }

      var _this$_resolveLocatio = this._resolveLocationAndAccessor(locationOrName, buffer, buffer.accessor, appAccessor),
          location = _this$_resolveLocatio.location,
          accessor = _this$_resolveLocatio.accessor;

      if (location >= 0) {
        this.values[location] = buffer;
        this.accessors[location] = accessor;
        this.clearDrawParams(); // Update vertexArray immediately if we have our own array

        if (!this.vertexArrayObject.isDefaultArray) {
          this.vertexArrayObject.setBuffer(location, buffer, accessor);
        }
      }

      return this;
    } // Set attribute to constant value (small typed array corresponding to one vertex' worth of data)

  }, {
    key: "setConstant",
    value: function setConstant(locationOrName, arrayValue) {
      var appAccessor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

      var _this$_resolveLocatio2 = this._resolveLocationAndAccessor(locationOrName, arrayValue, appAccessor),
          location = _this$_resolveLocatio2.location,
          accessor = _this$_resolveLocatio2.accessor;

      if (location >= 0) {
        arrayValue = this.vertexArrayObject._normalizeConstantArrayValue(arrayValue, accessor);
        this.values[location] = arrayValue;
        this.accessors[location] = accessor;
        this.clearDrawParams(); // Update vertexArray immediately if we have our own array
        // NOTE: We set the actual constant value later on bind. We can't set the value now since
        // constants are global and affect all other VertexArrays that have disabled attributes
        // in the same location.
        // We do disable the attribute which makes it use the global constant value at that location

        if (!this.vertexArrayObject.isDefaultArray) {
          this.vertexArrayObject.enable(location, false);
        }
      }

      return this;
    } // Workaround for Chrome TransformFeedback binding issue
    // If required, unbind temporarily to avoid conflicting with TransformFeedback

  }, {
    key: "unbindBuffers",
    value: function unbindBuffers() {
      var _this2 = this;

      this.vertexArrayObject.bind(function () {
        if (_this2.elements) {
          _this2.setElementBuffer(null);
        } // Chrome does not like buffers that are bound to several binding points,
        // so we need to offer and unbind facility
        // WebGL offers disabling, but no clear way to set a VertexArray buffer to `null`
        // So we just bind all the attributes to the dummy "attribute zero" buffer


        _this2.buffer = _this2.buffer || new _buffer.default(_this2.gl, {
          size: 4
        });

        for (var location = 0; location < _this2.vertexArrayObject.MAX_ATTRIBUTES; location++) {
          if (_this2.values[location] instanceof _buffer.default) {
            _this2.gl.disableVertexAttribArray(location);

            _this2.gl.bindBuffer(34962, _this2.buffer.handle);

            _this2.gl.vertexAttribPointer(location, 1, 5126, false, 0, 0);
          }
        }
      });
      return this;
    } // Workaround for Chrome TransformFeedback binding issue
    // If required, rebind rebind after temporary unbind

  }, {
    key: "bindBuffers",
    value: function bindBuffers() {
      var _this3 = this;

      this.vertexArrayObject.bind(function () {
        if (_this3.elements) {
          _this3.setElementBuffer(_this3.elements);
        }

        for (var location = 0; location < _this3.vertexArrayObject.MAX_ATTRIBUTES; location++) {
          var buffer = _this3.values[location];

          if (buffer instanceof _buffer.default) {
            _this3.setBuffer(location, buffer);
          }
        }
      });
      return this;
    } // Bind for use
    // When a vertex array is about to be used, we must:
    // - Set constant attributes (since these are stored on the context and reset on bind)
    // - Check if we need to initialize the buffer

  }, {
    key: "bindForDraw",
    value: function bindForDraw(vertexCount, instanceCount, func) {
      var _this4 = this;

      var value;
      this.vertexArrayObject.bind(function () {
        // Make sure that any constant attributes are updated (stored on the context, not the VAO)
        // Also handles attribute 0
        _this4._setConstantAttributes(vertexCount, instanceCount);

        if (!_this4.vertexArrayObject.hasVertexArrays) {
          _this4.bindBuffers();
        }

        value = func();

        if (!_this4.vertexArrayObject.hasVertexArrays) {
          _this4.unbindBuffers();
        }
      });
      return value;
    } // PRIVATE
    // Resolve locations and accessors

  }, {
    key: "_resolveLocationAndAccessor",
    value: function _resolveLocationAndAccessor(locationOrName, value, valueAccessor, appAccessor) {
      var _this5 = this;

      var location = this._getAttributeIndex(locationOrName);

      if (!Number.isFinite(location) || location < 0) {
        this.unused[locationOrName] = value;

        _utils.log.once(3, function () {
          return "unused value ".concat(locationOrName, " in ").concat(_this5.id);
        })();

        return this;
      }

      var accessInfo = this._getAttributeInfo(locationOrName); // Resolve the partial accessors into a final accessor


      var accessor = _accessor.default.resolve(accessInfo.accessor, valueAccessor, appAccessor);

      var size = accessor.size,
          type = accessor.type;
      (0, _utils.assert)(Number.isFinite(size) && Number.isFinite(type));
      return {
        location: location,
        accessor: accessor
      };
    }
  }, {
    key: "_getAttributeInfo",
    value: function _getAttributeInfo(attributeName) {
      return this.configuration && this.configuration.getAttributeInfo(attributeName);
    }
  }, {
    key: "_getAttributeIndex",
    value: function _getAttributeIndex(locationOrName) {
      if (this.configuration) {
        return this.configuration.getAttributeLocation(locationOrName);
      }

      var location = Number(locationOrName);

      if (Number.isFinite(location)) {
        return location;
      }

      return -1;
    } // Updates all constant attribute values (constants are used when vertex attributes are disabled).
    // This needs to be done repeatedly since in contrast to buffer bindings,
    // constants are stored on the WebGL context, not the VAO

  }, {
    key: "_setConstantAttributes",
    value: function _setConstantAttributes(vertexCount, instanceCount) {
      // TODO - use accessor to determine what length to use
      var elementCount = Math.max(vertexCount | 0, instanceCount | 0);
      var constant = this.values[0];

      if (ArrayBuffer.isView(constant)) {
        this._setConstantAttributeZero(constant, elementCount);
      }

      for (var location = 1; location < this.vertexArrayObject.MAX_ATTRIBUTES; location++) {
        constant = this.values[location];

        if (ArrayBuffer.isView(constant)) {
          this._setConstantAttribute(location, constant);
        }
      }
    }
  }, {
    key: "_setConstantAttributeZero",
    value: function _setConstantAttributeZero(constant, elementCount) {
      if (_vertexArrayObject.default.isSupported(this.gl, {
        constantAttributeZero: true
      })) {
        this._setConstantAttribute(0, constant);

        return;
      } // Get a dummy buffer populated with repeated constants


      var buffer = this.vertexArrayObject.getConstantBuffer(elementCount, constant); // Set the buffer on location 0

      this.vertexArrayObject.setBuffer(0, buffer, this.accessors[0]);
    }
  }, {
    key: "_setConstantAttribute",
    value: function _setConstantAttribute(location, constant) {
      _vertexArrayObject.default.setConstant(this.gl, location, constant); // If we are using the global VertexArrayObject, we need to disable the attribute now


      if (this.vertexArrayObject.isDefault) {
        this.vertexArrayObject.enable(location, false);
      }
    } // Walks the buffers and updates draw parameters

  }, {
    key: "_updateDrawParams",
    value: function _updateDrawParams() {
      var drawParams = {
        isIndexed: false,
        isInstanced: false,
        indexCount: Infinity,
        vertexCount: Infinity,
        instanceCount: Infinity
      };

      for (var location = 0; location < this.vertexArrayObject.MAX_ATTRIBUTES; location++) {
        this._updateDrawParamsForLocation(drawParams, location);
      }

      if (this.elements) {
        // indexing is autodetected - buffer with target GL.ELEMENT_ARRAY_BUFFER
        // index type is saved for drawElement calls
        drawParams.elementCount = this.elements.getElementCount(this.elements.accessor);
        drawParams.isIndexed = true;
        drawParams.indexType = this.elements.accessor.type;
      } // Post-calculation checks


      if (drawParams.indexCount === Infinity) {
        drawParams.indexCount = 0;
      }

      if (drawParams.vertexCount === Infinity) {
        drawParams.vertexCount = 0;
      }

      if (drawParams.instanceCount === Infinity) {
        drawParams.instanceCount = 0;
      }

      return drawParams;
    }
  }, {
    key: "_updateDrawParamsForLocation",
    value: function _updateDrawParamsForLocation(drawParams, location) {
      var value = this.values[location];
      var accessor = this.accessors[location];

      if (!value) {
        return;
      } // Check if instanced (whether buffer or constant)


      var divisor = accessor.divisor;
      var isInstanced = divisor > 0;
      drawParams.isInstanced = drawParams.isInstanced || isInstanced;

      if (value instanceof _buffer.default) {
        var buffer = value;

        if (isInstanced) {
          // instance attribute
          var instanceCount = buffer.getVertexCount(accessor);
          drawParams.instanceCount = Math.min(drawParams.instanceCount, instanceCount);
        } else {
          // normal attribute
          var vertexCount = buffer.getVertexCount(accessor);
          drawParams.vertexCount = Math.min(drawParams.vertexCount, vertexCount);
        }
      }
    } // DEPRECATED

  }, {
    key: "setElements",
    value: function setElements() {
      var elementBuffer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
      var accessor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

      _utils.log.deprecated('setElements', 'setElementBuffer');

      return this.setElementBuffer(elementBuffer, accessor);
    }
  }]);
  return VertexArray;
}();

exports.default = VertexArray;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","./accessor":"SwrD","./buffer":"Rc9V","./vertex-array-object":"HYHI","../utils":"PFG0"}],"wMBm":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _attributeUtils = require("../webgl-utils/attribute-utils");

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/* eslint-disable camelcase */
var ERR_ARGUMENT = 'UniformBufferLayout illegal argument'; // Local constants - these will "collapse" during minification

var GL_FLOAT = 0x1406;
var GL_INT = 0x1404;
var GL_UNSIGNED_INT = 0x1405; // Std140 layout for uniforms

var UniformBufferLayout =
/*#__PURE__*/
function () {
  function UniformBufferLayout(layout) {
    var _this$typedArray;

    (0, _classCallCheck2.default)(this, UniformBufferLayout);
    this.layout = {};
    this.size = 0; // Add layout (type, size and offset) definitions for each uniform in the layout

    for (var key in layout) {
      this._addUniform(key, layout[key]);
    } // Allocate three typed arrays pointing at same memory


    var data = new Float32Array(this.size);
    this.typedArray = (_this$typedArray = {}, (0, _defineProperty2.default)(_this$typedArray, GL_FLOAT, data), (0, _defineProperty2.default)(_this$typedArray, GL_INT, new Int32Array(data.buffer)), (0, _defineProperty2.default)(_this$typedArray, GL_UNSIGNED_INT, new Uint32Array(data.buffer)), _this$typedArray);
  } // Get number of bytes needed for buffer allocation


  (0, _createClass2.default)(UniformBufferLayout, [{
    key: "getBytes",
    value: function getBytes() {
      return this.size * 4;
    } // Get the current data as Float32Array, for bufferSubData

  }, {
    key: "getData",
    value: function getData() {
      return this.typedArray[GL_FLOAT];
    } // Get offset and data for one object (for bufferSubData)

  }, {
    key: "getSubData",
    value: function getSubData(index) {
      var data;
      var offset;

      if (index === undefined) {
        data = this.data;
        offset = 0;
      } else {
        var begin = this.offsets[index];
        var end = begin + this.sizes[index];
        data = this.data.subarray(begin, end);
        offset = begin * 4;
      }

      return {
        data: data,
        offset: offset
      };
    } // Set a map of values

  }, {
    key: "setUniforms",
    value: function setUniforms(values) {
      for (var key in values) {
        this._setValue(key, values[key]);
      }

      return this;
    }
  }, {
    key: "_setValue",
    value: function _setValue(key, value) {
      var layout = this.layout[key];
      (0, _assert.default)(layout, 'UniformLayoutStd140 illegal argument');
      var typedArray = this.typedArray[layout.type];

      if (layout.size === 1) {
        // single value -> just set it
        typedArray[layout.offset] = value;
      } else {
        // vector/matrix -> copy the supplied (typed) array, starting from offset
        typedArray.set(value, layout.offset);
      }
    }
  }, {
    key: "_addUniform",
    value: function _addUniform(key, uniformType) {
      var typeAndComponents = (0, _attributeUtils.decomposeCompositeGLType)(uniformType);
      (0, _assert.default)(typeAndComponents, ERR_ARGUMENT);
      var type = typeAndComponents.type,
          count = typeAndComponents.components; // First, align (bump) current offset to an even multiple of current object (1, 2, 4)

      this.size = this._alignTo(this.size, count); // Use the aligned size as the offset of the current uniform.

      var offset = this.size; // Then, add our object's padded size ((1, 2, multiple of 4) to the current offset

      this.size += count;
      this.layout[key] = {
        type: type,
        size: count,
        offset: offset
      };
    } // Align offset to 1, 2 or 4 elements (4, 8 or 16 bytes)

  }, {
    key: "_alignTo",
    value: function _alignTo(size, count) {
      switch (count) {
        case 1:
          return size;
        // Pad upwards to even multiple of 2

        case 2:
          return size + size % 2;
        // Pad upwards to even multiple of 2

        default:
          return size + (4 - size % 4) % 4;
        // Pad upwards to even multiple of 4
      }
    }
  }]);
  return UniformBufferLayout;
}();

exports.default = UniformBufferLayout;
},{"@babel/runtime/helpers/esm/defineProperty":"DOnw","@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","../webgl-utils/attribute-utils":"Z0Su","../utils/assert":"wYRU"}],"XrzY":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _isNativeFunction;

function _isNativeFunction(fn) {
  return Function.toString.call(fn).indexOf("[native code]") !== -1;
}
},{}],"FLVq":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _wrapNativeSuper;

var _getPrototypeOf = _interopRequireDefault(require("./getPrototypeOf"));

var _setPrototypeOf = _interopRequireDefault(require("./setPrototypeOf"));

var _isNativeFunction = _interopRequireDefault(require("./isNativeFunction"));

var _construct = _interopRequireDefault(require("./construct"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _wrapNativeSuper(Class) {
  var _cache = typeof Map === "function" ? new Map() : undefined;

  exports.default = _wrapNativeSuper = function _wrapNativeSuper(Class) {
    if (Class === null || !(0, _isNativeFunction.default)(Class)) return Class;

    if (typeof Class !== "function") {
      throw new TypeError("Super expression must either be null or a function");
    }

    if (typeof _cache !== "undefined") {
      if (_cache.has(Class)) return _cache.get(Class);

      _cache.set(Class, Wrapper);
    }

    function Wrapper() {
      return (0, _construct.default)(Class, arguments, (0, _getPrototypeOf.default)(this).constructor);
    }

    Wrapper.prototype = Object.create(Class.prototype, {
      constructor: {
        value: Wrapper,
        enumerable: false,
        writable: true,
        configurable: true
      }
    });
    return (0, _setPrototypeOf.default)(Wrapper, Class);
  };

  return _wrapNativeSuper(Class);
}
},{"./getPrototypeOf":"i2He","./setPrototypeOf":"spGh","./isNativeFunction":"XrzY","./construct":"fwwN"}],"Ma4c":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.configure = configure;
exports.checkNumber = checkNumber;
exports.formatValue = formatValue;
exports.formatAngle = formatAngle;
exports.isArray = isArray;
exports.clone = clone;
exports.radians = radians;
exports.degrees = degrees;
exports.sin = sin;
exports.cos = cos;
exports.tan = tan;
exports.asin = asin;
exports.acos = acos;
exports.atan = atan;
exports.clamp = clamp;
exports.lerp = lerp;
exports.equals = equals;
exports.config = void 0;
var config = {};
exports.config = config;
config.EPSILON = 1e-12;
config.debug = true;
config.precision = 4;
config.printTypes = false;
config.printDegrees = false;
config.printRowMajor = true;

function configure(options) {
  if ('epsilon' in options) {
    config.EPSILON = options.epsilon;
  }

  if ('debug' in options) {
    config.debug = options.debug;
  }
}

function checkNumber(value) {
  if (!Number.isFinite(value)) {
    throw new Error("Invalid number ".concat(value));
  }

  return value;
}

function round(value) {
  return Math.round(value / config.EPSILON) * config.EPSILON;
}

function formatValue(value) {
  var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
      _ref$precision = _ref.precision,
      precision = _ref$precision === void 0 ? config.precision || 4 : _ref$precision;

  value = round(value);
  return parseFloat(value.toPrecision(precision));
}

function formatAngle(value) {
  var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
      _ref2$precision = _ref2.precision,
      precision = _ref2$precision === void 0 ? config.precision || 4 : _ref2$precision,
      _ref2$printDegrees = _ref2.printDegrees,
      printDegrees = _ref2$printDegrees === void 0 ? config.printAngles : _ref2$printDegrees;

  value = printDegrees ? degrees(value) : value;
  value = round(value);
  return "".concat(parseFloat(value.toPrecision(precision))).concat(printDegrees ? '°' : '');
}

function isArray(value) {
  return Array.isArray(value) || ArrayBuffer.isView(value) && value.length !== undefined;
}

function clone(array) {
  return array.clone ? array.clone() : new Array(array);
}

function map(value, func) {
  if (isArray(value)) {
    var result = clone(value);

    for (var i = 0; i < result.length; ++i) {
      result[i] = func(result[i], i, result);
    }

    return result;
  }

  return func(value);
}

function radians(degrees) {
  return map(degrees, function (degrees) {
    return degrees / 180 * Math.PI;
  });
}

function degrees(radians) {
  return map(radians, function (radians) {
    return radians * 180 / Math.PI;
  });
}

function sin(radians) {
  return map(radians, function (angle) {
    return Math.sin(angle);
  });
}

function cos(radians) {
  return map(radians, function (angle) {
    return Math.cos(angle);
  });
}

function tan(radians) {
  return map(radians, function (angle) {
    return Math.tan(angle);
  });
}

function asin(radians) {
  return map(radians, function (angle) {
    return Math.asin(angle);
  });
}

function acos(radians) {
  return map(radians, function (angle) {
    return Math.acos(angle);
  });
}

function atan(radians) {
  return map(radians, function (angle) {
    return Math.atan(angle);
  });
}

function clamp(value, min, max) {
  return map(value, function (value) {
    return Math.max(min, Math.min(max, value));
  });
}

function lerp(a, b, t) {
  if (isArray(a)) {
    return a.map(function (ai, i) {
      return lerp(ai, b[i], t);
    });
  }

  return t * b + (1 - t) * a;
}

function equals(a, b) {
  if (isArray(a) && isArray(b)) {
    if (a === b) {
      return true;
    }

    if (a.length !== b.length) {
      return false;
    }

    for (var i = 0; i < a.length; ++i) {
      if (!equals(a[i], b[i])) {
        return false;
      }
    }

    return true;
  }

  return Math.abs(a - b) <= config.EPSILON * Math.max(1.0, Math.abs(a), Math.abs(b));
}
},{}],"orGy":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/wrapNativeSuper"));

var _common = require("./common");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var MathArray = function (_Array) {
  (0, _inherits2.default)(MathArray, _Array);

  function MathArray() {
    (0, _classCallCheck2.default)(this, MathArray);
    return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(MathArray).apply(this, arguments));
  }

  (0, _createClass2.default)(MathArray, [{
    key: "clone",
    value: function clone() {
      return new this.constructor().copy(this).check();
    }
  }, {
    key: "copy",
    value: function copy(array) {
      for (var i = 0; i < this.ELEMENTS; ++i) {
        this[i] = array[i];
      }

      return this.check();
    }
  }, {
    key: "set",
    value: function set() {
      for (var i = 0; i < this.ELEMENTS; ++i) {
        this[i] = (i < 0 || arguments.length <= i ? undefined : arguments[i]) || 0;
      }

      return this.check();
    }
  }, {
    key: "fromArray",
    value: function fromArray(array) {
      var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;

      for (var i = 0; i < this.ELEMENTS; ++i) {
        this[i] = array[i + offset];
      }

      return this.check();
    }
  }, {
    key: "toString",
    value: function toString() {
      return this.formatString(_common.config);
    }
  }, {
    key: "formatString",
    value: function formatString(opts) {
      var string = '';

      for (var i = 0; i < this.ELEMENTS; ++i) {
        string += (i > 0 ? ', ' : '') + (0, _common.formatValue)(this[i], opts);
      }

      return "".concat(opts.printTypes ? this.constructor.name : '', "[").concat(string, "]");
    }
  }, {
    key: "toArray",
    value: function toArray() {
      var array = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
      var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;

      for (var i = 0; i < this.ELEMENTS; ++i) {
        array[offset + i] = this[i];
      }

      return array;
    }
  }, {
    key: "toFloat32Array",
    value: function toFloat32Array() {
      return new Float32Array(this);
    }
  }, {
    key: "equals",
    value: function equals(array) {
      if (!array || this.length !== array.length) {
        return false;
      }

      for (var i = 0; i < this.ELEMENTS; ++i) {
        if (!(0, _common.equals)(this[i], array[i])) {
          return false;
        }
      }

      return true;
    }
  }, {
    key: "exactEquals",
    value: function exactEquals(array) {
      if (!array || this.length !== array.length) {
        return false;
      }

      for (var i = 0; i < this.ELEMENTS; ++i) {
        if (this[i] !== array[i]) {
          return false;
        }
      }

      return true;
    }
  }, {
    key: "negate",
    value: function negate() {
      for (var i = 0; i < this.ELEMENTS; ++i) {
        this[i] = -this[i];
      }

      return this.check();
    }
  }, {
    key: "inverse",
    value: function inverse() {
      for (var i = 0; i < this.ELEMENTS; ++i) {
        this[i] = 1 / this[i];
      }

      return this.check();
    }
  }, {
    key: "lerp",
    value: function lerp(a, b, t) {
      if (t === undefined) {
        t = b;
        b = a;
        a = this;
      }

      for (var i = 0; i < this.ELEMENTS; ++i) {
        var ai = a[i];
        this[i] = ai + t * (b[i] - ai);
      }

      return this.check();
    }
  }, {
    key: "min",
    value: function min(vector) {
      for (var i = 0; i < this.ELEMENTS; ++i) {
        this[i] = Math.min(vector[i], this[i]);
      }

      return this.check();
    }
  }, {
    key: "max",
    value: function max(vector) {
      for (var i = 0; i < this.ELEMENTS; ++i) {
        this[i] = Math.max(vector[i], this[i]);
      }

      return this.check();
    }
  }, {
    key: "clamp",
    value: function clamp(minVector, maxVector) {
      for (var i = 0; i < this.ELEMENTS; ++i) {
        this[i] = Math.min(Math.max(this[i], minVector[i]), maxVector[i]);
      }

      return this.check();
    }
  }, {
    key: "validate",
    value: function validate() {
      var valid = this.length === this.ELEMENTS;

      for (var i = 0; i < this.ELEMENTS; ++i) {
        valid = valid && Number.isFinite(this[i]);
      }

      return valid;
    }
  }, {
    key: "check",
    value: function check() {
      if (_common.config.debug && !this.validate(this)) {
        throw new Error("math.gl: ".concat(this.constructor.name, " some fields set to invalid numbers'"));
      }

      return this;
    }
  }, {
    key: "sub",
    value: function sub(a) {
      return this.subtract(a);
    }
  }, {
    key: "setScalar",
    value: function setScalar(a) {
      for (var i = 0; i < this.ELEMENTS; ++i) {
        this[i] = a;
      }

      return this.check();
    }
  }, {
    key: "addScalar",
    value: function addScalar(a) {
      for (var i = 0; i < this.ELEMENTS; ++i) {
        this[i] += a;
      }

      return this.check();
    }
  }, {
    key: "subScalar",
    value: function subScalar(a) {
      return this.addScalar(-a);
    }
  }, {
    key: "multiplyScalar",
    value: function multiplyScalar(a) {
      return this.scale(a);
    }
  }, {
    key: "divideScalar",
    value: function divideScalar(a) {
      return this.scale(1 / a);
    }
  }, {
    key: "clampScalar",
    value: function clampScalar(min, max) {
      for (var i = 0; i < this.ELEMENTS; ++i) {
        this[i] = Math.min(Math.max(this[i], min), max);
      }

      return this.check();
    }
  }]);
  return MathArray;
}((0, _wrapNativeSuper2.default)(Array));

exports.default = MathArray;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","@babel/runtime/helpers/esm/wrapNativeSuper":"FLVq","./common":"Ma4c"}],"JeJF":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _mathArray = _interopRequireDefault(require("./math-array"));

var _common = require("./common");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var assert = function assert(x, m) {
  if (!x) {
    throw new Error(m);
  }
};

var Vector = function (_MathArray) {
  (0, _inherits2.default)(Vector, _MathArray);

  function Vector() {
    (0, _classCallCheck2.default)(this, Vector);
    return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Vector).apply(this, arguments));
  }

  (0, _createClass2.default)(Vector, [{
    key: "len",
    value: function len() {
      return Math.sqrt(this.lengthSquared());
    }
  }, {
    key: "magnitude",
    value: function magnitude() {
      return Math.sqrt(this.lengthSquared());
    }
  }, {
    key: "lengthSquared",
    value: function lengthSquared() {
      var length = 0;

      for (var i = 0; i < this.ELEMENTS; ++i) {
        length += this[i] * this[i];
      }

      return length;
    }
  }, {
    key: "distance",
    value: function distance(mathArray) {
      return Math.sqrt(this.distanceSquared(mathArray));
    }
  }, {
    key: "distanceSquared",
    value: function distanceSquared(mathArray) {
      var length = 0;

      for (var i = 0; i < this.ELEMENTS; ++i) {
        var dist = this[i] - mathArray[i];
        length += dist * dist;
      }

      return (0, _common.checkNumber)(length);
    }
  }, {
    key: "dot",
    value: function dot(mathArray) {
      var product = 0;

      for (var i = 0; i < this.ELEMENTS; ++i) {
        product += this[i] * mathArray[i];
      }

      return (0, _common.checkNumber)(product);
    }
  }, {
    key: "normalize",
    value: function normalize() {
      var length = this.magnitude();

      if (length !== 0) {
        for (var i = 0; i < this.ELEMENTS; ++i) {
          this[i] /= length;
        }
      }

      return this.check();
    }
  }, {
    key: "add",
    value: function add() {
      for (var _len = arguments.length, vectors = new Array(_len), _key = 0; _key < _len; _key++) {
        vectors[_key] = arguments[_key];
      }

      for (var _i = 0; _i < vectors.length; _i++) {
        var vector = vectors[_i];

        for (var i = 0; i < this.ELEMENTS; ++i) {
          this[i] += vector[i];
        }
      }

      return this.check();
    }
  }, {
    key: "subtract",
    value: function subtract() {
      for (var _len2 = arguments.length, vectors = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
        vectors[_key2] = arguments[_key2];
      }

      for (var _i2 = 0; _i2 < vectors.length; _i2++) {
        var vector = vectors[_i2];

        for (var i = 0; i < this.ELEMENTS; ++i) {
          this[i] -= vector[i];
        }
      }

      return this.check();
    }
  }, {
    key: "multiply",
    value: function multiply() {
      for (var _len3 = arguments.length, vectors = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
        vectors[_key3] = arguments[_key3];
      }

      for (var _i3 = 0; _i3 < vectors.length; _i3++) {
        var vector = vectors[_i3];

        for (var i = 0; i < this.ELEMENTS; ++i) {
          this[i] *= vector[i];
        }
      }

      return this.check();
    }
  }, {
    key: "divide",
    value: function divide() {
      for (var _len4 = arguments.length, vectors = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
        vectors[_key4] = arguments[_key4];
      }

      for (var _i4 = 0; _i4 < vectors.length; _i4++) {
        var vector = vectors[_i4];

        for (var i = 0; i < this.ELEMENTS; ++i) {
          this[i] /= vector[i];
        }
      }

      return this.check();
    }
  }, {
    key: "scale",
    value: function scale(_scale) {
      if (Array.isArray(_scale)) {
        return this.multiply(_scale);
      }

      for (var i = 0; i < this.ELEMENTS; ++i) {
        this[i] *= _scale;
      }

      return this.check();
    }
  }, {
    key: "scaleAndAdd",
    value: function scaleAndAdd(vector, scale) {
      for (var i = 0; i < this.ELEMENTS; ++i) {
        this[i] = this[i] * scale + vector[i];
      }

      return this.check();
    }
  }, {
    key: "lengthSq",
    value: function lengthSq() {
      return this.lengthSquared();
    }
  }, {
    key: "distanceTo",
    value: function distanceTo(vector) {
      return this.distance(vector);
    }
  }, {
    key: "distanceToSquared",
    value: function distanceToSquared(vector) {
      return this.distanceSquared(vector);
    }
  }, {
    key: "getComponent",
    value: function getComponent(i) {
      assert(i >= 0 && i < this.ELEMENTS, 'index is out of range');
      return (0, _common.checkNumber)(this[i]);
    }
  }, {
    key: "setComponent",
    value: function setComponent(i, value) {
      assert(i >= 0 && i < this.ELEMENTS, 'index is out of range');
      this[i] = value;
      return this.check();
    }
  }, {
    key: "addVectors",
    value: function addVectors(a, b) {
      return this.copy(a).add(b);
    }
  }, {
    key: "subVectors",
    value: function subVectors(a, b) {
      return this.copy(a).subtract(b);
    }
  }, {
    key: "multiplyVectors",
    value: function multiplyVectors(a, b) {
      return this.copy(a).multiply(b);
    }
  }, {
    key: "addScaledVector",
    value: function addScaledVector(a, b) {
      return this.add(new this.constructor(a).multiplyScalar(b));
    }
  }, {
    key: "x",
    get: function get() {
      return this[0];
    },
    set: function set(value) {
      return this[0] = (0, _common.checkNumber)(value);
    }
  }, {
    key: "y",
    get: function get() {
      return this[1];
    },
    set: function set(value) {
      return this[1] = (0, _common.checkNumber)(value);
    }
  }]);
  return Vector;
}(_mathArray.default);

exports.default = Vector;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","./math-array":"orGy","./common":"Ma4c"}],"hRXm":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.setMatrixArrayType = setMatrixArrayType;
exports.toRadian = toRadian;
exports.equals = equals;
exports.RANDOM = exports.ARRAY_TYPE = exports.EPSILON = void 0;

/**
 * Common utilities
 * @module glMatrix
 */
// Configuration Constants
var EPSILON = 0.000001;
exports.EPSILON = EPSILON;
var ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array;
exports.ARRAY_TYPE = ARRAY_TYPE;
var RANDOM = Math.random;
/**
 * Sets the type of array used when creating new vectors and matrices
 *
 * @param {Type} type Array type, such as Float32Array or Array
 */

exports.RANDOM = RANDOM;

function setMatrixArrayType(type) {
  exports.ARRAY_TYPE = ARRAY_TYPE = type;
}

var degree = Math.PI / 180;
/**
 * Convert Degree To Radian
 *
 * @param {Number} a Angle in Degrees
 */

function toRadian(a) {
  return a * degree;
}
/**
 * Tests whether or not the arguments have approximately the same value, within an absolute
 * or relative tolerance of glMatrix.EPSILON (an absolute tolerance is used for values less
 * than or equal to 1.0, and a relative tolerance is used for larger values)
 *
 * @param {Number} a The first number to test.
 * @param {Number} b The second number to test.
 * @returns {Boolean} True if the numbers are approximately equal, false otherwise.
 */


function equals(a, b) {
  return Math.abs(a - b) <= EPSILON * Math.max(1.0, Math.abs(a), Math.abs(b));
}

if (!Math.hypot) Math.hypot = function () {
  var y = 0,
      i = arguments.length;

  while (i--) {
    y += arguments[i] * arguments[i];
  }

  return Math.sqrt(y);
};
},{}],"iP3z":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.create = create;
exports.clone = clone;
exports.fromValues = fromValues;
exports.copy = copy;
exports.set = set;
exports.add = add;
exports.subtract = subtract;
exports.multiply = multiply;
exports.divide = divide;
exports.ceil = ceil;
exports.floor = floor;
exports.min = min;
exports.max = max;
exports.round = round;
exports.scale = scale;
exports.scaleAndAdd = scaleAndAdd;
exports.distance = distance;
exports.squaredDistance = squaredDistance;
exports.length = length;
exports.squaredLength = squaredLength;
exports.negate = negate;
exports.inverse = inverse;
exports.normalize = normalize;
exports.dot = dot;
exports.cross = cross;
exports.lerp = lerp;
exports.random = random;
exports.transformMat2 = transformMat2;
exports.transformMat2d = transformMat2d;
exports.transformMat3 = transformMat3;
exports.transformMat4 = transformMat4;
exports.rotate = rotate;
exports.angle = angle;
exports.zero = zero;
exports.str = str;
exports.exactEquals = exactEquals;
exports.equals = equals;
exports.forEach = exports.sqrLen = exports.sqrDist = exports.dist = exports.div = exports.mul = exports.sub = exports.len = void 0;

var glMatrix = _interopRequireWildcard(require("./common.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * 2 Dimensional Vector
 * @module vec2
 */

/**
 * Creates a new, empty vec2
 *
 * @returns {vec2} a new 2D vector
 */
function create() {
  var out = new glMatrix.ARRAY_TYPE(2);

  if (glMatrix.ARRAY_TYPE != Float32Array) {
    out[0] = 0;
    out[1] = 0;
  }

  return out;
}
/**
 * Creates a new vec2 initialized with values from an existing vector
 *
 * @param {vec2} a vector to clone
 * @returns {vec2} a new 2D vector
 */


function clone(a) {
  var out = new glMatrix.ARRAY_TYPE(2);
  out[0] = a[0];
  out[1] = a[1];
  return out;
}
/**
 * Creates a new vec2 initialized with the given values
 *
 * @param {Number} x X component
 * @param {Number} y Y component
 * @returns {vec2} a new 2D vector
 */


function fromValues(x, y) {
  var out = new glMatrix.ARRAY_TYPE(2);
  out[0] = x;
  out[1] = y;
  return out;
}
/**
 * Copy the values from one vec2 to another
 *
 * @param {vec2} out the receiving vector
 * @param {vec2} a the source vector
 * @returns {vec2} out
 */


function copy(out, a) {
  out[0] = a[0];
  out[1] = a[1];
  return out;
}
/**
 * Set the components of a vec2 to the given values
 *
 * @param {vec2} out the receiving vector
 * @param {Number} x X component
 * @param {Number} y Y component
 * @returns {vec2} out
 */


function set(out, x, y) {
  out[0] = x;
  out[1] = y;
  return out;
}
/**
 * Adds two vec2's
 *
 * @param {vec2} out the receiving vector
 * @param {vec2} a the first operand
 * @param {vec2} b the second operand
 * @returns {vec2} out
 */


function add(out, a, b) {
  out[0] = a[0] + b[0];
  out[1] = a[1] + b[1];
  return out;
}
/**
 * Subtracts vector b from vector a
 *
 * @param {vec2} out the receiving vector
 * @param {vec2} a the first operand
 * @param {vec2} b the second operand
 * @returns {vec2} out
 */


function subtract(out, a, b) {
  out[0] = a[0] - b[0];
  out[1] = a[1] - b[1];
  return out;
}
/**
 * Multiplies two vec2's
 *
 * @param {vec2} out the receiving vector
 * @param {vec2} a the first operand
 * @param {vec2} b the second operand
 * @returns {vec2} out
 */


function multiply(out, a, b) {
  out[0] = a[0] * b[0];
  out[1] = a[1] * b[1];
  return out;
}
/**
 * Divides two vec2's
 *
 * @param {vec2} out the receiving vector
 * @param {vec2} a the first operand
 * @param {vec2} b the second operand
 * @returns {vec2} out
 */


function divide(out, a, b) {
  out[0] = a[0] / b[0];
  out[1] = a[1] / b[1];
  return out;
}
/**
 * Math.ceil the components of a vec2
 *
 * @param {vec2} out the receiving vector
 * @param {vec2} a vector to ceil
 * @returns {vec2} out
 */


function ceil(out, a) {
  out[0] = Math.ceil(a[0]);
  out[1] = Math.ceil(a[1]);
  return out;
}
/**
 * Math.floor the components of a vec2
 *
 * @param {vec2} out the receiving vector
 * @param {vec2} a vector to floor
 * @returns {vec2} out
 */


function floor(out, a) {
  out[0] = Math.floor(a[0]);
  out[1] = Math.floor(a[1]);
  return out;
}
/**
 * Returns the minimum of two vec2's
 *
 * @param {vec2} out the receiving vector
 * @param {vec2} a the first operand
 * @param {vec2} b the second operand
 * @returns {vec2} out
 */


function min(out, a, b) {
  out[0] = Math.min(a[0], b[0]);
  out[1] = Math.min(a[1], b[1]);
  return out;
}
/**
 * Returns the maximum of two vec2's
 *
 * @param {vec2} out the receiving vector
 * @param {vec2} a the first operand
 * @param {vec2} b the second operand
 * @returns {vec2} out
 */


function max(out, a, b) {
  out[0] = Math.max(a[0], b[0]);
  out[1] = Math.max(a[1], b[1]);
  return out;
}
/**
 * Math.round the components of a vec2
 *
 * @param {vec2} out the receiving vector
 * @param {vec2} a vector to round
 * @returns {vec2} out
 */


function round(out, a) {
  out[0] = Math.round(a[0]);
  out[1] = Math.round(a[1]);
  return out;
}
/**
 * Scales a vec2 by a scalar number
 *
 * @param {vec2} out the receiving vector
 * @param {vec2} a the vector to scale
 * @param {Number} b amount to scale the vector by
 * @returns {vec2} out
 */


function scale(out, a, b) {
  out[0] = a[0] * b;
  out[1] = a[1] * b;
  return out;
}
/**
 * Adds two vec2's after scaling the second operand by a scalar value
 *
 * @param {vec2} out the receiving vector
 * @param {vec2} a the first operand
 * @param {vec2} b the second operand
 * @param {Number} scale the amount to scale b by before adding
 * @returns {vec2} out
 */


function scaleAndAdd(out, a, b, scale) {
  out[0] = a[0] + b[0] * scale;
  out[1] = a[1] + b[1] * scale;
  return out;
}
/**
 * Calculates the euclidian distance between two vec2's
 *
 * @param {vec2} a the first operand
 * @param {vec2} b the second operand
 * @returns {Number} distance between a and b
 */


function distance(a, b) {
  var x = b[0] - a[0],
      y = b[1] - a[1];
  return Math.hypot(x, y);
}
/**
 * Calculates the squared euclidian distance between two vec2's
 *
 * @param {vec2} a the first operand
 * @param {vec2} b the second operand
 * @returns {Number} squared distance between a and b
 */


function squaredDistance(a, b) {
  var x = b[0] - a[0],
      y = b[1] - a[1];
  return x * x + y * y;
}
/**
 * Calculates the length of a vec2
 *
 * @param {vec2} a vector to calculate length of
 * @returns {Number} length of a
 */


function length(a) {
  var x = a[0],
      y = a[1];
  return Math.hypot(x, y);
}
/**
 * Calculates the squared length of a vec2
 *
 * @param {vec2} a vector to calculate squared length of
 * @returns {Number} squared length of a
 */


function squaredLength(a) {
  var x = a[0],
      y = a[1];
  return x * x + y * y;
}
/**
 * Negates the components of a vec2
 *
 * @param {vec2} out the receiving vector
 * @param {vec2} a vector to negate
 * @returns {vec2} out
 */


function negate(out, a) {
  out[0] = -a[0];
  out[1] = -a[1];
  return out;
}
/**
 * Returns the inverse of the components of a vec2
 *
 * @param {vec2} out the receiving vector
 * @param {vec2} a vector to invert
 * @returns {vec2} out
 */


function inverse(out, a) {
  out[0] = 1.0 / a[0];
  out[1] = 1.0 / a[1];
  return out;
}
/**
 * Normalize a vec2
 *
 * @param {vec2} out the receiving vector
 * @param {vec2} a vector to normalize
 * @returns {vec2} out
 */


function normalize(out, a) {
  var x = a[0],
      y = a[1];
  var len = x * x + y * y;

  if (len > 0) {
    //TODO: evaluate use of glm_invsqrt here?
    len = 1 / Math.sqrt(len);
  }

  out[0] = a[0] * len;
  out[1] = a[1] * len;
  return out;
}
/**
 * Calculates the dot product of two vec2's
 *
 * @param {vec2} a the first operand
 * @param {vec2} b the second operand
 * @returns {Number} dot product of a and b
 */


function dot(a, b) {
  return a[0] * b[0] + a[1] * b[1];
}
/**
 * Computes the cross product of two vec2's
 * Note that the cross product must by definition produce a 3D vector
 *
 * @param {vec3} out the receiving vector
 * @param {vec2} a the first operand
 * @param {vec2} b the second operand
 * @returns {vec3} out
 */


function cross(out, a, b) {
  var z = a[0] * b[1] - a[1] * b[0];
  out[0] = out[1] = 0;
  out[2] = z;
  return out;
}
/**
 * Performs a linear interpolation between two vec2's
 *
 * @param {vec2} out the receiving vector
 * @param {vec2} a the first operand
 * @param {vec2} b the second operand
 * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
 * @returns {vec2} out
 */


function lerp(out, a, b, t) {
  var ax = a[0],
      ay = a[1];
  out[0] = ax + t * (b[0] - ax);
  out[1] = ay + t * (b[1] - ay);
  return out;
}
/**
 * Generates a random vector with the given scale
 *
 * @param {vec2} out the receiving vector
 * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned
 * @returns {vec2} out
 */


function random(out, scale) {
  scale = scale || 1.0;
  var r = glMatrix.RANDOM() * 2.0 * Math.PI;
  out[0] = Math.cos(r) * scale;
  out[1] = Math.sin(r) * scale;
  return out;
}
/**
 * Transforms the vec2 with a mat2
 *
 * @param {vec2} out the receiving vector
 * @param {vec2} a the vector to transform
 * @param {mat2} m matrix to transform with
 * @returns {vec2} out
 */


function transformMat2(out, a, m) {
  var x = a[0],
      y = a[1];
  out[0] = m[0] * x + m[2] * y;
  out[1] = m[1] * x + m[3] * y;
  return out;
}
/**
 * Transforms the vec2 with a mat2d
 *
 * @param {vec2} out the receiving vector
 * @param {vec2} a the vector to transform
 * @param {mat2d} m matrix to transform with
 * @returns {vec2} out
 */


function transformMat2d(out, a, m) {
  var x = a[0],
      y = a[1];
  out[0] = m[0] * x + m[2] * y + m[4];
  out[1] = m[1] * x + m[3] * y + m[5];
  return out;
}
/**
 * Transforms the vec2 with a mat3
 * 3rd vector component is implicitly '1'
 *
 * @param {vec2} out the receiving vector
 * @param {vec2} a the vector to transform
 * @param {mat3} m matrix to transform with
 * @returns {vec2} out
 */


function transformMat3(out, a, m) {
  var x = a[0],
      y = a[1];
  out[0] = m[0] * x + m[3] * y + m[6];
  out[1] = m[1] * x + m[4] * y + m[7];
  return out;
}
/**
 * Transforms the vec2 with a mat4
 * 3rd vector component is implicitly '0'
 * 4th vector component is implicitly '1'
 *
 * @param {vec2} out the receiving vector
 * @param {vec2} a the vector to transform
 * @param {mat4} m matrix to transform with
 * @returns {vec2} out
 */


function transformMat4(out, a, m) {
  var x = a[0];
  var y = a[1];
  out[0] = m[0] * x + m[4] * y + m[12];
  out[1] = m[1] * x + m[5] * y + m[13];
  return out;
}
/**
 * Rotate a 2D vector
 * @param {vec2} out The receiving vec2
 * @param {vec2} a The vec2 point to rotate
 * @param {vec2} b The origin of the rotation
 * @param {Number} c The angle of rotation
 * @returns {vec2} out
 */


function rotate(out, a, b, c) {
  //Translate point to the origin
  var p0 = a[0] - b[0],
      p1 = a[1] - b[1],
      sinC = Math.sin(c),
      cosC = Math.cos(c); //perform rotation and translate to correct position

  out[0] = p0 * cosC - p1 * sinC + b[0];
  out[1] = p0 * sinC + p1 * cosC + b[1];
  return out;
}
/**
 * Get the angle between two 2D vectors
 * @param {vec2} a The first operand
 * @param {vec2} b The second operand
 * @returns {Number} The angle in radians
 */


function angle(a, b) {
  var x1 = a[0],
      y1 = a[1],
      x2 = b[0],
      y2 = b[1];
  var len1 = x1 * x1 + y1 * y1;

  if (len1 > 0) {
    //TODO: evaluate use of glm_invsqrt here?
    len1 = 1 / Math.sqrt(len1);
  }

  var len2 = x2 * x2 + y2 * y2;

  if (len2 > 0) {
    //TODO: evaluate use of glm_invsqrt here?
    len2 = 1 / Math.sqrt(len2);
  }

  var cosine = (x1 * x2 + y1 * y2) * len1 * len2;

  if (cosine > 1.0) {
    return 0;
  } else if (cosine < -1.0) {
    return Math.PI;
  } else {
    return Math.acos(cosine);
  }
}
/**
 * Set the components of a vec2 to zero
 *
 * @param {vec2} out the receiving vector
 * @returns {vec2} out
 */


function zero(out) {
  out[0] = 0.0;
  out[1] = 0.0;
  return out;
}
/**
 * Returns a string representation of a vector
 *
 * @param {vec2} a vector to represent as a string
 * @returns {String} string representation of the vector
 */


function str(a) {
  return 'vec2(' + a[0] + ', ' + a[1] + ')';
}
/**
 * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===)
 *
 * @param {vec2} a The first vector.
 * @param {vec2} b The second vector.
 * @returns {Boolean} True if the vectors are equal, false otherwise.
 */


function exactEquals(a, b) {
  return a[0] === b[0] && a[1] === b[1];
}
/**
 * Returns whether or not the vectors have approximately the same elements in the same position.
 *
 * @param {vec2} a The first vector.
 * @param {vec2} b The second vector.
 * @returns {Boolean} True if the vectors are equal, false otherwise.
 */


function equals(a, b) {
  var a0 = a[0],
      a1 = a[1];
  var b0 = b[0],
      b1 = b[1];
  return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1));
}
/**
 * Alias for {@link vec2.length}
 * @function
 */


var len = length;
/**
 * Alias for {@link vec2.subtract}
 * @function
 */

exports.len = len;
var sub = subtract;
/**
 * Alias for {@link vec2.multiply}
 * @function
 */

exports.sub = sub;
var mul = multiply;
/**
 * Alias for {@link vec2.divide}
 * @function
 */

exports.mul = mul;
var div = divide;
/**
 * Alias for {@link vec2.distance}
 * @function
 */

exports.div = div;
var dist = distance;
/**
 * Alias for {@link vec2.squaredDistance}
 * @function
 */

exports.dist = dist;
var sqrDist = squaredDistance;
/**
 * Alias for {@link vec2.squaredLength}
 * @function
 */

exports.sqrDist = sqrDist;
var sqrLen = squaredLength;
/**
 * Perform some operation over an array of vec2s.
 *
 * @param {Array} a the array of vectors to iterate over
 * @param {Number} stride Number of elements between the start of each vec2. If 0 assumes tightly packed
 * @param {Number} offset Number of elements to skip at the beginning of the array
 * @param {Number} count Number of vec2s to iterate over. If 0 iterates over entire array
 * @param {Function} fn Function to call for each vector in the array
 * @param {Object} [arg] additional argument to pass to fn
 * @returns {Array} a
 * @function
 */

exports.sqrLen = sqrLen;

var forEach = function () {
  var vec = create();
  return function (a, stride, offset, count, fn, arg) {
    var i, l;

    if (!stride) {
      stride = 2;
    }

    if (!offset) {
      offset = 0;
    }

    if (count) {
      l = Math.min(count * stride + offset, a.length);
    } else {
      l = a.length;
    }

    for (i = offset; i < l; i += stride) {
      vec[0] = a[i];
      vec[1] = a[i + 1];
      fn(vec, vec, arg);
      a[i] = vec[0];
      a[i + 1] = vec[1];
    }

    return a;
  };
}();

exports.forEach = forEach;
},{"./common.js":"hRXm"}],"VaFZ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _vector = _interopRequireDefault(require("./lib/vector"));

var vec2 = _interopRequireWildcard(require("gl-matrix/vec2"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Vector2 = function (_Vector) {
  (0, _inherits2.default)(Vector2, _Vector);

  function Vector2() {
    var _this;

    var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
    var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
    (0, _classCallCheck2.default)(this, Vector2);
    _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Vector2).call(this, 2));

    if (Array.isArray(x) && arguments.length === 1) {
      _this.copy(x);
    } else {
      _this.set(x, y);
    }

    return _this;
  }

  (0, _createClass2.default)(Vector2, [{
    key: "cross",
    value: function cross(vector) {
      vec2.cross(this, this, vector);
      return this.check();
    }
  }, {
    key: "horizontalAngle",
    value: function horizontalAngle() {
      return Math.atan2(this.y, this.x);
    }
  }, {
    key: "verticalAngle",
    value: function verticalAngle() {
      return Math.atan2(this.x, this.y);
    }
  }, {
    key: "operation",
    value: function operation(_operation) {
      for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
        args[_key - 1] = arguments[_key];
      }

      _operation.apply(void 0, [this, this].concat(args));

      return this.check();
    }
  }, {
    key: "ELEMENTS",
    get: function get() {
      return 2;
    }
  }]);
  return Vector2;
}(_vector.default);

exports.default = Vector2;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","./lib/vector":"JeJF","gl-matrix/vec2":"iP3z"}],"vuBh":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.create = create;
exports.clone = clone;
exports.length = length;
exports.fromValues = fromValues;
exports.copy = copy;
exports.set = set;
exports.add = add;
exports.subtract = subtract;
exports.multiply = multiply;
exports.divide = divide;
exports.ceil = ceil;
exports.floor = floor;
exports.min = min;
exports.max = max;
exports.round = round;
exports.scale = scale;
exports.scaleAndAdd = scaleAndAdd;
exports.distance = distance;
exports.squaredDistance = squaredDistance;
exports.squaredLength = squaredLength;
exports.negate = negate;
exports.inverse = inverse;
exports.normalize = normalize;
exports.dot = dot;
exports.cross = cross;
exports.lerp = lerp;
exports.hermite = hermite;
exports.bezier = bezier;
exports.random = random;
exports.transformMat4 = transformMat4;
exports.transformMat3 = transformMat3;
exports.transformQuat = transformQuat;
exports.rotateX = rotateX;
exports.rotateY = rotateY;
exports.rotateZ = rotateZ;
exports.angle = angle;
exports.zero = zero;
exports.str = str;
exports.exactEquals = exactEquals;
exports.equals = equals;
exports.forEach = exports.sqrLen = exports.len = exports.sqrDist = exports.dist = exports.div = exports.mul = exports.sub = void 0;

var glMatrix = _interopRequireWildcard(require("./common.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * 3 Dimensional Vector
 * @module vec3
 */

/**
 * Creates a new, empty vec3
 *
 * @returns {vec3} a new 3D vector
 */
function create() {
  var out = new glMatrix.ARRAY_TYPE(3);

  if (glMatrix.ARRAY_TYPE != Float32Array) {
    out[0] = 0;
    out[1] = 0;
    out[2] = 0;
  }

  return out;
}
/**
 * Creates a new vec3 initialized with values from an existing vector
 *
 * @param {vec3} a vector to clone
 * @returns {vec3} a new 3D vector
 */


function clone(a) {
  var out = new glMatrix.ARRAY_TYPE(3);
  out[0] = a[0];
  out[1] = a[1];
  out[2] = a[2];
  return out;
}
/**
 * Calculates the length of a vec3
 *
 * @param {vec3} a vector to calculate length of
 * @returns {Number} length of a
 */


function length(a) {
  var x = a[0];
  var y = a[1];
  var z = a[2];
  return Math.hypot(x, y, z);
}
/**
 * Creates a new vec3 initialized with the given values
 *
 * @param {Number} x X component
 * @param {Number} y Y component
 * @param {Number} z Z component
 * @returns {vec3} a new 3D vector
 */


function fromValues(x, y, z) {
  var out = new glMatrix.ARRAY_TYPE(3);
  out[0] = x;
  out[1] = y;
  out[2] = z;
  return out;
}
/**
 * Copy the values from one vec3 to another
 *
 * @param {vec3} out the receiving vector
 * @param {vec3} a the source vector
 * @returns {vec3} out
 */


function copy(out, a) {
  out[0] = a[0];
  out[1] = a[1];
  out[2] = a[2];
  return out;
}
/**
 * Set the components of a vec3 to the given values
 *
 * @param {vec3} out the receiving vector
 * @param {Number} x X component
 * @param {Number} y Y component
 * @param {Number} z Z component
 * @returns {vec3} out
 */


function set(out, x, y, z) {
  out[0] = x;
  out[1] = y;
  out[2] = z;
  return out;
}
/**
 * Adds two vec3's
 *
 * @param {vec3} out the receiving vector
 * @param {vec3} a the first operand
 * @param {vec3} b the second operand
 * @returns {vec3} out
 */


function add(out, a, b) {
  out[0] = a[0] + b[0];
  out[1] = a[1] + b[1];
  out[2] = a[2] + b[2];
  return out;
}
/**
 * Subtracts vector b from vector a
 *
 * @param {vec3} out the receiving vector
 * @param {vec3} a the first operand
 * @param {vec3} b the second operand
 * @returns {vec3} out
 */


function subtract(out, a, b) {
  out[0] = a[0] - b[0];
  out[1] = a[1] - b[1];
  out[2] = a[2] - b[2];
  return out;
}
/**
 * Multiplies two vec3's
 *
 * @param {vec3} out the receiving vector
 * @param {vec3} a the first operand
 * @param {vec3} b the second operand
 * @returns {vec3} out
 */


function multiply(out, a, b) {
  out[0] = a[0] * b[0];
  out[1] = a[1] * b[1];
  out[2] = a[2] * b[2];
  return out;
}
/**
 * Divides two vec3's
 *
 * @param {vec3} out the receiving vector
 * @param {vec3} a the first operand
 * @param {vec3} b the second operand
 * @returns {vec3} out
 */


function divide(out, a, b) {
  out[0] = a[0] / b[0];
  out[1] = a[1] / b[1];
  out[2] = a[2] / b[2];
  return out;
}
/**
 * Math.ceil the components of a vec3
 *
 * @param {vec3} out the receiving vector
 * @param {vec3} a vector to ceil
 * @returns {vec3} out
 */


function ceil(out, a) {
  out[0] = Math.ceil(a[0]);
  out[1] = Math.ceil(a[1]);
  out[2] = Math.ceil(a[2]);
  return out;
}
/**
 * Math.floor the components of a vec3
 *
 * @param {vec3} out the receiving vector
 * @param {vec3} a vector to floor
 * @returns {vec3} out
 */


function floor(out, a) {
  out[0] = Math.floor(a[0]);
  out[1] = Math.floor(a[1]);
  out[2] = Math.floor(a[2]);
  return out;
}
/**
 * Returns the minimum of two vec3's
 *
 * @param {vec3} out the receiving vector
 * @param {vec3} a the first operand
 * @param {vec3} b the second operand
 * @returns {vec3} out
 */


function min(out, a, b) {
  out[0] = Math.min(a[0], b[0]);
  out[1] = Math.min(a[1], b[1]);
  out[2] = Math.min(a[2], b[2]);
  return out;
}
/**
 * Returns the maximum of two vec3's
 *
 * @param {vec3} out the receiving vector
 * @param {vec3} a the first operand
 * @param {vec3} b the second operand
 * @returns {vec3} out
 */


function max(out, a, b) {
  out[0] = Math.max(a[0], b[0]);
  out[1] = Math.max(a[1], b[1]);
  out[2] = Math.max(a[2], b[2]);
  return out;
}
/**
 * Math.round the components of a vec3
 *
 * @param {vec3} out the receiving vector
 * @param {vec3} a vector to round
 * @returns {vec3} out
 */


function round(out, a) {
  out[0] = Math.round(a[0]);
  out[1] = Math.round(a[1]);
  out[2] = Math.round(a[2]);
  return out;
}
/**
 * Scales a vec3 by a scalar number
 *
 * @param {vec3} out the receiving vector
 * @param {vec3} a the vector to scale
 * @param {Number} b amount to scale the vector by
 * @returns {vec3} out
 */


function scale(out, a, b) {
  out[0] = a[0] * b;
  out[1] = a[1] * b;
  out[2] = a[2] * b;
  return out;
}
/**
 * Adds two vec3's after scaling the second operand by a scalar value
 *
 * @param {vec3} out the receiving vector
 * @param {vec3} a the first operand
 * @param {vec3} b the second operand
 * @param {Number} scale the amount to scale b by before adding
 * @returns {vec3} out
 */


function scaleAndAdd(out, a, b, scale) {
  out[0] = a[0] + b[0] * scale;
  out[1] = a[1] + b[1] * scale;
  out[2] = a[2] + b[2] * scale;
  return out;
}
/**
 * Calculates the euclidian distance between two vec3's
 *
 * @param {vec3} a the first operand
 * @param {vec3} b the second operand
 * @returns {Number} distance between a and b
 */


function distance(a, b) {
  var x = b[0] - a[0];
  var y = b[1] - a[1];
  var z = b[2] - a[2];
  return Math.hypot(x, y, z);
}
/**
 * Calculates the squared euclidian distance between two vec3's
 *
 * @param {vec3} a the first operand
 * @param {vec3} b the second operand
 * @returns {Number} squared distance between a and b
 */


function squaredDistance(a, b) {
  var x = b[0] - a[0];
  var y = b[1] - a[1];
  var z = b[2] - a[2];
  return x * x + y * y + z * z;
}
/**
 * Calculates the squared length of a vec3
 *
 * @param {vec3} a vector to calculate squared length of
 * @returns {Number} squared length of a
 */


function squaredLength(a) {
  var x = a[0];
  var y = a[1];
  var z = a[2];
  return x * x + y * y + z * z;
}
/**
 * Negates the components of a vec3
 *
 * @param {vec3} out the receiving vector
 * @param {vec3} a vector to negate
 * @returns {vec3} out
 */


function negate(out, a) {
  out[0] = -a[0];
  out[1] = -a[1];
  out[2] = -a[2];
  return out;
}
/**
 * Returns the inverse of the components of a vec3
 *
 * @param {vec3} out the receiving vector
 * @param {vec3} a vector to invert
 * @returns {vec3} out
 */


function inverse(out, a) {
  out[0] = 1.0 / a[0];
  out[1] = 1.0 / a[1];
  out[2] = 1.0 / a[2];
  return out;
}
/**
 * Normalize a vec3
 *
 * @param {vec3} out the receiving vector
 * @param {vec3} a vector to normalize
 * @returns {vec3} out
 */


function normalize(out, a) {
  var x = a[0];
  var y = a[1];
  var z = a[2];
  var len = x * x + y * y + z * z;

  if (len > 0) {
    //TODO: evaluate use of glm_invsqrt here?
    len = 1 / Math.sqrt(len);
  }

  out[0] = a[0] * len;
  out[1] = a[1] * len;
  out[2] = a[2] * len;
  return out;
}
/**
 * Calculates the dot product of two vec3's
 *
 * @param {vec3} a the first operand
 * @param {vec3} b the second operand
 * @returns {Number} dot product of a and b
 */


function dot(a, b) {
  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
}
/**
 * Computes the cross product of two vec3's
 *
 * @param {vec3} out the receiving vector
 * @param {vec3} a the first operand
 * @param {vec3} b the second operand
 * @returns {vec3} out
 */


function cross(out, a, b) {
  var ax = a[0],
      ay = a[1],
      az = a[2];
  var bx = b[0],
      by = b[1],
      bz = b[2];
  out[0] = ay * bz - az * by;
  out[1] = az * bx - ax * bz;
  out[2] = ax * by - ay * bx;
  return out;
}
/**
 * Performs a linear interpolation between two vec3's
 *
 * @param {vec3} out the receiving vector
 * @param {vec3} a the first operand
 * @param {vec3} b the second operand
 * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
 * @returns {vec3} out
 */


function lerp(out, a, b, t) {
  var ax = a[0];
  var ay = a[1];
  var az = a[2];
  out[0] = ax + t * (b[0] - ax);
  out[1] = ay + t * (b[1] - ay);
  out[2] = az + t * (b[2] - az);
  return out;
}
/**
 * Performs a hermite interpolation with two control points
 *
 * @param {vec3} out the receiving vector
 * @param {vec3} a the first operand
 * @param {vec3} b the second operand
 * @param {vec3} c the third operand
 * @param {vec3} d the fourth operand
 * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
 * @returns {vec3} out
 */


function hermite(out, a, b, c, d, t) {
  var factorTimes2 = t * t;
  var factor1 = factorTimes2 * (2 * t - 3) + 1;
  var factor2 = factorTimes2 * (t - 2) + t;
  var factor3 = factorTimes2 * (t - 1);
  var factor4 = factorTimes2 * (3 - 2 * t);
  out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;
  out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;
  out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;
  return out;
}
/**
 * Performs a bezier interpolation with two control points
 *
 * @param {vec3} out the receiving vector
 * @param {vec3} a the first operand
 * @param {vec3} b the second operand
 * @param {vec3} c the third operand
 * @param {vec3} d the fourth operand
 * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
 * @returns {vec3} out
 */


function bezier(out, a, b, c, d, t) {
  var inverseFactor = 1 - t;
  var inverseFactorTimesTwo = inverseFactor * inverseFactor;
  var factorTimes2 = t * t;
  var factor1 = inverseFactorTimesTwo * inverseFactor;
  var factor2 = 3 * t * inverseFactorTimesTwo;
  var factor3 = 3 * factorTimes2 * inverseFactor;
  var factor4 = factorTimes2 * t;
  out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;
  out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;
  out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;
  return out;
}
/**
 * Generates a random vector with the given scale
 *
 * @param {vec3} out the receiving vector
 * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned
 * @returns {vec3} out
 */


function random(out, scale) {
  scale = scale || 1.0;
  var r = glMatrix.RANDOM() * 2.0 * Math.PI;
  var z = glMatrix.RANDOM() * 2.0 - 1.0;
  var zScale = Math.sqrt(1.0 - z * z) * scale;
  out[0] = Math.cos(r) * zScale;
  out[1] = Math.sin(r) * zScale;
  out[2] = z * scale;
  return out;
}
/**
 * Transforms the vec3 with a mat4.
 * 4th vector component is implicitly '1'
 *
 * @param {vec3} out the receiving vector
 * @param {vec3} a the vector to transform
 * @param {mat4} m matrix to transform with
 * @returns {vec3} out
 */


function transformMat4(out, a, m) {
  var x = a[0],
      y = a[1],
      z = a[2];
  var w = m[3] * x + m[7] * y + m[11] * z + m[15];
  w = w || 1.0;
  out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;
  out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;
  out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;
  return out;
}
/**
 * Transforms the vec3 with a mat3.
 *
 * @param {vec3} out the receiving vector
 * @param {vec3} a the vector to transform
 * @param {mat3} m the 3x3 matrix to transform with
 * @returns {vec3} out
 */


function transformMat3(out, a, m) {
  var x = a[0],
      y = a[1],
      z = a[2];
  out[0] = x * m[0] + y * m[3] + z * m[6];
  out[1] = x * m[1] + y * m[4] + z * m[7];
  out[2] = x * m[2] + y * m[5] + z * m[8];
  return out;
}
/**
 * Transforms the vec3 with a quat
 * Can also be used for dual quaternions. (Multiply it with the real part)
 *
 * @param {vec3} out the receiving vector
 * @param {vec3} a the vector to transform
 * @param {quat} q quaternion to transform with
 * @returns {vec3} out
 */


function transformQuat(out, a, q) {
  // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed
  var qx = q[0],
      qy = q[1],
      qz = q[2],
      qw = q[3];
  var x = a[0],
      y = a[1],
      z = a[2]; // var qvec = [qx, qy, qz];
  // var uv = vec3.cross([], qvec, a);

  var uvx = qy * z - qz * y,
      uvy = qz * x - qx * z,
      uvz = qx * y - qy * x; // var uuv = vec3.cross([], qvec, uv);

  var uuvx = qy * uvz - qz * uvy,
      uuvy = qz * uvx - qx * uvz,
      uuvz = qx * uvy - qy * uvx; // vec3.scale(uv, uv, 2 * w);

  var w2 = qw * 2;
  uvx *= w2;
  uvy *= w2;
  uvz *= w2; // vec3.scale(uuv, uuv, 2);

  uuvx *= 2;
  uuvy *= 2;
  uuvz *= 2; // return vec3.add(out, a, vec3.add(out, uv, uuv));

  out[0] = x + uvx + uuvx;
  out[1] = y + uvy + uuvy;
  out[2] = z + uvz + uuvz;
  return out;
}
/**
 * Rotate a 3D vector around the x-axis
 * @param {vec3} out The receiving vec3
 * @param {vec3} a The vec3 point to rotate
 * @param {vec3} b The origin of the rotation
 * @param {Number} c The angle of rotation
 * @returns {vec3} out
 */


function rotateX(out, a, b, c) {
  var p = [],
      r = []; //Translate point to the origin

  p[0] = a[0] - b[0];
  p[1] = a[1] - b[1];
  p[2] = a[2] - b[2]; //perform rotation

  r[0] = p[0];
  r[1] = p[1] * Math.cos(c) - p[2] * Math.sin(c);
  r[2] = p[1] * Math.sin(c) + p[2] * Math.cos(c); //translate to correct position

  out[0] = r[0] + b[0];
  out[1] = r[1] + b[1];
  out[2] = r[2] + b[2];
  return out;
}
/**
 * Rotate a 3D vector around the y-axis
 * @param {vec3} out The receiving vec3
 * @param {vec3} a The vec3 point to rotate
 * @param {vec3} b The origin of the rotation
 * @param {Number} c The angle of rotation
 * @returns {vec3} out
 */


function rotateY(out, a, b, c) {
  var p = [],
      r = []; //Translate point to the origin

  p[0] = a[0] - b[0];
  p[1] = a[1] - b[1];
  p[2] = a[2] - b[2]; //perform rotation

  r[0] = p[2] * Math.sin(c) + p[0] * Math.cos(c);
  r[1] = p[1];
  r[2] = p[2] * Math.cos(c) - p[0] * Math.sin(c); //translate to correct position

  out[0] = r[0] + b[0];
  out[1] = r[1] + b[1];
  out[2] = r[2] + b[2];
  return out;
}
/**
 * Rotate a 3D vector around the z-axis
 * @param {vec3} out The receiving vec3
 * @param {vec3} a The vec3 point to rotate
 * @param {vec3} b The origin of the rotation
 * @param {Number} c The angle of rotation
 * @returns {vec3} out
 */


function rotateZ(out, a, b, c) {
  var p = [],
      r = []; //Translate point to the origin

  p[0] = a[0] - b[0];
  p[1] = a[1] - b[1];
  p[2] = a[2] - b[2]; //perform rotation

  r[0] = p[0] * Math.cos(c) - p[1] * Math.sin(c);
  r[1] = p[0] * Math.sin(c) + p[1] * Math.cos(c);
  r[2] = p[2]; //translate to correct position

  out[0] = r[0] + b[0];
  out[1] = r[1] + b[1];
  out[2] = r[2] + b[2];
  return out;
}
/**
 * Get the angle between two 3D vectors
 * @param {vec3} a The first operand
 * @param {vec3} b The second operand
 * @returns {Number} The angle in radians
 */


function angle(a, b) {
  var tempA = fromValues(a[0], a[1], a[2]);
  var tempB = fromValues(b[0], b[1], b[2]);
  normalize(tempA, tempA);
  normalize(tempB, tempB);
  var cosine = dot(tempA, tempB);

  if (cosine > 1.0) {
    return 0;
  } else if (cosine < -1.0) {
    return Math.PI;
  } else {
    return Math.acos(cosine);
  }
}
/**
 * Set the components of a vec3 to zero
 *
 * @param {vec3} out the receiving vector
 * @returns {vec3} out
 */


function zero(out) {
  out[0] = 0.0;
  out[1] = 0.0;
  out[2] = 0.0;
  return out;
}
/**
 * Returns a string representation of a vector
 *
 * @param {vec3} a vector to represent as a string
 * @returns {String} string representation of the vector
 */


function str(a) {
  return 'vec3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ')';
}
/**
 * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)
 *
 * @param {vec3} a The first vector.
 * @param {vec3} b The second vector.
 * @returns {Boolean} True if the vectors are equal, false otherwise.
 */


function exactEquals(a, b) {
  return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];
}
/**
 * Returns whether or not the vectors have approximately the same elements in the same position.
 *
 * @param {vec3} a The first vector.
 * @param {vec3} b The second vector.
 * @returns {Boolean} True if the vectors are equal, false otherwise.
 */


function equals(a, b) {
  var a0 = a[0],
      a1 = a[1],
      a2 = a[2];
  var b0 = b[0],
      b1 = b[1],
      b2 = b[2];
  return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2));
}
/**
 * Alias for {@link vec3.subtract}
 * @function
 */


var sub = subtract;
/**
 * Alias for {@link vec3.multiply}
 * @function
 */

exports.sub = sub;
var mul = multiply;
/**
 * Alias for {@link vec3.divide}
 * @function
 */

exports.mul = mul;
var div = divide;
/**
 * Alias for {@link vec3.distance}
 * @function
 */

exports.div = div;
var dist = distance;
/**
 * Alias for {@link vec3.squaredDistance}
 * @function
 */

exports.dist = dist;
var sqrDist = squaredDistance;
/**
 * Alias for {@link vec3.length}
 * @function
 */

exports.sqrDist = sqrDist;
var len = length;
/**
 * Alias for {@link vec3.squaredLength}
 * @function
 */

exports.len = len;
var sqrLen = squaredLength;
/**
 * Perform some operation over an array of vec3s.
 *
 * @param {Array} a the array of vectors to iterate over
 * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed
 * @param {Number} offset Number of elements to skip at the beginning of the array
 * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array
 * @param {Function} fn Function to call for each vector in the array
 * @param {Object} [arg] additional argument to pass to fn
 * @returns {Array} a
 * @function
 */

exports.sqrLen = sqrLen;

var forEach = function () {
  var vec = create();
  return function (a, stride, offset, count, fn, arg) {
    var i, l;

    if (!stride) {
      stride = 3;
    }

    if (!offset) {
      offset = 0;
    }

    if (count) {
      l = Math.min(count * stride + offset, a.length);
    } else {
      l = a.length;
    }

    for (i = offset; i < l; i += stride) {
      vec[0] = a[i];
      vec[1] = a[i + 1];
      vec[2] = a[i + 2];
      fn(vec, vec, arg);
      a[i] = vec[0];
      a[i + 1] = vec[1];
      a[i + 2] = vec[2];
    }

    return a;
  };
}();

exports.forEach = forEach;
},{"./common.js":"hRXm"}],"jb7a":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _vector = _interopRequireDefault(require("./lib/vector"));

var _common = require("./lib/common");

var vec3 = _interopRequireWildcard(require("gl-matrix/vec3"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var ORIGIN = [0, 0, 0];

var Vector3 = function (_Vector) {
  (0, _inherits2.default)(Vector3, _Vector);

  function Vector3() {
    var _this;

    var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
    var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
    var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
    (0, _classCallCheck2.default)(this, Vector3);
    _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Vector3).call(this, 3));

    if (Array.isArray(x) && arguments.length === 1) {
      _this.copy(x);
    } else {
      _this.set(x, y, z);
    }

    return _this;
  }

  (0, _createClass2.default)(Vector3, [{
    key: "angle",
    value: function angle(vector) {
      return vec3.angle(this, vector);
    }
  }, {
    key: "cross",
    value: function cross(vector) {
      vec3.cross(this, this, vector);
      return this.check();
    }
  }, {
    key: "rotateX",
    value: function rotateX(_ref) {
      var radians = _ref.radians,
          _ref$origin = _ref.origin,
          origin = _ref$origin === void 0 ? ORIGIN : _ref$origin;
      vec3.rotateX(this, this, origin, radians);
      return this.check();
    }
  }, {
    key: "rotateY",
    value: function rotateY(_ref2) {
      var radians = _ref2.radians,
          _ref2$origin = _ref2.origin,
          origin = _ref2$origin === void 0 ? ORIGIN : _ref2$origin;
      vec3.rotateY(this, this, origin, radians);
      return this.check();
    }
  }, {
    key: "rotateZ",
    value: function rotateZ(_ref3) {
      var radians = _ref3.radians,
          _ref3$origin = _ref3.origin,
          origin = _ref3$origin === void 0 ? ORIGIN : _ref3$origin;
      vec3.rotateZ(this, this, origin, radians);
      return this.check();
    }
  }, {
    key: "operation",
    value: function operation(_operation) {
      for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
        args[_key - 1] = arguments[_key];
      }

      _operation.apply(void 0, [this, this].concat(args));

      return this.check();
    }
  }, {
    key: "ELEMENTS",
    get: function get() {
      return 3;
    }
  }, {
    key: "z",
    get: function get() {
      return this[2];
    },
    set: function set(value) {
      return this[2] = (0, _common.checkNumber)(value);
    }
  }]);
  return Vector3;
}(_vector.default);

exports.default = Vector3;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","./lib/vector":"JeJF","./lib/common":"Ma4c","gl-matrix/vec3":"vuBh"}],"LqC5":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _vector = _interopRequireDefault(require("./lib/vector"));

var _common = require("./lib/common");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Vector4 = function (_Vector) {
  (0, _inherits2.default)(Vector4, _Vector);

  function Vector4() {
    var _this;

    var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
    var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
    var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
    var w = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
    (0, _classCallCheck2.default)(this, Vector4);
    _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Vector4).call(this, 4));

    if (Array.isArray(x) && arguments.length === 1) {
      _this.copy(x);
    } else {
      _this.set(x, y, z, w);
    }

    return _this;
  }

  (0, _createClass2.default)(Vector4, [{
    key: "applyMatrix4",
    value: function applyMatrix4(m) {
      m.transformVector(this, this);
      return this;
    }
  }, {
    key: "ELEMENTS",
    get: function get() {
      return 4;
    }
  }, {
    key: "z",
    get: function get() {
      return this[2];
    },
    set: function set(value) {
      return this[2] = (0, _common.checkNumber)(value);
    }
  }, {
    key: "w",
    get: function get() {
      return this[3];
    },
    set: function set(value) {
      return this[3] = (0, _common.checkNumber)(value);
    }
  }]);
  return Vector4;
}(_vector.default);

exports.default = Vector4;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","./lib/vector":"JeJF","./lib/common":"Ma4c"}],"s8Y3":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.validateVector = validateVector;

function validateVector(v, length) {
  if (v.length !== length) {
    return false;
  }

  return v.every(Number.isFinite);
}
},{}],"xq97":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.create = create;
exports.fromMat4 = fromMat4;
exports.clone = clone;
exports.copy = copy;
exports.fromValues = fromValues;
exports.set = set;
exports.identity = identity;
exports.transpose = transpose;
exports.invert = invert;
exports.adjoint = adjoint;
exports.determinant = determinant;
exports.multiply = multiply;
exports.translate = translate;
exports.rotate = rotate;
exports.scale = scale;
exports.fromTranslation = fromTranslation;
exports.fromRotation = fromRotation;
exports.fromScaling = fromScaling;
exports.fromMat2d = fromMat2d;
exports.fromQuat = fromQuat;
exports.normalFromMat4 = normalFromMat4;
exports.projection = projection;
exports.str = str;
exports.frob = frob;
exports.add = add;
exports.subtract = subtract;
exports.multiplyScalar = multiplyScalar;
exports.multiplyScalarAndAdd = multiplyScalarAndAdd;
exports.exactEquals = exactEquals;
exports.equals = equals;
exports.sub = exports.mul = void 0;

var glMatrix = _interopRequireWildcard(require("./common.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * 3x3 Matrix
 * @module mat3
 */

/**
 * Creates a new identity mat3
 *
 * @returns {mat3} a new 3x3 matrix
 */
function create() {
  var out = new glMatrix.ARRAY_TYPE(9);

  if (glMatrix.ARRAY_TYPE != Float32Array) {
    out[1] = 0;
    out[2] = 0;
    out[3] = 0;
    out[5] = 0;
    out[6] = 0;
    out[7] = 0;
  }

  out[0] = 1;
  out[4] = 1;
  out[8] = 1;
  return out;
}
/**
 * Copies the upper-left 3x3 values into the given mat3.
 *
 * @param {mat3} out the receiving 3x3 matrix
 * @param {mat4} a   the source 4x4 matrix
 * @returns {mat3} out
 */


function fromMat4(out, a) {
  out[0] = a[0];
  out[1] = a[1];
  out[2] = a[2];
  out[3] = a[4];
  out[4] = a[5];
  out[5] = a[6];
  out[6] = a[8];
  out[7] = a[9];
  out[8] = a[10];
  return out;
}
/**
 * Creates a new mat3 initialized with values from an existing matrix
 *
 * @param {mat3} a matrix to clone
 * @returns {mat3} a new 3x3 matrix
 */


function clone(a) {
  var out = new glMatrix.ARRAY_TYPE(9);
  out[0] = a[0];
  out[1] = a[1];
  out[2] = a[2];
  out[3] = a[3];
  out[4] = a[4];
  out[5] = a[5];
  out[6] = a[6];
  out[7] = a[7];
  out[8] = a[8];
  return out;
}
/**
 * Copy the values from one mat3 to another
 *
 * @param {mat3} out the receiving matrix
 * @param {mat3} a the source matrix
 * @returns {mat3} out
 */


function copy(out, a) {
  out[0] = a[0];
  out[1] = a[1];
  out[2] = a[2];
  out[3] = a[3];
  out[4] = a[4];
  out[5] = a[5];
  out[6] = a[6];
  out[7] = a[7];
  out[8] = a[8];
  return out;
}
/**
 * Create a new mat3 with the given values
 *
 * @param {Number} m00 Component in column 0, row 0 position (index 0)
 * @param {Number} m01 Component in column 0, row 1 position (index 1)
 * @param {Number} m02 Component in column 0, row 2 position (index 2)
 * @param {Number} m10 Component in column 1, row 0 position (index 3)
 * @param {Number} m11 Component in column 1, row 1 position (index 4)
 * @param {Number} m12 Component in column 1, row 2 position (index 5)
 * @param {Number} m20 Component in column 2, row 0 position (index 6)
 * @param {Number} m21 Component in column 2, row 1 position (index 7)
 * @param {Number} m22 Component in column 2, row 2 position (index 8)
 * @returns {mat3} A new mat3
 */


function fromValues(m00, m01, m02, m10, m11, m12, m20, m21, m22) {
  var out = new glMatrix.ARRAY_TYPE(9);
  out[0] = m00;
  out[1] = m01;
  out[2] = m02;
  out[3] = m10;
  out[4] = m11;
  out[5] = m12;
  out[6] = m20;
  out[7] = m21;
  out[8] = m22;
  return out;
}
/**
 * Set the components of a mat3 to the given values
 *
 * @param {mat3} out the receiving matrix
 * @param {Number} m00 Component in column 0, row 0 position (index 0)
 * @param {Number} m01 Component in column 0, row 1 position (index 1)
 * @param {Number} m02 Component in column 0, row 2 position (index 2)
 * @param {Number} m10 Component in column 1, row 0 position (index 3)
 * @param {Number} m11 Component in column 1, row 1 position (index 4)
 * @param {Number} m12 Component in column 1, row 2 position (index 5)
 * @param {Number} m20 Component in column 2, row 0 position (index 6)
 * @param {Number} m21 Component in column 2, row 1 position (index 7)
 * @param {Number} m22 Component in column 2, row 2 position (index 8)
 * @returns {mat3} out
 */


function set(out, m00, m01, m02, m10, m11, m12, m20, m21, m22) {
  out[0] = m00;
  out[1] = m01;
  out[2] = m02;
  out[3] = m10;
  out[4] = m11;
  out[5] = m12;
  out[6] = m20;
  out[7] = m21;
  out[8] = m22;
  return out;
}
/**
 * Set a mat3 to the identity matrix
 *
 * @param {mat3} out the receiving matrix
 * @returns {mat3} out
 */


function identity(out) {
  out[0] = 1;
  out[1] = 0;
  out[2] = 0;
  out[3] = 0;
  out[4] = 1;
  out[5] = 0;
  out[6] = 0;
  out[7] = 0;
  out[8] = 1;
  return out;
}
/**
 * Transpose the values of a mat3
 *
 * @param {mat3} out the receiving matrix
 * @param {mat3} a the source matrix
 * @returns {mat3} out
 */


function transpose(out, a) {
  // If we are transposing ourselves we can skip a few steps but have to cache some values
  if (out === a) {
    var a01 = a[1],
        a02 = a[2],
        a12 = a[5];
    out[1] = a[3];
    out[2] = a[6];
    out[3] = a01;
    out[5] = a[7];
    out[6] = a02;
    out[7] = a12;
  } else {
    out[0] = a[0];
    out[1] = a[3];
    out[2] = a[6];
    out[3] = a[1];
    out[4] = a[4];
    out[5] = a[7];
    out[6] = a[2];
    out[7] = a[5];
    out[8] = a[8];
  }

  return out;
}
/**
 * Inverts a mat3
 *
 * @param {mat3} out the receiving matrix
 * @param {mat3} a the source matrix
 * @returns {mat3} out
 */


function invert(out, a) {
  var a00 = a[0],
      a01 = a[1],
      a02 = a[2];
  var a10 = a[3],
      a11 = a[4],
      a12 = a[5];
  var a20 = a[6],
      a21 = a[7],
      a22 = a[8];
  var b01 = a22 * a11 - a12 * a21;
  var b11 = -a22 * a10 + a12 * a20;
  var b21 = a21 * a10 - a11 * a20; // Calculate the determinant

  var det = a00 * b01 + a01 * b11 + a02 * b21;

  if (!det) {
    return null;
  }

  det = 1.0 / det;
  out[0] = b01 * det;
  out[1] = (-a22 * a01 + a02 * a21) * det;
  out[2] = (a12 * a01 - a02 * a11) * det;
  out[3] = b11 * det;
  out[4] = (a22 * a00 - a02 * a20) * det;
  out[5] = (-a12 * a00 + a02 * a10) * det;
  out[6] = b21 * det;
  out[7] = (-a21 * a00 + a01 * a20) * det;
  out[8] = (a11 * a00 - a01 * a10) * det;
  return out;
}
/**
 * Calculates the adjugate of a mat3
 *
 * @param {mat3} out the receiving matrix
 * @param {mat3} a the source matrix
 * @returns {mat3} out
 */


function adjoint(out, a) {
  var a00 = a[0],
      a01 = a[1],
      a02 = a[2];
  var a10 = a[3],
      a11 = a[4],
      a12 = a[5];
  var a20 = a[6],
      a21 = a[7],
      a22 = a[8];
  out[0] = a11 * a22 - a12 * a21;
  out[1] = a02 * a21 - a01 * a22;
  out[2] = a01 * a12 - a02 * a11;
  out[3] = a12 * a20 - a10 * a22;
  out[4] = a00 * a22 - a02 * a20;
  out[5] = a02 * a10 - a00 * a12;
  out[6] = a10 * a21 - a11 * a20;
  out[7] = a01 * a20 - a00 * a21;
  out[8] = a00 * a11 - a01 * a10;
  return out;
}
/**
 * Calculates the determinant of a mat3
 *
 * @param {mat3} a the source matrix
 * @returns {Number} determinant of a
 */


function determinant(a) {
  var a00 = a[0],
      a01 = a[1],
      a02 = a[2];
  var a10 = a[3],
      a11 = a[4],
      a12 = a[5];
  var a20 = a[6],
      a21 = a[7],
      a22 = a[8];
  return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20);
}
/**
 * Multiplies two mat3's
 *
 * @param {mat3} out the receiving matrix
 * @param {mat3} a the first operand
 * @param {mat3} b the second operand
 * @returns {mat3} out
 */


function multiply(out, a, b) {
  var a00 = a[0],
      a01 = a[1],
      a02 = a[2];
  var a10 = a[3],
      a11 = a[4],
      a12 = a[5];
  var a20 = a[6],
      a21 = a[7],
      a22 = a[8];
  var b00 = b[0],
      b01 = b[1],
      b02 = b[2];
  var b10 = b[3],
      b11 = b[4],
      b12 = b[5];
  var b20 = b[6],
      b21 = b[7],
      b22 = b[8];
  out[0] = b00 * a00 + b01 * a10 + b02 * a20;
  out[1] = b00 * a01 + b01 * a11 + b02 * a21;
  out[2] = b00 * a02 + b01 * a12 + b02 * a22;
  out[3] = b10 * a00 + b11 * a10 + b12 * a20;
  out[4] = b10 * a01 + b11 * a11 + b12 * a21;
  out[5] = b10 * a02 + b11 * a12 + b12 * a22;
  out[6] = b20 * a00 + b21 * a10 + b22 * a20;
  out[7] = b20 * a01 + b21 * a11 + b22 * a21;
  out[8] = b20 * a02 + b21 * a12 + b22 * a22;
  return out;
}
/**
 * Translate a mat3 by the given vector
 *
 * @param {mat3} out the receiving matrix
 * @param {mat3} a the matrix to translate
 * @param {vec2} v vector to translate by
 * @returns {mat3} out
 */


function translate(out, a, v) {
  var a00 = a[0],
      a01 = a[1],
      a02 = a[2],
      a10 = a[3],
      a11 = a[4],
      a12 = a[5],
      a20 = a[6],
      a21 = a[7],
      a22 = a[8],
      x = v[0],
      y = v[1];
  out[0] = a00;
  out[1] = a01;
  out[2] = a02;
  out[3] = a10;
  out[4] = a11;
  out[5] = a12;
  out[6] = x * a00 + y * a10 + a20;
  out[7] = x * a01 + y * a11 + a21;
  out[8] = x * a02 + y * a12 + a22;
  return out;
}
/**
 * Rotates a mat3 by the given angle
 *
 * @param {mat3} out the receiving matrix
 * @param {mat3} a the matrix to rotate
 * @param {Number} rad the angle to rotate the matrix by
 * @returns {mat3} out
 */


function rotate(out, a, rad) {
  var a00 = a[0],
      a01 = a[1],
      a02 = a[2],
      a10 = a[3],
      a11 = a[4],
      a12 = a[5],
      a20 = a[6],
      a21 = a[7],
      a22 = a[8],
      s = Math.sin(rad),
      c = Math.cos(rad);
  out[0] = c * a00 + s * a10;
  out[1] = c * a01 + s * a11;
  out[2] = c * a02 + s * a12;
  out[3] = c * a10 - s * a00;
  out[4] = c * a11 - s * a01;
  out[5] = c * a12 - s * a02;
  out[6] = a20;
  out[7] = a21;
  out[8] = a22;
  return out;
}

;
/**
 * Scales the mat3 by the dimensions in the given vec2
 *
 * @param {mat3} out the receiving matrix
 * @param {mat3} a the matrix to rotate
 * @param {vec2} v the vec2 to scale the matrix by
 * @returns {mat3} out
 **/

function scale(out, a, v) {
  var x = v[0],
      y = v[1];
  out[0] = x * a[0];
  out[1] = x * a[1];
  out[2] = x * a[2];
  out[3] = y * a[3];
  out[4] = y * a[4];
  out[5] = y * a[5];
  out[6] = a[6];
  out[7] = a[7];
  out[8] = a[8];
  return out;
}
/**
 * Creates a matrix from a vector translation
 * This is equivalent to (but much faster than):
 *
 *     mat3.identity(dest);
 *     mat3.translate(dest, dest, vec);
 *
 * @param {mat3} out mat3 receiving operation result
 * @param {vec2} v Translation vector
 * @returns {mat3} out
 */


function fromTranslation(out, v) {
  out[0] = 1;
  out[1] = 0;
  out[2] = 0;
  out[3] = 0;
  out[4] = 1;
  out[5] = 0;
  out[6] = v[0];
  out[7] = v[1];
  out[8] = 1;
  return out;
}
/**
 * Creates a matrix from a given angle
 * This is equivalent to (but much faster than):
 *
 *     mat3.identity(dest);
 *     mat3.rotate(dest, dest, rad);
 *
 * @param {mat3} out mat3 receiving operation result
 * @param {Number} rad the angle to rotate the matrix by
 * @returns {mat3} out
 */


function fromRotation(out, rad) {
  var s = Math.sin(rad),
      c = Math.cos(rad);
  out[0] = c;
  out[1] = s;
  out[2] = 0;
  out[3] = -s;
  out[4] = c;
  out[5] = 0;
  out[6] = 0;
  out[7] = 0;
  out[8] = 1;
  return out;
}
/**
 * Creates a matrix from a vector scaling
 * This is equivalent to (but much faster than):
 *
 *     mat3.identity(dest);
 *     mat3.scale(dest, dest, vec);
 *
 * @param {mat3} out mat3 receiving operation result
 * @param {vec2} v Scaling vector
 * @returns {mat3} out
 */


function fromScaling(out, v) {
  out[0] = v[0];
  out[1] = 0;
  out[2] = 0;
  out[3] = 0;
  out[4] = v[1];
  out[5] = 0;
  out[6] = 0;
  out[7] = 0;
  out[8] = 1;
  return out;
}
/**
 * Copies the values from a mat2d into a mat3
 *
 * @param {mat3} out the receiving matrix
 * @param {mat2d} a the matrix to copy
 * @returns {mat3} out
 **/


function fromMat2d(out, a) {
  out[0] = a[0];
  out[1] = a[1];
  out[2] = 0;
  out[3] = a[2];
  out[4] = a[3];
  out[5] = 0;
  out[6] = a[4];
  out[7] = a[5];
  out[8] = 1;
  return out;
}
/**
* Calculates a 3x3 matrix from the given quaternion
*
* @param {mat3} out mat3 receiving operation result
* @param {quat} q Quaternion to create matrix from
*
* @returns {mat3} out
*/


function fromQuat(out, q) {
  var x = q[0],
      y = q[1],
      z = q[2],
      w = q[3];
  var x2 = x + x;
  var y2 = y + y;
  var z2 = z + z;
  var xx = x * x2;
  var yx = y * x2;
  var yy = y * y2;
  var zx = z * x2;
  var zy = z * y2;
  var zz = z * z2;
  var wx = w * x2;
  var wy = w * y2;
  var wz = w * z2;
  out[0] = 1 - yy - zz;
  out[3] = yx - wz;
  out[6] = zx + wy;
  out[1] = yx + wz;
  out[4] = 1 - xx - zz;
  out[7] = zy - wx;
  out[2] = zx - wy;
  out[5] = zy + wx;
  out[8] = 1 - xx - yy;
  return out;
}
/**
* Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix
*
* @param {mat3} out mat3 receiving operation result
* @param {mat4} a Mat4 to derive the normal matrix from
*
* @returns {mat3} out
*/


function normalFromMat4(out, a) {
  var a00 = a[0],
      a01 = a[1],
      a02 = a[2],
      a03 = a[3];
  var a10 = a[4],
      a11 = a[5],
      a12 = a[6],
      a13 = a[7];
  var a20 = a[8],
      a21 = a[9],
      a22 = a[10],
      a23 = a[11];
  var a30 = a[12],
      a31 = a[13],
      a32 = a[14],
      a33 = a[15];
  var b00 = a00 * a11 - a01 * a10;
  var b01 = a00 * a12 - a02 * a10;
  var b02 = a00 * a13 - a03 * a10;
  var b03 = a01 * a12 - a02 * a11;
  var b04 = a01 * a13 - a03 * a11;
  var b05 = a02 * a13 - a03 * a12;
  var b06 = a20 * a31 - a21 * a30;
  var b07 = a20 * a32 - a22 * a30;
  var b08 = a20 * a33 - a23 * a30;
  var b09 = a21 * a32 - a22 * a31;
  var b10 = a21 * a33 - a23 * a31;
  var b11 = a22 * a33 - a23 * a32; // Calculate the determinant

  var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;

  if (!det) {
    return null;
  }

  det = 1.0 / det;
  out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;
  out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;
  out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;
  out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;
  out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;
  out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;
  out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;
  out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;
  out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;
  return out;
}
/**
 * Generates a 2D projection matrix with the given bounds
 *
 * @param {mat3} out mat3 frustum matrix will be written into
 * @param {number} width Width of your gl context
 * @param {number} height Height of gl context
 * @returns {mat3} out
 */


function projection(out, width, height) {
  out[0] = 2 / width;
  out[1] = 0;
  out[2] = 0;
  out[3] = 0;
  out[4] = -2 / height;
  out[5] = 0;
  out[6] = -1;
  out[7] = 1;
  out[8] = 1;
  return out;
}
/**
 * Returns a string representation of a mat3
 *
 * @param {mat3} a matrix to represent as a string
 * @returns {String} string representation of the matrix
 */


function str(a) {
  return 'mat3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' + a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' + a[8] + ')';
}
/**
 * Returns Frobenius norm of a mat3
 *
 * @param {mat3} a the matrix to calculate Frobenius norm of
 * @returns {Number} Frobenius norm
 */


function frob(a) {
  return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]);
}
/**
 * Adds two mat3's
 *
 * @param {mat3} out the receiving matrix
 * @param {mat3} a the first operand
 * @param {mat3} b the second operand
 * @returns {mat3} out
 */


function add(out, a, b) {
  out[0] = a[0] + b[0];
  out[1] = a[1] + b[1];
  out[2] = a[2] + b[2];
  out[3] = a[3] + b[3];
  out[4] = a[4] + b[4];
  out[5] = a[5] + b[5];
  out[6] = a[6] + b[6];
  out[7] = a[7] + b[7];
  out[8] = a[8] + b[8];
  return out;
}
/**
 * Subtracts matrix b from matrix a
 *
 * @param {mat3} out the receiving matrix
 * @param {mat3} a the first operand
 * @param {mat3} b the second operand
 * @returns {mat3} out
 */


function subtract(out, a, b) {
  out[0] = a[0] - b[0];
  out[1] = a[1] - b[1];
  out[2] = a[2] - b[2];
  out[3] = a[3] - b[3];
  out[4] = a[4] - b[4];
  out[5] = a[5] - b[5];
  out[6] = a[6] - b[6];
  out[7] = a[7] - b[7];
  out[8] = a[8] - b[8];
  return out;
}
/**
 * Multiply each element of the matrix by a scalar.
 *
 * @param {mat3} out the receiving matrix
 * @param {mat3} a the matrix to scale
 * @param {Number} b amount to scale the matrix's elements by
 * @returns {mat3} out
 */


function multiplyScalar(out, a, b) {
  out[0] = a[0] * b;
  out[1] = a[1] * b;
  out[2] = a[2] * b;
  out[3] = a[3] * b;
  out[4] = a[4] * b;
  out[5] = a[5] * b;
  out[6] = a[6] * b;
  out[7] = a[7] * b;
  out[8] = a[8] * b;
  return out;
}
/**
 * Adds two mat3's after multiplying each element of the second operand by a scalar value.
 *
 * @param {mat3} out the receiving vector
 * @param {mat3} a the first operand
 * @param {mat3} b the second operand
 * @param {Number} scale the amount to scale b's elements by before adding
 * @returns {mat3} out
 */


function multiplyScalarAndAdd(out, a, b, scale) {
  out[0] = a[0] + b[0] * scale;
  out[1] = a[1] + b[1] * scale;
  out[2] = a[2] + b[2] * scale;
  out[3] = a[3] + b[3] * scale;
  out[4] = a[4] + b[4] * scale;
  out[5] = a[5] + b[5] * scale;
  out[6] = a[6] + b[6] * scale;
  out[7] = a[7] + b[7] * scale;
  out[8] = a[8] + b[8] * scale;
  return out;
}
/**
 * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
 *
 * @param {mat3} a The first matrix.
 * @param {mat3} b The second matrix.
 * @returns {Boolean} True if the matrices are equal, false otherwise.
 */


function exactEquals(a, b) {
  return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8];
}
/**
 * Returns whether or not the matrices have approximately the same elements in the same position.
 *
 * @param {mat3} a The first matrix.
 * @param {mat3} b The second matrix.
 * @returns {Boolean} True if the matrices are equal, false otherwise.
 */


function equals(a, b) {
  var a0 = a[0],
      a1 = a[1],
      a2 = a[2],
      a3 = a[3],
      a4 = a[4],
      a5 = a[5],
      a6 = a[6],
      a7 = a[7],
      a8 = a[8];
  var b0 = b[0],
      b1 = b[1],
      b2 = b[2],
      b3 = b[3],
      b4 = b[4],
      b5 = b[5],
      b6 = b[6],
      b7 = b[7],
      b8 = b[8];
  return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8));
}
/**
 * Alias for {@link mat3.multiply}
 * @function
 */


var mul = multiply;
/**
 * Alias for {@link mat3.subtract}
 * @function
 */

exports.mul = mul;
var sub = subtract;
exports.sub = sub;
},{"./common.js":"hRXm"}],"YyGJ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.validateMatrix3 = validateMatrix3;
exports.default = void 0;

var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _mathArray = _interopRequireDefault(require("./lib/math-array"));

var _validators = require("./lib/validators");

var _common = require("./lib/common");

var _vector = _interopRequireDefault(require("./vector2"));

var _vector2 = _interopRequireDefault(require("./vector3"));

var mat3 = _interopRequireWildcard(require("gl-matrix/mat3"));

var vec2 = _interopRequireWildcard(require("gl-matrix/vec2"));

var vec3 = _interopRequireWildcard(require("gl-matrix/vec3"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var IDENTITY = [1, 0, 0, 0, 1, 0, 0, 0, 1];

function validateMatrix3(m) {
  return m.length === 9 && Number.isFinite(m[0]) && Number.isFinite(m[1]) && Number.isFinite(m[2]) && Number.isFinite(m[3]) && Number.isFinite(m[4]) && Number.isFinite(m[5]) && Number.isFinite(m[6]) && Number.isFinite(m[7]) && Number.isFinite(m[8]);
}

var Matrix3 = function (_MathArray) {
  (0, _inherits2.default)(Matrix3, _MathArray);

  function Matrix3() {
    var _this;

    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    (0, _classCallCheck2.default)(this, Matrix3);
    _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Matrix3).call(this, 9));

    if (Array.isArray(args[0]) && arguments.length === 1) {
      _this.copy(args[0]);
    } else {
      _this.identity();
    }

    return _this;
  }

  (0, _createClass2.default)(Matrix3, [{
    key: "setRowMajor",
    value: function setRowMajor() {
      var m00 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
      var m01 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
      var m02 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
      var m10 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
      var m11 = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
      var m12 = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
      var m20 = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
      var m21 = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 0;
      var m22 = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : 1;
      this[0] = m00;
      this[1] = m10;
      this[2] = m20;
      this[3] = m01;
      this[4] = m11;
      this[5] = m21;
      this[6] = m02;
      this[7] = m12;
      this[8] = m22;
      return this.check();
    }
  }, {
    key: "setColumnMajor",
    value: function setColumnMajor() {
      var m00 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
      var m10 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
      var m20 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
      var m01 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
      var m11 = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
      var m21 = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
      var m02 = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
      var m12 = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 0;
      var m22 = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : 1;
      this[0] = m00;
      this[1] = m10;
      this[2] = m20;
      this[3] = m01;
      this[4] = m11;
      this[5] = m21;
      this[6] = m02;
      this[7] = m12;
      this[8] = m22;
      return this.check();
    }
  }, {
    key: "copy",
    value: function copy(array) {
      return this.setColumnMajor.apply(this, (0, _toConsumableArray2.default)(array));
    }
  }, {
    key: "set",
    value: function set() {
      return this.setColumnMajor.apply(this, arguments);
    }
  }, {
    key: "getElement",
    value: function getElement(i, j) {
      var columnMajor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
      return columnMajor ? this[i * 3 + j] : this[j * 3 + i];
    }
  }, {
    key: "setElement",
    value: function setElement(i, j, value) {
      var columnMajor = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      if (columnMajor) {
        this[i * 3 + j] = (0, _common.checkNumber)(value);
      } else {
        this[j * 3 + i] = (0, _common.checkNumber)(value);
      }

      return this;
    }
  }, {
    key: "determinant",
    value: function determinant() {
      return mat3.determinant(this);
    }
  }, {
    key: "identity",
    value: function identity() {
      for (var i = 0; i < IDENTITY.length; ++i) {
        this[i] = IDENTITY[i];
      }

      return this.check();
    }
  }, {
    key: "fromQuaternion",
    value: function fromQuaternion(q) {
      mat3.fromQuat(this, q);
      return this.check();
    }
  }, {
    key: "transpose",
    value: function transpose() {
      mat3.transpose(this, this);
      return this.check();
    }
  }, {
    key: "invert",
    value: function invert() {
      mat3.invert(this, this);
      return this.check();
    }
  }, {
    key: "multiplyLeft",
    value: function multiplyLeft(a) {
      mat3.multiply(this, a, this);
      return this.check();
    }
  }, {
    key: "multiplyRight",
    value: function multiplyRight(a) {
      mat3.multiply(this, this, a);
      return this.check();
    }
  }, {
    key: "rotate",
    value: function rotate(radians) {
      mat3.rotate(this, this, radians);
      return this.check();
    }
  }, {
    key: "scale",
    value: function scale(factor) {
      if (Array.isArray(factor)) {
        mat3.scale(this, this, factor);
      } else {
        mat3.scale(this, this, [factor, factor, factor]);
      }

      return this.check();
    }
  }, {
    key: "translate",
    value: function translate(vec) {
      mat3.translate(this, this, vec);
      return this.check();
    }
  }, {
    key: "transformVector2",
    value: function transformVector2(vector, out) {
      out = out || new _vector.default();
      vec2.transformMat3(out, vector, this);
      (0, _validators.validateVector)(out, 2);
      return out;
    }
  }, {
    key: "transformVector3",
    value: function transformVector3(vector, out) {
      out = out || new _vector2.default();
      vec3.transformMat3(out, vector, this);
      (0, _validators.validateVector)(out, 3);
      return out;
    }
  }, {
    key: "transformVector",
    value: function transformVector(vector, out) {
      switch (vector.length) {
        case 2:
          return this.transformVector2(vector, out);

        case 3:
          return this.transformVector3(vector, out);

        default:
          throw new Error('Illegal vector');
      }
    }
  }, {
    key: "ELEMENTS",
    get: function get() {
      return 9;
    }
  }]);
  return Matrix3;
}(_mathArray.default);

exports.default = Matrix3;
},{"@babel/runtime/helpers/esm/toConsumableArray":"lA6S","@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","./lib/math-array":"orGy","./lib/validators":"s8Y3","./lib/common":"Ma4c","./vector2":"VaFZ","./vector3":"jb7a","gl-matrix/mat3":"xq97","gl-matrix/vec2":"iP3z","gl-matrix/vec3":"vuBh"}],"Nd3D":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.create = create;
exports.clone = clone;
exports.copy = copy;
exports.fromValues = fromValues;
exports.set = set;
exports.identity = identity;
exports.transpose = transpose;
exports.invert = invert;
exports.adjoint = adjoint;
exports.determinant = determinant;
exports.multiply = multiply;
exports.translate = translate;
exports.scale = scale;
exports.rotate = rotate;
exports.rotateX = rotateX;
exports.rotateY = rotateY;
exports.rotateZ = rotateZ;
exports.fromTranslation = fromTranslation;
exports.fromScaling = fromScaling;
exports.fromRotation = fromRotation;
exports.fromXRotation = fromXRotation;
exports.fromYRotation = fromYRotation;
exports.fromZRotation = fromZRotation;
exports.fromRotationTranslation = fromRotationTranslation;
exports.fromQuat2 = fromQuat2;
exports.getTranslation = getTranslation;
exports.getScaling = getScaling;
exports.getRotation = getRotation;
exports.fromRotationTranslationScale = fromRotationTranslationScale;
exports.fromRotationTranslationScaleOrigin = fromRotationTranslationScaleOrigin;
exports.fromQuat = fromQuat;
exports.frustum = frustum;
exports.perspective = perspective;
exports.perspectiveFromFieldOfView = perspectiveFromFieldOfView;
exports.ortho = ortho;
exports.lookAt = lookAt;
exports.targetTo = targetTo;
exports.str = str;
exports.frob = frob;
exports.add = add;
exports.subtract = subtract;
exports.multiplyScalar = multiplyScalar;
exports.multiplyScalarAndAdd = multiplyScalarAndAdd;
exports.exactEquals = exactEquals;
exports.equals = equals;
exports.sub = exports.mul = void 0;

var glMatrix = _interopRequireWildcard(require("./common.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * 4x4 Matrix<br>Format: column-major, when typed out it looks like row-major<br>The matrices are being post multiplied.
 * @module mat4
 */

/**
 * Creates a new identity mat4
 *
 * @returns {mat4} a new 4x4 matrix
 */
function create() {
  var out = new glMatrix.ARRAY_TYPE(16);

  if (glMatrix.ARRAY_TYPE != Float32Array) {
    out[1] = 0;
    out[2] = 0;
    out[3] = 0;
    out[4] = 0;
    out[6] = 0;
    out[7] = 0;
    out[8] = 0;
    out[9] = 0;
    out[11] = 0;
    out[12] = 0;
    out[13] = 0;
    out[14] = 0;
  }

  out[0] = 1;
  out[5] = 1;
  out[10] = 1;
  out[15] = 1;
  return out;
}
/**
 * Creates a new mat4 initialized with values from an existing matrix
 *
 * @param {mat4} a matrix to clone
 * @returns {mat4} a new 4x4 matrix
 */


function clone(a) {
  var out = new glMatrix.ARRAY_TYPE(16);
  out[0] = a[0];
  out[1] = a[1];
  out[2] = a[2];
  out[3] = a[3];
  out[4] = a[4];
  out[5] = a[5];
  out[6] = a[6];
  out[7] = a[7];
  out[8] = a[8];
  out[9] = a[9];
  out[10] = a[10];
  out[11] = a[11];
  out[12] = a[12];
  out[13] = a[13];
  out[14] = a[14];
  out[15] = a[15];
  return out;
}
/**
 * Copy the values from one mat4 to another
 *
 * @param {mat4} out the receiving matrix
 * @param {mat4} a the source matrix
 * @returns {mat4} out
 */


function copy(out, a) {
  out[0] = a[0];
  out[1] = a[1];
  out[2] = a[2];
  out[3] = a[3];
  out[4] = a[4];
  out[5] = a[5];
  out[6] = a[6];
  out[7] = a[7];
  out[8] = a[8];
  out[9] = a[9];
  out[10] = a[10];
  out[11] = a[11];
  out[12] = a[12];
  out[13] = a[13];
  out[14] = a[14];
  out[15] = a[15];
  return out;
}
/**
 * Create a new mat4 with the given values
 *
 * @param {Number} m00 Component in column 0, row 0 position (index 0)
 * @param {Number} m01 Component in column 0, row 1 position (index 1)
 * @param {Number} m02 Component in column 0, row 2 position (index 2)
 * @param {Number} m03 Component in column 0, row 3 position (index 3)
 * @param {Number} m10 Component in column 1, row 0 position (index 4)
 * @param {Number} m11 Component in column 1, row 1 position (index 5)
 * @param {Number} m12 Component in column 1, row 2 position (index 6)
 * @param {Number} m13 Component in column 1, row 3 position (index 7)
 * @param {Number} m20 Component in column 2, row 0 position (index 8)
 * @param {Number} m21 Component in column 2, row 1 position (index 9)
 * @param {Number} m22 Component in column 2, row 2 position (index 10)
 * @param {Number} m23 Component in column 2, row 3 position (index 11)
 * @param {Number} m30 Component in column 3, row 0 position (index 12)
 * @param {Number} m31 Component in column 3, row 1 position (index 13)
 * @param {Number} m32 Component in column 3, row 2 position (index 14)
 * @param {Number} m33 Component in column 3, row 3 position (index 15)
 * @returns {mat4} A new mat4
 */


function fromValues(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {
  var out = new glMatrix.ARRAY_TYPE(16);
  out[0] = m00;
  out[1] = m01;
  out[2] = m02;
  out[3] = m03;
  out[4] = m10;
  out[5] = m11;
  out[6] = m12;
  out[7] = m13;
  out[8] = m20;
  out[9] = m21;
  out[10] = m22;
  out[11] = m23;
  out[12] = m30;
  out[13] = m31;
  out[14] = m32;
  out[15] = m33;
  return out;
}
/**
 * Set the components of a mat4 to the given values
 *
 * @param {mat4} out the receiving matrix
 * @param {Number} m00 Component in column 0, row 0 position (index 0)
 * @param {Number} m01 Component in column 0, row 1 position (index 1)
 * @param {Number} m02 Component in column 0, row 2 position (index 2)
 * @param {Number} m03 Component in column 0, row 3 position (index 3)
 * @param {Number} m10 Component in column 1, row 0 position (index 4)
 * @param {Number} m11 Component in column 1, row 1 position (index 5)
 * @param {Number} m12 Component in column 1, row 2 position (index 6)
 * @param {Number} m13 Component in column 1, row 3 position (index 7)
 * @param {Number} m20 Component in column 2, row 0 position (index 8)
 * @param {Number} m21 Component in column 2, row 1 position (index 9)
 * @param {Number} m22 Component in column 2, row 2 position (index 10)
 * @param {Number} m23 Component in column 2, row 3 position (index 11)
 * @param {Number} m30 Component in column 3, row 0 position (index 12)
 * @param {Number} m31 Component in column 3, row 1 position (index 13)
 * @param {Number} m32 Component in column 3, row 2 position (index 14)
 * @param {Number} m33 Component in column 3, row 3 position (index 15)
 * @returns {mat4} out
 */


function set(out, m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {
  out[0] = m00;
  out[1] = m01;
  out[2] = m02;
  out[3] = m03;
  out[4] = m10;
  out[5] = m11;
  out[6] = m12;
  out[7] = m13;
  out[8] = m20;
  out[9] = m21;
  out[10] = m22;
  out[11] = m23;
  out[12] = m30;
  out[13] = m31;
  out[14] = m32;
  out[15] = m33;
  return out;
}
/**
 * Set a mat4 to the identity matrix
 *
 * @param {mat4} out the receiving matrix
 * @returns {mat4} out
 */


function identity(out) {
  out[0] = 1;
  out[1] = 0;
  out[2] = 0;
  out[3] = 0;
  out[4] = 0;
  out[5] = 1;
  out[6] = 0;
  out[7] = 0;
  out[8] = 0;
  out[9] = 0;
  out[10] = 1;
  out[11] = 0;
  out[12] = 0;
  out[13] = 0;
  out[14] = 0;
  out[15] = 1;
  return out;
}
/**
 * Transpose the values of a mat4
 *
 * @param {mat4} out the receiving matrix
 * @param {mat4} a the source matrix
 * @returns {mat4} out
 */


function transpose(out, a) {
  // If we are transposing ourselves we can skip a few steps but have to cache some values
  if (out === a) {
    var a01 = a[1],
        a02 = a[2],
        a03 = a[3];
    var a12 = a[6],
        a13 = a[7];
    var a23 = a[11];
    out[1] = a[4];
    out[2] = a[8];
    out[3] = a[12];
    out[4] = a01;
    out[6] = a[9];
    out[7] = a[13];
    out[8] = a02;
    out[9] = a12;
    out[11] = a[14];
    out[12] = a03;
    out[13] = a13;
    out[14] = a23;
  } else {
    out[0] = a[0];
    out[1] = a[4];
    out[2] = a[8];
    out[3] = a[12];
    out[4] = a[1];
    out[5] = a[5];
    out[6] = a[9];
    out[7] = a[13];
    out[8] = a[2];
    out[9] = a[6];
    out[10] = a[10];
    out[11] = a[14];
    out[12] = a[3];
    out[13] = a[7];
    out[14] = a[11];
    out[15] = a[15];
  }

  return out;
}
/**
 * Inverts a mat4
 *
 * @param {mat4} out the receiving matrix
 * @param {mat4} a the source matrix
 * @returns {mat4} out
 */


function invert(out, a) {
  var a00 = a[0],
      a01 = a[1],
      a02 = a[2],
      a03 = a[3];
  var a10 = a[4],
      a11 = a[5],
      a12 = a[6],
      a13 = a[7];
  var a20 = a[8],
      a21 = a[9],
      a22 = a[10],
      a23 = a[11];
  var a30 = a[12],
      a31 = a[13],
      a32 = a[14],
      a33 = a[15];
  var b00 = a00 * a11 - a01 * a10;
  var b01 = a00 * a12 - a02 * a10;
  var b02 = a00 * a13 - a03 * a10;
  var b03 = a01 * a12 - a02 * a11;
  var b04 = a01 * a13 - a03 * a11;
  var b05 = a02 * a13 - a03 * a12;
  var b06 = a20 * a31 - a21 * a30;
  var b07 = a20 * a32 - a22 * a30;
  var b08 = a20 * a33 - a23 * a30;
  var b09 = a21 * a32 - a22 * a31;
  var b10 = a21 * a33 - a23 * a31;
  var b11 = a22 * a33 - a23 * a32; // Calculate the determinant

  var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;

  if (!det) {
    return null;
  }

  det = 1.0 / det;
  out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;
  out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;
  out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;
  out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;
  out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;
  out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;
  out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;
  out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;
  out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;
  out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;
  out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;
  out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;
  out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;
  out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;
  out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;
  out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;
  return out;
}
/**
 * Calculates the adjugate of a mat4
 *
 * @param {mat4} out the receiving matrix
 * @param {mat4} a the source matrix
 * @returns {mat4} out
 */


function adjoint(out, a) {
  var a00 = a[0],
      a01 = a[1],
      a02 = a[2],
      a03 = a[3];
  var a10 = a[4],
      a11 = a[5],
      a12 = a[6],
      a13 = a[7];
  var a20 = a[8],
      a21 = a[9],
      a22 = a[10],
      a23 = a[11];
  var a30 = a[12],
      a31 = a[13],
      a32 = a[14],
      a33 = a[15];
  out[0] = a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22);
  out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22));
  out[2] = a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12);
  out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12));
  out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22));
  out[5] = a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22);
  out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12));
  out[7] = a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12);
  out[8] = a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21);
  out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21));
  out[10] = a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11);
  out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11));
  out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21));
  out[13] = a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21);
  out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11));
  out[15] = a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11);
  return out;
}
/**
 * Calculates the determinant of a mat4
 *
 * @param {mat4} a the source matrix
 * @returns {Number} determinant of a
 */


function determinant(a) {
  var a00 = a[0],
      a01 = a[1],
      a02 = a[2],
      a03 = a[3];
  var a10 = a[4],
      a11 = a[5],
      a12 = a[6],
      a13 = a[7];
  var a20 = a[8],
      a21 = a[9],
      a22 = a[10],
      a23 = a[11];
  var a30 = a[12],
      a31 = a[13],
      a32 = a[14],
      a33 = a[15];
  var b00 = a00 * a11 - a01 * a10;
  var b01 = a00 * a12 - a02 * a10;
  var b02 = a00 * a13 - a03 * a10;
  var b03 = a01 * a12 - a02 * a11;
  var b04 = a01 * a13 - a03 * a11;
  var b05 = a02 * a13 - a03 * a12;
  var b06 = a20 * a31 - a21 * a30;
  var b07 = a20 * a32 - a22 * a30;
  var b08 = a20 * a33 - a23 * a30;
  var b09 = a21 * a32 - a22 * a31;
  var b10 = a21 * a33 - a23 * a31;
  var b11 = a22 * a33 - a23 * a32; // Calculate the determinant

  return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
}
/**
 * Multiplies two mat4s
 *
 * @param {mat4} out the receiving matrix
 * @param {mat4} a the first operand
 * @param {mat4} b the second operand
 * @returns {mat4} out
 */


function multiply(out, a, b) {
  var a00 = a[0],
      a01 = a[1],
      a02 = a[2],
      a03 = a[3];
  var a10 = a[4],
      a11 = a[5],
      a12 = a[6],
      a13 = a[7];
  var a20 = a[8],
      a21 = a[9],
      a22 = a[10],
      a23 = a[11];
  var a30 = a[12],
      a31 = a[13],
      a32 = a[14],
      a33 = a[15]; // Cache only the current line of the second matrix

  var b0 = b[0],
      b1 = b[1],
      b2 = b[2],
      b3 = b[3];
  out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
  out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
  out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
  out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
  b0 = b[4];
  b1 = b[5];
  b2 = b[6];
  b3 = b[7];
  out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
  out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
  out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
  out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
  b0 = b[8];
  b1 = b[9];
  b2 = b[10];
  b3 = b[11];
  out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
  out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
  out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
  out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
  b0 = b[12];
  b1 = b[13];
  b2 = b[14];
  b3 = b[15];
  out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
  out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
  out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
  out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
  return out;
}
/**
 * Translate a mat4 by the given vector
 *
 * @param {mat4} out the receiving matrix
 * @param {mat4} a the matrix to translate
 * @param {vec3} v vector to translate by
 * @returns {mat4} out
 */


function translate(out, a, v) {
  var x = v[0],
      y = v[1],
      z = v[2];
  var a00, a01, a02, a03;
  var a10, a11, a12, a13;
  var a20, a21, a22, a23;

  if (a === out) {
    out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];
    out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];
    out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];
    out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];
  } else {
    a00 = a[0];
    a01 = a[1];
    a02 = a[2];
    a03 = a[3];
    a10 = a[4];
    a11 = a[5];
    a12 = a[6];
    a13 = a[7];
    a20 = a[8];
    a21 = a[9];
    a22 = a[10];
    a23 = a[11];
    out[0] = a00;
    out[1] = a01;
    out[2] = a02;
    out[3] = a03;
    out[4] = a10;
    out[5] = a11;
    out[6] = a12;
    out[7] = a13;
    out[8] = a20;
    out[9] = a21;
    out[10] = a22;
    out[11] = a23;
    out[12] = a00 * x + a10 * y + a20 * z + a[12];
    out[13] = a01 * x + a11 * y + a21 * z + a[13];
    out[14] = a02 * x + a12 * y + a22 * z + a[14];
    out[15] = a03 * x + a13 * y + a23 * z + a[15];
  }

  return out;
}
/**
 * Scales the mat4 by the dimensions in the given vec3 not using vectorization
 *
 * @param {mat4} out the receiving matrix
 * @param {mat4} a the matrix to scale
 * @param {vec3} v the vec3 to scale the matrix by
 * @returns {mat4} out
 **/


function scale(out, a, v) {
  var x = v[0],
      y = v[1],
      z = v[2];
  out[0] = a[0] * x;
  out[1] = a[1] * x;
  out[2] = a[2] * x;
  out[3] = a[3] * x;
  out[4] = a[4] * y;
  out[5] = a[5] * y;
  out[6] = a[6] * y;
  out[7] = a[7] * y;
  out[8] = a[8] * z;
  out[9] = a[9] * z;
  out[10] = a[10] * z;
  out[11] = a[11] * z;
  out[12] = a[12];
  out[13] = a[13];
  out[14] = a[14];
  out[15] = a[15];
  return out;
}
/**
 * Rotates a mat4 by the given angle around the given axis
 *
 * @param {mat4} out the receiving matrix
 * @param {mat4} a the matrix to rotate
 * @param {Number} rad the angle to rotate the matrix by
 * @param {vec3} axis the axis to rotate around
 * @returns {mat4} out
 */


function rotate(out, a, rad, axis) {
  var x = axis[0],
      y = axis[1],
      z = axis[2];
  var len = Math.hypot(x, y, z);
  var s, c, t;
  var a00, a01, a02, a03;
  var a10, a11, a12, a13;
  var a20, a21, a22, a23;
  var b00, b01, b02;
  var b10, b11, b12;
  var b20, b21, b22;

  if (len < glMatrix.EPSILON) {
    return null;
  }

  len = 1 / len;
  x *= len;
  y *= len;
  z *= len;
  s = Math.sin(rad);
  c = Math.cos(rad);
  t = 1 - c;
  a00 = a[0];
  a01 = a[1];
  a02 = a[2];
  a03 = a[3];
  a10 = a[4];
  a11 = a[5];
  a12 = a[6];
  a13 = a[7];
  a20 = a[8];
  a21 = a[9];
  a22 = a[10];
  a23 = a[11]; // Construct the elements of the rotation matrix

  b00 = x * x * t + c;
  b01 = y * x * t + z * s;
  b02 = z * x * t - y * s;
  b10 = x * y * t - z * s;
  b11 = y * y * t + c;
  b12 = z * y * t + x * s;
  b20 = x * z * t + y * s;
  b21 = y * z * t - x * s;
  b22 = z * z * t + c; // Perform rotation-specific matrix multiplication

  out[0] = a00 * b00 + a10 * b01 + a20 * b02;
  out[1] = a01 * b00 + a11 * b01 + a21 * b02;
  out[2] = a02 * b00 + a12 * b01 + a22 * b02;
  out[3] = a03 * b00 + a13 * b01 + a23 * b02;
  out[4] = a00 * b10 + a10 * b11 + a20 * b12;
  out[5] = a01 * b10 + a11 * b11 + a21 * b12;
  out[6] = a02 * b10 + a12 * b11 + a22 * b12;
  out[7] = a03 * b10 + a13 * b11 + a23 * b12;
  out[8] = a00 * b20 + a10 * b21 + a20 * b22;
  out[9] = a01 * b20 + a11 * b21 + a21 * b22;
  out[10] = a02 * b20 + a12 * b21 + a22 * b22;
  out[11] = a03 * b20 + a13 * b21 + a23 * b22;

  if (a !== out) {
    // If the source and destination differ, copy the unchanged last row
    out[12] = a[12];
    out[13] = a[13];
    out[14] = a[14];
    out[15] = a[15];
  }

  return out;
}
/**
 * Rotates a matrix by the given angle around the X axis
 *
 * @param {mat4} out the receiving matrix
 * @param {mat4} a the matrix to rotate
 * @param {Number} rad the angle to rotate the matrix by
 * @returns {mat4} out
 */


function rotateX(out, a, rad) {
  var s = Math.sin(rad);
  var c = Math.cos(rad);
  var a10 = a[4];
  var a11 = a[5];
  var a12 = a[6];
  var a13 = a[7];
  var a20 = a[8];
  var a21 = a[9];
  var a22 = a[10];
  var a23 = a[11];

  if (a !== out) {
    // If the source and destination differ, copy the unchanged rows
    out[0] = a[0];
    out[1] = a[1];
    out[2] = a[2];
    out[3] = a[3];
    out[12] = a[12];
    out[13] = a[13];
    out[14] = a[14];
    out[15] = a[15];
  } // Perform axis-specific matrix multiplication


  out[4] = a10 * c + a20 * s;
  out[5] = a11 * c + a21 * s;
  out[6] = a12 * c + a22 * s;
  out[7] = a13 * c + a23 * s;
  out[8] = a20 * c - a10 * s;
  out[9] = a21 * c - a11 * s;
  out[10] = a22 * c - a12 * s;
  out[11] = a23 * c - a13 * s;
  return out;
}
/**
 * Rotates a matrix by the given angle around the Y axis
 *
 * @param {mat4} out the receiving matrix
 * @param {mat4} a the matrix to rotate
 * @param {Number} rad the angle to rotate the matrix by
 * @returns {mat4} out
 */


function rotateY(out, a, rad) {
  var s = Math.sin(rad);
  var c = Math.cos(rad);
  var a00 = a[0];
  var a01 = a[1];
  var a02 = a[2];
  var a03 = a[3];
  var a20 = a[8];
  var a21 = a[9];
  var a22 = a[10];
  var a23 = a[11];

  if (a !== out) {
    // If the source and destination differ, copy the unchanged rows
    out[4] = a[4];
    out[5] = a[5];
    out[6] = a[6];
    out[7] = a[7];
    out[12] = a[12];
    out[13] = a[13];
    out[14] = a[14];
    out[15] = a[15];
  } // Perform axis-specific matrix multiplication


  out[0] = a00 * c - a20 * s;
  out[1] = a01 * c - a21 * s;
  out[2] = a02 * c - a22 * s;
  out[3] = a03 * c - a23 * s;
  out[8] = a00 * s + a20 * c;
  out[9] = a01 * s + a21 * c;
  out[10] = a02 * s + a22 * c;
  out[11] = a03 * s + a23 * c;
  return out;
}
/**
 * Rotates a matrix by the given angle around the Z axis
 *
 * @param {mat4} out the receiving matrix
 * @param {mat4} a the matrix to rotate
 * @param {Number} rad the angle to rotate the matrix by
 * @returns {mat4} out
 */


function rotateZ(out, a, rad) {
  var s = Math.sin(rad);
  var c = Math.cos(rad);
  var a00 = a[0];
  var a01 = a[1];
  var a02 = a[2];
  var a03 = a[3];
  var a10 = a[4];
  var a11 = a[5];
  var a12 = a[6];
  var a13 = a[7];

  if (a !== out) {
    // If the source and destination differ, copy the unchanged last row
    out[8] = a[8];
    out[9] = a[9];
    out[10] = a[10];
    out[11] = a[11];
    out[12] = a[12];
    out[13] = a[13];
    out[14] = a[14];
    out[15] = a[15];
  } // Perform axis-specific matrix multiplication


  out[0] = a00 * c + a10 * s;
  out[1] = a01 * c + a11 * s;
  out[2] = a02 * c + a12 * s;
  out[3] = a03 * c + a13 * s;
  out[4] = a10 * c - a00 * s;
  out[5] = a11 * c - a01 * s;
  out[6] = a12 * c - a02 * s;
  out[7] = a13 * c - a03 * s;
  return out;
}
/**
 * Creates a matrix from a vector translation
 * This is equivalent to (but much faster than):
 *
 *     mat4.identity(dest);
 *     mat4.translate(dest, dest, vec);
 *
 * @param {mat4} out mat4 receiving operation result
 * @param {vec3} v Translation vector
 * @returns {mat4} out
 */


function fromTranslation(out, v) {
  out[0] = 1;
  out[1] = 0;
  out[2] = 0;
  out[3] = 0;
  out[4] = 0;
  out[5] = 1;
  out[6] = 0;
  out[7] = 0;
  out[8] = 0;
  out[9] = 0;
  out[10] = 1;
  out[11] = 0;
  out[12] = v[0];
  out[13] = v[1];
  out[14] = v[2];
  out[15] = 1;
  return out;
}
/**
 * Creates a matrix from a vector scaling
 * This is equivalent to (but much faster than):
 *
 *     mat4.identity(dest);
 *     mat4.scale(dest, dest, vec);
 *
 * @param {mat4} out mat4 receiving operation result
 * @param {vec3} v Scaling vector
 * @returns {mat4} out
 */


function fromScaling(out, v) {
  out[0] = v[0];
  out[1] = 0;
  out[2] = 0;
  out[3] = 0;
  out[4] = 0;
  out[5] = v[1];
  out[6] = 0;
  out[7] = 0;
  out[8] = 0;
  out[9] = 0;
  out[10] = v[2];
  out[11] = 0;
  out[12] = 0;
  out[13] = 0;
  out[14] = 0;
  out[15] = 1;
  return out;
}
/**
 * Creates a matrix from a given angle around a given axis
 * This is equivalent to (but much faster than):
 *
 *     mat4.identity(dest);
 *     mat4.rotate(dest, dest, rad, axis);
 *
 * @param {mat4} out mat4 receiving operation result
 * @param {Number} rad the angle to rotate the matrix by
 * @param {vec3} axis the axis to rotate around
 * @returns {mat4} out
 */


function fromRotation(out, rad, axis) {
  var x = axis[0],
      y = axis[1],
      z = axis[2];
  var len = Math.hypot(x, y, z);
  var s, c, t;

  if (len < glMatrix.EPSILON) {
    return null;
  }

  len = 1 / len;
  x *= len;
  y *= len;
  z *= len;
  s = Math.sin(rad);
  c = Math.cos(rad);
  t = 1 - c; // Perform rotation-specific matrix multiplication

  out[0] = x * x * t + c;
  out[1] = y * x * t + z * s;
  out[2] = z * x * t - y * s;
  out[3] = 0;
  out[4] = x * y * t - z * s;
  out[5] = y * y * t + c;
  out[6] = z * y * t + x * s;
  out[7] = 0;
  out[8] = x * z * t + y * s;
  out[9] = y * z * t - x * s;
  out[10] = z * z * t + c;
  out[11] = 0;
  out[12] = 0;
  out[13] = 0;
  out[14] = 0;
  out[15] = 1;
  return out;
}
/**
 * Creates a matrix from the given angle around the X axis
 * This is equivalent to (but much faster than):
 *
 *     mat4.identity(dest);
 *     mat4.rotateX(dest, dest, rad);
 *
 * @param {mat4} out mat4 receiving operation result
 * @param {Number} rad the angle to rotate the matrix by
 * @returns {mat4} out
 */


function fromXRotation(out, rad) {
  var s = Math.sin(rad);
  var c = Math.cos(rad); // Perform axis-specific matrix multiplication

  out[0] = 1;
  out[1] = 0;
  out[2] = 0;
  out[3] = 0;
  out[4] = 0;
  out[5] = c;
  out[6] = s;
  out[7] = 0;
  out[8] = 0;
  out[9] = -s;
  out[10] = c;
  out[11] = 0;
  out[12] = 0;
  out[13] = 0;
  out[14] = 0;
  out[15] = 1;
  return out;
}
/**
 * Creates a matrix from the given angle around the Y axis
 * This is equivalent to (but much faster than):
 *
 *     mat4.identity(dest);
 *     mat4.rotateY(dest, dest, rad);
 *
 * @param {mat4} out mat4 receiving operation result
 * @param {Number} rad the angle to rotate the matrix by
 * @returns {mat4} out
 */


function fromYRotation(out, rad) {
  var s = Math.sin(rad);
  var c = Math.cos(rad); // Perform axis-specific matrix multiplication

  out[0] = c;
  out[1] = 0;
  out[2] = -s;
  out[3] = 0;
  out[4] = 0;
  out[5] = 1;
  out[6] = 0;
  out[7] = 0;
  out[8] = s;
  out[9] = 0;
  out[10] = c;
  out[11] = 0;
  out[12] = 0;
  out[13] = 0;
  out[14] = 0;
  out[15] = 1;
  return out;
}
/**
 * Creates a matrix from the given angle around the Z axis
 * This is equivalent to (but much faster than):
 *
 *     mat4.identity(dest);
 *     mat4.rotateZ(dest, dest, rad);
 *
 * @param {mat4} out mat4 receiving operation result
 * @param {Number} rad the angle to rotate the matrix by
 * @returns {mat4} out
 */


function fromZRotation(out, rad) {
  var s = Math.sin(rad);
  var c = Math.cos(rad); // Perform axis-specific matrix multiplication

  out[0] = c;
  out[1] = s;
  out[2] = 0;
  out[3] = 0;
  out[4] = -s;
  out[5] = c;
  out[6] = 0;
  out[7] = 0;
  out[8] = 0;
  out[9] = 0;
  out[10] = 1;
  out[11] = 0;
  out[12] = 0;
  out[13] = 0;
  out[14] = 0;
  out[15] = 1;
  return out;
}
/**
 * Creates a matrix from a quaternion rotation and vector translation
 * This is equivalent to (but much faster than):
 *
 *     mat4.identity(dest);
 *     mat4.translate(dest, vec);
 *     let quatMat = mat4.create();
 *     quat4.toMat4(quat, quatMat);
 *     mat4.multiply(dest, quatMat);
 *
 * @param {mat4} out mat4 receiving operation result
 * @param {quat4} q Rotation quaternion
 * @param {vec3} v Translation vector
 * @returns {mat4} out
 */


function fromRotationTranslation(out, q, v) {
  // Quaternion math
  var x = q[0],
      y = q[1],
      z = q[2],
      w = q[3];
  var x2 = x + x;
  var y2 = y + y;
  var z2 = z + z;
  var xx = x * x2;
  var xy = x * y2;
  var xz = x * z2;
  var yy = y * y2;
  var yz = y * z2;
  var zz = z * z2;
  var wx = w * x2;
  var wy = w * y2;
  var wz = w * z2;
  out[0] = 1 - (yy + zz);
  out[1] = xy + wz;
  out[2] = xz - wy;
  out[3] = 0;
  out[4] = xy - wz;
  out[5] = 1 - (xx + zz);
  out[6] = yz + wx;
  out[7] = 0;
  out[8] = xz + wy;
  out[9] = yz - wx;
  out[10] = 1 - (xx + yy);
  out[11] = 0;
  out[12] = v[0];
  out[13] = v[1];
  out[14] = v[2];
  out[15] = 1;
  return out;
}
/**
 * Creates a new mat4 from a dual quat.
 *
 * @param {mat4} out Matrix
 * @param {quat2} a Dual Quaternion
 * @returns {mat4} mat4 receiving operation result
 */


function fromQuat2(out, a) {
  var translation = new glMatrix.ARRAY_TYPE(3);
  var bx = -a[0],
      by = -a[1],
      bz = -a[2],
      bw = a[3],
      ax = a[4],
      ay = a[5],
      az = a[6],
      aw = a[7];
  var magnitude = bx * bx + by * by + bz * bz + bw * bw; //Only scale if it makes sense

  if (magnitude > 0) {
    translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude;
    translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude;
    translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude;
  } else {
    translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;
    translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;
    translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;
  }

  fromRotationTranslation(out, a, translation);
  return out;
}
/**
 * Returns the translation vector component of a transformation
 *  matrix. If a matrix is built with fromRotationTranslation,
 *  the returned vector will be the same as the translation vector
 *  originally supplied.
 * @param  {vec3} out Vector to receive translation component
 * @param  {mat4} mat Matrix to be decomposed (input)
 * @return {vec3} out
 */


function getTranslation(out, mat) {
  out[0] = mat[12];
  out[1] = mat[13];
  out[2] = mat[14];
  return out;
}
/**
 * Returns the scaling factor component of a transformation
 *  matrix. If a matrix is built with fromRotationTranslationScale
 *  with a normalized Quaternion paramter, the returned vector will be
 *  the same as the scaling vector
 *  originally supplied.
 * @param  {vec3} out Vector to receive scaling factor component
 * @param  {mat4} mat Matrix to be decomposed (input)
 * @return {vec3} out
 */


function getScaling(out, mat) {
  var m11 = mat[0];
  var m12 = mat[1];
  var m13 = mat[2];
  var m21 = mat[4];
  var m22 = mat[5];
  var m23 = mat[6];
  var m31 = mat[8];
  var m32 = mat[9];
  var m33 = mat[10];
  out[0] = Math.hypot(m11, m12, m13);
  out[1] = Math.hypot(m21, m22, m23);
  out[2] = Math.hypot(m31, m32, m33);
  return out;
}
/**
 * Returns a quaternion representing the rotational component
 *  of a transformation matrix. If a matrix is built with
 *  fromRotationTranslation, the returned quaternion will be the
 *  same as the quaternion originally supplied.
 * @param {quat} out Quaternion to receive the rotation component
 * @param {mat4} mat Matrix to be decomposed (input)
 * @return {quat} out
 */


function getRotation(out, mat) {
  var scaling = new glMatrix.ARRAY_TYPE(3);
  getScaling(scaling, mat);
  var is1 = 1 / scaling[0];
  var is2 = 1 / scaling[1];
  var is3 = 1 / scaling[2];
  var sm11 = mat[0] * is1;
  var sm12 = mat[1] * is2;
  var sm13 = mat[2] * is3;
  var sm21 = mat[4] * is1;
  var sm22 = mat[5] * is2;
  var sm23 = mat[6] * is3;
  var sm31 = mat[8] * is1;
  var sm32 = mat[9] * is2;
  var sm33 = mat[10] * is3;
  var trace = sm11 + sm22 + sm33;
  var S = 0;

  if (trace > 0) {
    S = Math.sqrt(trace + 1.0) * 2;
    out[3] = 0.25 * S;
    out[0] = (sm23 - sm32) / S;
    out[1] = (sm31 - sm13) / S;
    out[2] = (sm12 - sm21) / S;
  } else if (sm11 > sm22 && sm11 > sm33) {
    S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;
    out[3] = (sm23 - sm32) / S;
    out[0] = 0.25 * S;
    out[1] = (sm12 + sm21) / S;
    out[2] = (sm31 + sm13) / S;
  } else if (sm22 > sm33) {
    S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;
    out[3] = (sm31 - sm13) / S;
    out[0] = (sm12 + sm21) / S;
    out[1] = 0.25 * S;
    out[2] = (sm23 + sm32) / S;
  } else {
    S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;
    out[3] = (sm12 - sm21) / S;
    out[0] = (sm31 + sm13) / S;
    out[1] = (sm23 + sm32) / S;
    out[2] = 0.25 * S;
  }

  return out;
}
/**
 * Creates a matrix from a quaternion rotation, vector translation and vector scale
 * This is equivalent to (but much faster than):
 *
 *     mat4.identity(dest);
 *     mat4.translate(dest, vec);
 *     let quatMat = mat4.create();
 *     quat4.toMat4(quat, quatMat);
 *     mat4.multiply(dest, quatMat);
 *     mat4.scale(dest, scale)
 *
 * @param {mat4} out mat4 receiving operation result
 * @param {quat4} q Rotation quaternion
 * @param {vec3} v Translation vector
 * @param {vec3} s Scaling vector
 * @returns {mat4} out
 */


function fromRotationTranslationScale(out, q, v, s) {
  // Quaternion math
  var x = q[0],
      y = q[1],
      z = q[2],
      w = q[3];
  var x2 = x + x;
  var y2 = y + y;
  var z2 = z + z;
  var xx = x * x2;
  var xy = x * y2;
  var xz = x * z2;
  var yy = y * y2;
  var yz = y * z2;
  var zz = z * z2;
  var wx = w * x2;
  var wy = w * y2;
  var wz = w * z2;
  var sx = s[0];
  var sy = s[1];
  var sz = s[2];
  out[0] = (1 - (yy + zz)) * sx;
  out[1] = (xy + wz) * sx;
  out[2] = (xz - wy) * sx;
  out[3] = 0;
  out[4] = (xy - wz) * sy;
  out[5] = (1 - (xx + zz)) * sy;
  out[6] = (yz + wx) * sy;
  out[7] = 0;
  out[8] = (xz + wy) * sz;
  out[9] = (yz - wx) * sz;
  out[10] = (1 - (xx + yy)) * sz;
  out[11] = 0;
  out[12] = v[0];
  out[13] = v[1];
  out[14] = v[2];
  out[15] = 1;
  return out;
}
/**
 * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin
 * This is equivalent to (but much faster than):
 *
 *     mat4.identity(dest);
 *     mat4.translate(dest, vec);
 *     mat4.translate(dest, origin);
 *     let quatMat = mat4.create();
 *     quat4.toMat4(quat, quatMat);
 *     mat4.multiply(dest, quatMat);
 *     mat4.scale(dest, scale)
 *     mat4.translate(dest, negativeOrigin);
 *
 * @param {mat4} out mat4 receiving operation result
 * @param {quat4} q Rotation quaternion
 * @param {vec3} v Translation vector
 * @param {vec3} s Scaling vector
 * @param {vec3} o The origin vector around which to scale and rotate
 * @returns {mat4} out
 */


function fromRotationTranslationScaleOrigin(out, q, v, s, o) {
  // Quaternion math
  var x = q[0],
      y = q[1],
      z = q[2],
      w = q[3];
  var x2 = x + x;
  var y2 = y + y;
  var z2 = z + z;
  var xx = x * x2;
  var xy = x * y2;
  var xz = x * z2;
  var yy = y * y2;
  var yz = y * z2;
  var zz = z * z2;
  var wx = w * x2;
  var wy = w * y2;
  var wz = w * z2;
  var sx = s[0];
  var sy = s[1];
  var sz = s[2];
  var ox = o[0];
  var oy = o[1];
  var oz = o[2];
  var out0 = (1 - (yy + zz)) * sx;
  var out1 = (xy + wz) * sx;
  var out2 = (xz - wy) * sx;
  var out4 = (xy - wz) * sy;
  var out5 = (1 - (xx + zz)) * sy;
  var out6 = (yz + wx) * sy;
  var out8 = (xz + wy) * sz;
  var out9 = (yz - wx) * sz;
  var out10 = (1 - (xx + yy)) * sz;
  out[0] = out0;
  out[1] = out1;
  out[2] = out2;
  out[3] = 0;
  out[4] = out4;
  out[5] = out5;
  out[6] = out6;
  out[7] = 0;
  out[8] = out8;
  out[9] = out9;
  out[10] = out10;
  out[11] = 0;
  out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz);
  out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz);
  out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz);
  out[15] = 1;
  return out;
}
/**
 * Calculates a 4x4 matrix from the given quaternion
 *
 * @param {mat4} out mat4 receiving operation result
 * @param {quat} q Quaternion to create matrix from
 *
 * @returns {mat4} out
 */


function fromQuat(out, q) {
  var x = q[0],
      y = q[1],
      z = q[2],
      w = q[3];
  var x2 = x + x;
  var y2 = y + y;
  var z2 = z + z;
  var xx = x * x2;
  var yx = y * x2;
  var yy = y * y2;
  var zx = z * x2;
  var zy = z * y2;
  var zz = z * z2;
  var wx = w * x2;
  var wy = w * y2;
  var wz = w * z2;
  out[0] = 1 - yy - zz;
  out[1] = yx + wz;
  out[2] = zx - wy;
  out[3] = 0;
  out[4] = yx - wz;
  out[5] = 1 - xx - zz;
  out[6] = zy + wx;
  out[7] = 0;
  out[8] = zx + wy;
  out[9] = zy - wx;
  out[10] = 1 - xx - yy;
  out[11] = 0;
  out[12] = 0;
  out[13] = 0;
  out[14] = 0;
  out[15] = 1;
  return out;
}
/**
 * Generates a frustum matrix with the given bounds
 *
 * @param {mat4} out mat4 frustum matrix will be written into
 * @param {Number} left Left bound of the frustum
 * @param {Number} right Right bound of the frustum
 * @param {Number} bottom Bottom bound of the frustum
 * @param {Number} top Top bound of the frustum
 * @param {Number} near Near bound of the frustum
 * @param {Number} far Far bound of the frustum
 * @returns {mat4} out
 */


function frustum(out, left, right, bottom, top, near, far) {
  var rl = 1 / (right - left);
  var tb = 1 / (top - bottom);
  var nf = 1 / (near - far);
  out[0] = near * 2 * rl;
  out[1] = 0;
  out[2] = 0;
  out[3] = 0;
  out[4] = 0;
  out[5] = near * 2 * tb;
  out[6] = 0;
  out[7] = 0;
  out[8] = (right + left) * rl;
  out[9] = (top + bottom) * tb;
  out[10] = (far + near) * nf;
  out[11] = -1;
  out[12] = 0;
  out[13] = 0;
  out[14] = far * near * 2 * nf;
  out[15] = 0;
  return out;
}
/**
 * Generates a perspective projection matrix with the given bounds.
 * Passing null/undefined/no value for far will generate infinite projection matrix.
 *
 * @param {mat4} out mat4 frustum matrix will be written into
 * @param {number} fovy Vertical field of view in radians
 * @param {number} aspect Aspect ratio. typically viewport width/height
 * @param {number} near Near bound of the frustum
 * @param {number} far Far bound of the frustum, can be null or Infinity
 * @returns {mat4} out
 */


function perspective(out, fovy, aspect, near, far) {
  var f = 1.0 / Math.tan(fovy / 2),
      nf;
  out[0] = f / aspect;
  out[1] = 0;
  out[2] = 0;
  out[3] = 0;
  out[4] = 0;
  out[5] = f;
  out[6] = 0;
  out[7] = 0;
  out[8] = 0;
  out[9] = 0;
  out[11] = -1;
  out[12] = 0;
  out[13] = 0;
  out[15] = 0;

  if (far != null && far !== Infinity) {
    nf = 1 / (near - far);
    out[10] = (far + near) * nf;
    out[14] = 2 * far * near * nf;
  } else {
    out[10] = -1;
    out[14] = -2 * near;
  }

  return out;
}
/**
 * Generates a perspective projection matrix with the given field of view.
 * This is primarily useful for generating projection matrices to be used
 * with the still experiemental WebVR API.
 *
 * @param {mat4} out mat4 frustum matrix will be written into
 * @param {Object} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees
 * @param {number} near Near bound of the frustum
 * @param {number} far Far bound of the frustum
 * @returns {mat4} out
 */


function perspectiveFromFieldOfView(out, fov, near, far) {
  var upTan = Math.tan(fov.upDegrees * Math.PI / 180.0);
  var downTan = Math.tan(fov.downDegrees * Math.PI / 180.0);
  var leftTan = Math.tan(fov.leftDegrees * Math.PI / 180.0);
  var rightTan = Math.tan(fov.rightDegrees * Math.PI / 180.0);
  var xScale = 2.0 / (leftTan + rightTan);
  var yScale = 2.0 / (upTan + downTan);
  out[0] = xScale;
  out[1] = 0.0;
  out[2] = 0.0;
  out[3] = 0.0;
  out[4] = 0.0;
  out[5] = yScale;
  out[6] = 0.0;
  out[7] = 0.0;
  out[8] = -((leftTan - rightTan) * xScale * 0.5);
  out[9] = (upTan - downTan) * yScale * 0.5;
  out[10] = far / (near - far);
  out[11] = -1.0;
  out[12] = 0.0;
  out[13] = 0.0;
  out[14] = far * near / (near - far);
  out[15] = 0.0;
  return out;
}
/**
 * Generates a orthogonal projection matrix with the given bounds
 *
 * @param {mat4} out mat4 frustum matrix will be written into
 * @param {number} left Left bound of the frustum
 * @param {number} right Right bound of the frustum
 * @param {number} bottom Bottom bound of the frustum
 * @param {number} top Top bound of the frustum
 * @param {number} near Near bound of the frustum
 * @param {number} far Far bound of the frustum
 * @returns {mat4} out
 */


function ortho(out, left, right, bottom, top, near, far) {
  var lr = 1 / (left - right);
  var bt = 1 / (bottom - top);
  var nf = 1 / (near - far);
  out[0] = -2 * lr;
  out[1] = 0;
  out[2] = 0;
  out[3] = 0;
  out[4] = 0;
  out[5] = -2 * bt;
  out[6] = 0;
  out[7] = 0;
  out[8] = 0;
  out[9] = 0;
  out[10] = 2 * nf;
  out[11] = 0;
  out[12] = (left + right) * lr;
  out[13] = (top + bottom) * bt;
  out[14] = (far + near) * nf;
  out[15] = 1;
  return out;
}
/**
 * Generates a look-at matrix with the given eye position, focal point, and up axis.
 * If you want a matrix that actually makes an object look at another object, you should use targetTo instead.
 *
 * @param {mat4} out mat4 frustum matrix will be written into
 * @param {vec3} eye Position of the viewer
 * @param {vec3} center Point the viewer is looking at
 * @param {vec3} up vec3 pointing up
 * @returns {mat4} out
 */


function lookAt(out, eye, center, up) {
  var x0, x1, x2, y0, y1, y2, z0, z1, z2, len;
  var eyex = eye[0];
  var eyey = eye[1];
  var eyez = eye[2];
  var upx = up[0];
  var upy = up[1];
  var upz = up[2];
  var centerx = center[0];
  var centery = center[1];
  var centerz = center[2];

  if (Math.abs(eyex - centerx) < glMatrix.EPSILON && Math.abs(eyey - centery) < glMatrix.EPSILON && Math.abs(eyez - centerz) < glMatrix.EPSILON) {
    return identity(out);
  }

  z0 = eyex - centerx;
  z1 = eyey - centery;
  z2 = eyez - centerz;
  len = 1 / Math.hypot(z0, z1, z2);
  z0 *= len;
  z1 *= len;
  z2 *= len;
  x0 = upy * z2 - upz * z1;
  x1 = upz * z0 - upx * z2;
  x2 = upx * z1 - upy * z0;
  len = Math.hypot(x0, x1, x2);

  if (!len) {
    x0 = 0;
    x1 = 0;
    x2 = 0;
  } else {
    len = 1 / len;
    x0 *= len;
    x1 *= len;
    x2 *= len;
  }

  y0 = z1 * x2 - z2 * x1;
  y1 = z2 * x0 - z0 * x2;
  y2 = z0 * x1 - z1 * x0;
  len = Math.hypot(y0, y1, y2);

  if (!len) {
    y0 = 0;
    y1 = 0;
    y2 = 0;
  } else {
    len = 1 / len;
    y0 *= len;
    y1 *= len;
    y2 *= len;
  }

  out[0] = x0;
  out[1] = y0;
  out[2] = z0;
  out[3] = 0;
  out[4] = x1;
  out[5] = y1;
  out[6] = z1;
  out[7] = 0;
  out[8] = x2;
  out[9] = y2;
  out[10] = z2;
  out[11] = 0;
  out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);
  out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);
  out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);
  out[15] = 1;
  return out;
}
/**
 * Generates a matrix that makes something look at something else.
 *
 * @param {mat4} out mat4 frustum matrix will be written into
 * @param {vec3} eye Position of the viewer
 * @param {vec3} center Point the viewer is looking at
 * @param {vec3} up vec3 pointing up
 * @returns {mat4} out
 */


function targetTo(out, eye, target, up) {
  var eyex = eye[0],
      eyey = eye[1],
      eyez = eye[2],
      upx = up[0],
      upy = up[1],
      upz = up[2];
  var z0 = eyex - target[0],
      z1 = eyey - target[1],
      z2 = eyez - target[2];
  var len = z0 * z0 + z1 * z1 + z2 * z2;

  if (len > 0) {
    len = 1 / Math.sqrt(len);
    z0 *= len;
    z1 *= len;
    z2 *= len;
  }

  var x0 = upy * z2 - upz * z1,
      x1 = upz * z0 - upx * z2,
      x2 = upx * z1 - upy * z0;
  len = x0 * x0 + x1 * x1 + x2 * x2;

  if (len > 0) {
    len = 1 / Math.sqrt(len);
    x0 *= len;
    x1 *= len;
    x2 *= len;
  }

  out[0] = x0;
  out[1] = x1;
  out[2] = x2;
  out[3] = 0;
  out[4] = z1 * x2 - z2 * x1;
  out[5] = z2 * x0 - z0 * x2;
  out[6] = z0 * x1 - z1 * x0;
  out[7] = 0;
  out[8] = z0;
  out[9] = z1;
  out[10] = z2;
  out[11] = 0;
  out[12] = eyex;
  out[13] = eyey;
  out[14] = eyez;
  out[15] = 1;
  return out;
}

;
/**
 * Returns a string representation of a mat4
 *
 * @param {mat4} a matrix to represent as a string
 * @returns {String} string representation of the matrix
 */

function str(a) {
  return 'mat4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' + a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' + a[8] + ', ' + a[9] + ', ' + a[10] + ', ' + a[11] + ', ' + a[12] + ', ' + a[13] + ', ' + a[14] + ', ' + a[15] + ')';
}
/**
 * Returns Frobenius norm of a mat4
 *
 * @param {mat4} a the matrix to calculate Frobenius norm of
 * @returns {Number} Frobenius norm
 */


function frob(a) {
  return Math.hypot(a[0], a[1], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15]);
}
/**
 * Adds two mat4's
 *
 * @param {mat4} out the receiving matrix
 * @param {mat4} a the first operand
 * @param {mat4} b the second operand
 * @returns {mat4} out
 */


function add(out, a, b) {
  out[0] = a[0] + b[0];
  out[1] = a[1] + b[1];
  out[2] = a[2] + b[2];
  out[3] = a[3] + b[3];
  out[4] = a[4] + b[4];
  out[5] = a[5] + b[5];
  out[6] = a[6] + b[6];
  out[7] = a[7] + b[7];
  out[8] = a[8] + b[8];
  out[9] = a[9] + b[9];
  out[10] = a[10] + b[10];
  out[11] = a[11] + b[11];
  out[12] = a[12] + b[12];
  out[13] = a[13] + b[13];
  out[14] = a[14] + b[14];
  out[15] = a[15] + b[15];
  return out;
}
/**
 * Subtracts matrix b from matrix a
 *
 * @param {mat4} out the receiving matrix
 * @param {mat4} a the first operand
 * @param {mat4} b the second operand
 * @returns {mat4} out
 */


function subtract(out, a, b) {
  out[0] = a[0] - b[0];
  out[1] = a[1] - b[1];
  out[2] = a[2] - b[2];
  out[3] = a[3] - b[3];
  out[4] = a[4] - b[4];
  out[5] = a[5] - b[5];
  out[6] = a[6] - b[6];
  out[7] = a[7] - b[7];
  out[8] = a[8] - b[8];
  out[9] = a[9] - b[9];
  out[10] = a[10] - b[10];
  out[11] = a[11] - b[11];
  out[12] = a[12] - b[12];
  out[13] = a[13] - b[13];
  out[14] = a[14] - b[14];
  out[15] = a[15] - b[15];
  return out;
}
/**
 * Multiply each element of the matrix by a scalar.
 *
 * @param {mat4} out the receiving matrix
 * @param {mat4} a the matrix to scale
 * @param {Number} b amount to scale the matrix's elements by
 * @returns {mat4} out
 */


function multiplyScalar(out, a, b) {
  out[0] = a[0] * b;
  out[1] = a[1] * b;
  out[2] = a[2] * b;
  out[3] = a[3] * b;
  out[4] = a[4] * b;
  out[5] = a[5] * b;
  out[6] = a[6] * b;
  out[7] = a[7] * b;
  out[8] = a[8] * b;
  out[9] = a[9] * b;
  out[10] = a[10] * b;
  out[11] = a[11] * b;
  out[12] = a[12] * b;
  out[13] = a[13] * b;
  out[14] = a[14] * b;
  out[15] = a[15] * b;
  return out;
}
/**
 * Adds two mat4's after multiplying each element of the second operand by a scalar value.
 *
 * @param {mat4} out the receiving vector
 * @param {mat4} a the first operand
 * @param {mat4} b the second operand
 * @param {Number} scale the amount to scale b's elements by before adding
 * @returns {mat4} out
 */


function multiplyScalarAndAdd(out, a, b, scale) {
  out[0] = a[0] + b[0] * scale;
  out[1] = a[1] + b[1] * scale;
  out[2] = a[2] + b[2] * scale;
  out[3] = a[3] + b[3] * scale;
  out[4] = a[4] + b[4] * scale;
  out[5] = a[5] + b[5] * scale;
  out[6] = a[6] + b[6] * scale;
  out[7] = a[7] + b[7] * scale;
  out[8] = a[8] + b[8] * scale;
  out[9] = a[9] + b[9] * scale;
  out[10] = a[10] + b[10] * scale;
  out[11] = a[11] + b[11] * scale;
  out[12] = a[12] + b[12] * scale;
  out[13] = a[13] + b[13] * scale;
  out[14] = a[14] + b[14] * scale;
  out[15] = a[15] + b[15] * scale;
  return out;
}
/**
 * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
 *
 * @param {mat4} a The first matrix.
 * @param {mat4} b The second matrix.
 * @returns {Boolean} True if the matrices are equal, false otherwise.
 */


function exactEquals(a, b) {
  return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8] && a[9] === b[9] && a[10] === b[10] && a[11] === b[11] && a[12] === b[12] && a[13] === b[13] && a[14] === b[14] && a[15] === b[15];
}
/**
 * Returns whether or not the matrices have approximately the same elements in the same position.
 *
 * @param {mat4} a The first matrix.
 * @param {mat4} b The second matrix.
 * @returns {Boolean} True if the matrices are equal, false otherwise.
 */


function equals(a, b) {
  var a0 = a[0],
      a1 = a[1],
      a2 = a[2],
      a3 = a[3];
  var a4 = a[4],
      a5 = a[5],
      a6 = a[6],
      a7 = a[7];
  var a8 = a[8],
      a9 = a[9],
      a10 = a[10],
      a11 = a[11];
  var a12 = a[12],
      a13 = a[13],
      a14 = a[14],
      a15 = a[15];
  var b0 = b[0],
      b1 = b[1],
      b2 = b[2],
      b3 = b[3];
  var b4 = b[4],
      b5 = b[5],
      b6 = b[6],
      b7 = b[7];
  var b8 = b[8],
      b9 = b[9],
      b10 = b[10],
      b11 = b[11];
  var b12 = b[12],
      b13 = b[13],
      b14 = b[14],
      b15 = b[15];
  return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a15), Math.abs(b15));
}
/**
 * Alias for {@link mat4.multiply}
 * @function
 */


var mul = multiply;
/**
 * Alias for {@link mat4.subtract}
 * @function
 */

exports.mul = mul;
var sub = subtract;
exports.sub = sub;
},{"./common.js":"hRXm"}],"i3i1":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.create = create;
exports.clone = clone;
exports.fromValues = fromValues;
exports.copy = copy;
exports.set = set;
exports.add = add;
exports.subtract = subtract;
exports.multiply = multiply;
exports.divide = divide;
exports.ceil = ceil;
exports.floor = floor;
exports.min = min;
exports.max = max;
exports.round = round;
exports.scale = scale;
exports.scaleAndAdd = scaleAndAdd;
exports.distance = distance;
exports.squaredDistance = squaredDistance;
exports.length = length;
exports.squaredLength = squaredLength;
exports.negate = negate;
exports.inverse = inverse;
exports.normalize = normalize;
exports.dot = dot;
exports.cross = cross;
exports.lerp = lerp;
exports.random = random;
exports.transformMat4 = transformMat4;
exports.transformQuat = transformQuat;
exports.zero = zero;
exports.str = str;
exports.exactEquals = exactEquals;
exports.equals = equals;
exports.forEach = exports.sqrLen = exports.len = exports.sqrDist = exports.dist = exports.div = exports.mul = exports.sub = void 0;

var glMatrix = _interopRequireWildcard(require("./common.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * 4 Dimensional Vector
 * @module vec4
 */

/**
 * Creates a new, empty vec4
 *
 * @returns {vec4} a new 4D vector
 */
function create() {
  var out = new glMatrix.ARRAY_TYPE(4);

  if (glMatrix.ARRAY_TYPE != Float32Array) {
    out[0] = 0;
    out[1] = 0;
    out[2] = 0;
    out[3] = 0;
  }

  return out;
}
/**
 * Creates a new vec4 initialized with values from an existing vector
 *
 * @param {vec4} a vector to clone
 * @returns {vec4} a new 4D vector
 */


function clone(a) {
  var out = new glMatrix.ARRAY_TYPE(4);
  out[0] = a[0];
  out[1] = a[1];
  out[2] = a[2];
  out[3] = a[3];
  return out;
}
/**
 * Creates a new vec4 initialized with the given values
 *
 * @param {Number} x X component
 * @param {Number} y Y component
 * @param {Number} z Z component
 * @param {Number} w W component
 * @returns {vec4} a new 4D vector
 */


function fromValues(x, y, z, w) {
  var out = new glMatrix.ARRAY_TYPE(4);
  out[0] = x;
  out[1] = y;
  out[2] = z;
  out[3] = w;
  return out;
}
/**
 * Copy the values from one vec4 to another
 *
 * @param {vec4} out the receiving vector
 * @param {vec4} a the source vector
 * @returns {vec4} out
 */


function copy(out, a) {
  out[0] = a[0];
  out[1] = a[1];
  out[2] = a[2];
  out[3] = a[3];
  return out;
}
/**
 * Set the components of a vec4 to the given values
 *
 * @param {vec4} out the receiving vector
 * @param {Number} x X component
 * @param {Number} y Y component
 * @param {Number} z Z component
 * @param {Number} w W component
 * @returns {vec4} out
 */


function set(out, x, y, z, w) {
  out[0] = x;
  out[1] = y;
  out[2] = z;
  out[3] = w;
  return out;
}
/**
 * Adds two vec4's
 *
 * @param {vec4} out the receiving vector
 * @param {vec4} a the first operand
 * @param {vec4} b the second operand
 * @returns {vec4} out
 */


function add(out, a, b) {
  out[0] = a[0] + b[0];
  out[1] = a[1] + b[1];
  out[2] = a[2] + b[2];
  out[3] = a[3] + b[3];
  return out;
}
/**
 * Subtracts vector b from vector a
 *
 * @param {vec4} out the receiving vector
 * @param {vec4} a the first operand
 * @param {vec4} b the second operand
 * @returns {vec4} out
 */


function subtract(out, a, b) {
  out[0] = a[0] - b[0];
  out[1] = a[1] - b[1];
  out[2] = a[2] - b[2];
  out[3] = a[3] - b[3];
  return out;
}
/**
 * Multiplies two vec4's
 *
 * @param {vec4} out the receiving vector
 * @param {vec4} a the first operand
 * @param {vec4} b the second operand
 * @returns {vec4} out
 */


function multiply(out, a, b) {
  out[0] = a[0] * b[0];
  out[1] = a[1] * b[1];
  out[2] = a[2] * b[2];
  out[3] = a[3] * b[3];
  return out;
}
/**
 * Divides two vec4's
 *
 * @param {vec4} out the receiving vector
 * @param {vec4} a the first operand
 * @param {vec4} b the second operand
 * @returns {vec4} out
 */


function divide(out, a, b) {
  out[0] = a[0] / b[0];
  out[1] = a[1] / b[1];
  out[2] = a[2] / b[2];
  out[3] = a[3] / b[3];
  return out;
}
/**
 * Math.ceil the components of a vec4
 *
 * @param {vec4} out the receiving vector
 * @param {vec4} a vector to ceil
 * @returns {vec4} out
 */


function ceil(out, a) {
  out[0] = Math.ceil(a[0]);
  out[1] = Math.ceil(a[1]);
  out[2] = Math.ceil(a[2]);
  out[3] = Math.ceil(a[3]);
  return out;
}
/**
 * Math.floor the components of a vec4
 *
 * @param {vec4} out the receiving vector
 * @param {vec4} a vector to floor
 * @returns {vec4} out
 */


function floor(out, a) {
  out[0] = Math.floor(a[0]);
  out[1] = Math.floor(a[1]);
  out[2] = Math.floor(a[2]);
  out[3] = Math.floor(a[3]);
  return out;
}
/**
 * Returns the minimum of two vec4's
 *
 * @param {vec4} out the receiving vector
 * @param {vec4} a the first operand
 * @param {vec4} b the second operand
 * @returns {vec4} out
 */


function min(out, a, b) {
  out[0] = Math.min(a[0], b[0]);
  out[1] = Math.min(a[1], b[1]);
  out[2] = Math.min(a[2], b[2]);
  out[3] = Math.min(a[3], b[3]);
  return out;
}
/**
 * Returns the maximum of two vec4's
 *
 * @param {vec4} out the receiving vector
 * @param {vec4} a the first operand
 * @param {vec4} b the second operand
 * @returns {vec4} out
 */


function max(out, a, b) {
  out[0] = Math.max(a[0], b[0]);
  out[1] = Math.max(a[1], b[1]);
  out[2] = Math.max(a[2], b[2]);
  out[3] = Math.max(a[3], b[3]);
  return out;
}
/**
 * Math.round the components of a vec4
 *
 * @param {vec4} out the receiving vector
 * @param {vec4} a vector to round
 * @returns {vec4} out
 */


function round(out, a) {
  out[0] = Math.round(a[0]);
  out[1] = Math.round(a[1]);
  out[2] = Math.round(a[2]);
  out[3] = Math.round(a[3]);
  return out;
}
/**
 * Scales a vec4 by a scalar number
 *
 * @param {vec4} out the receiving vector
 * @param {vec4} a the vector to scale
 * @param {Number} b amount to scale the vector by
 * @returns {vec4} out
 */


function scale(out, a, b) {
  out[0] = a[0] * b;
  out[1] = a[1] * b;
  out[2] = a[2] * b;
  out[3] = a[3] * b;
  return out;
}
/**
 * Adds two vec4's after scaling the second operand by a scalar value
 *
 * @param {vec4} out the receiving vector
 * @param {vec4} a the first operand
 * @param {vec4} b the second operand
 * @param {Number} scale the amount to scale b by before adding
 * @returns {vec4} out
 */


function scaleAndAdd(out, a, b, scale) {
  out[0] = a[0] + b[0] * scale;
  out[1] = a[1] + b[1] * scale;
  out[2] = a[2] + b[2] * scale;
  out[3] = a[3] + b[3] * scale;
  return out;
}
/**
 * Calculates the euclidian distance between two vec4's
 *
 * @param {vec4} a the first operand
 * @param {vec4} b the second operand
 * @returns {Number} distance between a and b
 */


function distance(a, b) {
  var x = b[0] - a[0];
  var y = b[1] - a[1];
  var z = b[2] - a[2];
  var w = b[3] - a[3];
  return Math.hypot(x, y, z, w);
}
/**
 * Calculates the squared euclidian distance between two vec4's
 *
 * @param {vec4} a the first operand
 * @param {vec4} b the second operand
 * @returns {Number} squared distance between a and b
 */


function squaredDistance(a, b) {
  var x = b[0] - a[0];
  var y = b[1] - a[1];
  var z = b[2] - a[2];
  var w = b[3] - a[3];
  return x * x + y * y + z * z + w * w;
}
/**
 * Calculates the length of a vec4
 *
 * @param {vec4} a vector to calculate length of
 * @returns {Number} length of a
 */


function length(a) {
  var x = a[0];
  var y = a[1];
  var z = a[2];
  var w = a[3];
  return Math.hypot(x, y, z, w);
}
/**
 * Calculates the squared length of a vec4
 *
 * @param {vec4} a vector to calculate squared length of
 * @returns {Number} squared length of a
 */


function squaredLength(a) {
  var x = a[0];
  var y = a[1];
  var z = a[2];
  var w = a[3];
  return x * x + y * y + z * z + w * w;
}
/**
 * Negates the components of a vec4
 *
 * @param {vec4} out the receiving vector
 * @param {vec4} a vector to negate
 * @returns {vec4} out
 */


function negate(out, a) {
  out[0] = -a[0];
  out[1] = -a[1];
  out[2] = -a[2];
  out[3] = -a[3];
  return out;
}
/**
 * Returns the inverse of the components of a vec4
 *
 * @param {vec4} out the receiving vector
 * @param {vec4} a vector to invert
 * @returns {vec4} out
 */


function inverse(out, a) {
  out[0] = 1.0 / a[0];
  out[1] = 1.0 / a[1];
  out[2] = 1.0 / a[2];
  out[3] = 1.0 / a[3];
  return out;
}
/**
 * Normalize a vec4
 *
 * @param {vec4} out the receiving vector
 * @param {vec4} a vector to normalize
 * @returns {vec4} out
 */


function normalize(out, a) {
  var x = a[0];
  var y = a[1];
  var z = a[2];
  var w = a[3];
  var len = x * x + y * y + z * z + w * w;

  if (len > 0) {
    len = 1 / Math.sqrt(len);
  }

  out[0] = x * len;
  out[1] = y * len;
  out[2] = z * len;
  out[3] = w * len;
  return out;
}
/**
 * Calculates the dot product of two vec4's
 *
 * @param {vec4} a the first operand
 * @param {vec4} b the second operand
 * @returns {Number} dot product of a and b
 */


function dot(a, b) {
  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
}
/**
 * Returns the cross-product of three vectors in a 4-dimensional space
 *
 * @param {vec4} result the receiving vector
 * @param {vec4} U the first vector
 * @param {vec4} V the second vector
 * @param {vec4} W the third vector
 * @returns {vec4} result
 */


function cross(out, u, v, w) {
  var A = v[0] * w[1] - v[1] * w[0],
      B = v[0] * w[2] - v[2] * w[0],
      C = v[0] * w[3] - v[3] * w[0],
      D = v[1] * w[2] - v[2] * w[1],
      E = v[1] * w[3] - v[3] * w[1],
      F = v[2] * w[3] - v[3] * w[2];
  var G = u[0];
  var H = u[1];
  var I = u[2];
  var J = u[3];
  out[0] = H * F - I * E + J * D;
  out[1] = -(G * F) + I * C - J * B;
  out[2] = G * E - H * C + J * A;
  out[3] = -(G * D) + H * B - I * A;
  return out;
}

;
/**
 * Performs a linear interpolation between two vec4's
 *
 * @param {vec4} out the receiving vector
 * @param {vec4} a the first operand
 * @param {vec4} b the second operand
 * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
 * @returns {vec4} out
 */

function lerp(out, a, b, t) {
  var ax = a[0];
  var ay = a[1];
  var az = a[2];
  var aw = a[3];
  out[0] = ax + t * (b[0] - ax);
  out[1] = ay + t * (b[1] - ay);
  out[2] = az + t * (b[2] - az);
  out[3] = aw + t * (b[3] - aw);
  return out;
}
/**
 * Generates a random vector with the given scale
 *
 * @param {vec4} out the receiving vector
 * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned
 * @returns {vec4} out
 */


function random(out, scale) {
  scale = scale || 1.0; // Marsaglia, George. Choosing a Point from the Surface of a
  // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646.
  // http://projecteuclid.org/euclid.aoms/1177692644;

  var v1, v2, v3, v4;
  var s1, s2;

  do {
    v1 = glMatrix.RANDOM() * 2 - 1;
    v2 = glMatrix.RANDOM() * 2 - 1;
    s1 = v1 * v1 + v2 * v2;
  } while (s1 >= 1);

  do {
    v3 = glMatrix.RANDOM() * 2 - 1;
    v4 = glMatrix.RANDOM() * 2 - 1;
    s2 = v3 * v3 + v4 * v4;
  } while (s2 >= 1);

  var d = Math.sqrt((1 - s1) / s2);
  out[0] = scale * v1;
  out[1] = scale * v2;
  out[2] = scale * v3 * d;
  out[3] = scale * v4 * d;
  return out;
}
/**
 * Transforms the vec4 with a mat4.
 *
 * @param {vec4} out the receiving vector
 * @param {vec4} a the vector to transform
 * @param {mat4} m matrix to transform with
 * @returns {vec4} out
 */


function transformMat4(out, a, m) {
  var x = a[0],
      y = a[1],
      z = a[2],
      w = a[3];
  out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;
  out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;
  out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;
  out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;
  return out;
}
/**
 * Transforms the vec4 with a quat
 *
 * @param {vec4} out the receiving vector
 * @param {vec4} a the vector to transform
 * @param {quat} q quaternion to transform with
 * @returns {vec4} out
 */


function transformQuat(out, a, q) {
  var x = a[0],
      y = a[1],
      z = a[2];
  var qx = q[0],
      qy = q[1],
      qz = q[2],
      qw = q[3]; // calculate quat * vec

  var ix = qw * x + qy * z - qz * y;
  var iy = qw * y + qz * x - qx * z;
  var iz = qw * z + qx * y - qy * x;
  var iw = -qx * x - qy * y - qz * z; // calculate result * inverse quat

  out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;
  out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;
  out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;
  out[3] = a[3];
  return out;
}
/**
 * Set the components of a vec4 to zero
 *
 * @param {vec4} out the receiving vector
 * @returns {vec4} out
 */


function zero(out) {
  out[0] = 0.0;
  out[1] = 0.0;
  out[2] = 0.0;
  out[3] = 0.0;
  return out;
}
/**
 * Returns a string representation of a vector
 *
 * @param {vec4} a vector to represent as a string
 * @returns {String} string representation of the vector
 */


function str(a) {
  return 'vec4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ')';
}
/**
 * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)
 *
 * @param {vec4} a The first vector.
 * @param {vec4} b The second vector.
 * @returns {Boolean} True if the vectors are equal, false otherwise.
 */


function exactEquals(a, b) {
  return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];
}
/**
 * Returns whether or not the vectors have approximately the same elements in the same position.
 *
 * @param {vec4} a The first vector.
 * @param {vec4} b The second vector.
 * @returns {Boolean} True if the vectors are equal, false otherwise.
 */


function equals(a, b) {
  var a0 = a[0],
      a1 = a[1],
      a2 = a[2],
      a3 = a[3];
  var b0 = b[0],
      b1 = b[1],
      b2 = b[2],
      b3 = b[3];
  return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3));
}
/**
 * Alias for {@link vec4.subtract}
 * @function
 */


var sub = subtract;
/**
 * Alias for {@link vec4.multiply}
 * @function
 */

exports.sub = sub;
var mul = multiply;
/**
 * Alias for {@link vec4.divide}
 * @function
 */

exports.mul = mul;
var div = divide;
/**
 * Alias for {@link vec4.distance}
 * @function
 */

exports.div = div;
var dist = distance;
/**
 * Alias for {@link vec4.squaredDistance}
 * @function
 */

exports.dist = dist;
var sqrDist = squaredDistance;
/**
 * Alias for {@link vec4.length}
 * @function
 */

exports.sqrDist = sqrDist;
var len = length;
/**
 * Alias for {@link vec4.squaredLength}
 * @function
 */

exports.len = len;
var sqrLen = squaredLength;
/**
 * Perform some operation over an array of vec4s.
 *
 * @param {Array} a the array of vectors to iterate over
 * @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed
 * @param {Number} offset Number of elements to skip at the beginning of the array
 * @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array
 * @param {Function} fn Function to call for each vector in the array
 * @param {Object} [arg] additional argument to pass to fn
 * @returns {Array} a
 * @function
 */

exports.sqrLen = sqrLen;

var forEach = function () {
  var vec = create();
  return function (a, stride, offset, count, fn, arg) {
    var i, l;

    if (!stride) {
      stride = 4;
    }

    if (!offset) {
      offset = 0;
    }

    if (count) {
      l = Math.min(count * stride + offset, a.length);
    } else {
      l = a.length;
    }

    for (i = offset; i < l; i += stride) {
      vec[0] = a[i];
      vec[1] = a[i + 1];
      vec[2] = a[i + 2];
      vec[3] = a[i + 3];
      fn(vec, vec, arg);
      a[i] = vec[0];
      a[i + 1] = vec[1];
      a[i + 2] = vec[2];
      a[i + 3] = vec[3];
    }

    return a;
  };
}();

exports.forEach = forEach;
},{"./common.js":"hRXm"}],"zcrk":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.validateMatrix4 = validateMatrix4;
exports.default = void 0;

var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _mathArray = _interopRequireDefault(require("./lib/math-array"));

var _common = require("./lib/common");

var _validators = require("./lib/validators");

var _vector = _interopRequireDefault(require("./vector2"));

var _vector2 = _interopRequireDefault(require("./vector3"));

var _vector3 = _interopRequireDefault(require("./vector4"));

var mat4 = _interopRequireWildcard(require("gl-matrix/mat4"));

var vec2 = _interopRequireWildcard(require("gl-matrix/vec2"));

var vec3 = _interopRequireWildcard(require("gl-matrix/vec3"));

var vec4 = _interopRequireWildcard(require("gl-matrix/vec4"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var IDENTITY = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];

function validateMatrix4(m) {
  return m.length === 16 && Number.isFinite(m[0]) && Number.isFinite(m[1]) && Number.isFinite(m[2]) && Number.isFinite(m[3]) && Number.isFinite(m[4]) && Number.isFinite(m[5]) && Number.isFinite(m[6]) && Number.isFinite(m[7]) && Number.isFinite(m[8]) && Number.isFinite(m[9]) && Number.isFinite(m[10]) && Number.isFinite(m[11]) && Number.isFinite(m[12]) && Number.isFinite(m[13]) && Number.isFinite(m[14]) && Number.isFinite(m[15]);
}

var Matrix4 = function (_MathArray) {
  (0, _inherits2.default)(Matrix4, _MathArray);

  function Matrix4() {
    var _this;

    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    (0, _classCallCheck2.default)(this, Matrix4);
    _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Matrix4).call(this, 16));

    if (Array.isArray(args[0]) && arguments.length === 1) {
      _this.copy(args[0]);
    } else {
      _this.identity();
    }

    return _this;
  }

  (0, _createClass2.default)(Matrix4, [{
    key: "setRowMajor",
    value: function setRowMajor() {
      var m00 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
      var m01 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
      var m02 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
      var m03 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
      var m10 = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
      var m11 = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
      var m12 = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
      var m13 = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 0;
      var m20 = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : 0;
      var m21 = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : 0;
      var m22 = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : 1;
      var m23 = arguments.length > 11 && arguments[11] !== undefined ? arguments[11] : 0;
      var m30 = arguments.length > 12 && arguments[12] !== undefined ? arguments[12] : 0;
      var m31 = arguments.length > 13 && arguments[13] !== undefined ? arguments[13] : 0;
      var m32 = arguments.length > 14 && arguments[14] !== undefined ? arguments[14] : 0;
      var m33 = arguments.length > 15 && arguments[15] !== undefined ? arguments[15] : 1;
      this[0] = m00;
      this[1] = m10;
      this[2] = m20;
      this[3] = m30;
      this[4] = m01;
      this[5] = m11;
      this[6] = m21;
      this[7] = m31;
      this[8] = m02;
      this[9] = m12;
      this[10] = m22;
      this[11] = m32;
      this[12] = m03;
      this[13] = m13;
      this[14] = m23;
      this[15] = m33;
      return this.check();
    }
  }, {
    key: "setColumnMajor",
    value: function setColumnMajor() {
      var m00 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
      var m10 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
      var m20 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
      var m30 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
      var m01 = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
      var m11 = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
      var m21 = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
      var m31 = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 0;
      var m02 = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : 0;
      var m12 = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : 0;
      var m22 = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : 1;
      var m32 = arguments.length > 11 && arguments[11] !== undefined ? arguments[11] : 0;
      var m03 = arguments.length > 12 && arguments[12] !== undefined ? arguments[12] : 0;
      var m13 = arguments.length > 13 && arguments[13] !== undefined ? arguments[13] : 0;
      var m23 = arguments.length > 14 && arguments[14] !== undefined ? arguments[14] : 0;
      var m33 = arguments.length > 15 && arguments[15] !== undefined ? arguments[15] : 1;
      this[0] = m00;
      this[1] = m10;
      this[2] = m20;
      this[3] = m30;
      this[4] = m01;
      this[5] = m11;
      this[6] = m21;
      this[7] = m31;
      this[8] = m02;
      this[9] = m12;
      this[10] = m22;
      this[11] = m32;
      this[12] = m03;
      this[13] = m13;
      this[14] = m23;
      this[15] = m33;
      return this.check();
    }
  }, {
    key: "set",
    value: function set() {
      return this.setColumnMajor.apply(this, arguments);
    }
  }, {
    key: "getElement",
    value: function getElement(i, j) {
      var columnMajor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
      return columnMajor ? this[i][j] : this[j][i];
    }
  }, {
    key: "setElement",
    value: function setElement(i, j, value) {
      var columnMajor = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      if (columnMajor) {
        this[i][j] = (0, _common.checkNumber)(value);
      } else {
        this[j][i] = (0, _common.checkNumber)(value);
      }

      return this;
    }
  }, {
    key: "determinant",
    value: function determinant() {
      return mat4.determinant(this);
    }
  }, {
    key: "identity",
    value: function identity() {
      return this.copy(IDENTITY);
    }
  }, {
    key: "fromQuaternion",
    value: function fromQuaternion(q) {
      mat4.fromQuat(this, q);
      return this.check();
    }
  }, {
    key: "frustum",
    value: function frustum(_ref) {
      var left = _ref.left,
          right = _ref.right,
          bottom = _ref.bottom,
          top = _ref.top,
          near = _ref.near,
          far = _ref.far;
      mat4.frustum(this, left, right, bottom, top, near, far);
      return this.check();
    }
  }, {
    key: "lookAt",
    value: function lookAt(_ref2) {
      var eye = _ref2.eye,
          _ref2$center = _ref2.center,
          center = _ref2$center === void 0 ? [0, 0, 0] : _ref2$center,
          _ref2$up = _ref2.up,
          up = _ref2$up === void 0 ? [0, 1, 0] : _ref2$up;
      mat4.lookAt(this, eye, center, up);
      return this.check();
    }
  }, {
    key: "ortho",
    value: function ortho(_ref3) {
      var left = _ref3.left,
          right = _ref3.right,
          bottom = _ref3.bottom,
          top = _ref3.top,
          _ref3$near = _ref3.near,
          near = _ref3$near === void 0 ? 0.1 : _ref3$near,
          _ref3$far = _ref3.far,
          far = _ref3$far === void 0 ? 500 : _ref3$far;
      mat4.ortho(this, left, right, bottom, top, near, far);
      return this.check();
    }
  }, {
    key: "orthographic",
    value: function orthographic(_ref4) {
      var _ref4$fovy = _ref4.fovy,
          fovy = _ref4$fovy === void 0 ? 45 * Math.PI / 180 : _ref4$fovy,
          _ref4$aspect = _ref4.aspect,
          aspect = _ref4$aspect === void 0 ? 1 : _ref4$aspect,
          _ref4$focalDistance = _ref4.focalDistance,
          focalDistance = _ref4$focalDistance === void 0 ? 1 : _ref4$focalDistance,
          _ref4$near = _ref4.near,
          near = _ref4$near === void 0 ? 0.1 : _ref4$near,
          _ref4$far = _ref4.far,
          far = _ref4$far === void 0 ? 500 : _ref4$far;

      if (fovy > Math.PI * 2) {
        throw Error('radians');
      }

      var halfY = fovy / 2;
      var top = focalDistance * Math.tan(halfY);
      var right = top * aspect;
      return new Matrix4().ortho({
        left: -right,
        right: right,
        bottom: -top,
        top: top,
        near: near,
        far: far
      });
    }
  }, {
    key: "perspective",
    value: function perspective() {
      var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          fovy = _ref5.fovy,
          _ref5$fov = _ref5.fov,
          fov = _ref5$fov === void 0 ? 45 * Math.PI / 180 : _ref5$fov,
          _ref5$aspect = _ref5.aspect,
          aspect = _ref5$aspect === void 0 ? 1 : _ref5$aspect,
          _ref5$near = _ref5.near,
          near = _ref5$near === void 0 ? 0.1 : _ref5$near,
          _ref5$far = _ref5.far,
          far = _ref5$far === void 0 ? 500 : _ref5$far;

      fovy = fovy || fov;

      if (fovy > Math.PI * 2) {
        throw Error('radians');
      }

      mat4.perspective(this, fovy, aspect, near, far);
      return this.check();
    }
  }, {
    key: "transpose",
    value: function transpose() {
      mat4.transpose(this, this);
      return this.check();
    }
  }, {
    key: "invert",
    value: function invert() {
      mat4.invert(this, this);
      return this.check();
    }
  }, {
    key: "multiplyLeft",
    value: function multiplyLeft(a) {
      mat4.multiply(this, a, this);
      return this.check();
    }
  }, {
    key: "multiplyRight",
    value: function multiplyRight(a) {
      mat4.multiply(this, this, a);
      return this.check();
    }
  }, {
    key: "rotateX",
    value: function rotateX(radians) {
      mat4.rotateX(this, this, radians);
      return this.check();
    }
  }, {
    key: "rotateY",
    value: function rotateY(radians) {
      mat4.rotateY(this, this, radians);
      return this.check();
    }
  }, {
    key: "rotateZ",
    value: function rotateZ(radians) {
      mat4.rotateZ(this, this, radians);
      return this.check();
    }
  }, {
    key: "rotateXYZ",
    value: function rotateXYZ(_ref6) {
      var _ref7 = (0, _slicedToArray2.default)(_ref6, 3),
          rx = _ref7[0],
          ry = _ref7[1],
          rz = _ref7[2];

      return this.rotateX(rx).rotateY(ry).rotateZ(rz);
    }
  }, {
    key: "rotateAxis",
    value: function rotateAxis(radians, axis) {
      mat4.rotate(this, this, radians, axis);
      return this.check();
    }
  }, {
    key: "scale",
    value: function scale(factor) {
      if (Array.isArray(factor)) {
        mat4.scale(this, this, factor);
      } else {
        mat4.scale(this, this, [factor, factor, factor]);
      }

      return this.check();
    }
  }, {
    key: "translate",
    value: function translate(vec) {
      mat4.translate(this, this, vec);
      return this.check();
    }
  }, {
    key: "transformVector2",
    value: function transformVector2(vector, out) {
      out = out || new _vector.default();
      vec2.transformMat4(out, vector, this);
      (0, _validators.validateVector)(out, 2);
      return out;
    }
  }, {
    key: "transformVector3",
    value: function transformVector3(vector, out) {
      out = out || new _vector2.default();
      vec3.transformMat4(out, vector, this);
      (0, _validators.validateVector)(out, 3);
      return out;
    }
  }, {
    key: "transformVector4",
    value: function transformVector4(vector, out) {
      out = out || new _vector3.default();
      vec4.transformMat4(out, vector, this);
      (0, _validators.validateVector)(out, 4);
      return out.check();
    }
  }, {
    key: "transformVector",
    value: function transformVector(vector, out) {
      switch (vector.length) {
        case 2:
          return this.transformVector2(vector, out);

        case 3:
          return this.transformVector3(vector, out);

        case 4:
          return this.transformVector4(vector, out);

        default:
          throw new Error('Illegal vector');
      }
    }
  }, {
    key: "transformDirection",
    value: function transformDirection(vector, out) {
      return this._transformVector(vector, out, 0);
    }
  }, {
    key: "transformPoint",
    value: function transformPoint(vector, out) {
      return this._transformVector(vector, out, 1);
    }
  }, {
    key: "_transformVector",
    value: function _transformVector(vector, out, w) {
      switch (vector.length) {
        case 2:
          out = out || new _vector.default();
          vec4.transformMat4(out, [vector[0], vector[1], 0, w], this);
          out.length = 2;
          (0, _validators.validateVector)(out, 2);
          break;

        case 3:
          out = out || new _vector2.default();
          vec4.transformMat4(out, [vector[0], vector[1], vector[2], w], this);
          out.length = 3;
          (0, _validators.validateVector)(out, 3);
          break;

        case 4:
          if (Boolean(w) !== Boolean(vector[3])) {
            throw new Error('math.gl: Matrix4.transformPoint - invalid vector');
          }

          out = out || new _vector3.default();
          vec4.transformMat4(out, vector, this);
          (0, _validators.validateVector)(out, 4);
          break;

        default:
          throw new Error('Illegal vector');
      }

      return out;
    }
  }, {
    key: "makeRotationX",
    value: function makeRotationX(radians) {
      return this.identity().rotateX(radians);
    }
  }, {
    key: "makeTranslation",
    value: function makeTranslation(x, y, z) {
      return this.identity().translate([x, y, z]);
    }
  }, {
    key: "ELEMENTS",
    get: function get() {
      return 16;
    }
  }]);
  return Matrix4;
}(_mathArray.default);

exports.default = Matrix4;
},{"@babel/runtime/helpers/esm/slicedToArray":"U1JK","@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","./lib/math-array":"orGy","./lib/common":"Ma4c","./lib/validators":"s8Y3","./vector2":"VaFZ","./vector3":"jb7a","./vector4":"LqC5","gl-matrix/mat4":"Nd3D","gl-matrix/vec2":"iP3z","gl-matrix/vec3":"vuBh","gl-matrix/vec4":"i3i1"}],"cCtq":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.create = create;
exports.identity = identity;
exports.setAxisAngle = setAxisAngle;
exports.getAxisAngle = getAxisAngle;
exports.getAngle = getAngle;
exports.multiply = multiply;
exports.rotateX = rotateX;
exports.rotateY = rotateY;
exports.rotateZ = rotateZ;
exports.calculateW = calculateW;
exports.exp = exp;
exports.ln = ln;
exports.pow = pow;
exports.slerp = slerp;
exports.random = random;
exports.invert = invert;
exports.conjugate = conjugate;
exports.fromMat3 = fromMat3;
exports.fromEuler = fromEuler;
exports.str = str;
exports.setAxes = exports.sqlerp = exports.rotationTo = exports.equals = exports.exactEquals = exports.normalize = exports.sqrLen = exports.squaredLength = exports.len = exports.length = exports.lerp = exports.dot = exports.scale = exports.mul = exports.add = exports.set = exports.copy = exports.fromValues = exports.clone = void 0;

var glMatrix = _interopRequireWildcard(require("./common.js"));

var mat3 = _interopRequireWildcard(require("./mat3.js"));

var vec3 = _interopRequireWildcard(require("./vec3.js"));

var vec4 = _interopRequireWildcard(require("./vec4.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * Quaternion
 * @module quat
 */

/**
 * Creates a new identity quat
 *
 * @returns {quat} a new quaternion
 */
function create() {
  var out = new glMatrix.ARRAY_TYPE(4);

  if (glMatrix.ARRAY_TYPE != Float32Array) {
    out[0] = 0;
    out[1] = 0;
    out[2] = 0;
  }

  out[3] = 1;
  return out;
}
/**
 * Set a quat to the identity quaternion
 *
 * @param {quat} out the receiving quaternion
 * @returns {quat} out
 */


function identity(out) {
  out[0] = 0;
  out[1] = 0;
  out[2] = 0;
  out[3] = 1;
  return out;
}
/**
 * Sets a quat from the given angle and rotation axis,
 * then returns it.
 *
 * @param {quat} out the receiving quaternion
 * @param {vec3} axis the axis around which to rotate
 * @param {Number} rad the angle in radians
 * @returns {quat} out
 **/


function setAxisAngle(out, axis, rad) {
  rad = rad * 0.5;
  var s = Math.sin(rad);
  out[0] = s * axis[0];
  out[1] = s * axis[1];
  out[2] = s * axis[2];
  out[3] = Math.cos(rad);
  return out;
}
/**
 * Gets the rotation axis and angle for a given
 *  quaternion. If a quaternion is created with
 *  setAxisAngle, this method will return the same
 *  values as providied in the original parameter list
 *  OR functionally equivalent values.
 * Example: The quaternion formed by axis [0, 0, 1] and
 *  angle -90 is the same as the quaternion formed by
 *  [0, 0, 1] and 270. This method favors the latter.
 * @param  {vec3} out_axis  Vector receiving the axis of rotation
 * @param  {quat} q     Quaternion to be decomposed
 * @return {Number}     Angle, in radians, of the rotation
 */


function getAxisAngle(out_axis, q) {
  var rad = Math.acos(q[3]) * 2.0;
  var s = Math.sin(rad / 2.0);

  if (s > glMatrix.EPSILON) {
    out_axis[0] = q[0] / s;
    out_axis[1] = q[1] / s;
    out_axis[2] = q[2] / s;
  } else {
    // If s is zero, return any axis (no rotation - axis does not matter)
    out_axis[0] = 1;
    out_axis[1] = 0;
    out_axis[2] = 0;
  }

  return rad;
}
/**
 * Gets the angular distance between two unit quaternions
 *
 * @param  {quat} a     Origin unit quaternion 
 * @param  {quat} b     Destination unit quaternion
 * @return {Number}     Angle, in radians, between the two quaternions
 */


function getAngle(a, b) {
  var dotproduct = dot(a, b);
  return Math.acos(2 * dotproduct * dotproduct - 1);
}
/**
 * Multiplies two quat's
 *
 * @param {quat} out the receiving quaternion
 * @param {quat} a the first operand
 * @param {quat} b the second operand
 * @returns {quat} out
 */


function multiply(out, a, b) {
  var ax = a[0],
      ay = a[1],
      az = a[2],
      aw = a[3];
  var bx = b[0],
      by = b[1],
      bz = b[2],
      bw = b[3];
  out[0] = ax * bw + aw * bx + ay * bz - az * by;
  out[1] = ay * bw + aw * by + az * bx - ax * bz;
  out[2] = az * bw + aw * bz + ax * by - ay * bx;
  out[3] = aw * bw - ax * bx - ay * by - az * bz;
  return out;
}
/**
 * Rotates a quaternion by the given angle about the X axis
 *
 * @param {quat} out quat receiving operation result
 * @param {quat} a quat to rotate
 * @param {number} rad angle (in radians) to rotate
 * @returns {quat} out
 */


function rotateX(out, a, rad) {
  rad *= 0.5;
  var ax = a[0],
      ay = a[1],
      az = a[2],
      aw = a[3];
  var bx = Math.sin(rad),
      bw = Math.cos(rad);
  out[0] = ax * bw + aw * bx;
  out[1] = ay * bw + az * bx;
  out[2] = az * bw - ay * bx;
  out[3] = aw * bw - ax * bx;
  return out;
}
/**
 * Rotates a quaternion by the given angle about the Y axis
 *
 * @param {quat} out quat receiving operation result
 * @param {quat} a quat to rotate
 * @param {number} rad angle (in radians) to rotate
 * @returns {quat} out
 */


function rotateY(out, a, rad) {
  rad *= 0.5;
  var ax = a[0],
      ay = a[1],
      az = a[2],
      aw = a[3];
  var by = Math.sin(rad),
      bw = Math.cos(rad);
  out[0] = ax * bw - az * by;
  out[1] = ay * bw + aw * by;
  out[2] = az * bw + ax * by;
  out[3] = aw * bw - ay * by;
  return out;
}
/**
 * Rotates a quaternion by the given angle about the Z axis
 *
 * @param {quat} out quat receiving operation result
 * @param {quat} a quat to rotate
 * @param {number} rad angle (in radians) to rotate
 * @returns {quat} out
 */


function rotateZ(out, a, rad) {
  rad *= 0.5;
  var ax = a[0],
      ay = a[1],
      az = a[2],
      aw = a[3];
  var bz = Math.sin(rad),
      bw = Math.cos(rad);
  out[0] = ax * bw + ay * bz;
  out[1] = ay * bw - ax * bz;
  out[2] = az * bw + aw * bz;
  out[3] = aw * bw - az * bz;
  return out;
}
/**
 * Calculates the W component of a quat from the X, Y, and Z components.
 * Assumes that quaternion is 1 unit in length.
 * Any existing W component will be ignored.
 *
 * @param {quat} out the receiving quaternion
 * @param {quat} a quat to calculate W component of
 * @returns {quat} out
 */


function calculateW(out, a) {
  var x = a[0],
      y = a[1],
      z = a[2];
  out[0] = x;
  out[1] = y;
  out[2] = z;
  out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));
  return out;
}
/**
 * Calculate the exponential of a unit quaternion.
 *
 * @param {quat} out the receiving quaternion
 * @param {quat} a quat to calculate the exponential of
 * @returns {quat} out
 */


function exp(out, a) {
  var x = a[0],
      y = a[1],
      z = a[2],
      w = a[3];
  var r = Math.sqrt(x * x + y * y + z * z);
  var et = Math.exp(w);
  var s = r > 0 ? et * Math.sin(r) / r : 0;
  out[0] = x * s;
  out[1] = y * s;
  out[2] = z * s;
  out[3] = et * Math.cos(r);
  return out;
}
/**
 * Calculate the natural logarithm of a unit quaternion.
 *
 * @param {quat} out the receiving quaternion
 * @param {quat} a quat to calculate the exponential of
 * @returns {quat} out
 */


function ln(out, a) {
  var x = a[0],
      y = a[1],
      z = a[2],
      w = a[3];
  var r = Math.sqrt(x * x + y * y + z * z);
  var t = r > 0 ? Math.atan2(r, w) / r : 0;
  out[0] = x * t;
  out[1] = y * t;
  out[2] = z * t;
  out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w);
  return out;
}
/**
 * Calculate the scalar power of a unit quaternion.
 *
 * @param {quat} out the receiving quaternion
 * @param {quat} a quat to calculate the exponential of
 * @param {Number} b amount to scale the quaternion by
 * @returns {quat} out
 */


function pow(out, a, b) {
  ln(out, a);
  scale(out, out, b);
  exp(out, out);
  return out;
}
/**
 * Performs a spherical linear interpolation between two quat
 *
 * @param {quat} out the receiving quaternion
 * @param {quat} a the first operand
 * @param {quat} b the second operand
 * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
 * @returns {quat} out
 */


function slerp(out, a, b, t) {
  // benchmarks:
  //    http://jsperf.com/quaternion-slerp-implementations
  var ax = a[0],
      ay = a[1],
      az = a[2],
      aw = a[3];
  var bx = b[0],
      by = b[1],
      bz = b[2],
      bw = b[3];
  var omega, cosom, sinom, scale0, scale1; // calc cosine

  cosom = ax * bx + ay * by + az * bz + aw * bw; // adjust signs (if necessary)

  if (cosom < 0.0) {
    cosom = -cosom;
    bx = -bx;
    by = -by;
    bz = -bz;
    bw = -bw;
  } // calculate coefficients


  if (1.0 - cosom > glMatrix.EPSILON) {
    // standard case (slerp)
    omega = Math.acos(cosom);
    sinom = Math.sin(omega);
    scale0 = Math.sin((1.0 - t) * omega) / sinom;
    scale1 = Math.sin(t * omega) / sinom;
  } else {
    // "from" and "to" quaternions are very close
    //  ... so we can do a linear interpolation
    scale0 = 1.0 - t;
    scale1 = t;
  } // calculate final values


  out[0] = scale0 * ax + scale1 * bx;
  out[1] = scale0 * ay + scale1 * by;
  out[2] = scale0 * az + scale1 * bz;
  out[3] = scale0 * aw + scale1 * bw;
  return out;
}
/**
 * Generates a random unit quaternion
 * 
 * @param {quat} out the receiving quaternion
 * @returns {quat} out
 */


function random(out) {
  // Implementation of http://planning.cs.uiuc.edu/node198.html
  // TODO: Calling random 3 times is probably not the fastest solution
  var u1 = glMatrix.RANDOM();
  var u2 = glMatrix.RANDOM();
  var u3 = glMatrix.RANDOM();
  var sqrt1MinusU1 = Math.sqrt(1 - u1);
  var sqrtU1 = Math.sqrt(u1);
  out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2);
  out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2);
  out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3);
  out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3);
  return out;
}
/**
 * Calculates the inverse of a quat
 *
 * @param {quat} out the receiving quaternion
 * @param {quat} a quat to calculate inverse of
 * @returns {quat} out
 */


function invert(out, a) {
  var a0 = a[0],
      a1 = a[1],
      a2 = a[2],
      a3 = a[3];
  var dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;
  var invDot = dot ? 1.0 / dot : 0; // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0

  out[0] = -a0 * invDot;
  out[1] = -a1 * invDot;
  out[2] = -a2 * invDot;
  out[3] = a3 * invDot;
  return out;
}
/**
 * Calculates the conjugate of a quat
 * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.
 *
 * @param {quat} out the receiving quaternion
 * @param {quat} a quat to calculate conjugate of
 * @returns {quat} out
 */


function conjugate(out, a) {
  out[0] = -a[0];
  out[1] = -a[1];
  out[2] = -a[2];
  out[3] = a[3];
  return out;
}
/**
 * Creates a quaternion from the given 3x3 rotation matrix.
 *
 * NOTE: The resultant quaternion is not normalized, so you should be sure
 * to renormalize the quaternion yourself where necessary.
 *
 * @param {quat} out the receiving quaternion
 * @param {mat3} m rotation matrix
 * @returns {quat} out
 * @function
 */


function fromMat3(out, m) {
  // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes
  // article "Quaternion Calculus and Fast Animation".
  var fTrace = m[0] + m[4] + m[8];
  var fRoot;

  if (fTrace > 0.0) {
    // |w| > 1/2, may as well choose w > 1/2
    fRoot = Math.sqrt(fTrace + 1.0); // 2w

    out[3] = 0.5 * fRoot;
    fRoot = 0.5 / fRoot; // 1/(4w)

    out[0] = (m[5] - m[7]) * fRoot;
    out[1] = (m[6] - m[2]) * fRoot;
    out[2] = (m[1] - m[3]) * fRoot;
  } else {
    // |w| <= 1/2
    var i = 0;
    if (m[4] > m[0]) i = 1;
    if (m[8] > m[i * 3 + i]) i = 2;
    var j = (i + 1) % 3;
    var k = (i + 2) % 3;
    fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0);
    out[i] = 0.5 * fRoot;
    fRoot = 0.5 / fRoot;
    out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot;
    out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot;
    out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot;
  }

  return out;
}
/**
 * Creates a quaternion from the given euler angle x, y, z.
 *
 * @param {quat} out the receiving quaternion
 * @param {x} Angle to rotate around X axis in degrees.
 * @param {y} Angle to rotate around Y axis in degrees.
 * @param {z} Angle to rotate around Z axis in degrees.
 * @returns {quat} out
 * @function
 */


function fromEuler(out, x, y, z) {
  var halfToRad = 0.5 * Math.PI / 180.0;
  x *= halfToRad;
  y *= halfToRad;
  z *= halfToRad;
  var sx = Math.sin(x);
  var cx = Math.cos(x);
  var sy = Math.sin(y);
  var cy = Math.cos(y);
  var sz = Math.sin(z);
  var cz = Math.cos(z);
  out[0] = sx * cy * cz - cx * sy * sz;
  out[1] = cx * sy * cz + sx * cy * sz;
  out[2] = cx * cy * sz - sx * sy * cz;
  out[3] = cx * cy * cz + sx * sy * sz;
  return out;
}
/**
 * Returns a string representation of a quatenion
 *
 * @param {quat} a vector to represent as a string
 * @returns {String} string representation of the vector
 */


function str(a) {
  return 'quat(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ')';
}
/**
 * Creates a new quat initialized with values from an existing quaternion
 *
 * @param {quat} a quaternion to clone
 * @returns {quat} a new quaternion
 * @function
 */


var clone = vec4.clone;
/**
 * Creates a new quat initialized with the given values
 *
 * @param {Number} x X component
 * @param {Number} y Y component
 * @param {Number} z Z component
 * @param {Number} w W component
 * @returns {quat} a new quaternion
 * @function
 */

exports.clone = clone;
var fromValues = vec4.fromValues;
/**
 * Copy the values from one quat to another
 *
 * @param {quat} out the receiving quaternion
 * @param {quat} a the source quaternion
 * @returns {quat} out
 * @function
 */

exports.fromValues = fromValues;
var copy = vec4.copy;
/**
 * Set the components of a quat to the given values
 *
 * @param {quat} out the receiving quaternion
 * @param {Number} x X component
 * @param {Number} y Y component
 * @param {Number} z Z component
 * @param {Number} w W component
 * @returns {quat} out
 * @function
 */

exports.copy = copy;
var set = vec4.set;
/**
 * Adds two quat's
 *
 * @param {quat} out the receiving quaternion
 * @param {quat} a the first operand
 * @param {quat} b the second operand
 * @returns {quat} out
 * @function
 */

exports.set = set;
var add = vec4.add;
/**
 * Alias for {@link quat.multiply}
 * @function
 */

exports.add = add;
var mul = multiply;
/**
 * Scales a quat by a scalar number
 *
 * @param {quat} out the receiving vector
 * @param {quat} a the vector to scale
 * @param {Number} b amount to scale the vector by
 * @returns {quat} out
 * @function
 */

exports.mul = mul;
var scale = vec4.scale;
/**
 * Calculates the dot product of two quat's
 *
 * @param {quat} a the first operand
 * @param {quat} b the second operand
 * @returns {Number} dot product of a and b
 * @function
 */

exports.scale = scale;
var dot = vec4.dot;
/**
 * Performs a linear interpolation between two quat's
 *
 * @param {quat} out the receiving quaternion
 * @param {quat} a the first operand
 * @param {quat} b the second operand
 * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
 * @returns {quat} out
 * @function
 */

exports.dot = dot;
var lerp = vec4.lerp;
/**
 * Calculates the length of a quat
 *
 * @param {quat} a vector to calculate length of
 * @returns {Number} length of a
 */

exports.lerp = lerp;
var length = vec4.length;
/**
 * Alias for {@link quat.length}
 * @function
 */

exports.length = length;
var len = length;
/**
 * Calculates the squared length of a quat
 *
 * @param {quat} a vector to calculate squared length of
 * @returns {Number} squared length of a
 * @function
 */

exports.len = len;
var squaredLength = vec4.squaredLength;
/**
 * Alias for {@link quat.squaredLength}
 * @function
 */

exports.squaredLength = squaredLength;
var sqrLen = squaredLength;
/**
 * Normalize a quat
 *
 * @param {quat} out the receiving quaternion
 * @param {quat} a quaternion to normalize
 * @returns {quat} out
 * @function
 */

exports.sqrLen = sqrLen;
var normalize = vec4.normalize;
/**
 * Returns whether or not the quaternions have exactly the same elements in the same position (when compared with ===)
 *
 * @param {quat} a The first quaternion.
 * @param {quat} b The second quaternion.
 * @returns {Boolean} True if the vectors are equal, false otherwise.
 */

exports.normalize = normalize;
var exactEquals = vec4.exactEquals;
/**
 * Returns whether or not the quaternions have approximately the same elements in the same position.
 *
 * @param {quat} a The first vector.
 * @param {quat} b The second vector.
 * @returns {Boolean} True if the vectors are equal, false otherwise.
 */

exports.exactEquals = exactEquals;
var equals = vec4.equals;
/**
 * Sets a quaternion to represent the shortest rotation from one
 * vector to another.
 *
 * Both vectors are assumed to be unit length.
 *
 * @param {quat} out the receiving quaternion.
 * @param {vec3} a the initial vector
 * @param {vec3} b the destination vector
 * @returns {quat} out
 */

exports.equals = equals;

var rotationTo = function () {
  var tmpvec3 = vec3.create();
  var xUnitVec3 = vec3.fromValues(1, 0, 0);
  var yUnitVec3 = vec3.fromValues(0, 1, 0);
  return function (out, a, b) {
    var dot = vec3.dot(a, b);

    if (dot < -0.999999) {
      vec3.cross(tmpvec3, xUnitVec3, a);
      if (vec3.len(tmpvec3) < 0.000001) vec3.cross(tmpvec3, yUnitVec3, a);
      vec3.normalize(tmpvec3, tmpvec3);
      setAxisAngle(out, tmpvec3, Math.PI);
      return out;
    } else if (dot > 0.999999) {
      out[0] = 0;
      out[1] = 0;
      out[2] = 0;
      out[3] = 1;
      return out;
    } else {
      vec3.cross(tmpvec3, a, b);
      out[0] = tmpvec3[0];
      out[1] = tmpvec3[1];
      out[2] = tmpvec3[2];
      out[3] = 1 + dot;
      return normalize(out, out);
    }
  };
}();
/**
 * Performs a spherical linear interpolation with two control points
 *
 * @param {quat} out the receiving quaternion
 * @param {quat} a the first operand
 * @param {quat} b the second operand
 * @param {quat} c the third operand
 * @param {quat} d the fourth operand
 * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
 * @returns {quat} out
 */


exports.rotationTo = rotationTo;

var sqlerp = function () {
  var temp1 = create();
  var temp2 = create();
  return function (out, a, b, c, d, t) {
    slerp(temp1, a, d, t);
    slerp(temp2, b, c, t);
    slerp(out, temp1, temp2, 2 * t * (1 - t));
    return out;
  };
}();
/**
 * Sets the specified quaternion with values corresponding to the given
 * axes. Each axis is a vec3 and is expected to be unit length and
 * perpendicular to all other specified axes.
 *
 * @param {vec3} view  the vector representing the viewing direction
 * @param {vec3} right the vector representing the local "right" direction
 * @param {vec3} up    the vector representing the local "up" direction
 * @returns {quat} out
 */


exports.sqlerp = sqlerp;

var setAxes = function () {
  var matr = mat3.create();
  return function (out, view, right, up) {
    matr[0] = right[0];
    matr[3] = right[1];
    matr[6] = right[2];
    matr[1] = up[0];
    matr[4] = up[1];
    matr[7] = up[2];
    matr[2] = -view[0];
    matr[5] = -view[1];
    matr[8] = -view[2];
    return normalize(out, fromMat3(out, matr));
  };
}();

exports.setAxes = setAxes;
},{"./common.js":"hRXm","./mat3.js":"xq97","./vec3.js":"vuBh","./vec4.js":"i3i1"}],"NvoU":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.validateQuaternion = validateQuaternion;
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _mathArray = _interopRequireDefault(require("./lib/math-array"));

var _common = require("./lib/common");

var quat = _interopRequireWildcard(require("gl-matrix/quat"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var IDENTITY_QUATERNION = [0, 0, 0, 1];

function validateQuaternion(q) {
  return q.length === 4 && Number.isFinite(q[0]) && Number.isFinite(q[1]) && Number.isFinite(q[2]) && Number.isFinite(q[3]);
}

var Quaternion = function (_MathArray) {
  (0, _inherits2.default)(Quaternion, _MathArray);

  function Quaternion() {
    var _this;

    var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
    var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
    var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
    var w = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
    (0, _classCallCheck2.default)(this, Quaternion);
    _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Quaternion).call(this, 4));

    if (Array.isArray(x) && arguments.length === 1) {
      _this.copy(x);
    } else {
      _this.set(x, y, z, w);
    }

    return _this;
  }

  (0, _createClass2.default)(Quaternion, [{
    key: "fromMatrix3",
    value: function fromMatrix3(m) {
      quat.fromMat3(this, m);
      return this.check();
    }
  }, {
    key: "fromValues",
    value: function fromValues(x, y, z, w) {
      return this.set(x, y, z, w);
    }
  }, {
    key: "identity",
    value: function identity() {
      quat.identity(this);
      return this.check();
    }
  }, {
    key: "length",
    value: function length() {
      return quat.length(this);
    }
  }, {
    key: "squaredLength",
    value: function squaredLength(a) {
      return quat.squaredLength(this);
    }
  }, {
    key: "dot",
    value: function dot(a, b) {
      if (b !== undefined) {
        throw new Error('Quaternion.dot only takes one argument');
      }

      return quat.dot(this, a);
    }
  }, {
    key: "rotationTo",
    value: function rotationTo(vectorA, vectorB) {
      quat.rotationTo(this, vectorA, vectorB);
      return this.check();
    }
  }, {
    key: "add",
    value: function add(a, b) {
      if (b !== undefined) {
        throw new Error('Quaternion.add only takes one argument');
      }

      quat.add(this, a);
      return this.check();
    }
  }, {
    key: "calculateW",
    value: function calculateW() {
      quat.calculateW(this, this);
      return this.check();
    }
  }, {
    key: "conjugate",
    value: function conjugate() {
      quat.conjugate(this, this);
      return this.check();
    }
  }, {
    key: "invert",
    value: function invert() {
      quat.invert(this, this);
      return this.check();
    }
  }, {
    key: "lerp",
    value: function lerp(a, b, t) {
      quat.lerp(this, a, b, t);
      return this.check();
    }
  }, {
    key: "multiply",
    value: function multiply(a, b) {
      if (b !== undefined) {
        throw new Error('Quaternion.multiply only takes one argument');
      }

      quat.multiply(this, this, a);
      return this.check();
    }
  }, {
    key: "normalize",
    value: function normalize() {
      quat.normalize(this, this);
      return this.check();
    }
  }, {
    key: "rotateX",
    value: function rotateX(rad) {
      quat.rotateX(this, this, rad);
      return this.check();
    }
  }, {
    key: "rotateY",
    value: function rotateY(rad) {
      quat.rotateY(this, this, rad);
      return this.check();
    }
  }, {
    key: "rotateZ",
    value: function rotateZ(rad) {
      quat.rotateZ(this, this, rad);
      return this.check();
    }
  }, {
    key: "scale",
    value: function scale(b) {
      quat.scale(this, this, b);
      return this.check();
    }
  }, {
    key: "set",
    value: function set(i, j, k, l) {
      quat.set(this, i, j, k, l);
      return this.check();
    }
  }, {
    key: "setAxisAngle",
    value: function setAxisAngle(axis, rad) {
      quat.setAxisAngle(this, axis, rad);
      return this.check();
    }
  }, {
    key: "slerp",
    value: function slerp(_ref) {
      var _ref$start = _ref.start,
          start = _ref$start === void 0 ? IDENTITY_QUATERNION : _ref$start,
          target = _ref.target,
          ratio = _ref.ratio;
      quat.slerp(this, start, target, ratio);
      return this.check();
    }
  }, {
    key: "ELEMENTS",
    get: function get() {
      return 4;
    }
  }, {
    key: "x",
    get: function get() {
      return this[0];
    },
    set: function set(value) {
      return this[0] = (0, _common.checkNumber)(value);
    }
  }, {
    key: "y",
    get: function get() {
      return this[1];
    },
    set: function set(value) {
      return this[1] = (0, _common.checkNumber)(value);
    }
  }, {
    key: "z",
    get: function get() {
      return this[2];
    },
    set: function set(value) {
      return this[2] = (0, _common.checkNumber)(value);
    }
  }, {
    key: "w",
    get: function get() {
      return this[3];
    },
    set: function set(value) {
      return this[3] = (0, _common.checkNumber)(value);
    }
  }]);
  return Quaternion;
}(_mathArray.default);

exports.default = Quaternion;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","./lib/math-array":"orGy","./lib/common":"Ma4c","gl-matrix/quat":"cCtq"}],"DDjh":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _common = require("./lib/common");

var _vector = _interopRequireDefault(require("./vector3"));

var vec3 = _interopRequireWildcard(require("gl-matrix/vec3"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var EPSILON = 0.000001;
var EARTH_RADIUS_METERS = 6.371e6;

var SphericalCoordinates = function () {
  function SphericalCoordinates() {
    var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
        phi = _ref.phi,
        theta = _ref.theta,
        radius = _ref.radius,
        bearing = _ref.bearing,
        pitch = _ref.pitch,
        altitude = _ref.altitude,
        _ref$radiusScale = _ref.radiusScale,
        radiusScale = _ref$radiusScale === void 0 ? EARTH_RADIUS_METERS : _ref$radiusScale;

    (0, _classCallCheck2.default)(this, SphericalCoordinates);

    if (arguments.length === 0) {
      this.phi = 0;
      this.theta = 0;
      this.radius = 1;
    } else if (Number.isFinite(phi) || Number.isFinite(theta)) {
      this.phi = phi || 0;
      this.theta = theta || 0;
    } else if (Number.isFinite(bearing) || Number.isFinite(pitch)) {
      this.bearing = bearing || 0;
      this.pitch = pitch || 0;
    }

    this.radius = radius || 1;
    this.radiusScale = radiusScale || 1;
    this.check();
  }

  (0, _createClass2.default)(SphericalCoordinates, [{
    key: "toString",
    value: function toString() {
      return this.formatString(_common.config);
    }
  }, {
    key: "formatString",
    value: function formatString(_ref2) {
      var printTypes = _ref2.printTypes,
          printDegrees = _ref2.printDegrees;
      var f = _common.formatValue;
      return "".concat(printTypes ? 'Spherical' : '', "[rho:").concat(f(this.radius), ",theta:").concat(f(this.theta), ",phi:").concat(f(this.phi), "]");
    }
  }, {
    key: "equals",
    value: function equals(other) {
      return (0, _common.equals)(this.radius, other.radius) && (0, _common.equals)(this.theta, other.theta) && (0, _common.equals)(this.phi, other.phi);
    }
  }, {
    key: "exactEquals",
    value: function exactEquals(other) {
      return this.radius === other.radius && this.theta === other.theta && this.phi === other.phi;
    }
  }, {
    key: "set",
    value: function set(radius, phi, theta) {
      this.radius = radius;
      this.phi = phi;
      this.theta = theta;
      return this.check();
    }
  }, {
    key: "clone",
    value: function clone() {
      return new this.constructor().copy(this);
    }
  }, {
    key: "copy",
    value: function copy(other) {
      this.radius = other.radius;
      this.phi = other.phi;
      this.theta = other.theta;
      return this.check();
    }
  }, {
    key: "fromLngLatZ",
    value: function fromLngLatZ(_ref3) {
      var _ref4 = (0, _slicedToArray2.default)(_ref3, 3),
          lng = _ref4[0],
          lat = _ref4[1],
          z = _ref4[2];

      this.radius = 1 + z / this.radiusScale;
      this.phi = (0, _common.radians)(lat);
      this.theta = (0, _common.radians)(lng);
    }
  }, {
    key: "fromVector3",
    value: function fromVector3(v) {
      this.radius = vec3.length(v);

      if (this.radius === 0) {
        this.theta = 0;
        this.phi = 0;
      } else {
        this.theta = Math.atan2(v[0], v[1]);
        this.phi = Math.acos((0, _common.clamp)(v[2] / this.radius, -1, 1));
      }

      return this.check();
    }
  }, {
    key: "toVector3",
    value: function toVector3() {
      return new _vector.default(0, 0, this.radius).rotateX({
        radians: this.theta
      }).rotateZ({
        radians: this.phi
      });
    }
  }, {
    key: "makeSafe",
    value: function makeSafe() {
      this.phi = Math.max(EPSILON, Math.min(Math.PI - EPSILON, this.phi));
    }
  }, {
    key: "check",
    value: function check() {
      if (!Number.isFinite(this.phi) || !Number.isFinite(this.theta) || !(this.radius > 0)) {
        throw new Error('SphericalCoordinates: some fields set to invalid numbers');
      }

      return this;
    }
  }, {
    key: "bearing",
    get: function get() {
      return 180 - (0, _common.degrees)(this.phi);
    },
    set: function set(v) {
      this.phi = Math.PI - (0, _common.radians)(v);
    }
  }, {
    key: "pitch",
    get: function get() {
      return (0, _common.degrees)(this.theta);
    },
    set: function set(v) {
      this.theta = (0, _common.radians)(v);
    }
  }, {
    key: "longitude",
    get: function get() {
      return (0, _common.degrees)(this.phi);
    }
  }, {
    key: "latitude",
    get: function get() {
      return (0, _common.degrees)(this.theta);
    }
  }, {
    key: "lng",
    get: function get() {
      return (0, _common.degrees)(this.phi);
    }
  }, {
    key: "lat",
    get: function get() {
      return (0, _common.degrees)(this.theta);
    }
  }, {
    key: "z",
    get: function get() {
      return (this.radius - 1) * this.radiusScale;
    }
  }]);
  return SphericalCoordinates;
}();

exports.default = SphericalCoordinates;
},{"@babel/runtime/helpers/esm/slicedToArray":"U1JK","@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","./lib/common":"Ma4c","./vector3":"jb7a","gl-matrix/vec3":"vuBh"}],"cf33":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _mathArray = _interopRequireDefault(require("./lib/math-array"));

var _common = require("./lib/common");

var _matrix = _interopRequireDefault(require("./matrix4"));

var _quaternion2 = _interopRequireDefault(require("./quaternion"));

var _vector = _interopRequireDefault(require("./vector3"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var ERR_UNKNOWN_ORDER = 'Unknown Euler angle order';
var ALMOST_ONE = 0.99999;

function validateOrder(value) {
  return value >= 0 && value < 6;
}

function checkOrder(value) {
  if (value < 0 && value >= 6) {
    throw new Error(ERR_UNKNOWN_ORDER);
  }

  return value;
}

var Euler = function (_MathArray) {
  (0, _inherits2.default)(Euler, _MathArray);
  (0, _createClass2.default)(Euler, [{
    key: "ELEMENTS",
    get: function get() {
      return 4;
    }
  }], [{
    key: "rotationOrder",
    value: function rotationOrder(order) {
      return Euler.RotationOrders[order];
    }
  }, {
    key: "ZYX",
    get: function get() {
      return 0;
    }
  }, {
    key: "YXZ",
    get: function get() {
      return 1;
    }
  }, {
    key: "XZY",
    get: function get() {
      return 2;
    }
  }, {
    key: "ZXY",
    get: function get() {
      return 3;
    }
  }, {
    key: "YZX",
    get: function get() {
      return 4;
    }
  }, {
    key: "XYZ",
    get: function get() {
      return 5;
    }
  }, {
    key: "RollPitchYaw",
    get: function get() {
      return 0;
    }
  }, {
    key: "DefaultOrder",
    get: function get() {
      return Euler.ZYX;
    }
  }, {
    key: "RotationOrders",
    get: function get() {
      return ['ZYX', 'YXZ', 'XZY', 'ZXY', 'YZX', 'XYZ'];
    }
  }]);

  function Euler() {
    var _this;

    var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
    var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
    var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
    var order = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Euler.DefaultOrder;
    (0, _classCallCheck2.default)(this, Euler);
    _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Euler).call(this, 4));

    if (arguments.length > 0 && Array.isArray(arguments[0])) {
      var _this2;

      (_this2 = _this).fromVector3.apply(_this2, arguments);
    } else {
      _this.set(x, y, z, order);
    }

    return _this;
  }

  (0, _createClass2.default)(Euler, [{
    key: "fromQuaternion",
    value: function fromQuaternion(quaternion) {
      var _quaternion = (0, _slicedToArray2.default)(quaternion, 4),
          x = _quaternion[0],
          y = _quaternion[1],
          z = _quaternion[2],
          w = _quaternion[3];

      var ysqr = y * y;
      var t0 = -2.0 * (ysqr + z * z) + 1.0;
      var t1 = +2.0 * (x * y + w * z);
      var t2 = -2.0 * (x * z - w * y);
      var t3 = +2.0 * (y * z + w * x);
      var t4 = -2.0 * (x * x + ysqr) + 1.0;
      t2 = t2 > 1.0 ? 1.0 : t2;
      t2 = t2 < -1.0 ? -1.0 : t2;
      var roll = Math.atan2(t3, t4);
      var pitch = Math.asin(t2);
      var yaw = Math.atan2(t1, t0);
      return new Euler(roll, pitch, yaw, Euler.RollPitchYaw);
    }
  }, {
    key: "copy",
    value: function copy(array) {
      for (var i = 0; i < 3; ++i) {
        this[i] = array[i];
      }

      this[3] = Number.isFinite(array[3]) || this.order;
      return this.check();
    }
  }, {
    key: "set",
    value: function set() {
      var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
      var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
      var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
      var order = arguments.length > 3 ? arguments[3] : undefined;
      this[0] = x;
      this[1] = y;
      this[2] = z;
      this[3] = Number.isFinite(order) ? order : this[3];
      return this.check();
    }
  }, {
    key: "validate",
    value: function validate() {
      return validateOrder(this[3]) && Number.isFinite(this[0]) && Number.isFinite(this[1]) && Number.isFinite(this[2]);
    }
  }, {
    key: "toArray",
    value: function toArray() {
      var array = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
      var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
      array[offset] = this[0];
      array[offset + 1] = this[1];
      array[offset + 2] = this[2];
      return array;
    }
  }, {
    key: "toArray4",
    value: function toArray4() {
      var array = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
      var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
      array[offset] = this[0];
      array[offset + 1] = this[1];
      array[offset + 2] = this[2];
      array[offset + 3] = this[3];
      return array;
    }
  }, {
    key: "toVector3",
    value: function toVector3(optionalResult) {
      if (optionalResult) {
        return optionalResult.set(this[0], this[1], this[2]);
      }

      return new _vector.default(this[0], this[1], this[2]);
    }
  }, {
    key: "fromVector3",
    value: function fromVector3(v, order) {
      return this.set(v[0], v[1], v[2], Number.isFinite(order) ? order : this[3]);
    }
  }, {
    key: "fromArray",
    value: function fromArray(array) {
      var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
      this[0] = array[0 + offset];
      this[1] = array[1 + offset];
      this[2] = array[2 + offset];

      if (array[3] !== undefined) {
        this[3] = array[3];
      }

      return this.check();
    }
  }, {
    key: "fromRollPitchYaw",
    value: function fromRollPitchYaw(roll, pitch, yaw) {
      return this.set(roll, pitch, yaw, Euler.ZYX);
    }
  }, {
    key: "fromRotationMatrix",
    value: function fromRotationMatrix(m) {
      var order = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Euler.DefaultOrder;

      this._fromRotationMatrix(m, order);

      return this.check();
    }
  }, {
    key: "getRotationMatrix",
    value: function getRotationMatrix() {
      var m = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new _matrix.default();

      this._getRotationMatrix(m);

      return m;
    }
  }, {
    key: "getQuaternion",
    value: function getQuaternion() {
      var q = new _quaternion2.default();

      switch (this[4]) {
        case Euler.XYZ:
          return q.rotateX(this[0]).rotateY(this[1]).rotateZ(this[2]);

        case Euler.YXZ:
          return q.rotateY(this[0]).rotateX(this[1]).rotateZ(this[2]);

        case Euler.ZXY:
          return q.rotateZ(this[0]).rotateX(this[1]).rotateY(this[2]);

        case Euler.ZYX:
          return q.rotateZ(this[0]).rotateY(this[1]).rotateX(this[2]);

        case Euler.YZX:
          return q.rotateY(this[0]).rotateZ(this[1]).rotateX(this[2]);

        case Euler.XZY:
          return q.rotateX(this[0]).rotateZ(this[1]).rotateY(this[2]);

        default:
          throw new Error(ERR_UNKNOWN_ORDER);
      }
    }
  }, {
    key: "_fromRotationMatrix",
    value: function _fromRotationMatrix(m) {
      var order = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Euler.DefaultOrder;
      var te = m.elements;
      var m11 = te[0],
          m12 = te[4],
          m13 = te[8];
      var m21 = te[1],
          m22 = te[5],
          m23 = te[9];
      var m31 = te[2],
          m32 = te[6],
          m33 = te[10];
      order = order || this[3];

      switch (order) {
        case Euler.XYZ:
          this[1] = Math.asin((0, _common.clamp)(m13, -1, 1));

          if (Math.abs(m13) < ALMOST_ONE) {
            this[0] = Math.atan2(-m23, m33);
            this[2] = Math.atan2(-m12, m11);
          } else {
            this[0] = Math.atan2(m32, m22);
            this[2] = 0;
          }

          break;

        case Euler.YXZ:
          this[0] = Math.asin(-(0, _common.clamp)(m23, -1, 1));

          if (Math.abs(m23) < ALMOST_ONE) {
            this[1] = Math.atan2(m13, m33);
            this[2] = Math.atan2(m21, m22);
          } else {
            this[1] = Math.atan2(-m31, m11);
            this[2] = 0;
          }

          break;

        case Euler.ZXY:
          this[0] = Math.asin((0, _common.clamp)(m32, -1, 1));

          if (Math.abs(m32) < ALMOST_ONE) {
            this[1] = Math.atan2(-m31, m33);
            this[2] = Math.atan2(-m12, m22);
          } else {
            this[1] = 0;
            this[2] = Math.atan2(m21, m11);
          }

          break;

        case Euler.ZYX:
          this[1] = Math.asin(-(0, _common.clamp)(m31, -1, 1));

          if (Math.abs(m31) < ALMOST_ONE) {
            this[0] = Math.atan2(m32, m33);
            this[2] = Math.atan2(m21, m11);
          } else {
            this[0] = 0;
            this[2] = Math.atan2(-m12, m22);
          }

          break;

        case Euler.YZX:
          this[2] = Math.asin((0, _common.clamp)(m21, -1, 1));

          if (Math.abs(m21) < ALMOST_ONE) {
            this[0] = Math.atan2(-m23, m22);
            this[1] = Math.atan2(-m31, m11);
          } else {
            this[0] = 0;
            this[1] = Math.atan2(m13, m33);
          }

          break;

        case Euler.XZY:
          this[2] = Math.asin(-(0, _common.clamp)(m12, -1, 1));

          if (Math.abs(m12) < ALMOST_ONE) {
            this[0] = Math.atan2(m32, m22);
            this[1] = Math.atan2(m13, m11);
          } else {
            this[0] = Math.atan2(-m23, m33);
            this[1] = 0;
          }

          break;

        default:
          throw new Error(ERR_UNKNOWN_ORDER);
      }

      this[3] = order;
      return this;
    }
  }, {
    key: "_getRotationMatrix",
    value: function _getRotationMatrix() {
      var te = new _matrix.default();
      var x = this.x,
          y = this.y,
          z = this.z;
      var a = Math.cos(x);
      var c = Math.cos(y);
      var e = Math.cos(z);
      var b = Math.sin(x);
      var d = Math.sin(y);
      var f = Math.sin(z);

      switch (this[3]) {
        case Euler.XYZ:
          {
            var ae = a * e,
                af = a * f,
                be = b * e,
                bf = b * f;
            te[0] = c * e;
            te[4] = -c * f;
            te[8] = d;
            te[1] = af + be * d;
            te[5] = ae - bf * d;
            te[9] = -b * c;
            te[2] = bf - ae * d;
            te[6] = be + af * d;
            te[10] = a * c;
            break;
          }

        case Euler.YXZ:
          {
            var ce = c * e,
                cf = c * f,
                de = d * e,
                df = d * f;
            te[0] = ce + df * b;
            te[4] = de * b - cf;
            te[8] = a * d;
            te[1] = a * f;
            te[5] = a * e;
            te[9] = -b;
            te[2] = cf * b - de;
            te[6] = df + ce * b;
            te[10] = a * c;
            break;
          }

        case Euler.ZXY:
          {
            var _ce = c * e,
                _cf = c * f,
                _de = d * e,
                _df = d * f;

            te[0] = _ce - _df * b;
            te[4] = -a * f;
            te[8] = _de + _cf * b;
            te[1] = _cf + _de * b;
            te[5] = a * e;
            te[9] = _df - _ce * b;
            te[2] = -a * d;
            te[6] = b;
            te[10] = a * c;
            break;
          }

        case Euler.ZYX:
          {
            var _ae = a * e,
                _af = a * f,
                _be = b * e,
                _bf = b * f;

            te[0] = c * e;
            te[4] = _be * d - _af;
            te[8] = _ae * d + _bf;
            te[1] = c * f;
            te[5] = _bf * d + _ae;
            te[9] = _af * d - _be;
            te[2] = -d;
            te[6] = b * c;
            te[10] = a * c;
            break;
          }

        case Euler.YZX:
          {
            var ac = a * c,
                ad = a * d,
                bc = b * c,
                bd = b * d;
            te[0] = c * e;
            te[4] = bd - ac * f;
            te[8] = bc * f + ad;
            te[1] = f;
            te[5] = a * e;
            te[9] = -b * e;
            te[2] = -d * e;
            te[6] = ad * f + bc;
            te[10] = ac - bd * f;
            break;
          }

        case Euler.XZY:
          {
            var _ac = a * c,
                _ad = a * d,
                _bc = b * c,
                _bd = b * d;

            te[0] = c * e;
            te[4] = -f;
            te[8] = d * e;
            te[1] = _ac * f + _bd;
            te[5] = a * e;
            te[9] = _ad * f - _bc;
            te[2] = _bc * f - _ad;
            te[6] = b * e;
            te[10] = _bd * f + _ac;
            break;
          }

        default:
          throw new Error(ERR_UNKNOWN_ORDER);
      }

      te[3] = 0;
      te[7] = 0;
      te[11] = 0;
      te[12] = 0;
      te[13] = 0;
      te[14] = 0;
      te[15] = 1;
      return this;
    }
  }, {
    key: "toQuaternion",
    value: function toQuaternion() {
      var cy = Math.cos(this.yaw * 0.5);
      var sy = Math.sin(this.yaw * 0.5);
      var cr = Math.cos(this.roll * 0.5);
      var sr = Math.sin(this.roll * 0.5);
      var cp = Math.cos(this.pitch * 0.5);
      var sp = Math.sin(this.pitch * 0.5);
      var w = cy * cr * cp + sy * sr * sp;
      var x = cy * sr * cp - sy * cr * sp;
      var y = cy * cr * sp + sy * sr * cp;
      var z = sy * cr * cp - cy * sr * sp;
      return new _quaternion2.default(x, y, z, w);
    }
  }, {
    key: "x",
    get: function get() {
      return this[0];
    },
    set: function set(value) {
      return this[0] = (0, _common.checkNumber)(value);
    }
  }, {
    key: "y",
    get: function get() {
      return this[1];
    },
    set: function set(value) {
      return this[1] = (0, _common.checkNumber)(value);
    }
  }, {
    key: "z",
    get: function get() {
      return this[2];
    },
    set: function set(value) {
      return this[2] = (0, _common.checkNumber)(value);
    }
  }, {
    key: "alpha",
    get: function get() {
      return this[0];
    },
    set: function set(value) {
      return this[0] = (0, _common.checkNumber)(value);
    }
  }, {
    key: "beta",
    get: function get() {
      return this[1];
    },
    set: function set(value) {
      return this[1] = (0, _common.checkNumber)(value);
    }
  }, {
    key: "gamma",
    get: function get() {
      return this[2];
    },
    set: function set(value) {
      return this[2] = (0, _common.checkNumber)(value);
    }
  }, {
    key: "phi",
    get: function get() {
      return this[0];
    },
    set: function set(value) {
      return this[0] = (0, _common.checkNumber)(value);
    }
  }, {
    key: "theta",
    get: function get() {
      return this[1];
    },
    set: function set(value) {
      return this[1] = (0, _common.checkNumber)(value);
    }
  }, {
    key: "psi",
    get: function get() {
      return this[2];
    },
    set: function set(value) {
      return this[2] = (0, _common.checkNumber)(value);
    }
  }, {
    key: "roll",
    get: function get() {
      return this[0];
    },
    set: function set(value) {
      return this[0] = (0, _common.checkNumber)(value);
    }
  }, {
    key: "pitch",
    get: function get() {
      return this[1];
    },
    set: function set(value) {
      return this[1] = (0, _common.checkNumber)(value);
    }
  }, {
    key: "yaw",
    get: function get() {
      return this[2];
    },
    set: function set(value) {
      return this[2] = (0, _common.checkNumber)(value);
    }
  }, {
    key: "order",
    get: function get() {
      return this[3];
    },
    set: function set(value) {
      return this[3] = checkOrder(value);
    }
  }]);
  return Euler;
}(_mathArray.default);

exports.default = Euler;
},{"@babel/runtime/helpers/esm/slicedToArray":"U1JK","@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/inherits":"NNOi","./lib/math-array":"orGy","./lib/common":"Ma4c","./matrix4":"zcrk","./quaternion":"NvoU","./vector3":"jb7a"}],"HpnU":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _matrix = _interopRequireDefault(require("./matrix4"));

var _vector = _interopRequireDefault(require("./vector3"));

var _euler = _interopRequireDefault(require("./euler"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Pose = function () {
  function Pose(_ref) {
    var _ref$x = _ref.x,
        x = _ref$x === void 0 ? 0 : _ref$x,
        _ref$y = _ref.y,
        y = _ref$y === void 0 ? 0 : _ref$y,
        _ref$z = _ref.z,
        z = _ref$z === void 0 ? 0 : _ref$z,
        _ref$roll = _ref.roll,
        roll = _ref$roll === void 0 ? 0 : _ref$roll,
        _ref$pitch = _ref.pitch,
        pitch = _ref$pitch === void 0 ? 0 : _ref$pitch,
        _ref$yaw = _ref.yaw,
        yaw = _ref$yaw === void 0 ? 0 : _ref$yaw,
        position = _ref.position,
        orientation = _ref.orientation;
    (0, _classCallCheck2.default)(this, Pose);

    if (Array.isArray(position) && position.length === 3) {
      this.position = new _vector.default(position);
    } else {
      this.position = new _vector.default(x, y, z);
    }

    if (Array.isArray(orientation) && orientation.length === 4) {
      this.orientation = new _euler.default(orientation, orientation[3]);
    } else {
      this.orientation = new _euler.default(roll, pitch, yaw, _euler.default.RollPitchYaw);
    }
  }

  (0, _createClass2.default)(Pose, [{
    key: "getPosition",
    value: function getPosition() {
      return this.position;
    }
  }, {
    key: "getOrientation",
    value: function getOrientation() {
      return this.orientation;
    }
  }, {
    key: "equals",
    value: function equals(pose) {
      if (!pose) {
        return false;
      }

      return this.position.equals(pose.position) && this.orientation.equals(pose.orientation);
    }
  }, {
    key: "exactEquals",
    value: function exactEquals(pose) {
      if (!pose) {
        return false;
      }

      return this.position.exactEquals(pose.position) && this.orientation.exactEquals(pose.orientation);
    }
  }, {
    key: "getTransformationMatrix",
    value: function getTransformationMatrix() {
      var sr = Math.sin(this.roll);
      var sp = Math.sin(this.pitch);
      var sw = Math.sin(this.yaw);
      var cr = Math.cos(this.roll);
      var cp = Math.cos(this.pitch);
      var cw = Math.cos(this.yaw);
      var matrix = new _matrix.default().setRowMajor(cw * cp, -sw * cr + cw * sp * sr, sw * sr + cw * sp * cr, this.x, sw * cp, cw * cr + sw * sp * sr, -cw * sr + sw * sp * cr, this.y, -sp, cp * sr, cp * cr, this.z, 0, 0, 0, 1);
      return matrix;
    }
  }, {
    key: "getTransformationMatrixFromPose",
    value: function getTransformationMatrixFromPose(pose) {
      return new _matrix.default().multiplyRight(this.getTransformationMatrix()).multiplyRight(pose.getTransformationMatrix().invert());
    }
  }, {
    key: "getTransformationMatrixToPose",
    value: function getTransformationMatrixToPose(pose) {
      return new _matrix.default().multiplyRight(pose.getTransformationMatrix()).multiplyRight(this.getTransformationMatrix().invert());
    }
  }, {
    key: "x",
    get: function get() {
      return this.position.x;
    },
    set: function set(value) {
      return this.position.x = value;
    }
  }, {
    key: "y",
    get: function get() {
      return this.position.y;
    },
    set: function set(value) {
      return this.position.y = value;
    }
  }, {
    key: "z",
    get: function get() {
      return this.position.z;
    },
    set: function set(value) {
      return this.position.z = value;
    }
  }, {
    key: "roll",
    get: function get() {
      return this.orientation.roll;
    },
    set: function set(value) {
      return this.orientation.roll = value;
    }
  }, {
    key: "pitch",
    get: function get() {
      return this.orientation.pitch;
    },
    set: function set(value) {
      return this.orientation.pitch = value;
    }
  }, {
    key: "yaw",
    get: function get() {
      return this.orientation.yaw;
    },
    set: function set(value) {
      return this.orientation.yaw = value;
    }
  }]);
  return Pose;
}();

exports.default = Pose;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","./matrix4":"zcrk","./vector3":"jb7a","./euler":"cf33"}],"Tr16":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _common = require("../lib/common");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Polygon = function () {
  function Polygon(points) {
    (0, _classCallCheck2.default)(this, Polygon);
    this.points = points;
    this.isClosed = (0, _common.equals)(this.points[this.points.length - 1], this.points[0]);
    Object.freeze(this);
  }

  (0, _createClass2.default)(Polygon, [{
    key: "getSignedArea",
    value: function getSignedArea() {
      var area = 0;
      this.forEachSegment(function (p1, p2) {
        area += (p1[0] + p2[0]) * (p1[1] - p2[1]);
      });
      return area / 2;
    }
  }, {
    key: "getArea",
    value: function getArea() {
      return Math.abs(this.getSignedArea());
    }
  }, {
    key: "getWindingDirection",
    value: function getWindingDirection() {
      return Math.sign(this.getSignedArea());
    }
  }, {
    key: "forEachSegment",
    value: function forEachSegment(visitor) {
      var length = this.points.length;

      for (var i = 0; i < length - 1; i++) {
        visitor(this.points[i], this.points[i + 1], i, i + 1);
      }

      if (this.isPolygon && !this.isClosed()) {
        visitor(this.points[length - 1], this.points[0], length - 1, 0);
      }
    }
  }]);
  return Polygon;
}();

exports.default = Polygon;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","../lib/common":"Ma4c"}],"dl2t":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "Vector2", {
  enumerable: true,
  get: function () {
    return _vector.default;
  }
});
Object.defineProperty(exports, "Vector3", {
  enumerable: true,
  get: function () {
    return _vector2.default;
  }
});
Object.defineProperty(exports, "Vector4", {
  enumerable: true,
  get: function () {
    return _vector3.default;
  }
});
Object.defineProperty(exports, "Matrix3", {
  enumerable: true,
  get: function () {
    return _matrix.default;
  }
});
Object.defineProperty(exports, "Matrix4", {
  enumerable: true,
  get: function () {
    return _matrix2.default;
  }
});
Object.defineProperty(exports, "Quaternion", {
  enumerable: true,
  get: function () {
    return _quaternion.default;
  }
});
Object.defineProperty(exports, "config", {
  enumerable: true,
  get: function () {
    return _common.config;
  }
});
Object.defineProperty(exports, "checkNumber", {
  enumerable: true,
  get: function () {
    return _common.checkNumber;
  }
});
Object.defineProperty(exports, "configure", {
  enumerable: true,
  get: function () {
    return _common.configure;
  }
});
Object.defineProperty(exports, "formatValue", {
  enumerable: true,
  get: function () {
    return _common.formatValue;
  }
});
Object.defineProperty(exports, "isArray", {
  enumerable: true,
  get: function () {
    return _common.isArray;
  }
});
Object.defineProperty(exports, "clone", {
  enumerable: true,
  get: function () {
    return _common.clone;
  }
});
Object.defineProperty(exports, "radians", {
  enumerable: true,
  get: function () {
    return _common.radians;
  }
});
Object.defineProperty(exports, "degrees", {
  enumerable: true,
  get: function () {
    return _common.degrees;
  }
});
Object.defineProperty(exports, "sin", {
  enumerable: true,
  get: function () {
    return _common.sin;
  }
});
Object.defineProperty(exports, "cos", {
  enumerable: true,
  get: function () {
    return _common.cos;
  }
});
Object.defineProperty(exports, "tan", {
  enumerable: true,
  get: function () {
    return _common.tan;
  }
});
Object.defineProperty(exports, "asin", {
  enumerable: true,
  get: function () {
    return _common.asin;
  }
});
Object.defineProperty(exports, "acos", {
  enumerable: true,
  get: function () {
    return _common.acos;
  }
});
Object.defineProperty(exports, "atan", {
  enumerable: true,
  get: function () {
    return _common.atan;
  }
});
Object.defineProperty(exports, "clamp", {
  enumerable: true,
  get: function () {
    return _common.clamp;
  }
});
Object.defineProperty(exports, "lerp", {
  enumerable: true,
  get: function () {
    return _common.lerp;
  }
});
Object.defineProperty(exports, "equals", {
  enumerable: true,
  get: function () {
    return _common.equals;
  }
});
Object.defineProperty(exports, "_SphericalCoordinates", {
  enumerable: true,
  get: function () {
    return _sphericalCoordinates.default;
  }
});
Object.defineProperty(exports, "_Pose", {
  enumerable: true,
  get: function () {
    return _pose.default;
  }
});
Object.defineProperty(exports, "_Euler", {
  enumerable: true,
  get: function () {
    return _euler.default;
  }
});
Object.defineProperty(exports, "_Polygon", {
  enumerable: true,
  get: function () {
    return _polygon.default;
  }
});

var _vector = _interopRequireDefault(require("./vector2"));

var _vector2 = _interopRequireDefault(require("./vector3"));

var _vector3 = _interopRequireDefault(require("./vector4"));

var _matrix = _interopRequireDefault(require("./matrix3"));

var _matrix2 = _interopRequireDefault(require("./matrix4"));

var _quaternion = _interopRequireDefault(require("./quaternion"));

var _common = require("./lib/common");

var _sphericalCoordinates = _interopRequireDefault(require("./spherical-coordinates"));

var _pose = _interopRequireDefault(require("./pose"));

var _euler = _interopRequireDefault(require("./euler"));

var _polygon = _interopRequireDefault(require("./addons/polygon"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./vector2":"VaFZ","./vector3":"jb7a","./vector4":"LqC5","./matrix3":"YyGJ","./matrix4":"zcrk","./quaternion":"NvoU","./lib/common":"Ma4c","./spherical-coordinates":"DDjh","./pose":"HpnU","./euler":"cf33","./addons/polygon":"Tr16"}],"VniL":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _utils = require("../utils");

var _math = require("math.gl");

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Object3D =
/*#__PURE__*/
function () {
  function Object3D(_ref) {
    var id = _ref.id,
        _ref$display = _ref.display,
        display = _ref$display === void 0 ? true : _ref$display;
    (0, _classCallCheck2.default)(this, Object3D); // whether to display the object at all

    this.id = id || (0, _utils.uid)(this.constructor.name);
    this.display = true; // model position, rotation, scale and all in all matrix

    this.position = new _math.Vector3();
    this.rotation = new _math.Vector3();
    this.scale = new _math.Vector3(1, 1, 1);
    this.matrix = new _math.Matrix4();
    this.userData = {};
  }

  (0, _createClass2.default)(Object3D, [{
    key: "toString",
    value: function toString() {
      return "{id: ".concat(this.id, ", children: ").concat(this.children, ")}");
    }
  }, {
    key: "setPosition",
    value: function setPosition(position) {
      (0, _assert.default)(position.length === 3, 'setPosition requires vector argument');
      this.position = position;
      return this;
    }
  }, {
    key: "setRotation",
    value: function setRotation(rotation) {
      (0, _assert.default)(rotation.length === 3, 'setRotation requires vector argument');
      this.rotation = rotation;
      return this;
    }
  }, {
    key: "setScale",
    value: function setScale(scale) {
      (0, _assert.default)(scale.length === 3, 'setScale requires vector argument');
      this.scale = scale;
      return this;
    }
  }, {
    key: "setMatrixComponents",
    value: function setMatrixComponents(_ref2) {
      var position = _ref2.position,
          rotation = _ref2.rotation,
          scale = _ref2.scale,
          _ref2$update = _ref2.update,
          update = _ref2$update === void 0 ? true : _ref2$update;

      if (position) {
        this.setPosition(position);
      }

      if (rotation) {
        this.setRotation(rotation);
      }

      if (scale) {
        this.setScale(scale);
      }

      if (update) {
        this.updateMatrix();
      }

      return this;
    }
  }, {
    key: "updateMatrix",
    value: function updateMatrix() {
      var pos = this.position;
      var rot = this.rotation;
      var scale = this.scale;
      this.matrix.identity();
      this.matrix.translate(pos);
      this.matrix.rotateXYZ(rot);
      this.matrix.scale(scale);
      return this;
    }
  }, {
    key: "update",
    value: function update() {
      var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          position = _ref3.position,
          rotation = _ref3.rotation,
          scale = _ref3.scale;

      if (position) {
        this.setPosition(position);
      }

      if (rotation) {
        this.setRotation(rotation);
      }

      if (scale) {
        this.setScale(scale);
      }

      this.updateMatrix();
      return this;
    }
  }, {
    key: "getCoordinateUniforms",
    value: function getCoordinateUniforms(viewMatrix, modelMatrix) {
      // TODO - solve multiple class problem
      // assert(viewMatrix instanceof Matrix4);
      (0, _assert.default)(viewMatrix);
      modelMatrix = modelMatrix || this.matrix;
      var worldMatrix = new _math.Matrix4(viewMatrix).multiplyRight(modelMatrix);
      var worldInverse = worldMatrix.invert();
      var worldInverseTranspose = worldInverse.transpose();
      return {
        viewMatrix: viewMatrix,
        modelMatrix: modelMatrix,
        objectMatrix: modelMatrix,
        worldMatrix: worldMatrix,
        worldInverseMatrix: worldInverse,
        worldInverseTransposeMatrix: worldInverseTranspose
      };
    } // TODO - copied code, not yet vetted

  }, {
    key: "transform",
    value: function transform() {
      if (!this.parent) {
        this.endPosition.set(this.position);
        this.endRotation.set(this.rotation);
        this.endScale.set(this.scale);
      } else {
        var parent = this.parent;
        this.endPosition.set(this.position.add(parent.endPosition));
        this.endRotation.set(this.rotation.add(parent.endRotation));
        this.endScale.set(this.scale.add(parent.endScale));
      }

      var ch = this.children;

      for (var i = 0; i < ch.length; ++i) {
        ch[i].transform();
      }

      return this;
    }
  }]);
  return Object3D;
}();

exports.default = Object3D;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","../utils":"PFG0","math.gl":"dl2t","../utils/assert":"wYRU"}],"gKrA":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _object3d = _interopRequireDefault(require("./object-3d"));

var _math = require("math.gl");

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Group =
/*#__PURE__*/
function (_Object3D) {
  (0, _inherits2.default)(Group, _Object3D);

  function Group() {
    var _this;

    var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    (0, _classCallCheck2.default)(this, Group);
    opts = Array.isArray(opts) ? {
      children: opts
    } : opts;
    var _opts = opts,
        _opts$children = _opts.children,
        children = _opts$children === void 0 ? [] : _opts$children;
    children.every(function (child) {
      return (0, _assert.default)(child instanceof _object3d.default);
    });
    _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Group).call(this, opts));
    _this.children = children;
    return _this;
  } // Unpacks arrays and nested arrays of children


  (0, _createClass2.default)(Group, [{
    key: "add",
    value: function add() {
      for (var _len = arguments.length, children = new Array(_len), _key = 0; _key < _len; _key++) {
        children[_key] = arguments[_key];
      }

      for (var _i = 0; _i < children.length; _i++) {
        var child = children[_i];

        if (Array.isArray(child)) {
          this.add.apply(this, (0, _toConsumableArray2.default)(child));
        } else {
          this.children.push(child);
        }
      }

      return this;
    }
  }, {
    key: "remove",
    value: function remove(child) {
      var children = this.children;
      var indexOf = children.indexOf(child);

      if (indexOf > -1) {
        children.splice(indexOf, 1);
      }

      return this;
    }
  }, {
    key: "removeAll",
    value: function removeAll() {
      this.children = [];
      return this;
    } // If visitor returns a truthy value, traversal will be aborted and that value
    // will be returned from `traverse`. Otherwise `traverse` will return null.

  }, {
    key: "traverse",
    value: function traverse(visitor) {
      var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
          _ref$modelMatrix = _ref.modelMatrix,
          modelMatrix = _ref$modelMatrix === void 0 ? new _math.Matrix4() : _ref$modelMatrix;

      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = this.children[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var child = _step.value;
          var matrix = child.matrix;
          modelMatrix = modelMatrix.multiplyRight(matrix);
          var result = void 0;

          if (child instanceof Group) {
            result = child.traverse(visitor, {
              modelMatrix: modelMatrix
            });
          } else {
            // child.setUniforms({modelMatrix});
            result = visitor(child, {});
          } // Abort if a result was returned


          if (result) {
            return result;
          }
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return != null) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }

      return null;
    } // If visitor returns a truthy value, traversal will be aborted and that value
    // will be returned from `traverseReverse`. Otherwise `traverseReverse` will return null.

  }, {
    key: "traverseReverse",
    value: function traverseReverse(visitor) {
      var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
          _ref2$modelMatrix = _ref2.modelMatrix,
          modelMatrix = _ref2$modelMatrix === void 0 ? new _math.Matrix4() : _ref2$modelMatrix;

      for (var i = this.children.length - 1; i >= 0; --i) {
        var child = this.children[i];
        var matrix = child.matrix;
        modelMatrix = modelMatrix.multiplyRight(matrix);
        var result = void 0;

        if (child instanceof Group) {
          result = child.traverseReverse(visitor, {
            modelMatrix: modelMatrix
          });
        } else {
          // child.setUniforms({modelMatrix});
          result = visitor(child, {});
        } // Abort if a result was returned


        if (result) {
          return result;
        }
      }

      return null;
    }
  }]);
  return Group;
}(_object3d.default);

exports.default = Group;
},{"@babel/runtime/helpers/esm/toConsumableArray":"lA6S","@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","./object-3d":"VniL","math.gl":"dl2t","../utils/assert":"wYRU"}],"x2lE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "Image", {
  enumerable: true,
  get: function () {
    return _webglUtils.Image;
  }
});
Object.defineProperty(exports, "WebGLRenderingContext", {
  enumerable: true,
  get: function () {
    return _webglUtils.WebGLRenderingContext;
  }
});
Object.defineProperty(exports, "WebGLProgram", {
  enumerable: true,
  get: function () {
    return _webglUtils.WebGLProgram;
  }
});
Object.defineProperty(exports, "WebGLShader", {
  enumerable: true,
  get: function () {
    return _webglUtils.WebGLShader;
  }
});
Object.defineProperty(exports, "WebGLBuffer", {
  enumerable: true,
  get: function () {
    return _webglUtils.WebGLBuffer;
  }
});
Object.defineProperty(exports, "WebGLFramebuffer", {
  enumerable: true,
  get: function () {
    return _webglUtils.WebGLFramebuffer;
  }
});
Object.defineProperty(exports, "WebGLRenderbuffer", {
  enumerable: true,
  get: function () {
    return _webglUtils.WebGLRenderbuffer;
  }
});
Object.defineProperty(exports, "WebGLTexture", {
  enumerable: true,
  get: function () {
    return _webglUtils.WebGLTexture;
  }
});
Object.defineProperty(exports, "WebGLUniformLocation", {
  enumerable: true,
  get: function () {
    return _webglUtils.WebGLUniformLocation;
  }
});
Object.defineProperty(exports, "WebGLActiveInfo", {
  enumerable: true,
  get: function () {
    return _webglUtils.WebGLActiveInfo;
  }
});
Object.defineProperty(exports, "WebGLShaderPrecisionFormat", {
  enumerable: true,
  get: function () {
    return _webglUtils.WebGLShaderPrecisionFormat;
  }
});
Object.defineProperty(exports, "WebGL2RenderingContext", {
  enumerable: true,
  get: function () {
    return _webglUtils.WebGL2RenderingContext;
  }
});
Object.defineProperty(exports, "webGLTypesAvailable", {
  enumerable: true,
  get: function () {
    return _webglUtils.webGLTypesAvailable;
  }
});
Object.defineProperty(exports, "isWebGL", {
  enumerable: true,
  get: function () {
    return _context.isWebGL;
  }
});
Object.defineProperty(exports, "isWebGL2", {
  enumerable: true,
  get: function () {
    return _context.isWebGL2;
  }
});
Object.defineProperty(exports, "createGLContext", {
  enumerable: true,
  get: function () {
    return _context.createGLContext;
  }
});
Object.defineProperty(exports, "destroyGLContext", {
  enumerable: true,
  get: function () {
    return _context.destroyGLContext;
  }
});
Object.defineProperty(exports, "withParameters", {
  enumerable: true,
  get: function () {
    return _contextState.withParameters;
  }
});
Object.defineProperty(exports, "resetParameters", {
  enumerable: true,
  get: function () {
    return _contextState.resetParameters;
  }
});
Object.defineProperty(exports, "getContextInfo", {
  enumerable: true,
  get: function () {
    return _contextLimits.getContextInfo;
  }
});
Object.defineProperty(exports, "clear", {
  enumerable: true,
  get: function () {
    return _clear.clear;
  }
});
Object.defineProperty(exports, "parseUniformName", {
  enumerable: true,
  get: function () {
    return _uniforms.parseUniformName;
  }
});
Object.defineProperty(exports, "getUniformSetter", {
  enumerable: true,
  get: function () {
    return _uniforms.getUniformSetter;
  }
});
Object.defineProperty(exports, "Buffer", {
  enumerable: true,
  get: function () {
    return _buffer.default;
  }
});
Object.defineProperty(exports, "Shader", {
  enumerable: true,
  get: function () {
    return _shader.Shader;
  }
});
Object.defineProperty(exports, "VertexShader", {
  enumerable: true,
  get: function () {
    return _shader.VertexShader;
  }
});
Object.defineProperty(exports, "FragmentShader", {
  enumerable: true,
  get: function () {
    return _shader.FragmentShader;
  }
});
Object.defineProperty(exports, "Program", {
  enumerable: true,
  get: function () {
    return _program.default;
  }
});
Object.defineProperty(exports, "Framebuffer", {
  enumerable: true,
  get: function () {
    return _framebuffer.default;
  }
});
Object.defineProperty(exports, "Renderbuffer", {
  enumerable: true,
  get: function () {
    return _renderbuffer.default;
  }
});
Object.defineProperty(exports, "Texture2D", {
  enumerable: true,
  get: function () {
    return _texture2d.default;
  }
});
Object.defineProperty(exports, "TextureCube", {
  enumerable: true,
  get: function () {
    return _textureCube.default;
  }
});
Object.defineProperty(exports, "VertexArray", {
  enumerable: true,
  get: function () {
    return _vertexArray.default;
  }
});
Object.defineProperty(exports, "TransformFeedback", {
  enumerable: true,
  get: function () {
    return _transformFeedback.default;
  }
});
Object.defineProperty(exports, "Query", {
  enumerable: true,
  get: function () {
    return _query.default;
  }
});

var _webglUtils = require("../webgl-utils");

var _context = require("../webgl-context/context");

var _contextState = require("../webgl-context/context-state");

var _contextLimits = require("../webgl-context/context-limits");

var _clear = require("./clear");

var _uniforms = require("./uniforms");

var _buffer = _interopRequireDefault(require("./buffer"));

var _shader = require("./shader");

var _program = _interopRequireDefault(require("./program"));

var _framebuffer = _interopRequireDefault(require("./framebuffer"));

var _renderbuffer = _interopRequireDefault(require("./renderbuffer"));

var _texture2d = _interopRequireDefault(require("./texture-2d"));

var _textureCube = _interopRequireDefault(require("./texture-cube"));

var _vertexArray = _interopRequireDefault(require("./vertex-array"));

var _transformFeedback = _interopRequireDefault(require("./transform-feedback"));

var _query = _interopRequireDefault(require("./query"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"../webgl-utils":"PmJk","../webgl-context/context":"P3M9","../webgl-context/context-state":"cIIw","../webgl-context/context-limits":"fdIS","./clear":"Zd9V","./uniforms":"Eopn","./buffer":"Rc9V","./shader":"pOhm","./program":"hOuK","./framebuffer":"RDBm","./renderbuffer":"jd4o","./texture-2d":"jx3X","./texture-cube":"Bnce","./vertex-array":"yiqH","./transform-feedback":"oKAe","./query":"kye1"}],"lqt4":[function(require,module,exports) {

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _webgl = require("../webgl");

var _utils = require("../utils");

var _contextFeatures = require("../webgl-context/context-features");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/* eslint-disable complexity */
var Attribute =
/*#__PURE__*/
function () {
  function Attribute(gl) {
    var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, Attribute);
    var _opts$id = opts.id,
        id = _opts$id === void 0 ? (0, _utils.uid)('attribute') : _opts$id,
        type = opts.type,
        _opts$isIndexed = opts.isIndexed,
        isIndexed = _opts$isIndexed === void 0 ? false : _opts$isIndexed; // Options that cannot be changed later

    this.gl = gl;
    this.id = id;
    this.isIndexed = isIndexed;
    this.target = isIndexed ? 34963 : 34962;
    this.type = type;

    if (isIndexed && !type) {
      // If the attribute is indices, auto infer the correct type
      // WebGL2 and WebGL1 w/ uint32 index extension support accepts Uint32Array, otherwise Uint16Array
      this.type = gl && (0, _contextFeatures.hasFeature)(gl, _contextFeatures.FEATURES.ELEMENT_INDEX_UINT32) ? 5125 : 5123;
    } // Initialize the attribute descriptor, with WebGL and metadata fields


    this.value = null;
    this.externalBuffer = null;
    this.buffer = null;
    this.userData = {}; // Reserved for application

    this.update(opts); // Sanity - no app fields on our attributes. Use userData instead.

    Object.seal(this); // Check all fields and generate helpful error messages

    this._validateAttributeDefinition();
  }

  (0, _createClass2.default)(Attribute, [{
    key: "delete",
    value: function _delete() {
      if (this.buffer) {
        this.buffer.delete();
        this.buffer = null;
      }
    }
  }, {
    key: "update",
    value: function update(opts) {
      var value = opts.value,
          buffer = opts.buffer,
          _opts$constant = opts.constant,
          constant = _opts$constant === void 0 ? this.constant || false : _opts$constant;
      this.constant = constant;

      if (buffer) {
        this.externalBuffer = buffer;
        this.constant = false;
        this.type = buffer.accessor.type;

        if (buffer.accessor.divisor !== undefined) {
          this.divisor = buffer.accessor.divisor;
        }
      } else if (value) {
        this.externalBuffer = null;
        this.value = value;

        if (!constant && this.gl) {
          // Create buffer if needed
          this.buffer = this.buffer || new _webgl.Buffer(this.gl, Object.assign({}, opts, {
            id: this.id,
            target: this.target,
            type: this.type
          }));
          this.buffer.setData({
            data: value
          });
          this.type = this.buffer.accessor.type;
        }
      }

      this._setAccessor(opts);
    }
  }, {
    key: "getBuffer",
    value: function getBuffer() {
      if (this.constant) {
        return null;
      }

      return this.externalBuffer || this.buffer;
    }
  }, {
    key: "getValue",
    value: function getValue() {
      if (this.constant) {
        return this.value;
      }

      var buffer = this.externalBuffer || this.buffer;

      if (buffer) {
        return [buffer, this];
      }

      return null;
    } // Sets all accessor props except type
    // TODO - store on `this.accessor`

  }, {
    key: "_setAccessor",
    value: function _setAccessor(opts) {
      var _opts$size = opts.size,
          size = _opts$size === void 0 ? this.size : _opts$size,
          _opts$offset = opts.offset,
          offset = _opts$offset === void 0 ? this.offset || 0 : _opts$offset,
          _opts$stride = opts.stride,
          stride = _opts$stride === void 0 ? this.stride || 0 : _opts$stride,
          _opts$normalized = opts.normalized,
          normalized = _opts$normalized === void 0 ? this.normalized || false : _opts$normalized,
          _opts$integer = opts.integer,
          integer = _opts$integer === void 0 ? this.integer || false : _opts$integer,
          _opts$divisor = opts.divisor,
          divisor = _opts$divisor === void 0 ? this.divisor || 0 : _opts$divisor,
          instanced = opts.instanced,
          isInstanced = opts.isInstanced;
      this.size = size;
      this.offset = offset;
      this.stride = stride;
      this.normalized = normalized;
      this.integer = integer;
      this.divisor = divisor;

      if (isInstanced !== undefined) {
        _utils.log.deprecated('Attribute.isInstanced');

        this.divisor = isInstanced ? 1 : 0;
      }

      if (instanced !== undefined) {
        _utils.log.deprecated('Attribute.instanced');

        this.divisor = instanced ? 1 : 0;
      }
    }
  }, {
    key: "_validateAttributeDefinition",
    value: function _validateAttributeDefinition() {// Can be undefined for buffers (auto deduced from shaders)
      // or larger than 4 for uniform arrays
      // assert(
      //   this.size >= 1 && this.size <= 4,
      //   `Attribute definition for ${this.id} invalid size`
      // );
    }
  }]);
  return Attribute;
}();

exports.default = Attribute;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","../webgl":"x2lE","../utils":"PFG0","../webgl-context/context-features":"pWl5"}],"wX6R":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getDrawMode = getDrawMode;
exports.default = exports.DRAW_MODE = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _utils = require("../utils");

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Rendering primitives - specify how to extract primitives from vertices.
// NOTE: These are numerically identical to the corresponding WebGL/OpenGL constants
var DRAW_MODE = {
  POINTS: 0x0000,
  // draw single points.
  LINES: 0x0001,
  // draw lines. Each vertex connects to the one after it.
  LINE_LOOP: 0x0002,
  // draw lines. Each set of two vertices is treated as a separate line segment.
  LINE_STRIP: 0x0003,
  // draw a connected group of line segments from the first vertex to the last
  TRIANGLES: 0x0004,
  // draw triangles. Each set of three vertices creates a separate triangle.
  TRIANGLE_STRIP: 0x0005,
  // draw a connected group of triangles.
  TRIANGLE_FAN: 0x0006 // draw a connected group of triangles.
  // Each vertex connects to the previous and the first vertex in the fan.

}; // Helper function to handle string draw modes - when using this library without WebGL constants

exports.DRAW_MODE = DRAW_MODE;

function getDrawMode(drawMode) {
  var mode = typeof drawMode === 'string' ? DRAW_MODE[drawMode] || DRAW_MODE.TRIANGLES : drawMode;
  (0, _assert.default)(mode >= 0 && mode <= DRAW_MODE.TRIANGLE_FAN, 'Illegal drawMode');
  return mode;
}

var Geometry =
/*#__PURE__*/
function () {
  function Geometry() {
    var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    (0, _classCallCheck2.default)(this, Geometry);
    var id = opts.id,
        _opts$drawMode = opts.drawMode,
        drawMode = _opts$drawMode === void 0 ? DRAW_MODE.TRIANGLES : _opts$drawMode,
        _opts$vertexCount = opts.vertexCount,
        vertexCount = _opts$vertexCount === void 0 ? undefined : _opts$vertexCount,
        attributes = opts.attributes;
    this.id = id || (0, _utils.uid)(this.constructor.name);
    this.drawMode = getDrawMode(drawMode);
    this.vertexCount = vertexCount;
    this.attributes = {};
    this.needsRedraw = true;
    this.userData = {};
    Object.seal(this);

    if (attributes) {
      this.setAttributes(attributes);
    }
  }

  (0, _createClass2.default)(Geometry, [{
    key: "setNeedsRedraw",
    value: function setNeedsRedraw() {
      var redraw = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
      this.needsRedraw = redraw;
      return this;
    }
  }, {
    key: "getNeedsRedraw",
    value: function getNeedsRedraw() {
      var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          _ref$clearRedrawFlags = _ref.clearRedrawFlags,
          clearRedrawFlags = _ref$clearRedrawFlags === void 0 ? false : _ref$clearRedrawFlags;

      var redraw = false;
      redraw = redraw || this.needsRedraw;
      this.needsRedraw = this.needsRedraw && !clearRedrawFlags;
      return redraw;
    }
  }, {
    key: "setVertexCount",
    value: function setVertexCount(vertexCount) {
      this.vertexCount = vertexCount;
    }
  }, {
    key: "getVertexCount",
    value: function getVertexCount() {
      if (this.vertexCount !== undefined) {
        return this.vertexCount;
      } else if (this.attributes.indices) {
        return this.attributes.indices.value.length;
      } else if (this.attributes.vertices) {
        return this.attributes.vertices.value.length / 3;
      } else if (this.attributes.positions) {
        return this.attributes.positions.value.length / 3;
      }

      return false;
    }
  }, {
    key: "hasAttribute",
    value: function hasAttribute(attributeName) {
      return Boolean(this.attributes[attributeName]);
    }
  }, {
    key: "getAttribute",
    value: function getAttribute(attributeName) {
      var attribute = this.attributes[attributeName];
      (0, _assert.default)(attribute);
      return attribute.value;
    }
  }, {
    key: "getArray",
    value: function getArray(attributeName) {
      var attribute = this.attributes[attributeName];
      (0, _assert.default)(attribute);
      return attribute.value;
    }
  }, {
    key: "getAttributes",
    value: function getAttributes() {
      return this.attributes;
    } // Attribute
    // value: typed array
    // type: indices, vertices, uvs
    // size: elements per vertex
    // target: WebGL buffer type (string or constant)

  }, {
    key: "setAttributes",
    value: function setAttributes(attributes) {
      for (var attributeName in attributes) {
        var attribute = attributes[attributeName]; // Wrap "unwrapped" arrays and try to autodetect their type

        attribute = ArrayBuffer.isView(attribute) ? {
          value: attribute
        } : attribute;
        (0, _assert.default)(ArrayBuffer.isView(attribute.value), "".concat(this._print(attributeName), ": must be typed array or object with value as typed array"));

        this._autoDetectAttribute(attributeName, attribute);

        this.attributes[attributeName] = attribute;
      }

      this.setNeedsRedraw();
      return this;
    } // Check for well known attribute names

    /* eslint-disable default-case, complexity */

  }, {
    key: "_autoDetectAttribute",
    value: function _autoDetectAttribute(attributeName, attribute) {
      var category;

      switch (attributeName) {
        case 'indices':
          category = category || 'indices';
          break;

        case 'texCoords':
        case 'texCoord1':
        case 'texCoord2':
        case 'texCoord3':
          category = 'uvs';
          break;

        case 'vertices':
        case 'positions':
        case 'normals':
        case 'pickingColors':
          category = 'vectors';
          break;
      } // Check for categorys


      switch (category) {
        case 'vectors':
          attribute.size = attribute.size || 3;
          break;

        case 'uvs':
          attribute.size = attribute.size || 2;
          break;

        case 'indices':
          attribute.size = attribute.size || 1;
          attribute.isIndexed = attribute.isIndexed === undefined ? true : attribute.isIndexed;
          (0, _assert.default)(attribute.value instanceof Uint16Array || attribute.value instanceof Uint32Array, 'attribute array for "indices" must be of integer type');
          break;
      }

      (0, _assert.default)(attribute.size, "attribute ".concat(attributeName, " needs size"));
    }
    /* eslint-enable default-case, complexity */

  }, {
    key: "_print",
    value: function _print(attributeName) {
      return "Geometry ".concat(this.id, " attribute ").concat(attributeName);
    }
  }]);
  return Geometry;
}();

exports.default = Geometry;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","../utils":"PFG0","../utils/assert":"wYRU"}],"MntG":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _default = "#define SHADER_NAME luma_modular_vertex\n\n// object attributes\nattribute vec3 positions;\nattribute vec3 normals;\nattribute vec4 colors;\nattribute vec2 texCoords;\nattribute vec3 pickingColors;\n\nvoid main(void) {\n\n  // Set up position\n#ifdef MODULE_GEOMETRY\n  geometry_setPosition(positions);\n  geometry_setNormal(normals);\n#endif\n\n#ifdef MODULE_PROJECT\n  project_setPositionAndNormal_Model(positions, normals);\n  gl_Position = project_model_to_clipspace(positions);\n#endif\n\n  // Set up depth\n#ifdef MODULE_LOGDEPTH\n  logdepth_adjustPosition(gl_Position);\n#endif\n\n#ifdef MODULE_DIFFUSE\n  diffuse_setTextureCoordinate(texCoords);\n#endif\n\n  // Set up color calculations\n#ifdef MODULE_MATERIAL\n  material_setDiffuseColor(colors);\n  material_setDiffuseTextureCoordinates(texCoords);\n#endif\n\n#ifdef MODULE_LIGHTING\n  lighting_setPositionAndNormal(positions, normals);\n  lighting_apply_light(positions);\n  lighting_apply_reflection(positions);\n#endif\n\n#ifdef MODULE_PICKING\n  picking_setPickingColor(pickingColors);\n#endif\n\n}\n";
exports.default = _default;
},{}],"v1Uh":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _default = "#define SHADER_NAME luma-modular-fragment\n\nprecision highp float;\n\n// varyings\nvarying vec4 vColor;\n\nvoid main(){\n  gl_FragColor = vec4(1., 0., 1., 1.);\n\n#ifdef MODULE_DIFFUSE\n  gl_FragColor = diffuse_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_MATERIAL\n  gl_FragColor = material_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_LIGHTING\n  gl_FragColor = lighting_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_FOG\n  gl_FragColor = fog_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_PICKING\n  gl_FragColor = picking_filterHighlightColor(gl_FragColor);\n  gl_FragColor = picking_filterPickingColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_LOGDEPTH\n  logdepth_setFragDepth(gl_Position);\n#endif\n}\n";
exports.default = _default;
},{}],"LbWh":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.MODULAR_SHADERS = void 0;

var _modularVertex = _interopRequireDefault(require("./modular-vertex.glsl"));

var _modularFragment = _interopRequireDefault(require("./modular-fragment.glsl"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Default Shaders
// A set of base shaders that leverage the shader module system,
// dynamically enabling features depending on which modules are included
var MODULAR_SHADERS = {
  vs: _modularVertex.default,
  fs: _modularFragment.default,
  defaultUniforms: {}
};
exports.MODULAR_SHADERS = MODULAR_SHADERS;
},{"./modular-vertex.glsl":"MntG","./modular-fragment.glsl":"v1Uh"}],"S3EQ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.FRAGMENT_SHADER = exports.VERTEX_SHADER = void 0;
var VERTEX_SHADER = 'vs';
exports.VERTEX_SHADER = VERTEX_SHADER;
var FRAGMENT_SHADER = 'fs';
exports.FRAGMENT_SHADER = FRAGMENT_SHADER;
},{}],"rTAS":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = transpileShader;

// Transpiles shader source code to target GLSL version
// Note: We always run transpiler even if same version e.g. 3.00 => 3.00
// RFC: https://github.com/uber/luma.gl/blob/master/dev-docs/RFCs/v6.0/portable-glsl-300-rfc.md
function transpileShader(source, targetGLSLVersion, isVertex) {
  switch (targetGLSLVersion) {
    case 300:
      return isVertex ? convertVertexShaderTo300(source) : convertFragmentShaderTo300(source);

    case 100:
      return isVertex ? convertVertexShaderTo100(source) : convertFragmentShaderTo100(source);

    default:
      throw new Error("unknown GLSL version ".concat(targetGLSLVersion));
  }
}

function convertVertexShaderTo300(source) {
  return source.replace(/attribute\s+/g, 'in ').replace(/varying\s+/g, 'out ').replace(/texture2D\(/g, 'texture(').replace(/textureCube\(+/g, 'texture('); // Deal with fragColor
  // .replace(/gl_fragColor/g, 'fragColor ');
}

function convertFragmentShaderTo300(source) {
  return source.replace(/varying\s+/g, 'in ').replace(/texture2D\(/g, 'texture(').replace(/textureCube\(/g, 'texture('); // Deal with fragColor
  // .replace(/gl_fragColor/g, 'fragColor ');
}

function convertVertexShaderTo100(source) {
  // /gm - treats each line as a string, so that ^ matches after newlines
  return source.replace(/^in\s+/gm, 'attribute ').replace(/^out\s+/gm, 'varying ').replace(/texture\(/g, 'texture2D(');
}

function convertFragmentShaderTo100(source) {
  // /gm - treats each line as a string, so that ^ matches after newlines
  return source.replace(/^in\s+/gm, 'varying ').replace(/texture\(/g, 'texture2D('); // Deal with fragColor
  // .replace(/^out\s+/g, 'varying ')
}
},{}],"sYTV":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = assert;

// Recommendation is to ignore message but current test suite checks agains the
// message so keep it for now.
function assert(condition, message) {
  if (!condition) {
    throw new Error(message || 'shadertools: assertion failed.');
  }
}
},{}],"DoSG":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _transpileShader = _interopRequireDefault(require("./transpile-shader"));

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var VERTEX_SHADER = 'vs';
var FRAGMENT_SHADER = 'fs';

var ShaderModule =
/*#__PURE__*/
function () {
  function ShaderModule(_ref) {
    var name = _ref.name,
        vs = _ref.vs,
        fs = _ref.fs,
        _ref$dependencies = _ref.dependencies,
        dependencies = _ref$dependencies === void 0 ? [] : _ref$dependencies,
        _ref$getUniforms = _ref.getUniforms,
        getUniforms = _ref$getUniforms === void 0 ? function () {
      return {};
    } : _ref$getUniforms,
        _ref$deprecations = _ref.deprecations,
        deprecations = _ref$deprecations === void 0 ? [] : _ref$deprecations,
        vertexShader = _ref.vertexShader,
        fragmentShader = _ref.fragmentShader;
    (0, _classCallCheck2.default)(this, ShaderModule);
    (0, _assert.default)(typeof name === 'string');
    this.name = name;
    this.vs = vs || vertexShader;
    this.fs = fs || fragmentShader;
    this.getModuleUniforms = getUniforms;
    this.dependencies = dependencies;
    this.deprecations = this._parseDeprecationDefinitions(deprecations);
  } // Extracts the source code chunk for the specified shader type from the named shader module


  (0, _createClass2.default)(ShaderModule, [{
    key: "getModuleSource",
    value: function getModuleSource(type, targetGLSLVersion) {
      var moduleSource;

      switch (type) {
        case VERTEX_SHADER:
          moduleSource = (0, _transpileShader.default)(this.vs || '', targetGLSLVersion, true);
          break;

        case FRAGMENT_SHADER:
          moduleSource = (0, _transpileShader.default)(this.fs || '', targetGLSLVersion, false);
          break;

        default:
          (0, _assert.default)(false);
      }

      if (typeof moduleSource !== 'string') {
        return '';
      }

      return "#define MODULE_".concat(this.name.toUpperCase(), "\n").concat(moduleSource, "// END MODULE_").concat(this.name, "\n\n");
    }
  }, {
    key: "getUniforms",
    value: function getUniforms(opts, uniforms) {
      return this.getModuleUniforms(opts, uniforms);
    } // Warn about deprecated uniforms or functions

  }, {
    key: "checkDeprecations",
    value: function checkDeprecations(shaderSource, log) {
      this.deprecations.forEach(function (def) {
        if (def.regex.test(shaderSource)) {
          if (def.deprecated && log) {
            log.deprecated(def.old, def.new)();
          } else if (log) {
            log.removed(def.old, def.new)();
          }
        }
      });
    }
  }, {
    key: "_parseDeprecationDefinitions",
    value: function _parseDeprecationDefinitions() {
      var deprecations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
      deprecations.forEach(function (def) {
        switch (def.type) {
          case 'function':
            def.regex = new RegExp("\\b".concat(def.old, "\\("));
            break;

          default:
            def.regex = new RegExp("".concat(def.type, " ").concat(def.old, ";"));
        }
      });
      return deprecations;
    }
  }]);
  return ShaderModule;
}();

exports.default = ShaderModule;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","./transpile-shader":"rTAS","../utils/assert":"sYTV"}],"o1DC":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _shaderModule = _interopRequireDefault(require("./shader-module"));

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var ShaderModuleRegistry =
/*#__PURE__*/
function () {
  function ShaderModuleRegistry() {
    (0, _classCallCheck2.default)(this, ShaderModuleRegistry);
    this.shaderModules = {};
    this.defaultShaderModules = [];
  }

  (0, _createClass2.default)(ShaderModuleRegistry, [{
    key: "setDefaultShaderModules",
    value: function setDefaultShaderModules(modules) {
      this.defaultShaderModules = this.resolveModules(modules);
    }
  }, {
    key: "registerShaderModules",
    value: function registerShaderModules(shaderModuleList) {
      var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
          _ref$ignoreMultipleRe = _ref.ignoreMultipleRegistrations,
          ignoreMultipleRegistrations = _ref$ignoreMultipleRe === void 0 ? false : _ref$ignoreMultipleRe;

      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = shaderModuleList[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var shaderModule = _step.value;

          this._registerShaderModule(shaderModule, ignoreMultipleRegistrations);
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return != null) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }
    }
  }, {
    key: "getShaderModule",
    value: function getShaderModule(moduleOrName) {
      // Check if "inline" module, return it
      if (moduleOrName instanceof _shaderModule.default) {
        return moduleOrName;
      } // Check if module descriptor


      if (typeof moduleOrName !== 'string') {
        return this._registerShaderModule(moduleOrName, true);
      } // Module name - Look up module


      var module = this.shaderModules[moduleOrName];

      if (!module) {
        (0, _assert.default)(false, "Unknown shader module ".concat(moduleOrName));
      }

      return module;
    } // registers any supplied modules, resolves any names into modules
    // returns a list of modules

  }, {
    key: "resolveModules",
    value: function resolveModules(modules) {
      var _this = this;

      return modules.map(function (moduleOrName) {
        return _this.getShaderModule(moduleOrName);
      });
    } // PRIVATE API

  }, {
    key: "_registerShaderModule",
    value: function _registerShaderModule(module) {
      var ignoreMultipleRegistrations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; // Check if "inline" module, return it

      if (module instanceof _shaderModule.default) {
        return module;
      }

      (0, _assert.default)(module.name, 'shader module has no name');

      if (!this.shaderModules[module.name] || ignoreMultipleRegistrations) {
        // if ignoreMultipleRegistrations = true, we allow module to be re-registered
        module = new _shaderModule.default(module);
        module.dependencies = this.resolveModules(module.dependencies);
        this.shaderModules[module.name] = module;
      } else {
        // TODO - instead verify that definition is not changing...
        throw new Error("shader module ".concat(module.name, " already registered"));
      }

      return this.shaderModules[module.name];
    }
  }]);
  return ShaderModuleRegistry;
}();

exports.default = ShaderModuleRegistry;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","./shader-module":"DoSG","../utils/assert":"sYTV"}],"oOWu":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.setDefaultShaderModules = setDefaultShaderModules;
exports.registerShaderModules = registerShaderModules;
exports.resolveModules = resolveModules;
exports.getShaderModule = getShaderModule;
exports.TEST_EXPORTS = void 0;

var _shaderModuleRegistry = _interopRequireDefault(require("./shader-module-registry"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var shaderModuleRegistry = new _shaderModuleRegistry.default();
/**
 * Registers an array of default shader modules. These will be concatenated
 * automatically at the end of any shader module list passed to
 * `assembleShaders` (plus `resolveModules` and `getShaderDependencies`)
 * @param {Object[]} modules - Array of shader modules
 */

function setDefaultShaderModules(modules) {
  shaderModuleRegistry.setDefaultShaderModules(modules);
}
/**
 * Registers an array of shader modules
 * @param {Object[]} shaderModuleList - Array of shader modules
 */


function registerShaderModules(shaderModuleList) {
  var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
      _ref$ignoreMultipleRe = _ref.ignoreMultipleRegistrations,
      ignoreMultipleRegistrations = _ref$ignoreMultipleRe === void 0 ? false : _ref$ignoreMultipleRe;

  shaderModuleRegistry.registerShaderModules(shaderModuleList, {
    ignoreMultipleRegistrations: ignoreMultipleRegistrations
  });
} // registers any supplied modules and returns a list of module names


function resolveModules(modules) {
  modules = modules.concat(shaderModuleRegistry.defaultShaderModules);
  modules = shaderModuleRegistry.resolveModules(modules);
  return getShaderDependencies(modules);
} // Looks up a moduleName among registered modules and returns definition.
// If "inline" module, returns it directly


function getShaderModule(moduleOrName) {
  return shaderModuleRegistry.getShaderModule(moduleOrName);
}
/**
 * Takes a list of shader module names and returns a new list of
 * shader module names that includes all dependencies, sorted so
 * that modules that are dependencies of other modules come first.
 *
 * If the shader glsl code from the returned modules is concatenated
 * in the reverse order, it is guaranteed that all functions be resolved and
 * that all function and variable definitions come before use.
 *
 * @param {String[]} modules - Array of modules (inline modules or module names)
 * @return {String[]} - Array of modules
 */


function getShaderDependencies(modules) {
  var moduleMap = {};
  var moduleDepth = {};
  getDependencyGraph({
    modules: modules,
    level: 0,
    moduleMap: moduleMap,
    moduleDepth: moduleDepth
  }); // Return a reverse sort so that dependencies come before the modules that use them

  return Object.keys(moduleDepth).sort(function (a, b) {
    return moduleDepth[b] - moduleDepth[a];
  }).map(function (name) {
    return moduleMap[name];
  });
}
/**
 * Recursively checks module dpendencies to calculate dependency
 * level of each module.
 *
 * @param {String[]} modules - Array of modules
 * @param {Number} level - Current level
 * @return {result} - Map of module name to its level
 */
// Adds another level of dependencies to the result map


function getDependencyGraph(_ref2) {
  var modules = _ref2.modules,
      level = _ref2.level,
      moduleMap = _ref2.moduleMap,
      moduleDepth = _ref2.moduleDepth;

  if (level >= 5) {
    throw new Error('Possible loop in shader dependency graph');
  } // Update level on all current modules


  var _iteratorNormalCompletion = true;
  var _didIteratorError = false;
  var _iteratorError = undefined;

  try {
    for (var _iterator = modules[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
      var module = _step.value;
      moduleMap[module.name] = module;

      if (moduleDepth[module.name] === undefined || moduleDepth[module.name] < level) {
        moduleDepth[module.name] = level;
      }
    } // Recurse

  } catch (err) {
    _didIteratorError = true;
    _iteratorError = err;
  } finally {
    try {
      if (!_iteratorNormalCompletion && _iterator.return != null) {
        _iterator.return();
      }
    } finally {
      if (_didIteratorError) {
        throw _iteratorError;
      }
    }
  }

  var _iteratorNormalCompletion2 = true;
  var _didIteratorError2 = false;
  var _iteratorError2 = undefined;

  try {
    for (var _iterator2 = modules[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
      var _module = _step2.value;

      if (_module.dependencies) {
        getDependencyGraph({
          modules: _module.dependencies,
          level: level + 1,
          moduleMap: moduleMap,
          moduleDepth: moduleDepth
        });
      }
    }
  } catch (err) {
    _didIteratorError2 = true;
    _iteratorError2 = err;
  } finally {
    try {
      if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
        _iterator2.return();
      }
    } finally {
      if (_didIteratorError2) {
        throw _iteratorError2;
      }
    }
  }
}

var TEST_EXPORTS = {
  getShaderDependencies: getShaderDependencies,
  getDependencyGraph: getDependencyGraph
};
exports.TEST_EXPORTS = TEST_EXPORTS;
},{"./shader-module-registry":"o1DC"}],"SbFg":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = isOldIE;

/* global window */
// opts allows user agent to be overridden for testing
function isOldIE() {
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  var navigator = typeof window !== 'undefined' ? window.navigator || {} : {};
  var userAgent = opts.userAgent || navigator.userAgent || ''; // We only care about older versions of IE (IE 11 and below). Newer versions of IE (Edge)
  // have much better web standards support.

  var isMSIE = userAgent.indexOf('MSIE ') !== -1;
  var isTrident = userAgent.indexOf('Trident/') !== -1;
  return isMSIE || isTrident;
}
},{}],"OMcl":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getContextInfo = getContextInfo;
exports.canCompileGLGSExtension = canCompileGLGSExtension;
exports.hasFeatures = hasFeatures;
exports.FEATURES = void 0;

var _isOldIe = _interopRequireDefault(require("./is-old-ie"));

var _assert = _interopRequireDefault(require("./assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Feature detection for WebGL
//
// Provides a function that enables simple checking of which WebGL features are
// available in an WebGL1 or WebGL2 environment.

/* eslint-disable no-inline-comments, max-len */

/* global WebGL2RenderingContext */
var GL_TEXTURE_BINDING_3D = 0x806a;
var GL_VENDOR = 0x1f00;
var GL_RENDERER = 0x1f01;
var GL_VERSION = 0x1f02;
var GL_SHADING_LANGUAGE_VERSION = 0x8b8c; // Defines luma.gl "feature" names and semantics

var WEBGL_FEATURES = {
  // GLSL extensions
  GLSL_FRAG_DATA: ['WEBGL_draw_buffers', true],
  // TODO - name makes no sense in GLSL 3.00
  GLSL_FRAG_DEPTH: ['EXT_frag_depth', true],
  GLSL_DERIVATIVES: ['OES_standard_derivatives', true],
  GLSL_TEXTURE_LOD: ['EXT_shader_texture_lod', true]
}; // Create a key-mirrored FEATURES array

var FEATURES = {};
exports.FEATURES = FEATURES;
Object.keys(WEBGL_FEATURES).forEach(function (key) {
  FEATURES[key] = key;
});

function isWebGL2(gl) {
  return Boolean(gl && (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext || 32874 === GL_TEXTURE_BINDING_3D));
}

function getContextInfo(gl) {
  var info = gl.getExtension('WEBGL_debug_renderer_info');
  var vendor = gl.getParameter(info && info.UNMASKED_VENDOR_WEBGL || GL_VENDOR);
  var renderer = gl.getParameter(info && info.UNMASKED_RENDERER_WEBGL || GL_RENDERER);
  var gpuVendor = identifyGPUVendor(vendor, renderer);
  var gpuInfo = {
    gpuVendor: gpuVendor,
    vendor: vendor,
    renderer: renderer,
    version: gl.getParameter(GL_VERSION),
    shadingLanguageVersion: gl.getParameter(GL_SHADING_LANGUAGE_VERSION)
  };
  return gpuInfo;
}

function identifyGPUVendor(vendor, renderer) {
  if (vendor.match(/NVIDIA/i) || renderer.match(/NVIDIA/i)) {
    return 'NVIDIA';
  }

  if (vendor.match(/INTEL/i) || renderer.match(/INTEL/i)) {
    return 'INTEL';
  }

  if (vendor.match(/AMD/i) || renderer.match(/AMD/i) || vendor.match(/ATI/i) || renderer.match(/ATI/i)) {
    return 'AMD';
  }

  return 'UNKNOWN GPU';
}

var compiledGlslExtensions = {}; // Enables feature detection in IE11 due to a bug where gl.getExtension may return true
// but fail to compile when the extension is enabled in the shader. Specifically,
// the OES_standard_derivatives and WEBGL_draw_buffers extensions fails to compile in IE11 even though its included
// in the list of supported extensions.
// opts allows user agent to be overridden for testing

/*
* Inputs :
*  gl : WebGL context
*  cap : Key of WEBGL_FEATURES object identifying the extension
*  opts :
*   behavior : behavor of extension to be tested, by defualt `enable` is used
* Returns : true, if shader is compiled successfully, false otherwise
*/

function canCompileGLGSExtension(gl, cap) {
  var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  var feature = WEBGL_FEATURES[cap];
  (0, _assert.default)(feature, cap);

  if (!(0, _isOldIe.default)(opts)) {
    return true;
  }

  if (cap in compiledGlslExtensions) {
    return compiledGlslExtensions[cap];
  }

  var extensionName = feature[0];
  var behavior = opts.behavior || 'enable';
  var source = "#extension GL_".concat(extensionName, " : ").concat(behavior, "\nvoid main(void) {}");
  var shader = gl.createShader(35633);
  gl.shaderSource(shader, source);
  gl.compileShader(shader);
  var canCompile = gl.getShaderParameter(shader, 35713);
  gl.deleteShader(shader);
  compiledGlslExtensions[cap] = canCompile;
  return canCompile;
} // TODO - cache the value


function getFeature(gl, cap) {
  var feature = WEBGL_FEATURES[cap];
  (0, _assert.default)(feature, cap); // Get extension name from table

  var extensionName = isWebGL2(gl) ? feature[1] || feature[0] : feature[0]; // Check if the value is dependent on checking an extension

  var value = typeof extensionName === 'string' ? Boolean(gl.getExtension(extensionName)) : extensionName;
  (0, _assert.default)(value === false || value === true);
  return value;
}

function hasFeatures(gl, features) {
  features = Array.isArray(features) ? features : [features];
  return features.every(function (feature) {
    return getFeature(gl, feature);
  });
}
},{"./is-old-ie":"SbFg","./assert":"sYTV"}],"JbJM":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getPlatformShaderDefines = getPlatformShaderDefines;
exports.getVersionDefines = getVersionDefines;

var _webglInfo = require("../utils/webgl-info");

function getPlatformShaderDefines(gl) {
  var debugInfo = (0, _webglInfo.getContextInfo)(gl);

  switch (debugInfo.gpuVendor.toLowerCase()) {
    case 'nvidia':
      return "#define NVIDIA_GPU\n// Nvidia optimizes away the calculation necessary for emulated fp64\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n";

    case 'intel':
      return "#define INTEL_GPU\n// Intel optimizes away the calculation necessary for emulated fp64\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n// Intel's built-in 'tan' function doesn't have acceptable precision\n#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1\n// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow\n#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1\n";

    case 'amd':
      // AMD Does not eliminate fp64 code
      return "#define AMD_GPU\n";

    default:
      // We don't know what GPU it is, could be that the GPU driver or
      // browser is not implementing UNMASKED_RENDERER constant and not
      // reporting a correct name
      return "#define DEFAULT_GPU\n// Prevent driver from optimizing away the calculation necessary for emulated fp64\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n// Intel's built-in 'tan' function doesn't have acceptable precision\n#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1\n// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow\n#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1\n";
  }
}

function getVersionDefines(gl, glslVersion, isFragment) {
  // Add shadertools defines to let shaders portably v1/v3 check for features
  var versionDefines = "#if (__VERSION__ > 120)\n\n# define FRAG_DEPTH\n# define DERIVATIVES\n# define DRAW_BUFFERS\n# define TEXTURE_LOD\n\n#endif // __VERSION\n";

  if ((0, _webglInfo.hasFeatures)(gl, _webglInfo.FEATURES.GLSL_FRAG_DEPTH)) {
    versionDefines += "// FRAG_DEPTH => gl_FragDepth is available\n#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n# define FRAG_DEPTH\n# define gl_FragDepth gl_FragDepthEXT\n#endif\n";
  }

  if ((0, _webglInfo.hasFeatures)(gl, _webglInfo.FEATURES.GLSL_DERIVATIVES) && (0, _webglInfo.canCompileGLGSExtension)(gl, _webglInfo.FEATURES.GLSL_DERIVATIVES)) {
    versionDefines += "// DERIVATIVES => dxdF, dxdY and fwidth are available\n#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n# define DERIVATIVES\n#endif\n";
  }

  if ((0, _webglInfo.hasFeatures)(gl, _webglInfo.FEATURES.GLSL_FRAG_DATA) && (0, _webglInfo.canCompileGLGSExtension)(gl, _webglInfo.FEATURES.GLSL_FRAG_DATA, {
    behavior: 'require'
  })) {
    versionDefines += "// DRAW_BUFFERS => gl_FragData[] is available\n#ifdef GL_EXT_draw_buffers\n#extension GL_EXT_draw_buffers : require\n#define DRAW_BUFFERS\n#endif\n";
  }

  if ((0, _webglInfo.hasFeatures)(gl, _webglInfo.FEATURES.GLSL_TEXTURE_LOD)) {
    versionDefines += "// TEXTURE_LOD => texture2DLod etc are available\n#ifdef GL_EXT_shader_texture_lod\n#extension GL_EXT_shader_texture_lod : enable\n# define TEXTURE_LOD\n#define texture2DLod texture2DLodEXT\n#define texture2DProjLod texture2DProjLodEXT\n#define texture2DProjLod texture2DProjLodEXT\n#define textureCubeLod textureCubeLodEXT\n#define texture2DGrad texture2DGradEXT\n#define texture2DProjGrad texture2DProjGradEXT\n#define texture2DProjGrad texture2DProjGradEXT\n#define textureCubeGrad textureCubeGradEXT\n#endif\n";
  }

  return versionDefines;
}
},{"../utils/webgl-info":"OMcl"}],"H1la":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.MODULE_INJECTORS_FS = exports.MODULE_INJECTORS_VS = void 0;
var MODULE_INJECTORS_VS = "#ifdef MODULE_LOGDEPTH\n  logdepth_adjustPosition(gl_Position);\n#endif\n";
exports.MODULE_INJECTORS_VS = MODULE_INJECTORS_VS;
var MODULE_INJECTORS_FS = "#ifdef MODULE_MATERIAL\n  gl_FragColor = material_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_LIGHTING\n  gl_FragColor = lighting_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_FOG\n  gl_FragColor = fog_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_PICKING\n  gl_FragColor = picking_filterHighlightColor(gl_FragColor);\n  gl_FragColor = picking_filterPickingColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_LOGDEPTH\n  logdepth_setFragDepth();\n#endif\n";
exports.MODULE_INJECTORS_FS = MODULE_INJECTORS_FS;
},{}],"NLS8":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = injectShader;
exports.combineInjects = combineInjects;

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));

var _moduleInjectors = require("../modules/module-injectors");

var _constants = require("./constants");

var _assert = _interopRequireDefault(require("assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _MODULE_INJECTORS;

// TODO - experimental
var MODULE_INJECTORS = (_MODULE_INJECTORS = {}, (0, _defineProperty2.default)(_MODULE_INJECTORS, _constants.VERTEX_SHADER, _moduleInjectors.MODULE_INJECTORS_VS), (0, _defineProperty2.default)(_MODULE_INJECTORS, _constants.FRAGMENT_SHADER, _moduleInjectors.MODULE_INJECTORS_FS), _MODULE_INJECTORS);
var REGEX_START_OF_MAIN = /void main\s*\([^\)]*\)\s*\{\n?/; // Beginning of main

var REGEX_END_OF_MAIN = /}\n?[^{}]*$/; // End of main, assumes main is last function
// A minimal shader injection/templating system.
// RFC: https://github.com/uber/luma.gl/blob/master/dev-docs/RFCs/v6.0/shader-injection-rfc.md

/* eslint-disable complexity */

function injectShader(source, type, inject, injectStandardStubs) {
  var isVertex = type === _constants.VERTEX_SHADER;

  var _loop = function _loop(key) {
    var fragment = inject[key];

    switch (key) {
      // declarations are injected before the main function
      case 'vs:#decl':
        if (isVertex) {
          source = source.replace(REGEX_START_OF_MAIN, function (match) {
            return "".concat(fragment, "\n").concat(match);
          });
        }

        break;
      // main code is injected at the end of main function

      case 'vs:#main-start':
        if (isVertex) {
          source = source.replace(REGEX_START_OF_MAIN, function (match) {
            return match + fragment;
          });
        }

        break;

      case 'vs:#main-end':
        if (isVertex) {
          source = source.replace(REGEX_END_OF_MAIN, function (match) {
            return fragment + match;
          });
        }

        break;

      case 'fs:#decl':
        if (!isVertex) {
          source = source.replace(REGEX_START_OF_MAIN, function (match) {
            return "".concat(fragment, "\n").concat(match);
          });
        }

        break;

      case 'fs:#main-start':
        if (!isVertex) {
          source = source.replace(REGEX_START_OF_MAIN, function (match) {
            return match + fragment;
          });
        }

        break;

      case 'fs:#main-end':
        if (!isVertex) {
          source = source.replace(REGEX_END_OF_MAIN, function (match) {
            return fragment + match;
          });
        }

        break;

      default:
        // inject code after key, leaving key in place
        source = source.replace(key, function (match) {
          return match + fragment;
        });
    }
  };

  for (var key in inject) {
    _loop(key);
  } // Finally, if requested, insert an automatic module injector chunk


  if (injectStandardStubs) {
    source = source.replace('}s*$', function (match) {
      return match + MODULE_INJECTORS[type];
    });
  }

  return source;
}
/* eslint-enable complexity */
// Takes an array of inject objects and combines them into one


function combineInjects(injects) {
  var result = {};
  (0, _assert.default)(Array.isArray(injects) && injects.length > 1);
  injects.forEach(function (inject) {
    for (var key in inject) {
      result[key] = result[key] ? "".concat(result[key], "\n").concat(inject[key]) : inject[key];
    }
  });
  return result;
}
},{"@babel/runtime/helpers/esm/defineProperty":"DOnw","../modules/module-injectors":"H1la","./constants":"S3EQ","assert":"AoLc"}],"xBou":[function(require,module,exports) {
var define;
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.assembleShaders = assembleShaders;

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));

var _constants = require("./constants");

var _resolveModules = require("./resolve-modules");

var _platformDefines = require("./platform-defines");

var _injectShader = _interopRequireDefault(require("./inject-shader"));

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _SHADER_TYPE;

var SHADER_TYPE = (_SHADER_TYPE = {}, (0, _defineProperty2.default)(_SHADER_TYPE, _constants.VERTEX_SHADER, 'vertex'), (0, _defineProperty2.default)(_SHADER_TYPE, _constants.FRAGMENT_SHADER, 'fragment'), _SHADER_TYPE); // Precision prologue to inject before functions are injected in shader
// TODO - extract any existing prologue in the fragment source and move it up...

var FRAGMENT_SHADER_PROLOGUE = "precision highp float;\n\n"; // Inject a list of modules

function assembleShaders(gl) {
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  var vs = opts.vs,
      fs = opts.fs;
  var modules = (0, _resolveModules.resolveModules)(opts.modules || []);
  return {
    gl: gl,
    vs: assembleShader(gl, Object.assign({}, opts, {
      source: vs,
      type: _constants.VERTEX_SHADER,
      modules: modules
    })),
    fs: assembleShader(gl, Object.assign({}, opts, {
      source: fs,
      type: _constants.FRAGMENT_SHADER,
      modules: modules
    })),
    getUniforms: assembleGetUniforms(modules),
    modules: assembleModuleMap(modules)
  };
} // Pulls together complete source code for either a vertex or a fragment shader
// adding prologues, requested module chunks, and any final injections.


function assembleShader(gl, _ref) {
  var id = _ref.id,
      source = _ref.source,
      type = _ref.type,
      _ref$modules = _ref.modules,
      modules = _ref$modules === void 0 ? [] : _ref$modules,
      _ref$defines = _ref.defines,
      defines = _ref$defines === void 0 ? {} : _ref$defines,
      _ref$inject = _ref.inject,
      inject = _ref$inject === void 0 ? {} : _ref$inject,
      _ref$prologue = _ref.prologue,
      prologue = _ref$prologue === void 0 ? true : _ref$prologue,
      log = _ref.log;
  (0, _assert.default)(typeof source === 'string', 'shader source must be a string');
  var isVertex = type === _constants.VERTEX_SHADER;
  var sourceLines = source.split('\n');
  var glslVersion = 100;
  var versionLine = '';
  var coreSource = source; // Extract any version directive string from source.
  // TODO : keep all pre-processor statements at the begining of the shader.

  if (sourceLines[0].indexOf('#version ') === 0) {
    glslVersion = 300; // TODO - regexp that matches atual version number

    versionLine = sourceLines[0];
    coreSource = sourceLines.slice(1).join('\n');
  } // Add platform defines (use these to work around platform-specific bugs and limitations)
  // Add common defines (GLSL version compatibility, feature detection)
  // Add precision declaration for fragment shaders


  var assembledSource = prologue ? "".concat(versionLine, "\n").concat(getShaderName({
    id: id,
    source: source,
    type: type
  }), "\n").concat((0, _platformDefines.getPlatformShaderDefines)(gl), "\n").concat((0, _platformDefines.getVersionDefines)(gl, glslVersion, !isVertex), "\n").concat(getApplicationDefines(defines), "\n").concat(isVertex ? '' : FRAGMENT_SHADER_PROLOGUE, "\n") : "".concat(versionLine, "\n"); // Add source of dependent modules in resolved order

  var injectStandardStubs = false;
  var _iteratorNormalCompletion = true;
  var _didIteratorError = false;
  var _iteratorError = undefined;

  try {
    for (var _iterator = modules[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
      var module = _step.value;

      switch (module.name) {
        case 'inject':
          injectStandardStubs = true;
          break;

        default:
          module.checkDeprecations(coreSource, log);
          var moduleSource = module.getModuleSource(type, glslVersion); // Add the module source, and a #define that declares it presence

          assembledSource += moduleSource;
      }
    } // Add the version directive and actual source of this shader

  } catch (err) {
    _didIteratorError = true;
    _iteratorError = err;
  } finally {
    try {
      if (!_iteratorNormalCompletion && _iterator.return != null) {
        _iterator.return();
      }
    } finally {
      if (_didIteratorError) {
        throw _iteratorError;
      }
    }
  }

  assembledSource += coreSource; // Apply any requested shader injections

  assembledSource = (0, _injectShader.default)(assembledSource, type, inject, injectStandardStubs);
  return assembledSource;
} // Returns a combined `getUniforms` covering the options for all the modules,
// the created function will pass on options to the inidividual `getUniforms`
// function of each shader module and combine the results into one object that
// can be passed to setUniforms.


function assembleGetUniforms(modules) {
  return function getUniforms(opts) {
    var uniforms = {};
    var _iteratorNormalCompletion2 = true;
    var _didIteratorError2 = false;
    var _iteratorError2 = undefined;

    try {
      for (var _iterator2 = modules[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
        var module = _step2.value; // `modules` is already sorted by dependency level. This guarantees that
        // modules have access to the uniforms that are generated by their dependencies.

        var moduleUniforms = module.getUniforms(opts, uniforms);
        Object.assign(uniforms, moduleUniforms);
      }
    } catch (err) {
      _didIteratorError2 = true;
      _iteratorError2 = err;
    } finally {
      try {
        if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
          _iterator2.return();
        }
      } finally {
        if (_didIteratorError2) {
          throw _iteratorError2;
        }
      }
    }

    return uniforms;
  };
} // Returns a map with module names as keys, resolving to their module definitions
// The presence of a key indicates that the module is available in this program,
// whether directly included, or through a dependency of some other module


function assembleModuleMap(modules) {
  var result = {};
  var _iteratorNormalCompletion3 = true;
  var _didIteratorError3 = false;
  var _iteratorError3 = undefined;

  try {
    for (var _iterator3 = modules[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
      var moduleName = _step3.value;
      var shaderModule = (0, _resolveModules.getShaderModule)(moduleName);
      result[moduleName] = shaderModule;
    }
  } catch (err) {
    _didIteratorError3 = true;
    _iteratorError3 = err;
  } finally {
    try {
      if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
        _iterator3.return();
      }
    } finally {
      if (_didIteratorError3) {
        throw _iteratorError3;
      }
    }
  }

  return result;
} // Generate "glslify-compatible" SHADER_NAME defines
// These are understood by the GLSL error parsing function
// If id is provided and no SHADER_NAME constant is present in source, create one


function getShaderName(_ref2) {
  var id = _ref2.id,
      source = _ref2.source,
      type = _ref2.type;
  var injectShaderName = id && typeof id === 'string' && source.indexOf('SHADER_NAME') === -1;
  return injectShaderName ? "\n#define SHADER_NAME ".concat(id, "_").concat(SHADER_TYPE[type], "\n\n") : '';
} // Generates application defines from an object


function getApplicationDefines() {
  var defines = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  var count = 0;
  var sourceText = '';

  for (var define in defines) {
    if (count === 0) {
      sourceText += '\n// APPLICATION DEFINES\n';
    }

    count++;
    var value = defines[define];

    if (value || Number.isFinite(value)) {
      sourceText += "#define ".concat(define.toUpperCase(), " ").concat(defines[define], "\n");
    }
  }

  if (count === 0) {
    sourceText += '\n';
  }

  return sourceText;
}
},{"@babel/runtime/helpers/esm/defineProperty":"DOnw","./constants":"S3EQ","./resolve-modules":"oOWu","./platform-defines":"JbJM","./inject-shader":"NLS8","../utils/assert":"sYTV"}],"oP7N":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var fp32shader = "#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND\nconst float TWO_PI = 6.2831854820251465;\nconst float PI_2 = 1.5707963705062866;\nconst float PI_16 = 0.1963495463132858;\n\nconst float SIN_TABLE_0 = 0.19509032368659973;\nconst float SIN_TABLE_1 = 0.3826834261417389;\nconst float SIN_TABLE_2 = 0.5555702447891235;\nconst float SIN_TABLE_3 = 0.7071067690849304;\n\nconst float COS_TABLE_0 = 0.9807852506637573;\nconst float COS_TABLE_1 = 0.9238795042037964;\nconst float COS_TABLE_2 = 0.8314695954322815;\nconst float COS_TABLE_3 = 0.7071067690849304;\n\nconst float INVERSE_FACTORIAL_3 = 1.666666716337204e-01;\nconst float INVERSE_FACTORIAL_5 = 8.333333767950535e-03;\nconst float INVERSE_FACTORIAL_7 = 1.9841270113829523e-04;\nconst float INVERSE_FACTORIAL_9 = 2.75573188446287533e-06;\n\nfloat sin_taylor_fp32(float a) {\n  float r, s, t, x;\n\n  if (a == 0.0) {\n    return 0.0;\n  }\n\n  x = -a * a;\n  s = a;\n  r = a;\n\n  r = r * x;\n  t = r * INVERSE_FACTORIAL_3;\n  s = s + t;\n\n  r = r * x;\n  t = r * INVERSE_FACTORIAL_5;\n  s = s + t;\n\n  r = r * x;\n  t = r * INVERSE_FACTORIAL_7;\n  s = s + t;\n\n  r = r * x;\n  t = r * INVERSE_FACTORIAL_9;\n  s = s + t;\n\n  return s;\n}\n\nvoid sincos_taylor_fp32(float a, out float sin_t, out float cos_t) {\n  if (a == 0.0) {\n    sin_t = 0.0;\n    cos_t = 1.0;\n  }\n  sin_t = sin_taylor_fp32(a);\n  cos_t = sqrt(1.0 - sin_t * sin_t);\n}\n\nfloat tan_taylor_fp32(float a) {\n    float sin_a;\n    float cos_a;\n\n    if (a == 0.0) {\n        return 0.0;\n    }\n    float z = floor(a / TWO_PI);\n    float r = a - TWO_PI * z;\n\n    float t;\n    float q = floor(r / PI_2 + 0.5);\n    int j = int(q);\n\n    if (j < -2 || j > 2) {\n        return 0.0 / 0.0;\n    }\n\n    t = r - PI_2 * q;\n\n    q = floor(t / PI_16 + 0.5);\n    int k = int(q);\n    int abs_k = int(abs(float(k)));\n\n    if (abs_k > 4) {\n        return 0.0 / 0.0;\n    } else {\n        t = t - PI_16 * q;\n    }\n\n    float u = 0.0;\n    float v = 0.0;\n\n    float sin_t, cos_t;\n    float s, c;\n    sincos_taylor_fp32(t, sin_t, cos_t);\n\n    if (k == 0) {\n        s = sin_t;\n        c = cos_t;\n    } else {\n        if (abs(float(abs_k) - 1.0) < 0.5) {\n            u = COS_TABLE_0;\n            v = SIN_TABLE_0;\n        } else if (abs(float(abs_k) - 2.0) < 0.5) {\n            u = COS_TABLE_1;\n            v = SIN_TABLE_1;\n        } else if (abs(float(abs_k) - 3.0) < 0.5) {\n            u = COS_TABLE_2;\n            v = SIN_TABLE_2;\n        } else if (abs(float(abs_k) - 4.0) < 0.5) {\n            u = COS_TABLE_3;\n            v = SIN_TABLE_3;\n        }\n        if (k > 0) {\n            s = u * sin_t + v * cos_t;\n            c = u * cos_t - v * sin_t;\n        } else {\n            s = u * sin_t - v * cos_t;\n            c = u * cos_t + v * sin_t;\n        }\n    }\n\n    if (j == 0) {\n        sin_a = s;\n        cos_a = c;\n    } else if (j == 1) {\n        sin_a = c;\n        cos_a = -s;\n    } else if (j == -1) {\n        sin_a = -c;\n        cos_a = s;\n    } else {\n        sin_a = -s;\n        cos_a = -c;\n    }\n    return sin_a / cos_a;\n}\n#endif\n\nfloat tan_fp32(float a) {\n#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND\n  return tan_taylor_fp32(a);\n#else\n  return tan(a);\n#endif\n}\n";
var _default = {
  name: 'fp32',
  vs: fp32shader,
  fs: null
};
exports.default = _default;
},{}],"TZEe":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.fp64ify = fp64ify;
exports.fp64LowPart = fp64LowPart;
exports.fp64ifyMatrix4 = fp64ifyMatrix4;

/**
 * Calculate WebGL 64 bit float
 * @param a {number} - the input float number
 * @param out {array, optional} - the output array. If not supplied, a new array is created.
 * @param startIndex {integer, optional} - the index in the output array to fill from. Default 0.
 * @returns {array} - the fp64 representation of the input number
 */
function fp64ify(a) {
  var out = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  var startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  var hiPart = Math.fround(a);
  var loPart = a - hiPart;
  out[startIndex] = hiPart;
  out[startIndex + 1] = loPart;
  return out;
}
/**
 * Calculate the low part of a WebGL 64 bit float
 * @param a {number} - the input float number
 * @returns {number} - the lower 32 bit of the number
 */


function fp64LowPart(a) {
  return a - Math.fround(a);
}
/**
 * Calculate WebGL 64 bit matrix (transposed "Float64Array")
 * @param matrix {Matrix4} - the input matrix
 * @returns {array} - the fp64 representation of the input matrix
 */


function fp64ifyMatrix4(matrix) {
  // Transpose the projection matrix to column major for GLSL.
  var matrixFP64 = new Float32Array(32);

  for (var i = 0; i < 4; ++i) {
    for (var j = 0; j < 4; ++j) {
      var index = i * 4 + j;
      fp64ify(matrix[j * 4 + i], matrixFP64, index * 2);
    }
  }

  return matrixFP64;
}
},{}],"aYgH":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var _default = "uniform float ONE;\nvec2 split(float a) {\n  const float SPLIT = 4097.0;\n  float t = a * SPLIT;\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\n  float a_hi = t * ONE - (t - a);\n  float a_lo = a * ONE - a_hi;\n#else\n  float a_hi = t - (t - a);\n  float a_lo = a - a_hi;\n#endif\n  return vec2(a_hi, a_lo);\n}\nvec2 split2(vec2 a) {\n  vec2 b = split(a.x);\n  b.y += a.y;\n  return b;\n}\nvec2 quickTwoSum(float a, float b) {\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\n  float sum = (a + b) * ONE;\n  float err = b - (sum - a) * ONE;\n#else\n  float sum = a + b;\n  float err = b - (sum - a);\n#endif\n  return vec2(sum, err);\n}\nvec2 twoSum(float a, float b) {\n  float s = (a + b);\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\n  float v = (s * ONE - a) * ONE;\n  float err = (a - (s - v) * ONE) * ONE * ONE * ONE + (b - v);\n#else\n  float v = s - a;\n  float err = (a - (s - v)) + (b - v);\n#endif\n  return vec2(s, err);\n}\n\nvec2 twoSub(float a, float b) {\n  float s = (a - b);\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\n  float v = (s * ONE - a) * ONE;\n  float err = (a - (s - v) * ONE) * ONE * ONE * ONE - (b + v);\n#else\n  float v = s - a;\n  float err = (a - (s - v)) - (b + v);\n#endif\n  return vec2(s, err);\n}\n\nvec2 twoSqr(float a) {\n  float prod = a * a;\n  vec2 a_fp64 = split(a);\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\n  float err = ((a_fp64.x * a_fp64.x - prod) * ONE + 2.0 * a_fp64.x *\n    a_fp64.y * ONE * ONE) + a_fp64.y * a_fp64.y * ONE * ONE * ONE;\n#else\n  float err = ((a_fp64.x * a_fp64.x - prod) + 2.0 * a_fp64.x * a_fp64.y) + a_fp64.y * a_fp64.y;\n#endif\n  return vec2(prod, err);\n}\n\nvec2 twoProd(float a, float b) {\n  float prod = a * b;\n  vec2 a_fp64 = split(a);\n  vec2 b_fp64 = split(b);\n  float err = ((a_fp64.x * b_fp64.x - prod) + a_fp64.x * b_fp64.y +\n    a_fp64.y * b_fp64.x) + a_fp64.y * b_fp64.y;\n  return vec2(prod, err);\n}\n\nvec2 sum_fp64(vec2 a, vec2 b) {\n  vec2 s, t;\n  s = twoSum(a.x, b.x);\n  t = twoSum(a.y, b.y);\n  s.y += t.x;\n  s = quickTwoSum(s.x, s.y);\n  s.y += t.y;\n  s = quickTwoSum(s.x, s.y);\n  return s;\n}\n\nvec2 sub_fp64(vec2 a, vec2 b) {\n  vec2 s, t;\n  s = twoSub(a.x, b.x);\n  t = twoSub(a.y, b.y);\n  s.y += t.x;\n  s = quickTwoSum(s.x, s.y);\n  s.y += t.y;\n  s = quickTwoSum(s.x, s.y);\n  return s;\n}\n\nvec2 mul_fp64(vec2 a, vec2 b) {\n  vec2 prod = twoProd(a.x, b.x);\n  prod.y += a.x * b.y;\n#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)\n  prod = split2(prod);\n#endif\n  prod = quickTwoSum(prod.x, prod.y);\n  prod.y += a.y * b.x;\n#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)\n  prod = split2(prod);\n#endif\n  prod = quickTwoSum(prod.x, prod.y);\n  return prod;\n}\n\nvec2 div_fp64(vec2 a, vec2 b) {\n  float xn = 1.0 / b.x;\n#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)\n  vec2 yn = mul_fp64(a, vec2(xn, 0));\n#else\n  vec2 yn = a * xn;\n#endif\n  float diff = (sub_fp64(a, mul_fp64(b, yn))).x;\n  vec2 prod = twoProd(xn, diff);\n  return sum_fp64(yn, prod);\n}\n\nvec2 sqrt_fp64(vec2 a) {\n  if (a.x == 0.0 && a.y == 0.0) return vec2(0.0, 0.0);\n  if (a.x < 0.0) return vec2(0.0 / 0.0, 0.0 / 0.0);\n\n  float x = 1.0 / sqrt(a.x);\n  float yn = a.x * x;\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\n  vec2 yn_sqr = twoSqr(yn) * ONE;\n#else\n  vec2 yn_sqr = twoSqr(yn);\n#endif\n  float diff = sub_fp64(a, yn_sqr).x;\n  vec2 prod = twoProd(x * 0.5, diff);\n#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)\n  return sum_fp64(split(yn), prod);\n#else\n  return sum_fp64(vec2(yn, 0.0), prod);\n#endif\n}\n";
exports.default = _default;
},{}],"rBJz":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var _default = "const vec2 E_FP64 = vec2(2.7182817459106445e+00, 8.254840366817007e-08);\nconst vec2 LOG2_FP64 = vec2(0.6931471824645996e+00, -1.9046542121259336e-09);\nconst vec2 PI_FP64 = vec2(3.1415927410125732, -8.742278012618954e-8);\nconst vec2 TWO_PI_FP64 = vec2(6.2831854820251465, -1.7484556025237907e-7);\nconst vec2 PI_2_FP64 = vec2(1.5707963705062866, -4.371139006309477e-8);\nconst vec2 PI_4_FP64 = vec2(0.7853981852531433, -2.1855695031547384e-8);\nconst vec2 PI_16_FP64 = vec2(0.19634954631328583, -5.463923757886846e-9);\nconst vec2 PI_16_2_FP64 = vec2(0.39269909262657166, -1.0927847515773692e-8);\nconst vec2 PI_16_3_FP64 = vec2(0.5890486240386963, -1.4906100798128818e-9);\nconst vec2 PI_180_FP64 = vec2(0.01745329238474369, 1.3519960498364902e-10);\n\nconst vec2 SIN_TABLE_0_FP64 = vec2(0.19509032368659973, -1.6704714833615242e-9);\nconst vec2 SIN_TABLE_1_FP64 = vec2(0.3826834261417389, 6.22335089017767e-9);\nconst vec2 SIN_TABLE_2_FP64 = vec2(0.5555702447891235, -1.1769521357507529e-8);\nconst vec2 SIN_TABLE_3_FP64 = vec2(0.7071067690849304, 1.2101617041793133e-8);\n\nconst vec2 COS_TABLE_0_FP64 = vec2(0.9807852506637573, 2.9739473106360492e-8);\nconst vec2 COS_TABLE_1_FP64 = vec2(0.9238795042037964, 2.8307490351764386e-8);\nconst vec2 COS_TABLE_2_FP64 = vec2(0.8314695954322815, 1.6870263741530778e-8);\nconst vec2 COS_TABLE_3_FP64 = vec2(0.7071067690849304, 1.2101617152815436e-8);\n\nconst vec2 INVERSE_FACTORIAL_3_FP64 = vec2(1.666666716337204e-01, -4.967053879312289e-09);\nconst vec2 INVERSE_FACTORIAL_4_FP64 = vec2(4.16666679084301e-02, -1.2417634698280722e-09);\nconst vec2 INVERSE_FACTORIAL_5_FP64 = vec2(8.333333767950535e-03, -4.34617203337595e-10);\nconst vec2 INVERSE_FACTORIAL_6_FP64 = vec2(1.3888889225199819e-03, -3.3631094437103215e-11);\nconst vec2 INVERSE_FACTORIAL_7_FP64 = vec2(1.9841270113829523e-04,  -2.725596874933456e-12);\nconst vec2 INVERSE_FACTORIAL_8_FP64 = vec2(2.4801587642286904e-05, -3.406996025904184e-13);\nconst vec2 INVERSE_FACTORIAL_9_FP64 = vec2(2.75573188446287533e-06, 3.7935713937038186e-14);\nconst vec2 INVERSE_FACTORIAL_10_FP64 = vec2(2.755731998149713e-07, -7.575112367869873e-15);\n\nfloat nint(float d) {\n    if (d == floor(d)) return d;\n    return floor(d + 0.5);\n}\n\nvec2 nint_fp64(vec2 a) {\n    float hi = nint(a.x);\n    float lo;\n    vec2 tmp;\n    if (hi == a.x) {\n        lo = nint(a.y);\n        tmp = quickTwoSum(hi, lo);\n    } else {\n        lo = 0.0;\n        if (abs(hi - a.x) == 0.5 && a.y < 0.0) {\n            hi -= 1.0;\n        }\n        tmp = vec2(hi, lo);\n    }\n    return tmp;\n}\n\nvec2 exp_fp64(vec2 a) {\n\n  const int k_power = 4;\n  const float k = 16.0;\n\n  const float inv_k = 1.0 / k;\n\n  if (a.x <= -88.0) return vec2(0.0, 0.0);\n  if (a.x >= 88.0) return vec2(1.0 / 0.0, 1.0 / 0.0);\n  if (a.x == 0.0 && a.y == 0.0) return vec2(1.0, 0.0);\n  if (a.x == 1.0 && a.y == 0.0) return E_FP64;\n\n  float m = floor(a.x / LOG2_FP64.x + 0.5);\n  vec2 r = sub_fp64(a, mul_fp64(LOG2_FP64, vec2(m, 0.0))) * inv_k;\n  vec2 s, t, p;\n\n  p = mul_fp64(r, r);\n  s = sum_fp64(r, p * 0.5);\n  p = mul_fp64(p, r);\n  t = mul_fp64(p, INVERSE_FACTORIAL_3_FP64);\n\n  s = sum_fp64(s, t);\n  p = mul_fp64(p, r);\n  t = mul_fp64(p, INVERSE_FACTORIAL_4_FP64);\n\n  s = sum_fp64(s, t);\n  p = mul_fp64(p, r);\n  t = mul_fp64(p, INVERSE_FACTORIAL_5_FP64);\n\n\n\n\n\n\n  s = sum_fp64(s, t);\n  for (int i = 0; i < k_power; i++) {\n    s = sum_fp64(s * 2.0, mul_fp64(s, s));\n  }\n\n#if defined(NVIDIA_FP64_WORKAROUND) || defined(INTEL_FP64_WORKAROUND)\n  s = sum_fp64(s, vec2(ONE, 0.0));\n#else\n  s = sum_fp64(s, vec2(1.0, 0.0));\n#endif\n\n  return s * pow(2.0, m);\n}\n\nvec2 log_fp64(vec2 a)\n{\n  if (a.x == 1.0 && a.y == 0.0) return vec2(0.0, 0.0);\n  if (a.x <= 0.0) return vec2(0.0 / 0.0, 0.0 / 0.0);\n  vec2 x = vec2(log(a.x), 0.0);\n  vec2 s;\n#if defined(NVIDIA_FP64_WORKAROUND) || defined(INTEL_FP64_WORKAROUND)\n  s = vec2(ONE, 0.0);\n#else\n  s = vec2(1.0, 0.0);\n#endif\n\n  x = sub_fp64(sum_fp64(x, mul_fp64(a, exp_fp64(-x))), s);\n  return x;\n}\n\nvec2 sin_taylor_fp64(vec2 a) {\n  vec2 r, s, t, x;\n\n  if (a.x == 0.0 && a.y == 0.0) {\n    return vec2(0.0, 0.0);\n  }\n\n  x = -mul_fp64(a, a);\n  s = a;\n  r = a;\n\n  r = mul_fp64(r, x);\n  t = mul_fp64(r, INVERSE_FACTORIAL_3_FP64);\n  s = sum_fp64(s, t);\n\n  r = mul_fp64(r, x);\n  t = mul_fp64(r, INVERSE_FACTORIAL_5_FP64);\n  s = sum_fp64(s, t);\n\n\n\n\n\n\n  return s;\n}\n\nvec2 cos_taylor_fp64(vec2 a) {\n  vec2 r, s, t, x;\n\n  if (a.x == 0.0 && a.y == 0.0) {\n    return vec2(1.0, 0.0);\n  }\n\n  x = -mul_fp64(a, a);\n  r = x;\n  s = sum_fp64(vec2(1.0, 0.0), r * 0.5);\n\n  r = mul_fp64(r, x);\n  t = mul_fp64(r, INVERSE_FACTORIAL_4_FP64);\n  s = sum_fp64(s, t);\n\n  r = mul_fp64(r, x);\n  t = mul_fp64(r, INVERSE_FACTORIAL_6_FP64);\n  s = sum_fp64(s, t);\n\n\n\n\n\n\n  return s;\n}\n\nvoid sincos_taylor_fp64(vec2 a, out vec2 sin_t, out vec2 cos_t) {\n  if (a.x == 0.0 && a.y == 0.0) {\n    sin_t = vec2(0.0, 0.0);\n    cos_t = vec2(1.0, 0.0);\n  }\n\n  sin_t = sin_taylor_fp64(a);\n  cos_t = sqrt_fp64(sub_fp64(vec2(1.0, 0.0), mul_fp64(sin_t, sin_t)));\n}\n\nvec2 sin_fp64(vec2 a) {\n    if (a.x == 0.0 && a.y == 0.0) {\n        return vec2(0.0, 0.0);\n    }\n    vec2 z = nint_fp64(div_fp64(a, TWO_PI_FP64));\n    vec2 r = sub_fp64(a, mul_fp64(TWO_PI_FP64, z));\n\n    vec2 t;\n    float q = floor(r.x / PI_2_FP64.x + 0.5);\n    int j = int(q);\n\n    if (j < -2 || j > 2) {\n        return vec2(0.0 / 0.0, 0.0 / 0.0);\n    }\n\n    t = sub_fp64(r, mul_fp64(PI_2_FP64, vec2(q, 0.0)));\n\n    q = floor(t.x / PI_16_FP64.x + 0.5);\n    int k = int(q);\n\n    if (k == 0) {\n        if (j == 0) {\n            return sin_taylor_fp64(t);\n        } else if (j == 1) {\n            return cos_taylor_fp64(t);\n        } else if (j == -1) {\n            return -cos_taylor_fp64(t);\n        } else {\n            return -sin_taylor_fp64(t);\n        }\n    }\n\n    int abs_k = int(abs(float(k)));\n\n    if (abs_k > 4) {\n        return vec2(0.0 / 0.0, 0.0 / 0.0);\n    } else {\n        t = sub_fp64(t, mul_fp64(PI_16_FP64, vec2(q, 0.0)));\n    }\n\n    vec2 u = vec2(0.0, 0.0);\n    vec2 v = vec2(0.0, 0.0);\n\n#if defined(NVIDIA_FP64_WORKAROUND) || defined(INTEL_FP64_WORKAROUND)\n    if (abs(float(abs_k) - 1.0) < 0.5) {\n        u = COS_TABLE_0_FP64;\n        v = SIN_TABLE_0_FP64;\n    } else if (abs(float(abs_k) - 2.0) < 0.5) {\n        u = COS_TABLE_1_FP64;\n        v = SIN_TABLE_1_FP64;\n    } else if (abs(float(abs_k) - 3.0) < 0.5) {\n        u = COS_TABLE_2_FP64;\n        v = SIN_TABLE_2_FP64;\n    } else if (abs(float(abs_k) - 4.0) < 0.5) {\n        u = COS_TABLE_3_FP64;\n        v = SIN_TABLE_3_FP64;\n    }\n#else\n    if (abs_k == 1) {\n        u = COS_TABLE_0_FP64;\n        v = SIN_TABLE_0_FP64;\n    } else if (abs_k == 2) {\n        u = COS_TABLE_1_FP64;\n        v = SIN_TABLE_1_FP64;\n    } else if (abs_k == 3) {\n        u = COS_TABLE_2_FP64;\n        v = SIN_TABLE_2_FP64;\n    } else if (abs_k == 4) {\n        u = COS_TABLE_3_FP64;\n        v = SIN_TABLE_3_FP64;\n    }\n#endif\n\n    vec2 sin_t, cos_t;\n    sincos_taylor_fp64(t, sin_t, cos_t);\n\n\n\n    vec2 result = vec2(0.0, 0.0);\n    if (j == 0) {\n        if (k > 0) {\n            result = sum_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));\n        } else {\n            result = sub_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));\n        }\n    } else if (j == 1) {\n        if (k > 0) {\n            result = sub_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t));\n        } else {\n            result = sum_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t));\n        }\n    } else if (j == -1) {\n        if (k > 0) {\n            result = sub_fp64(mul_fp64(v, sin_t), mul_fp64(u, cos_t));\n        } else {\n            result = -sum_fp64(mul_fp64(v, sin_t), mul_fp64(u, cos_t));\n        }\n    } else {\n        if (k > 0) {\n            result = -sum_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));\n        } else {\n            result = sub_fp64(mul_fp64(v, cos_t), mul_fp64(u, sin_t));\n        }\n    }\n\n    return result;\n}\n\nvec2 cos_fp64(vec2 a) {\n    if (a.x == 0.0 && a.y == 0.0) {\n        return vec2(1.0, 0.0);\n    }\n    vec2 z = nint_fp64(div_fp64(a, TWO_PI_FP64));\n    vec2 r = sub_fp64(a, mul_fp64(TWO_PI_FP64, z));\n\n    vec2 t;\n    float q = floor(r.x / PI_2_FP64.x + 0.5);\n    int j = int(q);\n\n    if (j < -2 || j > 2) {\n        return vec2(0.0 / 0.0, 0.0 / 0.0);\n    }\n\n    t = sub_fp64(r, mul_fp64(PI_2_FP64, vec2(q, 0.0)));\n\n    q = floor(t.x / PI_16_FP64.x + 0.5);\n    int k = int(q);\n\n    if (k == 0) {\n        if (j == 0) {\n            return cos_taylor_fp64(t);\n        } else if (j == 1) {\n            return -sin_taylor_fp64(t);\n        } else if (j == -1) {\n            return sin_taylor_fp64(t);\n        } else {\n            return -cos_taylor_fp64(t);\n        }\n    }\n\n    int abs_k = int(abs(float(k)));\n\n    if (abs_k > 4) {\n        return vec2(0.0 / 0.0, 0.0 / 0.0);\n    } else {\n        t = sub_fp64(t, mul_fp64(PI_16_FP64, vec2(q, 0.0)));\n    }\n\n    vec2 u = vec2(0.0, 0.0);\n    vec2 v = vec2(0.0, 0.0);\n\n#if defined(NVIDIA_FP64_WORKAROUND) || defined(INTEL_FP64_WORKAROUND)\n    if (abs(float(abs_k) - 1.0) < 0.5) {\n        u = COS_TABLE_0_FP64;\n        v = SIN_TABLE_0_FP64;\n    } else if (abs(float(abs_k) - 2.0) < 0.5) {\n        u = COS_TABLE_1_FP64;\n        v = SIN_TABLE_1_FP64;\n    } else if (abs(float(abs_k) - 3.0) < 0.5) {\n        u = COS_TABLE_2_FP64;\n        v = SIN_TABLE_2_FP64;\n    } else if (abs(float(abs_k) - 4.0) < 0.5) {\n        u = COS_TABLE_3_FP64;\n        v = SIN_TABLE_3_FP64;\n    }\n#else\n    if (abs_k == 1) {\n        u = COS_TABLE_0_FP64;\n        v = SIN_TABLE_0_FP64;\n    } else if (abs_k == 2) {\n        u = COS_TABLE_1_FP64;\n        v = SIN_TABLE_1_FP64;\n    } else if (abs_k == 3) {\n        u = COS_TABLE_2_FP64;\n        v = SIN_TABLE_2_FP64;\n    } else if (abs_k == 4) {\n        u = COS_TABLE_3_FP64;\n        v = SIN_TABLE_3_FP64;\n    }\n#endif\n\n    vec2 sin_t, cos_t;\n    sincos_taylor_fp64(t, sin_t, cos_t);\n\n    vec2 result = vec2(0.0, 0.0);\n    if (j == 0) {\n        if (k > 0) {\n            result = sub_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t));\n        } else {\n            result = sum_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t));\n        }\n    } else if (j == 1) {\n        if (k > 0) {\n            result = -sum_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));\n        } else {\n            result = sub_fp64(mul_fp64(v, cos_t), mul_fp64(u, sin_t));\n        }\n    } else if (j == -1) {\n        if (k > 0) {\n            result = sum_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));\n        } else {\n            result = sub_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));\n        }\n    } else {\n        if (k > 0) {\n            result = sub_fp64(mul_fp64(v, sin_t), mul_fp64(u, cos_t));\n        } else {\n            result = -sum_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t));\n        }\n    }\n\n    return result;\n}\n\nvec2 tan_fp64(vec2 a) {\n    vec2 sin_a;\n    vec2 cos_a;\n\n    if (a.x == 0.0 && a.y == 0.0) {\n        return vec2(0.0, 0.0);\n    }\n    vec2 z = nint_fp64(div_fp64(a, TWO_PI_FP64));\n    vec2 r = sub_fp64(a, mul_fp64(TWO_PI_FP64, z));\n\n    vec2 t;\n    float q = floor(r.x / PI_2_FP64.x + 0.5);\n    int j = int(q);\n\n\n    if (j < -2 || j > 2) {\n        return vec2(0.0 / 0.0, 0.0 / 0.0);\n    }\n\n    t = sub_fp64(r, mul_fp64(PI_2_FP64, vec2(q, 0.0)));\n\n    q = floor(t.x / PI_16_FP64.x + 0.5);\n    int k = int(q);\n    int abs_k = int(abs(float(k)));\n\n    if (abs_k > 4) {\n        return vec2(0.0 / 0.0, 0.0 / 0.0);\n    } else {\n        t = sub_fp64(t, mul_fp64(PI_16_FP64, vec2(q, 0.0)));\n    }\n\n\n    vec2 u = vec2(0.0, 0.0);\n    vec2 v = vec2(0.0, 0.0);\n\n    vec2 sin_t, cos_t;\n    vec2 s, c;\n    sincos_taylor_fp64(t, sin_t, cos_t);\n\n    if (k == 0) {\n        s = sin_t;\n        c = cos_t;\n    } else {\n#if defined(NVIDIA_FP64_WORKAROUND) || defined(INTEL_FP64_WORKAROUND)\n        if (abs(float(abs_k) - 1.0) < 0.5) {\n            u = COS_TABLE_0_FP64;\n            v = SIN_TABLE_0_FP64;\n        } else if (abs(float(abs_k) - 2.0) < 0.5) {\n            u = COS_TABLE_1_FP64;\n            v = SIN_TABLE_1_FP64;\n        } else if (abs(float(abs_k) - 3.0) < 0.5) {\n            u = COS_TABLE_2_FP64;\n            v = SIN_TABLE_2_FP64;\n        } else if (abs(float(abs_k) - 4.0) < 0.5) {\n            u = COS_TABLE_3_FP64;\n            v = SIN_TABLE_3_FP64;\n        }\n#else\n        if (abs_k == 1) {\n            u = COS_TABLE_0_FP64;\n            v = SIN_TABLE_0_FP64;\n        } else if (abs_k == 2) {\n            u = COS_TABLE_1_FP64;\n            v = SIN_TABLE_1_FP64;\n        } else if (abs_k == 3) {\n            u = COS_TABLE_2_FP64;\n            v = SIN_TABLE_2_FP64;\n        } else if (abs_k == 4) {\n            u = COS_TABLE_3_FP64;\n            v = SIN_TABLE_3_FP64;\n        }\n#endif\n        if (k > 0) {\n            s = sum_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));\n            c = sub_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t));\n        } else {\n            s = sub_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));\n            c = sum_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t));\n        }\n    }\n\n    if (j == 0) {\n        sin_a = s;\n        cos_a = c;\n    } else if (j == 1) {\n        sin_a = c;\n        cos_a = -s;\n    } else if (j == -1) {\n        sin_a = -c;\n        cos_a = s;\n    } else {\n        sin_a = -s;\n        cos_a = -c;\n    }\n    return div_fp64(sin_a, cos_a);\n}\n\nvec2 radians_fp64(vec2 degree) {\n  return mul_fp64(degree, PI_180_FP64);\n}\n\nvec2 mix_fp64(vec2 a, vec2 b, float x) {\n  vec2 range = sub_fp64(b, a);\n  return sum_fp64(a, mul_fp64(range, vec2(x, 0.0)));\n}\n\nvoid vec2_sum_fp64(vec2 a[2], vec2 b[2], out vec2 out_val[2]) {\n    out_val[0] = sum_fp64(a[0], b[0]);\n    out_val[1] = sum_fp64(a[1], b[1]);\n}\n\nvoid vec2_sub_fp64(vec2 a[2], vec2 b[2], out vec2 out_val[2]) {\n    out_val[0] = sub_fp64(a[0], b[0]);\n    out_val[1] = sub_fp64(a[1], b[1]);\n}\n\nvoid vec2_mul_fp64(vec2 a[2], vec2 b[2], out vec2 out_val[2]) {\n    out_val[0] = mul_fp64(a[0], b[0]);\n    out_val[1] = mul_fp64(a[1], b[1]);\n}\n\nvoid vec2_div_fp64(vec2 a[2], vec2 b[2], out vec2 out_val[2]) {\n    out_val[0] = div_fp64(a[0], b[0]);\n    out_val[1] = div_fp64(a[1], b[1]);\n}\n\nvoid vec2_mix_fp64(vec2 x[2], vec2 y[2], float a, out vec2 out_val[2]) {\n  vec2 range[2];\n  vec2_sub_fp64(y, x, range);\n  vec2 portion[2];\n  portion[0] = range[0] * a;\n  portion[1] = range[1] * a;\n  vec2_sum_fp64(x, portion, out_val);\n}\n\nvec2 vec2_length_fp64(vec2 x[2]) {\n  return sqrt_fp64(sum_fp64(mul_fp64(x[0], x[0]), mul_fp64(x[1], x[1])));\n}\n\nvoid vec2_normalize_fp64(vec2 x[2], out vec2 out_val[2]) {\n  vec2 length = vec2_length_fp64(x);\n  vec2 length_vec2[2];\n  length_vec2[0] = length;\n  length_vec2[1] = length;\n\n  vec2_div_fp64(x, length_vec2, out_val);\n}\n\nvec2 vec2_distance_fp64(vec2 x[2], vec2 y[2]) {\n  vec2 diff[2];\n  vec2_sub_fp64(x, y, diff);\n  return vec2_length_fp64(diff);\n}\n\nvec2 vec2_dot_fp64(vec2 a[2], vec2 b[2]) {\n  vec2 v[2];\n\n  v[0] = mul_fp64(a[0], b[0]);\n  v[1] = mul_fp64(a[1], b[1]);\n\n  return sum_fp64(v[0], v[1]);\n}\nvoid vec3_sub_fp64(vec2 a[3], vec2 b[3], out vec2 out_val[3]) {\n  for (int i = 0; i < 3; i++) {\n    out_val[i] = sum_fp64(a[i], b[i]);\n  }\n}\n\nvoid vec3_sum_fp64(vec2 a[3], vec2 b[3], out vec2 out_val[3]) {\n  for (int i = 0; i < 3; i++) {\n    out_val[i] = sum_fp64(a[i], b[i]);\n  }\n}\n\nvec2 vec3_length_fp64(vec2 x[3]) {\n  return sqrt_fp64(sum_fp64(sum_fp64(mul_fp64(x[0], x[0]), mul_fp64(x[1], x[1])),\n    mul_fp64(x[2], x[2])));\n}\n\nvec2 vec3_distance_fp64(vec2 x[3], vec2 y[3]) {\n  vec2 diff[3];\n  vec3_sub_fp64(x, y, diff);\n  return vec3_length_fp64(diff);\n}\nvoid vec4_fp64(vec4 a, out vec2 out_val[4]) {\n  out_val[0].x = a[0];\n  out_val[0].y = 0.0;\n\n  out_val[1].x = a[1];\n  out_val[1].y = 0.0;\n\n  out_val[2].x = a[2];\n  out_val[2].y = 0.0;\n\n  out_val[3].x = a[3];\n  out_val[3].y = 0.0;\n}\n\nvoid vec4_scalar_mul_fp64(vec2 a[4], vec2 b, out vec2 out_val[4]) {\n  out_val[0] = mul_fp64(a[0], b);\n  out_val[1] = mul_fp64(a[1], b);\n  out_val[2] = mul_fp64(a[2], b);\n  out_val[3] = mul_fp64(a[3], b);\n}\n\nvoid vec4_sum_fp64(vec2 a[4], vec2 b[4], out vec2 out_val[4]) {\n  for (int i = 0; i < 4; i++) {\n    out_val[i] = sum_fp64(a[i], b[i]);\n  }\n}\n\nvoid vec4_dot_fp64(vec2 a[4], vec2 b[4], out vec2 out_val) {\n  vec2 v[4];\n\n  v[0] = mul_fp64(a[0], b[0]);\n  v[1] = mul_fp64(a[1], b[1]);\n  v[2] = mul_fp64(a[2], b[2]);\n  v[3] = mul_fp64(a[3], b[3]);\n\n  out_val = sum_fp64(sum_fp64(v[0], v[1]), sum_fp64(v[2], v[3]));\n}\n\nvoid mat4_vec4_mul_fp64(vec2 b[16], vec2 a[4], out vec2 out_val[4]) {\n  vec2 tmp[4];\n\n  for (int i = 0; i < 4; i++)\n  {\n    for (int j = 0; j < 4; j++)\n    {\n      tmp[j] = b[j + i * 4];\n    }\n    vec4_dot_fp64(a, tmp, out_val[i]);\n  }\n}\n";
exports.default = _default;
},{}],"bGYC":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "fp64ify", {
  enumerable: true,
  get: function () {
    return _fp64Utils.fp64ify;
  }
});
Object.defineProperty(exports, "fp64LowPart", {
  enumerable: true,
  get: function () {
    return _fp64Utils.fp64LowPart;
  }
});
Object.defineProperty(exports, "fp64ifyMatrix4", {
  enumerable: true,
  get: function () {
    return _fp64Utils.fp64ifyMatrix4;
  }
});
exports.fp64fs = exports.fp64arithmetic = exports.default = void 0;

var _fp64Utils = require("./fp64-utils");

var _fp64Arithmetic = _interopRequireDefault(require("./fp64-arithmetic.glsl"));

var _fp64Functions = _interopRequireDefault(require("./fp64-functions.glsl"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var fp64shader = "".concat(_fp64Arithmetic.default, "\n").concat(_fp64Functions.default);
var CONST_UNIFORMS = {
  // Used in LUMA_FP64_CODE_ELIMINATION_WORKAROUND
  ONE: 1.0
};

function getUniforms() {
  return Object.assign({}, CONST_UNIFORMS);
}

var _default = {
  name: 'fp64',
  vs: fp64shader,
  fs: null,
  fp64ify: _fp64Utils.fp64ify,
  fp64LowPart: _fp64Utils.fp64LowPart,
  fp64ifyMatrix4: _fp64Utils.fp64ifyMatrix4,
  getUniforms: getUniforms
}; // Arithmetic only

exports.default = _default;
var fp64arithmetic = {
  name: 'fp64-arithmetic',
  vs: "".concat(_fp64Arithmetic.default),
  fs: null
}; // Fragment shader fp64

exports.fp64arithmetic = fp64arithmetic;
var fp64fs = {
  name: 'fp64-fs',
  vs: null,
  fs: fp64shader
};
exports.fp64fs = fp64fs;
},{"./fp64-utils":"TZEe","./fp64-arithmetic.glsl":"aYgH","./fp64-functions.glsl":"rBJz"}],"EnWH":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _math = require("math.gl");

var IDENTITY_MATRIX = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
var DEFAULT_MODULE_OPTIONS = {
  modelMatrix: IDENTITY_MATRIX,
  viewMatrix: IDENTITY_MATRIX,
  projectionMatrix: IDENTITY_MATRIX,
  cameraPositionWorld: [0, 0, 0]
};

function getUniforms() {
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_MODULE_OPTIONS;
  var prevUniforms = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; // const viewProjectionInverse = viewProjection.invert();
  // viewInverseMatrix: view.invert(),
  // viewProjectionInverseMatrix: viewProjectionInverse

  var uniforms = {};

  if (opts.modelMatrix !== undefined) {
    uniforms.modelMatrix = opts.modelMatrix;
  }

  if (opts.viewMatrix !== undefined) {
    uniforms.viewMatrix = opts.viewMatrix;
  }

  if (opts.projectionMatrix !== undefined) {
    uniforms.projectionMatrix = opts.projectionMatrix;
  }

  if (opts.cameraPositionWorld !== undefined) {
    uniforms.cameraPositionWorld = opts.cameraPositionWorld;
  } // COMPOSITE UNIFORMS


  if (opts.projectionMatrix !== undefined || opts.viewMatrix !== undefined) {
    uniforms.viewProjectionMatrix = new _math.Matrix4(opts.projectionMatrix).multiplyRight(opts.viewMatrix);
  }

  return uniforms;
}

var common = "varying vec4 project_vPositionWorld;\nvarying vec3 project_vNormalWorld;\n\nvec4 project_getPosition_World() {\n  return project_vPositionWorld;\n}\n\nvec3 project_getNormal_World() {\n  return project_vNormalWorld;\n}\n";
var vs = "".concat(common, "\nuniform mat4 modelMatrix;\nuniform mat4 viewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewProjectionMatrix;\nuniform vec3 cameraPositionWorld;\n\nstruct World {\n  vec3 position;\n  vec3 normal;\n};\n\nWorld world;\n\nvoid project_setPosition(vec4 position) {\n  project_vPositionWorld = position;\n}\n\nvoid project_setNormal(vec3 normal) {\n  project_vNormalWorld = normal;\n}\n\nvoid project_setPositionAndNormal_World(vec3 position, vec3 normal) {\n  world.position = position;\n  world.normal = normal;\n}\n\nvoid project_setPositionAndNormal_Model(vec3 position, vec3 normal) {\n  world.position = (modelMatrix * vec4(position, 1.)).xyz;\n  world.normal = mat3(modelMatrix) * normal;\n}\n\nvec4 project_model_to_clipspace(vec4 position) {\n  return viewProjectionMatrix * modelMatrix * position;\n}\n\nvec4 project_model_to_clipspace(vec3 position) {\n  return viewProjectionMatrix * modelMatrix * vec4(position, 1.);\n}\n\nvec4 project_world_to_clipspace(vec3 position) {\n  return viewProjectionMatrix * vec4(position, 1.);\n}\n\nvec4 project_view_to_clipspace(vec3 position) {\n  return projectionMatrix * vec4(position, 1.);\n}\n\nvec4 project_to_clipspace(vec3 position) {\n  return viewProjectionMatrix * vec4(position, 1.);\n}\n");
var fs = "\n".concat(common);
var _default = {
  name: 'project',
  getUniforms: getUniforms,
  vs: vs,
  fs: fs
};
exports.default = _default;
},{"math.gl":"dl2t"}],"DNqo":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _default = "\n";
exports.default = _default;
},{}],"khCV":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _default = "#define LIGHT_MAX 4\n\nuniform bool lighting_uEnableLights;\nuniform vec3 lighting_uAmbientColor;\nuniform vec3 lighting_uDirection;\nuniform vec3 lighting_uDirectionalColor;\nuniform int  lighting_uPointCount;\nuniform vec3 lighting_uPointLocation[LIGHT_MAX];\nuniform vec3 lighting_uPointColor[LIGHT_MAX];\nuniform bool lighting_uEnableReflections;\nvarying vec4 lighting_vPosition;\nvarying vec4 lighting_vNormal;\nvarying vec3 lighting_vColor;\nvarying vec3 lighting_vLightWeighting;\nvarying vec3 lighting_vReflection;\n\nvoid lighting_setPositionAndNormal(vec3 position, vec3 normal) {\n  lighting_vPosition = worldMatrix * vec4(position, 1.);\n  lighting_vNormal = worldInverseTransposeMatrix * vec4(normal, 1.);;\n}\n\nvoid lighting__getLightWeigting() {\n  float directionalLightWeighting = max(dot(lighting_vNormal.xyz, lighting_uDirection), 0.);\n  vec3 pointWeight = vec3(0., 0., 0.);\n  for (int i = 0; i < LIGHT_MAX; i++) {\n    if (i < numberPoints) {\n      vec4 mvLightPosition = viewMatrix * vec4(lighting_uPointLocation[i], 1.);\n      vec3 pointLightDirection = normalize(mvLightPosition.xyz - lighting_vPosition.xyz);\n      pointWeight += max(dot(lighting_vNormal.xyz, pointLightDirection), 0.) * pointColor[i];\n     } else {\n       break;\n     }\n   }\n   return ambientColor + (directionalColor * directionalLightWeighting) + pointWeight;\n}\n\nvoid lighting_apply(vec3 position, vec3 normal) {\n  lighting_setPositionAndNormal(position, normal);\n  if(!lighting_uEnableLights) {\n    lighting_vLightWeighting = vec3(1., 1., 1.);\n  } else {\n    lighting_vLightWeighting = lighting__getLightWeighting();\n  }\n}\n\nvoid lighting_set_reflection(vec3 position) {\n  if (lighting_uEnableReflections) {\n    lighting_vReflection = (viewInverseMatrix[3] - (worldMatrix * vec4(position, 1.))).xyz;\n  } else {\n    lighting_vReflection = vec3(1., 1., 1.);\n  }\n}\n";
exports.default = _default;
},{}],"WmqL":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _default = "precision highp float;\n\n#define LIGHT_MAX 4\n\nvarying vec3 lighting_vLightWeighting;\n\nvec4 lighting_apply(vec4 color) {\n  return vec4(color.rgb * lighting_vLightWeighting, color.a);\n}\n\nuniform mat4 viewMatrix;\n\n\nvarying vec4 lighting_vColor;\nvarying vec4 lighting_vTransformedNormal;\nvarying vec4 lighting_vPosition;\n\nuniform float shininess;\nuniform bool enableSpecularMap;\nuniform bool enableLights;\n\nuniform vec3 ambientColor;\nuniform vec3 directionalColor;\nuniform vec3 lightingDirection;\n\nuniform vec3 lighting_uPointLocation[LIGHT_MAX];\nuniform vec3 lighting_uPointColor[LIGHT_MAX];\nuniform float lighting_uPointSpecularEnable[LIGHT_MAX];\nuniform vec3 lighting_uPointSpecularColor[LIGHT_MAX];\nuniform int numberPoints;\n\n\nvec3 lighting__calculate_light_weighting() {\n\treturn lighting__calculate_light_weighting(shininess);\n}\n\nvec3 lighting__calculate_light_weighting(shininess) {\n  vec3 normal = vTransformedNormal.xyz;\n  vec3 eyeDirection = normalize(-vPosition.xyz);\n\n  vec3 specularLight = vec3(0., 0., 0.);\n  vec3 diffuseLight = vec3(0., 0., 0.);\n\n  for (int i = 0; i < LIGHT_MAX; i++) {\n    if (i < numberPoints) {\n      vec3 transformedPointLocation = (viewMatrix * vec4(lighting_uPointLocation[i], 1.0)).xyz;\n      vec3 lightDirection = normalize(transformedPointLocation - vPosition.xyz);\n\n      if (lighting_uPointSpecularEnable > 0.) {\n        vec3 reflectionDirection = reflect(-lightDirection, normal);\n        float specularLightWeighting =\n          pow(max(dot(reflectionDirection, eyeDirection), 0.0), shininessVal);\n        specularLight += specularLightWeighting * lighting_uPointSpecularColor[i];\n      }\n\n      float diffuseLightWeighting = max(dot(normal, lightDirection), 0.0);\n      diffuseLight += diffuseLightWeighting * lighting_uPointColor[i];\n    } else {\n      break;\n    }\n  }\n\n  return ambientColor + diffuseLight + specularLight;\n}\n\nvoid lighting_filterColor(fragmentColor) {\n  if (!lighting_enable) {\n  \treturn fragmentColor;\n  } else {\n  \tvec3 lightWeighting = lighting__calculate_light_weighting();\n  \treturn vec4(fragmentColor.rgb * lightWeighting, fragmentColor.a);\n  }\n}\n\nuniform vec3 material_uAmbientColor;\nuniform vec3 material_uDiffuseColor;\nuniform vec3 material_uSpecularColor;\nuniform vec3 material_uEmissiveColor;\n\nuniform bool hasTexture1;\nuniform sampler2D sampler1;\n\nuniform mat4 viewMatrix;\n\nvoid apply_lighting(color) {\n  vec3 ambientLightWeighting = ambientColor;\n\n  vec3 normal = vTransformedNormal.xyz;\n  vec3 eyeDirection = normalize(-vPosition.xyz);\n\n  vec3 specularLight = vec3(0.0, 0.0, 0.0);\n  vec3 diffuseLight = vec3(0.0, 0.0, 0.0);\n\n  for (int i = 0; i < LIGHT_MAX; i++) {\n    if (i < numberPoints) {\n      vec3 transformedPointLocation = (viewMatrix * vec4(pointLocation[i], 1.0)).xyz;\n      vec3 lightDirection = normalize(transformedPointLocation - vPosition.xyz);\n\n      if (enableSpecularHighlights) {\n        vec3 reflectionDirection = reflect(-lightDirection, normal);\n        float specularLightWeighting =\n          pow(max(dot(reflectionDirection, eyeDirection), 0.0), shininess);\n        specularLight += specularLightWeighting * pointSpecularColor[i];\n      }\n\n      float diffuseLightWeighting = max(dot(normal, lightDirection), 0.0);\n      diffuseLight += diffuseLightWeighting * pointColor[i];\n    } else {\n        break;\n    }\n  }\n\n  vec3 matAmbientColor = material_uAmbientColor * color.rgb;\n  vec3 matDiffuseColor = material_uDiffuseColor * color.rgb;\n  vec3 matSpecularColor = material_uSpecularColor * color.rgb;\n  vec3 matEmissiveColor = material_uEmissiveColor * color.rgb;\n  gl_FragColor = vec4(\n    matAmbientColor * ambientLightWeighting\n    + matDiffuseColor * diffuseLightWeighting\n    + matSpecularColor * specularLightWeighting\n    + matEmissiveColor,\n    color.a\n  );\n}\n\n  vec3 lightWeighting;\n  if (!enableLights) {\n    lightWeighting = vec3(1.0, 1.0, 1.0);\n  } else {\n    vec3 lightDirection;\n    float specularLightWeighting = 0.0;\n    float diffuseLightWeighting = 0.0;\n    vec3  specularLight = vec3(0.0, 0.0, 0.0);\n    vec3  diffuseLight = vec3(0.0, 0.0, 0.0);\n\n    vec3 transformedPointLocation;\n    vec3 normal = vTransformedNormal.xyz;\n\n    vec3 eyeDirection = normalize(-vPosition.xyz);\n    vec3 reflectionDirection;\n\n    vec3 pointWeight = vec3(0.0, 0.0, 0.0);\n\n    for (int i = 0; i < LIGHT_MAX; i++) {\n      if (i < numberPoints) {\n        transformedPointLocation = (viewMatrix * vec4(pointLocation[i], 1.0)).xyz;\n        lightDirection = normalize(transformedPointLocation - vPosition.xyz);\n\n        if (enableSpecular[i] > 0.0) {\n          reflectionDirection = reflect(-lightDirection, normal);\n          specularLightWeighting = pow(max(dot(reflectionDirection, eyeDirection), 0.0), shininess);\n          specularLight += specularLightWeighting * pointSpecularColor[i];\n        }\n\n        diffuseLightWeighting = max(dot(normal, lightDirection), 0.0);\n        diffuseLight += diffuseLightWeighting * pointColor[i];\n      } else {\n        break;\n      }\n    }\n\n    lightWeighting = ambientColor + diffuseLight + specularLight;\n  }\nuniform float reflection;\nuniform float refraction;\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
exports.default = _default;
},{}],"Zq4p":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getUniforms = getUniforms;
exports.default = exports.config = exports.name = exports.fragmentShader = exports.vertexShader = void 0;

var _math = require("math.gl");

var _lightingCommon = _interopRequireDefault(require("./lighting-common.glsl"));

var _lightingVertex = _interopRequireDefault(require("./lighting-vertex.glsl"));

var _lightingFragment = _interopRequireDefault(require("./lighting-fragment.glsl"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var vertexShader = "".concat(_lightingCommon.default, "\n").concat(_lightingVertex.default, "\n");
exports.vertexShader = vertexShader;
var fragmentShader = "".concat(_lightingCommon.default, "\n").concat(_lightingFragment.default, "\n");
exports.fragmentShader = fragmentShader;
var name = 'lighting';
exports.name = name;
var config = {
  MAX_POINT_LIGHTS: 4
}; // Setup the lighting system: ambient, directional, point lights.

exports.config = config;

function getUniforms(_ref) {
  var _ref$lightingEnable = _ref.lightingEnable,
      lightingEnable = _ref$lightingEnable === void 0 ? false : _ref$lightingEnable,
      _ref$lightingAmbientC = _ref.lightingAmbientColor,
      lightingAmbientColor = _ref$lightingAmbientC === void 0 ? [0.2, 0.2, 0.2] : _ref$lightingAmbientC,
      _ref$lightingDirectio = _ref.lightingDirection,
      lightingDirection = _ref$lightingDirectio === void 0 ? [1, 1, 1] : _ref$lightingDirectio,
      _ref$lightingDirectio2 = _ref.lightingDirectionalColor,
      lightingDirectionalColor = _ref$lightingDirectio2 === void 0 ? [0, 0, 0] : _ref$lightingDirectio2,
      _ref$lightingPointLig = _ref.lightingPointLights,
      lightingPointLights = _ref$lightingPointLig === void 0 ? [] : _ref$lightingPointLig; // Set light uniforms. Ambient, directional and point lights.

  return Object.assign({
    lightingEnable: lightingEnable,
    // Ambient
    lightingAmbientColor: lightingAmbientColor
  }, getDirectionalUniforms(lightingDirection), getPointUniforms(lightingPointLights));
}

function getDirectionalUniforms(_ref2) {
  var color = _ref2.color,
      direction = _ref2.direction; // Normalize lighting direction vector

  var dir = new _math.Vector3(direction.x, direction.y, direction.z).normalize().scale(-1, -1, -1);
  return {
    directionalColor: [color.r, color.g, color.b],
    lightingDirection: [dir.x, dir.y, dir.z]
  };
}

function getPointUniforms(points) {
  points = points instanceof Array ? points : [points];
  var numberPoints = points.length;
  var pointLocations = [];
  var pointColors = [];
  var enableSpecular = [];
  var pointSpecularColors = [];
  var _iteratorNormalCompletion = true;
  var _didIteratorError = false;
  var _iteratorError = undefined;

  try {
    for (var _iterator = points[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
      var point = _step.value;
      var position = point.position,
          color = point.color,
          diffuse = point.diffuse,
          specular = point.specular;
      var pointColor = color || diffuse;
      pointLocations.push(position.x, position.y, position.z);
      pointColors.push(pointColor.r, pointColor.g, pointColor.b); // Add specular color

      enableSpecular.push(Number(Boolean(specular)));

      if (specular) {
        pointSpecularColors.push(specular.r, specular.g, specular.b);
      } else {
        pointSpecularColors.push(0, 0, 0);
      }
    }
  } catch (err) {
    _didIteratorError = true;
    _iteratorError = err;
  } finally {
    try {
      if (!_iteratorNormalCompletion && _iterator.return != null) {
        _iterator.return();
      }
    } finally {
      if (_didIteratorError) {
        throw _iteratorError;
      }
    }
  }

  return {
    numberPoints: numberPoints,
    pointLocation: pointLocations,
    pointColor: pointColors,
    enableSpecular: enableSpecular,
    pointSpecularColor: pointSpecularColors
  };
}

var _default = {
  name: name,
  vs: vertexShader,
  fs: fragmentShader,
  getUniforms: getUniforms
};
exports.default = _default;
},{"math.gl":"dl2t","./lighting-common.glsl":"DNqo","./lighting-vertex.glsl":"khCV","./lighting-fragment.glsl":"WmqL"}],"PhBq":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _project = _interopRequireDefault(require("../project/project"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Cheap lighting - single directional light, single dot product, one uniform

/* eslint-disable camelcase */
var DEFAULT_LIGHT_DIRECTION = new Float32Array([1, 1, 2]);
var DEFAULT_MODULE_OPTIONS = {
  lightDirection: DEFAULT_LIGHT_DIRECTION
};

function getUniforms() {
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_MODULE_OPTIONS;
  var uniforms = {};

  if (opts.lightDirection) {
    uniforms.dirlight_uLightDirection = opts.lightDirection;
  }

  return uniforms;
} // TODO - reuse normal from geometry module


var vs = null;
var fs = "uniform vec3 dirlight_uLightDirection;\nvec4 dirlight_filterColor(vec4 color) {\n  vec3 normal = project_getNormal_World();\n  float d = abs(dot(normalize(normal), normalize(dirlight_uLightDirection)));\n  return vec4(color.rgb * d, color.a);\n}\n";
var _default = {
  name: 'dirlight',
  vs: vs,
  fs: fs,
  getUniforms: getUniforms,
  dependencies: [_project.default]
};
exports.default = _default;
},{"../project/project":"EnWH"}],"ShTP":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var DEFAULT_HIGHLIGHT_COLOR = new Uint8Array([0, 255, 255, 255]);
var DEFAULT_MODULE_OPTIONS = {
  pickingSelectedColor: null,
  //  Set to a picking color to visually highlight that item
  pickingHighlightColor: DEFAULT_HIGHLIGHT_COLOR,
  // Color of visual highlight of "selected" item
  pickingThreshold: 1.0,
  pickingActive: false // Set to true when rendering to off-screen "picking" buffer

};
/* eslint-disable camelcase */

function getUniforms() {
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_MODULE_OPTIONS;
  var uniforms = {};

  if (opts.pickingSelectedColor !== undefined) {
    if (opts.pickingSelectedColor === null) {
      uniforms.picking_uSelectedColorValid = 0;
    } else {
      var selectedColor = [opts.pickingSelectedColor[0], opts.pickingSelectedColor[1], opts.pickingSelectedColor[2]];
      uniforms.picking_uSelectedColorValid = 1;
      uniforms.picking_uSelectedColor = selectedColor;
    }
  }

  if (opts.pickingHighlightColor !== undefined) {
    uniforms.picking_uHighlightColor = opts.pickingHighlightColor;
  } // TODO - major hack - decide on normalization and remove


  if (opts.pickingThreshold !== undefined) {
    uniforms.picking_uThreshold = opts.pickingThreshold;
  }

  if (opts.pickingActive !== undefined) {
    uniforms.picking_uActive = opts.pickingActive ? 1 : 0;
  }

  return uniforms;
}

var vs = "uniform vec3 picking_uSelectedColor;\nuniform float picking_uThreshold;\nuniform bool picking_uSelectedColorValid;\n\nout vec4 picking_vRGBcolor_Aselected;\n\nconst float COLOR_SCALE = 1. / 255.;\n\nbool isVertexPicked(vec3 vertexColor) {\n  return\n    picking_uSelectedColorValid &&\n    abs(vertexColor.r - picking_uSelectedColor.r) < picking_uThreshold &&\n    abs(vertexColor.g - picking_uSelectedColor.g) < picking_uThreshold &&\n    abs(vertexColor.b - picking_uSelectedColor.b) < picking_uThreshold;\n}\n\nvoid picking_setPickingColor(vec3 pickingColor) {\n  picking_vRGBcolor_Aselected.a =\n    float(isVertexPicked(pickingColor));\n  picking_vRGBcolor_Aselected.rgb = pickingColor * COLOR_SCALE;\n}\n";
var fs = "uniform bool picking_uActive;\nuniform vec3 picking_uSelectedColor;\nuniform vec4 picking_uHighlightColor;\n\nin vec4 picking_vRGBcolor_Aselected;\n\nconst float COLOR_SCALE = 1. / 255.;\nvec4 picking_filterHighlightColor(vec4 color) {\n  bool selected = bool(picking_vRGBcolor_Aselected.a);\n\n  if (selected) {\n    vec4 highLightColor = picking_uHighlightColor * COLOR_SCALE;\n\n    float highLightAlpha = highLightColor.a;\n    float blendedAlpha = highLightAlpha + color.a * (1.0 - highLightAlpha);\n    float highLightRatio = highLightAlpha / blendedAlpha;\n\n    vec3 blendedRGB = mix(color.rgb, highLightColor.rgb, highLightRatio);\n    return vec4(blendedRGB, blendedAlpha);\n  } else {\n    return color;\n  }\n}\nvec4 picking_filterPickingColor(vec4 color) {\n  vec3 pickingColor = picking_vRGBcolor_Aselected.rgb;\n  if (picking_uActive && length(pickingColor) < 0.001) {\n    discard;\n  }\n  return picking_uActive ? vec4(pickingColor, 1.0) : color;\n}\nvec4 picking_filterColor(vec4 color) {\n  vec4 highightColor = picking_filterHighlightColor(color);\n  return picking_filterPickingColor(highightColor);\n}\n\n";
var _default = {
  name: 'picking',
  vs: vs,
  fs: fs,
  getUniforms: getUniforms
};
exports.default = _default;
},{}],"Wm5i":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Minimal texture (diffuse map) support

/* eslint-disable camelcase */
var DEFAULT_MODULE_OPTIONS = {
  diffuseTexture: null,
  diffuseColor: [0.5, 0.5, 0.5, 1]
};

function getUniforms() {
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_MODULE_OPTIONS;
  var uniforms = {};

  if (opts.diffuseTexture !== undefined) {
    uniforms.diffuse_uHasTexture = Boolean(opts.diffuseTexture);
    uniforms.diffuse_uTexture = opts.diffuseTexture;
  }

  if (opts.diffuseColor !== undefined) {
    uniforms.diffuse_uColor = opts.diffuseColor;
  }

  return uniforms;
}

var vs = "out vec2 diffuse_vTexCoord;\nvoid diffuse_setTextureCoordinate(vec2 uv) {\n  diffuse_vTexCoord = uv;\n}\n";
var fs = "uniform vec4 diffuse_uColor;\nuniform bool diffuse_uHasTexture;\nuniform sampler2D diffuse_uTexture;\n\nin vec2 diffuse_vTexCoord;\n\n\n\nvec4 diffuse_getColor() {\n  vec2 texCoord = diffuse_vTexCoord;\n  return diffuse_uHasTexture ?\n    texture2D(diffuse_uTexture, vec2(texCoord.s, texCoord.t)) :\n    diffuse_uColor;\n}\n\nvec4 diffuse_filterColor(vec4 color) {\n  return diffuse_getColor();\n}\n";
var _default = {
  name: 'diffuse',
  getUniforms: getUniforms,
  vs: vs,
  fs: fs
};
exports.default = _default;
},{}],"ogd7":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getQualifierDetails = getQualifierDetails;
exports.getPassthroughFS = getPassthroughFS;
exports.typeToChannelSuffix = typeToChannelSuffix;
exports.typeToChannelCount = typeToChannelCount;
exports.convertToVec4 = convertToVec4;

var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));

var _assert = _interopRequireDefault(require("assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var FS100 = 'void main() {}';
var FS300 = "#version 300 es\n".concat(FS100); // Prase given glsl line and return qualifier details or null

function getQualifierDetails(line, qualifiers) {
  qualifiers = Array.isArray(qualifiers) ? qualifiers : [qualifiers];
  var words = line.replace(/^\s+/, '').split(/\s+/); // TODO add support for precession qualifiers (highp, mediump and lowp)

  var _words = (0, _slicedToArray2.default)(words, 3),
      qualifier = _words[0],
      type = _words[1],
      definition = _words[2];

  if (!qualifiers.includes(qualifier) || !type || !definition) {
    return null;
  }

  var name = definition.split(';')[0];
  return {
    qualifier: qualifier,
    type: type,
    name: name
  };
} // Given the shader version, input and output variable names,
// builds and return a pass through fragment shader.


function getPassthroughFS() {
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
      _ref$version = _ref.version,
      version = _ref$version === void 0 ? 100 : _ref$version,
      input = _ref.input,
      inputType = _ref.inputType,
      output = _ref.output;

  if (!input) {
    return version === 300 ? FS300 : FS100;
  }

  var outputValue = convertToVec4(input, inputType);

  if (version === 300) {
    return "#version 300 es\nin ".concat(inputType, " ").concat(input, ";\nout vec4 ").concat(output, ";\nvoid main() {\n  ").concat(output, " = ").concat(outputValue, ";\n}");
  } // version 100


  return "varying ".concat(inputType, " ").concat(input, ";\nvoid main() {\n  gl_FragColor = ").concat(outputValue, ";\n}");
} // convert glsl type to suffix


function typeToChannelSuffix(type) {
  switch (type) {
    case 'float':
      return 'x';

    case 'vec2':
      return 'xy';

    case 'vec3':
      return 'xyz';

    case 'vec4':
      return 'xyzw';

    default:
      (0, _assert.default)(false);
      return null;
  }
} // convert glsl type to channel count


function typeToChannelCount(type) {
  switch (type) {
    case 'float':
      return 1;

    case 'vec2':
      return 2;

    case 'vec3':
      return 3;

    case 'vec4':
      return 4;

    default:
      (0, _assert.default)(false);
      return null;
  }
} // Returns glsl instruction for converting to vec4


function convertToVec4(variable, type) {
  switch (type) {
    case 'float':
      return "vec4(".concat(variable, ", 0.0, 0.0, 1.0)");

    case 'vec2':
      return "vec4(".concat(variable, ", 0.0, 1.0)");

    case 'vec3':
      return "vec4(".concat(variable, ", 1.0)");

    case 'vec4':
      return variable;

    default:
      (0, _assert.default)(false);
      return null;
  }
}
},{"@babel/runtime/helpers/esm/slicedToArray":"U1JK","assert":"AoLc"}],"LqzU":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Private shader module used by `Transform`
var vs = "attribute float transform_elementID;\nvec2 transform_getPixelSizeHalf(vec2 size) {\n  return vec2(1.) / (2. * size);\n}\n\nvec2 transform_getPixelIndices(vec2 texSize, vec2 pixelSizeHalf) {\n  float yIndex = floor((transform_elementID / texSize[0]) + pixelSizeHalf[1]);\n  float xIndex = transform_elementID - (yIndex * texSize[0]);\n  return vec2(xIndex, yIndex);\n}\nvec2 transform_getTexCoord(vec2 size) {\n  vec2 pixelSizeHalf = transform_getPixelSizeHalf(size);\n  vec2 indices = transform_getPixelIndices(size, pixelSizeHalf);\n  vec2 coord = indices / size + pixelSizeHalf;\n  return coord;\n}\nvec2 transform_getPos(vec2 size) {\n  vec2 texCoord = transform_getTexCoord(size);\n  vec2 pos = (texCoord * (2.0, 2.0)) - (1., 1.);\n  return pos;\n}\nvec4 transform_getInput(sampler2D texSampler, vec2 size) {\n  vec2 texCoord = transform_getTexCoord(size);\n  vec4 textureColor = texture2D(texSampler, texCoord);\n  return textureColor;\n}\n";
var _default = {
  name: 'transform',
  vs: vs,
  fs: null
};
exports.default = _default;
},{}],"xR5I":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "assembleShaders", {
  enumerable: true,
  get: function () {
    return _assembleShaders.assembleShaders;
  }
});
Object.defineProperty(exports, "registerShaderModules", {
  enumerable: true,
  get: function () {
    return _resolveModules.registerShaderModules;
  }
});
Object.defineProperty(exports, "setDefaultShaderModules", {
  enumerable: true,
  get: function () {
    return _resolveModules.setDefaultShaderModules;
  }
});
Object.defineProperty(exports, "combineInjects", {
  enumerable: true,
  get: function () {
    return _injectShader.combineInjects;
  }
});
Object.defineProperty(exports, "fp32", {
  enumerable: true,
  get: function () {
    return _fp.default;
  }
});
Object.defineProperty(exports, "fp64", {
  enumerable: true,
  get: function () {
    return _fp2.default;
  }
});
Object.defineProperty(exports, "project", {
  enumerable: true,
  get: function () {
    return _project.default;
  }
});
Object.defineProperty(exports, "lighting", {
  enumerable: true,
  get: function () {
    return _lighting.default;
  }
});
Object.defineProperty(exports, "dirlight", {
  enumerable: true,
  get: function () {
    return _dirlight.default;
  }
});
Object.defineProperty(exports, "picking", {
  enumerable: true,
  get: function () {
    return _picking.default;
  }
});
Object.defineProperty(exports, "diffuse", {
  enumerable: true,
  get: function () {
    return _diffuse.default;
  }
});
Object.defineProperty(exports, "getQualifierDetails", {
  enumerable: true,
  get: function () {
    return _shaderUtils.getQualifierDetails;
  }
});
Object.defineProperty(exports, "getPassthroughFS", {
  enumerable: true,
  get: function () {
    return _shaderUtils.getPassthroughFS;
  }
});
Object.defineProperty(exports, "typeToChannelSuffix", {
  enumerable: true,
  get: function () {
    return _shaderUtils.typeToChannelSuffix;
  }
});
Object.defineProperty(exports, "typeToChannelCount", {
  enumerable: true,
  get: function () {
    return _shaderUtils.typeToChannelCount;
  }
});
Object.defineProperty(exports, "convertToVec4", {
  enumerable: true,
  get: function () {
    return _shaderUtils.convertToVec4;
  }
});
Object.defineProperty(exports, "_transform", {
  enumerable: true,
  get: function () {
    return _transform.default;
  }
});

var _assembleShaders = require("./lib/assemble-shaders");

var _resolveModules = require("./lib/resolve-modules");

var _injectShader = require("./lib/inject-shader");

var _fp = _interopRequireDefault(require("./modules/fp32/fp32"));

var _fp2 = _interopRequireDefault(require("./modules/fp64/fp64"));

var _project = _interopRequireDefault(require("./modules/project/project"));

var _lighting = _interopRequireDefault(require("./modules/lighting/lighting"));

var _dirlight = _interopRequireDefault(require("./modules/dirlight/dirlight"));

var _picking = _interopRequireDefault(require("./modules/picking/picking"));

var _diffuse = _interopRequireDefault(require("./modules/diffuse/diffuse"));

var _shaderUtils = require("./utils/shader-utils");

var _transform = _interopRequireDefault(require("./modules/transform/transform"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./lib/assemble-shaders":"xBou","./lib/resolve-modules":"oOWu","./lib/inject-shader":"NLS8","./modules/fp32/fp32":"oP7N","./modules/fp64/fp64":"bGYC","./modules/project/project":"EnWH","./modules/lighting/lighting":"Zq4p","./modules/dirlight/dirlight":"PhBq","./modules/picking/picking":"ShTP","./modules/diffuse/diffuse":"Wm5i","./utils/shader-utils":"ogd7","./modules/transform/transform":"LqzU"}],"Kyly":[function(require,module,exports) {
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

// Copyright (c) 2017 Uber Technologies, Inc.
//
// 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.

var isBrowser = typeof window !== 'undefined' && window.addEventListener;

var timers = new Map();

/**
 * Ready check for Seer initialization
 *
 * @returns {Boolean}
 */
var isReady = function isReady() {
  return isBrowser && window.__SEER_INITIALIZED__;
};

/**
 * Utility method allowing to throttle a user action based on a key and a minimun delay.
 *
 * @param key {String} A unique key
 * @param delay {Number} The minimal delay to throttle
 * @returns {Boolean}
 */
var throttle = function throttle(key, delay) {
  var time = timers.get(key);
  var now = Date.now();
  if (time && now - time < delay) {
    return true;
  }
  timers.set(key, now);
  return false;
};

var replacer = function replacer(seen) {
  return function (key, value) {
    if (value && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && seen.has(value)) {
      return;
    }
    seen.add(value);
    var isArray = Object.prototype.toString.call(value).slice(8, -1).includes('Array');
    if (isArray) {
      return Array.prototype.slice.call(value, 0, 20);
    }
    return value;
  };
};

/**
 * Low-level api leveraging window.postMessage
 *
 * @param type {String} The action type
 * @param payload {Any} The action payload
 */
var send = function send(type) {
  var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

  if (!isBrowser || !isReady()) {
    return;
  }

  var seen = new Set();
  var payload = JSON.stringify(data, replacer(seen));

  try {
    window.postMessage({ type: type, payload: payload, source: 'seer-agent' }, '*');
  } catch (e) {
    if (throttle('seer-log', 2E3)) {
      return;
    }
    console.log(e); // eslint-disable-line
  }
};

var listeners = new Map();

var listener = function listener(message) {
  if (!message || !message.data || message.data.source !== 'seer-core') {
    return;
  }
  var _message$data = message.data,
      type = _message$data.type,
      payload = _message$data.payload;


  var typeListeners = listeners.get(type);
  if (typeListeners) {
    typeListeners.forEach(function (cb) {
      return cb(payload);
    });
  }
};

/**
 * Initilize window listener. There will be only one for the whole process
 * to prevent too many registrations.
 *
 * This method will be called automatically if you use the `listenFor` method.
 */
var init = function init() {
  if (!isBrowser || window.__SEER_LISTENER__) {
    return;
  }
  window.addEventListener('message', listener);
  window.__SEER_LISTENER__ = true;
};

/**
 * Clean listener. Can be useful in case you want to unregister upcoming events
 * or liberate memory.
 */
var clean = function clean() {
  if (!isBrowser || !window.__SEER_LISTENER__) {
    return;
  }
  window.removeEventListener('message', listener);
  delete window.__SEER_LISTENER__;
};

/**
 * Create a listener that will be called upon events of the given key.
 *
 * @param key {String} The unique tab key
 * @param cb {Function} A callback that will receive the message payload
 */
var listenFor = function listenFor(type, cb) {
  if (!isBrowser) {
    return;
  }
  if (!type || !cb) {
    throw new Error('Please provide a type and callback');
  }
  if (!listeners.has(type)) {
    listeners.set(type, []);
  }
  if (!window.__SEER_LISTENER__) {
    init();
  }
  listeners.get(type).push(cb);
};

/**
 * Remove an identity listener
 *
 * @param cb {Function} The callback to remove
 */
var removeListener = function removeListener(cb) {
  listeners.forEach(function (typeListeners, key) {
    listeners.set(key, typeListeners.filter(function (l) {
      return l !== cb;
    }));
  });
};

/**
 * Creates a new indexed list.
 * It works by index to get O(1) accessing and performance.
 *
 * @param key {String} The key of the tab
 * @param data {Object} The indexed object
 */
var list = function list(key, data) {
  return send('LIST', { key: key, data: data });
};

/**
 * Creates an element in the indexed list, based on the itemKey.
 *
 * @param key {String} The key of the tab
 * @param itemKey {String} The key of the item
 * @param data {Any} The value of the item
 */
var listItem = function listItem(key, itemKey) {
  var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  return send('LIST_ITEM', { key: key, itemKey: itemKey, data: data });
};

/**
 * Update an item property, can be deeply nested.
 *
 * @param key {String} The key of the tab
 * @param itemKey {String} The key of the item
 * @param path {String} The path of the variable you want to update
 * @param data {Object} The new value
 */
var updateItem = function updateItem(key, itemKey, path, data) {
  return send('UPDATE_ITEM', { key: key, itemKey: itemKey, path: path, data: data });
};

/**
 * Similar to updateItem, but allows to pass an array with {path,data} pairs for
 * multiple update of the same item without having to send multiple messages.
 *
 * @param key {String} The key of the tab
 * @param itemKey {String} The key of the item
 * @param array {Array} The array of updates
 * @param array.path {String} The path for this update
 * @param array.data {Object} The value of this update
 */
var multiUpdate = function multiUpdate(key, itemKey, array) {
  return send('MULTI_UPDATE_ITEM', { key: key, itemKey: itemKey, array: array });
};

/**
 * Remove a specific item in a specific tab.
 *
 * @param key {String} They key of the tab
 * @param itemKey {String} The key of the item
 */
var deleteItem = function deleteItem(key, itemKey) {
  return send('DELETE_ITEM', { key: key, itemKey: itemKey });
};

/**
 * Will create a log message to an item, that will be displayde with the current time.
 *
 * @param key {String} The key of the tab
 * @param itemKey {String} The key of the item
 * @param msg {String} The message to display
 */
var addLog = function addLog(key, itemKey, msg) {
  return send('ADD_LOG', { key: key, itemKey: itemKey, msg: msg });
};

exports.default = {

  send: send,
  throttle: throttle,
  isReady: isReady,

  list: list,
  listItem: listItem,
  updateItem: updateItem,
  multiUpdate: multiUpdate,
  deleteItem: deleteItem,
  addLog: addLog,

  listeners: listeners,
  listenFor: listenFor,
  removeListener: removeListener,
  init: init,
  clean: clean

};

},{}],"KAYd":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getOverrides = exports.setOverride = exports.removeModel = exports.logModel = exports.addModel = void 0;

var _seer = _interopRequireDefault(require("seer"));

var _globals = require("../utils/globals");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var models = {};
/**
 * Add a model to our cache indexed by id
 */

var addModel = function addModel(model) {
  if (models[model.id]) {
    return;
  }

  models[model.id] = model;

  _seer.default.listItem('luma.gl', model.id);
};
/**
 * Log a model uniforms and attributes.
 */


exports.addModel = addModel;

var logModel = function logModel(model, uniforms) {
  if (!_seer.default.isReady() || _seer.default.throttle("luma.gl:".concat(model.id), 1e3)) {
    return;
  }

  var attributesObject = model.geometry ? Object.assign({}, model.geometry.attributes, model.attributes) : model.attributes;
  var uniformsObject = Object.assign({}, model.uniforms, uniforms);

  _seer.default.multiUpdate('luma.gl', model.id, [{
    path: 'objects.uniforms',
    data: uniformsObject
  }, {
    path: 'objects.attributes',
    data: attributesObject
  }]);
};
/**
 * Remove a previously set model from the cache
 */


exports.logModel = logModel;

var removeModel = function removeModel(id) {
  delete models[id];

  _seer.default.deleteItem('luma.gl', id);
};
/**
 * Recursively traverse an object given a path of properties and set the given value
 */


exports.removeModel = removeModel;

var recursiveSet = function recursiveSet(obj, path, value) {
  if (!obj) {
    return;
  }

  if (path.length > 1) {
    recursiveSet(obj[path[0]], path.slice(1), value);
  } else {
    obj[path[0]] = value;
  }
};

var overrides = new Map();
/**
 * Create an override on the specify layer, indexed by a valuePath array.
 * Do nothing in case Seer as not been initialized to prevent any preformance drawback.
 */

var setOverride = function setOverride(id, valuePath, value) {
  if (!_globals.window.__SEER_INITIALIZED__) {
    return;
  }

  if (!overrides.has(id)) {
    overrides.set(id, new Map());
  }

  var uniforms = overrides.get(id);
  uniforms.set(valuePath, value);
};
/**
 * Apply overrides to a specific model's uniforms
 */


exports.setOverride = setOverride;

var getOverrides = function getOverrides(id, uniforms) {
  if (!_globals.window.__SEER_INITIALIZED__ || !id) {
    return;
  }

  var overs = overrides.get(id);

  if (!overs) {
    return;
  }

  overs.forEach(function (value, valuePath) {
    recursiveSet(uniforms, valuePath, value);
  });
};
/**
 * Listen for luma.gl edit events
 */


exports.getOverrides = getOverrides;

_seer.default.listenFor('luma.gl', function (payload) {
  var model = models[payload.itemKey];

  if (!model || payload.type !== 'edit' || payload.valuePath[0] !== 'uniforms') {
    return;
  }

  var valuePath = payload.valuePath.slice(1);
  setOverride(payload.itemKey, valuePath, payload.value);
  var uniforms = model.getUniforms();
  recursiveSet(uniforms, valuePath, payload.value);
  model.setUniforms(uniforms);
});
},{"seer":"Kyly","../utils/globals":"AlqY"}],"wjN2":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getDebugTableForUniforms = getDebugTableForUniforms;

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));

var _utils = require("../utils");

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Prepares a table suitable for console.table

/* eslint-disable max-statements, complexity */
function getDebugTableForUniforms() {
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
      _ref$header = _ref.header,
      header = _ref$header === void 0 ? 'Uniforms' : _ref$header,
      program = _ref.program,
      uniforms = _ref.uniforms,
      _ref$undefinedOnly = _ref.undefinedOnly,
      undefinedOnly = _ref$undefinedOnly === void 0 ? false : _ref$undefinedOnly;

  (0, _assert.default)(program);
  var SHADER_MODULE_UNIFORM_REGEXP = '.*_.*';
  var PROJECT_MODULE_UNIFORM_REGEXP = '.*Matrix'; // TODO - Use explicit list

  var uniformLocations = program._uniformSetters;
  var table = {}; // {[header]: {}};
  // Add program's provided uniforms (in alphabetical order)

  var uniformNames = Object.keys(uniformLocations).sort();
  var count = 0; // First add non-underscored uniforms (assumed not coming from shader modules)

  var _iteratorNormalCompletion = true;
  var _didIteratorError = false;
  var _iteratorError = undefined;

  try {
    for (var _iterator = uniformNames[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
      var _uniformName = _step.value;

      if (!_uniformName.match(SHADER_MODULE_UNIFORM_REGEXP) && !_uniformName.match(PROJECT_MODULE_UNIFORM_REGEXP)) {
        if (addUniformToTable({
          table: table,
          header: header,
          uniforms: uniforms,
          uniformName: _uniformName,
          undefinedOnly: undefinedOnly
        })) {
          count++;
        }
      }
    } // add underscored uniforms (assumed from shader modules)

  } catch (err) {
    _didIteratorError = true;
    _iteratorError = err;
  } finally {
    try {
      if (!_iteratorNormalCompletion && _iterator.return != null) {
        _iterator.return();
      }
    } finally {
      if (_didIteratorError) {
        throw _iteratorError;
      }
    }
  }

  var _iteratorNormalCompletion2 = true;
  var _didIteratorError2 = false;
  var _iteratorError2 = undefined;

  try {
    for (var _iterator2 = uniformNames[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
      var _uniformName2 = _step2.value;

      if (_uniformName2.match(PROJECT_MODULE_UNIFORM_REGEXP)) {
        if (addUniformToTable({
          table: table,
          header: header,
          uniforms: uniforms,
          uniformName: _uniformName2,
          undefinedOnly: undefinedOnly
        })) {
          count++;
        }
      }
    }
  } catch (err) {
    _didIteratorError2 = true;
    _iteratorError2 = err;
  } finally {
    try {
      if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
        _iterator2.return();
      }
    } finally {
      if (_didIteratorError2) {
        throw _iteratorError2;
      }
    }
  }

  var _iteratorNormalCompletion3 = true;
  var _didIteratorError3 = false;
  var _iteratorError3 = undefined;

  try {
    for (var _iterator3 = uniformNames[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
      var _uniformName3 = _step3.value;

      if (!table[_uniformName3]) {
        if (addUniformToTable({
          table: table,
          header: header,
          uniforms: uniforms,
          uniformName: _uniformName3,
          undefinedOnly: undefinedOnly
        })) {
          count++;
        }
      }
    } // Create a table of unused uniforms

  } catch (err) {
    _didIteratorError3 = true;
    _iteratorError3 = err;
  } finally {
    try {
      if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
        _iterator3.return();
      }
    } finally {
      if (_didIteratorError3) {
        throw _iteratorError3;
      }
    }
  }

  var unusedCount = 0;
  var unusedTable = {};

  if (!undefinedOnly) {
    for (var uniformName in uniforms) {
      var uniform = uniforms[uniformName];

      if (!table[uniformName]) {
        unusedCount++;
        unusedTable[uniformName] = (0, _defineProperty2.default)({
          Type: "NOT USED: ".concat(uniform)
        }, header, (0, _utils.formatValue)(uniform));
      }
    }
  }

  return {
    table: table,
    count: count,
    unusedTable: unusedTable,
    unusedCount: unusedCount
  };
} // Helper


function addUniformToTable(_ref2) {
  var table = _ref2.table,
      header = _ref2.header,
      uniforms = _ref2.uniforms,
      uniformName = _ref2.uniformName,
      undefinedOnly = _ref2.undefinedOnly;
  var value = uniforms[uniformName];
  var isDefined = isUniformDefined(value);

  if (!undefinedOnly || !isDefined) {
    var _table$uniformName;

    table[uniformName] = (_table$uniformName = {}, (0, _defineProperty2.default)(_table$uniformName, header, isDefined ? (0, _utils.formatValue)(value) : 'N/A'), (0, _defineProperty2.default)(_table$uniformName, 'Uniform Type', isDefined ? value : 'NOT PROVIDED'), _table$uniformName);
    return true;
  }

  return false;
}

function isUniformDefined(value) {
  return value !== undefined && value !== null;
}
},{"@babel/runtime/helpers/esm/defineProperty":"DOnw","../utils":"PFG0","../utils/assert":"wYRU"}],"wjGn":[function(require,module,exports) {

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getDebugTableForVertexArray = getDebugTableForVertexArray;

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));

var _buffer = _interopRequireDefault(require("../webgl/buffer"));

var _constantsToKeys = require("../webgl-utils/constants-to-keys");

var _attributeUtils = require("../webgl-utils/attribute-utils");

var _utils = require("../utils");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Creates object suitable as input for console.table
function getDebugTableForVertexArray() {
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
      vertexArray = _ref.vertexArray,
      _ref$header = _ref.header,
      header = _ref$header === void 0 ? 'Attributes' : _ref$header;

  if (!vertexArray.configuration) {
    return {};
  }

  var table = {}; // {[header]: {}};
  // Add index (elements) if available

  if (vertexArray.elements) {
    // const elements = Object.assign({size: 1}, vertexArray.elements);
    table.ELEMENT_ARRAY_BUFFER = getDebugTableRow(vertexArray, vertexArray.elements, null, header);
  } // Add used attributes


  var attributes = vertexArray.values;

  for (var attributeLocation in attributes) {
    var info = vertexArray._getAttributeInfo(attributeLocation);

    if (info) {
      var rowHeader = "".concat(attributeLocation, ": ").concat(info.name);
      var accessor = vertexArray.accessors[info.location];

      if (accessor) {
        rowHeader = "".concat(attributeLocation, ": ").concat(getGLSLDeclaration(info.name, accessor));
      }

      table[rowHeader] = getDebugTableRow(vertexArray, attributes[attributeLocation], accessor, header);
    }
  }

  return table;
}
/* eslint-disable max-statements */


function getDebugTableRow(vertexArray, attribute, accessor, header) {
  var _ref3; // const round = xnum => Math.round(num * 10) / 10;


  var gl = vertexArray.gl;
  var type = 'NOT PROVIDED';
  var size = 'N/A';
  var verts = 'N/A';
  var bytes = 'N/A';
  var isInteger;
  var marker;
  var value;

  if (accessor) {
    type = accessor.type;
    size = accessor.size; // Generate a type name by dropping Array from Float32Array etc.

    type = String(type).replace('Array', ''); // Look for 'nt' to detect integer types, e.g. Int32Array, Uint32Array

    isInteger = type.indexOf('nt') !== -1;
  }

  if (attribute instanceof _buffer.default) {
    var _ref2;

    var buffer = attribute;

    var _buffer$getDebugData = buffer.getDebugData(),
        data = _buffer$getDebugData.data,
        modified = _buffer$getDebugData.modified;

    marker = modified ? '*' : '';
    value = data;
    bytes = buffer.byteLength;
    verts = bytes / data.BYTES_PER_ELEMENT / size;
    var format;

    if (accessor) {
      var instanced = accessor.divisor > 0;
      format = "".concat(instanced ? 'I ' : 'P ', " ").concat(verts, " (x").concat(size, "=").concat(bytes, " bytes ").concat((0, _constantsToKeys.glKey)(gl, type), ")");
    } else {
      // element buffer
      isInteger = true;
      format = "".concat(bytes, " bytes");
    }

    return _ref2 = {}, (0, _defineProperty2.default)(_ref2, header, "".concat(marker).concat((0, _utils.formatValue)(value, {
      size: size,
      isInteger: isInteger
    }))), (0, _defineProperty2.default)(_ref2, 'Format ', format), _ref2;
  } // CONSTANT VALUE


  value = attribute;
  size = attribute.length; // Generate a type name by dropping Array from Float32Array etc.

  type = String(attribute.constructor.name).replace('Array', ''); // Look for 'nt' to detect integer types, e.g. Int32Array, Uint32Array

  isInteger = type.indexOf('nt') !== -1;
  return _ref3 = {}, (0, _defineProperty2.default)(_ref3, header, "".concat((0, _utils.formatValue)(value, {
    size: size,
    isInteger: isInteger
  }), " (constant)")), (0, _defineProperty2.default)(_ref3, 'Format ', "".concat(size, "x").concat(type, " (constant)")), _ref3;
}
/* eslint-ensable max-statements */


function getGLSLDeclaration(name, accessor) {
  var type = accessor.type,
      size = accessor.size;
  var typeAndName = (0, _attributeUtils.getCompositeGLType)(type, size);

  if (typeAndName) {
    return "".concat(name, " (").concat(typeAndName.name, ")");
  }

  return name;
}
},{"@babel/runtime/helpers/esm/defineProperty":"DOnw","../webgl/buffer":"Rc9V","../webgl-utils/constants-to-keys":"OZ1B","../webgl-utils/attribute-utils":"Z0Su","../utils":"PFG0"}],"SQgV":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getDebugTableForProgramConfiguration = getDebugTableForProgramConfiguration;

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));

var _attributeUtils = require("../webgl-utils/attribute-utils");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function getDebugTableForProgramConfiguration(config) {
  var table = {};
  var header = "Accessors for ".concat(config.id);
  var _iteratorNormalCompletion = true;
  var _didIteratorError = false;
  var _iteratorError = undefined;

  try {
    for (var _iterator = config.attributeInfos[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
      var attributeInfo = _step.value;

      if (attributeInfo) {
        var glslDeclaration = getGLSLDeclaration(attributeInfo);
        table["in ".concat(glslDeclaration)] = (0, _defineProperty2.default)({}, header, JSON.stringify(attributeInfo.accessor));
      }
    }
  } catch (err) {
    _didIteratorError = true;
    _iteratorError = err;
  } finally {
    try {
      if (!_iteratorNormalCompletion && _iterator.return != null) {
        _iterator.return();
      }
    } finally {
      if (_didIteratorError) {
        throw _iteratorError;
      }
    }
  }

  var _iteratorNormalCompletion2 = true;
  var _didIteratorError2 = false;
  var _iteratorError2 = undefined;

  try {
    for (var _iterator2 = config.varyingInfos[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
      var varyingInfo = _step2.value;

      if (varyingInfo) {
        var _glslDeclaration = getGLSLDeclaration(varyingInfo);

        table["out ".concat(_glslDeclaration)] = (0, _defineProperty2.default)({}, header, JSON.stringify(varyingInfo.accessor));
      }
    }
  } catch (err) {
    _didIteratorError2 = true;
    _iteratorError2 = err;
  } finally {
    try {
      if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
        _iterator2.return();
      }
    } finally {
      if (_didIteratorError2) {
        throw _iteratorError2;
      }
    }
  }

  return table;
}

function getGLSLDeclaration(attributeInfo) {
  var _attributeInfo$access = attributeInfo.accessor,
      type = _attributeInfo$access.type,
      size = _attributeInfo$access.size;
  var typeAndName = (0, _attributeUtils.getCompositeGLType)(type, size);

  if (typeAndName) {
    return "".concat(typeAndName.name, " ").concat(attributeInfo.name);
  }

  return attributeInfo.name;
}
},{"@babel/runtime/helpers/esm/defineProperty":"DOnw","../webgl-utils/attribute-utils":"Z0Su"}],"yJrb":[function(require,module,exports) {

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _attribute = _interopRequireDefault(require("./attribute"));

var _object3d = _interopRequireDefault(require("./object-3d"));

var _geometry = require("../geometry/geometry");

var _webgl = require("../webgl");

var _webglUtils = require("../webgl-utils");

var _shaders = require("../shadertools/src/shaders");

var _src = require("../shadertools/src");

var _seerIntegration = require("../debug/seer-integration");

var _debugUniforms = require("../webgl-debug/debug-uniforms");

var _debugVertexArray = require("../webgl-debug/debug-vertex-array");

var _debugProgramConfiguration = require("../webgl-debug/debug-program-configuration");

var _utils = require("../utils");

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var ERR_MODEL_PARAMS = 'Model needs drawMode and vertexCount';
var LOG_DRAW_PRIORITY = 2;
var LOG_DRAW_TIMEOUT = 10000; // These old picking uniforms should be avoided and we should use picking module
// and set uniforms using Model class 'updateModuleSettings()'
// TODO - move to shader modules

var DEPRECATED_PICKING_UNIFORMS = ['renderPickingBuffer', 'pickingEnabled']; // Model abstract O3D Class

var Model =
/*#__PURE__*/
function (_Object3D) {
  (0, _inherits2.default)(Model, _Object3D);

  function Model(gl) {
    var _this;

    var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, Model);
    _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Model).call(this, props));
    (0, _assert.default)((0, _webglUtils.isWebGL)(gl));
    _this.gl = gl;
    _this.lastLogTime = 0; // TODO - move to probe.gl

    _this.initialize(props); // intended to be subclassed, do not seal


    return _this;
  }
  /* eslint-disable max-statements  */

  /* eslint-disable complexity  */


  (0, _createClass2.default)(Model, [{
    key: "initialize",
    value: function initialize() {
      var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      this.props = {};
      this.program = this._createProgram(props); // Create a vertex array configured after this program

      this.vertexArray = new _webgl.VertexArray(this.gl, {
        program: this.program
      }); // Initialize state

      this.userData = {};
      this.needsRedraw = true; // Model manages auto Buffer creation from typed arrays

      this._attributes = {}; // All attributes

      this.attributes = {}; // User defined attributes
      // Model manages uniform animation

      this.animatedUniforms = {};
      this.animated = false;
      this.animationLoop = null; // if set, used as source for animationProps

      this.timerQueryEnabled = false;
      this.timeElapsedQuery = undefined;
      this.lastQueryReturned = true;
      this.stats = {
        accumulatedFrameTime: 0,
        averageFrameTime: 0,
        profileFrameCount: 0
      }; // picking options

      this.pickable = true; // this.pick = pick || (() => false);

      this.setProps(props); // Make sure we have some reasonable default uniforms in place

      this.setUniforms(Object.assign({}, this.getModuleUniforms(), // Get all default uniforms
      this.getModuleUniforms(props.moduleSettings) // Get unforms for supplied parameters
      )); // Attributes and buffers
      // geometry might have set drawMode and vertexCount

      this.isInstanced = props.isInstanced || props.instanced;

      this.onBeforeRender = props.onBeforeRender || function () {};

      this.onAfterRender = props.onAfterRender || function () {}; // assert(program || program instanceof Program);


      (0, _assert.default)(this.drawMode !== undefined && Number.isFinite(this.vertexCount), ERR_MODEL_PARAMS);
    }
    /* eslint-enable max-statements */

  }, {
    key: "setProps",
    value: function setProps(props) {
      Object.assign(this.props, props); // params
      // if ('drawMode' in props) {
      //   this.drawMode = getDrawMode(props.drawMode);
      // }
      // if ('vertexCount' in props) {
      //   this.vertexCount = props.vertexCount;
      // }

      if ('instanceCount' in props) {
        this.instanceCount = props.instanceCount;
      }

      if ('geometry' in props) {
        this.setGeometry(props.geometry);
      } // webgl settings


      if ('attributes' in props) {
        this.setAttributes(props.attributes);
      }

      if ('uniforms' in props) {
        this.setUniforms(props.uniforms, props.samplers);
      }

      if ('pickable' in props) {
        this.pickable = props.pickable;
      } // Experimental props


      if ('timerQueryEnabled' in props) {
        this.timerQueryEnabled = props.timerQueryEnabled && _webgl.Query.isSupported(this.gl, ['timers']);

        if (props.timerQueryEnabled && !this.timerQueryEnabled) {
          _utils.log.warn('GPU timer not supported')();
        }
      }

      if ('_feedbackBuffers' in props) {
        this._setFeedbackBuffers(props._feedbackBuffers);
      }

      if ('_animationProps' in props) {
        this._setAnimationProps(props._animationProps);
      }

      if ('_animationLoop' in props) {
        this.animationLoop = props._animationLoop;
      }
    }
  }, {
    key: "delete",
    value: function _delete() {
      // delete all attributes created by this model
      // TODO - should buffer deletes be handled by vertex array?
      for (var key in this._attributes) {
        if (this._attributes[key] !== this.attributes[key]) {
          this._attributes[key].delete();
        }
      }

      this.program.delete();
      this.vertexArray.delete();
      (0, _seerIntegration.removeModel)(this.id);
    }
  }, {
    key: "destroy",
    value: function destroy() {
      this.delete();
    } // GETTERS

  }, {
    key: "getNeedsRedraw",
    value: function getNeedsRedraw() {
      var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          _ref$clearRedrawFlags = _ref.clearRedrawFlags,
          clearRedrawFlags = _ref$clearRedrawFlags === void 0 ? false : _ref$clearRedrawFlags;

      var redraw = false;
      redraw = redraw || this.needsRedraw;
      this.needsRedraw = this.needsRedraw && !clearRedrawFlags;

      if (this.geometry) {
        redraw = redraw || this.geometry.getNeedsRedraw({
          clearRedrawFlags: clearRedrawFlags
        });
      }

      if (this.animated) {
        redraw = redraw || "animated model ".concat(this.id);
      }

      return redraw;
    }
  }, {
    key: "getDrawMode",
    value: function getDrawMode() {
      return this.drawMode;
    }
  }, {
    key: "getVertexCount",
    value: function getVertexCount() {
      return this.vertexCount;
    }
  }, {
    key: "getInstanceCount",
    value: function getInstanceCount() {
      return this.instanceCount;
    }
  }, {
    key: "getProgram",
    value: function getProgram() {
      return this.program;
    }
  }, {
    key: "getAttributes",
    value: function getAttributes() {
      return this.attributes;
    }
  }, {
    key: "getUniforms",
    value: function getUniforms() {
      return this.program.getUniforms;
    } // SETTERS

  }, {
    key: "setNeedsRedraw",
    value: function setNeedsRedraw() {
      var redraw = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
      this.needsRedraw = redraw;
      return this;
    }
  }, {
    key: "setDrawMode",
    value: function setDrawMode(drawMode) {
      this.props.drawMode = (0, _geometry.getDrawMode)(drawMode);
      return this;
    }
  }, {
    key: "setVertexCount",
    value: function setVertexCount(vertexCount) {
      (0, _assert.default)(Number.isFinite(vertexCount));
      this.props.vertexCount = vertexCount;
      return this;
    }
  }, {
    key: "setInstanceCount",
    value: function setInstanceCount(instanceCount) {
      (0, _assert.default)(Number.isFinite(instanceCount));
      this.instanceCount = instanceCount;
      return this;
    } // TODO - just set attributes, don't hold on to geometry

  }, {
    key: "setGeometry",
    value: function setGeometry(geometry) {
      this.geometry = geometry;

      var buffers = this._createBuffersFromAttributeDescriptors(this.geometry.getAttributes());

      this.vertexArray.setAttributes(buffers);
      this.setNeedsRedraw();
      return this;
    }
  }, {
    key: "setAttributes",
    value: function setAttributes() {
      var attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; // Avoid setting needsRedraw if no attributes

      if ((0, _utils.isObjectEmpty)(attributes)) {
        return this;
      }

      Object.assign(this.attributes, attributes);

      var buffers = this._createBuffersFromAttributeDescriptors(attributes); // Object.assign(this.attributes, buffers);


      this.vertexArray.setAttributes(buffers);
      this.setNeedsRedraw();
      return this;
    } // TODO - should actually set the uniforms

  }, {
    key: "setUniforms",
    value: function setUniforms() {
      var _this2 = this;

      var uniforms = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      var samplers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; // Let Seer override edited uniforms

      uniforms = Object.assign({}, uniforms);
      (0, _seerIntegration.getOverrides)(this.id, uniforms); // Resolve any animated uniforms so that we have an initial value

      uniforms = this._extractAnimatedUniforms(uniforms);
      this.program.setUniforms(uniforms, samplers, function () {
        // if something changed
        _this2._checkForDeprecatedUniforms(uniforms);

        _this2.setNeedsRedraw();
      });
    } // Updates (evaluates) all function valued uniforms based on a new set of animationProps
    // experimental

  }, {
    key: "_setAnimationProps",
    value: function _setAnimationProps(animationProps) {
      var _this3 = this;

      if (this.animated) {
        (0, _assert.default)(animationProps, 'Model.draw(): animated uniforms but no animationProps');

        var animatedUniforms = this._evaluateAnimateUniforms(animationProps);

        this.program.setUniforms(animatedUniforms, {}, function () {
          // if something changed
          _this3._checkForDeprecatedUniforms(animatedUniforms);

          _this3.setNeedsRedraw();
        });
      }
    }
  }, {
    key: "updateModuleSettings",
    value: function updateModuleSettings(opts) {
      var uniforms = this.getModuleUniforms(opts || {});
      return this.setUniforms(uniforms);
    } // DRAW CALLS

  }, {
    key: "clear",
    value: function clear(opts) {
      (0, _webgl.clear)(this.program.gl, opts);
      return this;
    }
    /* eslint-disable max-statements  */

  }, {
    key: "draw",
    value: function draw() {
      var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      var _opts$moduleSettings = opts.moduleSettings,
          moduleSettings = _opts$moduleSettings === void 0 ? null : _opts$moduleSettings,
          framebuffer = opts.framebuffer,
          _opts$uniforms = opts.uniforms,
          uniforms = _opts$uniforms === void 0 ? {} : _opts$uniforms,
          _opts$attributes = opts.attributes,
          attributes = _opts$attributes === void 0 ? {} : _opts$attributes,
          _opts$samplers = opts.samplers,
          samplers = _opts$samplers === void 0 ? {} : _opts$samplers,
          _opts$transformFeedba = opts.transformFeedback,
          transformFeedback = _opts$transformFeedba === void 0 ? this.transformFeedback : _opts$transformFeedba,
          _opts$parameters = opts.parameters,
          parameters = _opts$parameters === void 0 ? {} : _opts$parameters,
          _opts$vertexArray = opts.vertexArray,
          vertexArray = _opts$vertexArray === void 0 ? this.vertexArray : _opts$vertexArray,
          animationProps = opts.animationProps; // Update module settings

      (0, _seerIntegration.addModel)(this); // Update model with any just provided attributes, settings or uniforms

      this.setAttributes(attributes);
      this.updateModuleSettings(moduleSettings);
      this.setUniforms(uniforms, samplers); // Animate any function valued uniforms

      this._refreshAnimationProps(animationProps);

      var logPriority = this._logDrawCallStart(2);

      var drawParams = this.vertexArray.getDrawParams(this.props);

      if (drawParams.isInstanced && !this.isInstanced) {
        _utils.log.warn('Found instanced attributes on non-instanced model', this.id)();
      }

      var isIndexed = drawParams.isIndexed,
          indexType = drawParams.indexType;
      var isInstanced = this.isInstanced,
          instanceCount = this.instanceCount;
      this.onBeforeRender();

      this._timerQueryStart();

      this.program.draw(Object.assign({}, opts, {
        logPriority: logPriority,
        uniforms: null,
        // Already set (may contain "function values" not understood by Program)
        framebuffer: framebuffer,
        parameters: parameters,
        drawMode: this.getDrawMode(),
        vertexCount: this.getVertexCount(),
        vertexArray: vertexArray,
        transformFeedback: transformFeedback,
        isIndexed: isIndexed,
        indexType: indexType,
        isInstanced: isInstanced,
        instanceCount: instanceCount
      }));

      this._timerQueryEnd();

      this.onAfterRender();
      this.setNeedsRedraw(false);

      this._logDrawCallEnd(logPriority, vertexArray, framebuffer);

      return this;
    }
    /* eslint-enable max-statements  */
    // Draw call for transform feedback

  }, {
    key: "transform",
    value: function transform() {
      var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      var _opts$discard = opts.discard,
          discard = _opts$discard === void 0 ? true : _opts$discard,
          feedbackBuffers = opts.feedbackBuffers,
          _opts$unbindModels = opts.unbindModels,
          unbindModels = _opts$unbindModels === void 0 ? [] : _opts$unbindModels;
      var parameters = opts.parameters;

      if (feedbackBuffers) {
        this._setFeedbackBuffers(feedbackBuffers);
      }

      if (discard) {
        parameters = Object.assign({}, parameters, (0, _defineProperty2.default)({}, 35977, discard));
      }

      unbindModels.forEach(function (model) {
        return model.vertexArray.unbindBuffers();
      });

      try {
        this.draw(Object.assign({}, opts, {
          parameters: parameters
        }));
      } finally {
        unbindModels.forEach(function (model) {
          return model.vertexArray.bindBuffers();
        });
      }

      return this;
    } // DEPRECATED METHODS

  }, {
    key: "render",
    value: function render() {
      var uniforms = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      (0, _assert.default)(arguments.length <= 1); // log.deprecated('Model.render()', 'Model.draw()')();

      return this.draw({
        uniforms: uniforms
      });
    } // PRIVATE METHODS

  }, {
    key: "_createProgram",
    value: function _createProgram(_ref2) {
      var _ref2$vs = _ref2.vs,
          vs = _ref2$vs === void 0 ? null : _ref2$vs,
          _ref2$fs = _ref2.fs,
          fs = _ref2$fs === void 0 ? null : _ref2$fs,
          _ref2$modules = _ref2.modules,
          modules = _ref2$modules === void 0 ? null : _ref2$modules,
          _ref2$defines = _ref2.defines,
          defines = _ref2$defines === void 0 ? {} : _ref2$defines,
          _ref2$inject = _ref2.inject,
          inject = _ref2$inject === void 0 ? {} : _ref2$inject,
          _ref2$shaderCache = _ref2.shaderCache,
          shaderCache = _ref2$shaderCache === void 0 ? null : _ref2$shaderCache,
          _ref2$varyings = _ref2.varyings,
          varyings = _ref2$varyings === void 0 ? null : _ref2$varyings,
          _ref2$bufferMode = _ref2.bufferMode,
          bufferMode = _ref2$bufferMode === void 0 ? 35981 : _ref2$bufferMode,
          _ref2$program = _ref2.program,
          program = _ref2$program === void 0 ? null : _ref2$program;

      this.getModuleUniforms = function (x) {};

      var id = this.id;

      if (!program) {
        // Assign default shaders if none are provided
        vs = vs || _shaders.MODULAR_SHADERS.vs;
        fs = fs || _shaders.MODULAR_SHADERS.fs;
        var assembleResult = (0, _src.assembleShaders)(this.gl, {
          vs: vs,
          fs: fs,
          modules: modules,
          inject: inject,
          defines: defines,
          log: _utils.log
        });
        vs = assembleResult.vs;
        fs = assembleResult.fs;

        if (shaderCache) {
          program = shaderCache.getProgram(this.gl, {
            id: id,
            vs: vs,
            fs: fs
          });
        } else {
          program = new _webgl.Program(this.gl, {
            id: id,
            vs: vs,
            fs: fs,
            varyings: varyings,
            bufferMode: bufferMode
          });
        }

        this.getModuleUniforms = assembleResult.getUniforms || function (x) {};
      }

      (0, _assert.default)(program instanceof _webgl.Program, 'Model needs a program');
      return program;
    }
    /* eslint-enable complexity */
    // Uniforms

  }, {
    key: "_checkForDeprecatedUniforms",
    value: function _checkForDeprecatedUniforms(uniforms) {
      // deprecated picking uniforms
      DEPRECATED_PICKING_UNIFORMS.forEach(function (uniform) {
        if (uniform in uniforms) {
          _utils.log.deprecated(uniform, 'use picking shader module and Model class updateModuleSettings()')();
        }
      });
    } // Refreshes animated uniforms, attempting to get animated props from animationLoop if registered

  }, {
    key: "_refreshAnimationProps",
    value: function _refreshAnimationProps(animationProps) {
      // Try to read animationProps
      animationProps = animationProps || this.animationLoop && this.animationLoop.animationProps;

      if (animationProps) {
        this._setAnimationProps(animationProps);
      }
    } // Calculate new values for any function uniforms based on supplied animationProps

  }, {
    key: "_evaluateAnimateUniforms",
    value: function _evaluateAnimateUniforms(animationProps) {
      if (!this.animated) {
        return {};
      }

      var animatedUniforms = {};

      for (var uniformName in this.animatedUniforms) {
        var valueFunction = this.animatedUniforms[uniformName];
        animatedUniforms[uniformName] = valueFunction(animationProps);
      }

      return animatedUniforms;
    } // Extracts a list of function valued uniforms, so we can update them before each draw call
    // Also removes such uniforms from the returned list

  }, {
    key: "_extractAnimatedUniforms",
    value: function _extractAnimatedUniforms(uniforms) {
      var foundAnimated = false; // Keep our animatedUniforms map up-to-date

      for (var uniformName in uniforms) {
        var newValue = uniforms[uniformName];

        if (typeof newValue === 'function') {
          this.animatedUniforms[uniformName] = newValue;
          foundAnimated = true;
        } else {
          delete this.animatedUniforms[uniformName];
        }
      } // Update animated flag: `Model` is animated if any uniforms are animated (i.e. functions)


      this.animated = !(0, _utils.isObjectEmpty)(this.animatedUniforms);

      if (!foundAnimated) {
        return uniforms;
      } // If animated uniforms were found, remove them from ordinary uniform list
      // `Program` class can't (and shouldn't) handle function valued uniforms


      var staticUniforms = {};

      for (var _uniformName in uniforms) {
        if (!this.animatedUniforms[_uniformName]) {
          staticUniforms[_uniformName] = uniforms[_uniformName];
        }
      }

      return staticUniforms;
    } // Transform Feedback

  }, {
    key: "_setFeedbackBuffers",
    value: function _setFeedbackBuffers() {
      var feedbackBuffers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; // Avoid setting needsRedraw if no feedbackBuffers

      if ((0, _utils.isObjectEmpty)(feedbackBuffers)) {
        return this;
      }

      var gl = this.program.gl;
      this.transformFeedback = this.transformFeedback || new _webgl.TransformFeedback(gl, {
        program: this.program
      });
      this.transformFeedback.setBuffers(feedbackBuffers);
      this.setNeedsRedraw();
      return this;
    } // Timer Queries

  }, {
    key: "_timerQueryStart",
    value: function _timerQueryStart() {
      if (this.timerQueryEnabled === true) {
        if (!this.timeElapsedQuery) {
          this.timeElapsedQuery = new _webgl.Query(this.gl);
        }

        if (this.lastQueryReturned) {
          this.lastQueryReturned = false;
          this.timeElapsedQuery.beginTimeElapsedQuery();
        }
      }
    }
  }, {
    key: "_timerQueryEnd",
    value: function _timerQueryEnd() {
      if (this.timerQueryEnabled === true) {
        this.timeElapsedQuery.end(); // TODO: Skip results if 'gl.getParameter(this.ext.GPU_DISJOINT_EXT)' returns false
        // should this be incorporated into Query object?

        if (this.timeElapsedQuery.isResultAvailable()) {
          this.lastQueryReturned = true;
          var elapsedTime = this.timeElapsedQuery.getResult(); // Update stats (e.g. for seer)

          this.stats.lastFrameTime = elapsedTime;
          this.stats.accumulatedFrameTime += elapsedTime;
          this.stats.profileFrameCount++;
          this.stats.averageFrameTime = this.stats.accumulatedFrameTime / this.stats.profileFrameCount; // Log stats

          _utils.log.log(LOG_DRAW_PRIORITY, "GPU time ".concat(this.program.id, ": ").concat(this.stats.lastFrameTime, "ms average ").concat(this.stats.averageFrameTime, "ms accumulated: ").concat(this.stats.accumulatedFrameTime, "ms count: ").concat(this.stats.profileFrameCount))();
        }
      }
    } // Makes sure buffers are created for all attributes
    // and that the program is updated with those buffers
    // TODO - do we need the separation between "attributes" and "buffers"
    // couldn't apps just create buffers directly?

  }, {
    key: "_createBuffersFromAttributeDescriptors",
    value: function _createBuffersFromAttributeDescriptors(attributes) {
      var gl = this.program.gl; // const attributes = {};

      var buffers = {};

      for (var attributeName in attributes) {
        var descriptor = attributes[attributeName];
        var attribute = this._attributes[attributeName];

        if (descriptor instanceof _attribute.default) {
          attribute = descriptor;
        } else if (descriptor instanceof _webgl.Buffer) {
          attribute = attribute || new _attribute.default(gl, Object.assign({}, descriptor, descriptor.layout, {
            id: attributeName
          }));
          attribute.update({
            buffer: descriptor
          });
        } else if (attribute) {
          attribute.update(descriptor);
        } else {
          attribute = new _attribute.default(gl, Object.assign({}, descriptor, {
            id: attributeName
          }));
        }

        this._attributes[attributeName] = attribute;
        buffers[attributeName] = attribute.getValue();
      }

      return buffers;
    }
  }, {
    key: "_logDrawCallStart",
    value: function _logDrawCallStart(priority) {
      var logDrawTimeout = priority > 3 ? 0 : LOG_DRAW_TIMEOUT;

      if (_utils.log.priority < priority || Date.now() - this.lastLogTime < logDrawTimeout) {
        return undefined;
      }

      this.lastLogTime = Date.now();

      _utils.log.group(LOG_DRAW_PRIORITY, ">>> DRAWING MODEL ".concat(this.id), {
        collapsed: _utils.log.priority <= 2
      })();

      return priority;
    }
  }, {
    key: "_logDrawCallEnd",
    value: function _logDrawCallEnd(priority, vertexArray, uniforms, framebuffer) {
      // HACK: priority === undefined means logDrawCallStart didn't run
      if (priority === undefined) {
        return;
      }

      var attributeTable = (0, _debugVertexArray.getDebugTableForVertexArray)({
        vertexArray: vertexArray,
        header: "".concat(this.id, " attributes"),
        attributes: this._attributes
      });

      var _getDebugTableForUnif = (0, _debugUniforms.getDebugTableForUniforms)({
        header: "".concat(this.id, " uniforms"),
        program: this.program,
        uniforms: Object.assign({}, this.program.uniforms, uniforms)
      }),
          uniformTable = _getDebugTableForUnif.table,
          unusedTable = _getDebugTableForUnif.unusedTable,
          unusedCount = _getDebugTableForUnif.unusedCount; // log missing uniforms


      var _getDebugTableForUnif2 = (0, _debugUniforms.getDebugTableForUniforms)({
        header: "".concat(this.id, " uniforms"),
        program: this.program,
        uniforms: Object.assign({}, this.program.uniforms, uniforms),
        undefinedOnly: true
      }),
          missingTable = _getDebugTableForUnif2.table,
          missingCount = _getDebugTableForUnif2.count;

      if (missingCount > 0) {
        _utils.log.log('MISSING UNIFORMS', Object.keys(missingTable))(); // log.table(priority, missingTable)();

      }

      if (unusedCount > 0) {
        _utils.log.log('UNUSED UNIFORMS', Object.keys(unusedTable))(); // log.log(priority, 'Unused uniforms ', unusedTable)();

      }

      var configTable = (0, _debugProgramConfiguration.getDebugTableForProgramConfiguration)(this.vertexArray.configuration);

      _utils.log.table(priority, attributeTable)();

      _utils.log.table(priority, uniformTable)();

      _utils.log.table(priority + 1, configTable)();

      (0, _seerIntegration.logModel)(this, uniforms);

      if (framebuffer) {
        framebuffer.log({
          priority: LOG_DRAW_PRIORITY,
          message: "Rendered to ".concat(framebuffer.id)
        });
      }

      _utils.log.groupEnd(LOG_DRAW_PRIORITY, ">>> DRAWING MODEL ".concat(this.id))();
    }
  }, {
    key: "vertexCount",
    get: function get() {
      if (Number.isFinite(this.props.vertexCount)) {
        return this.props.vertexCount;
      }

      return this.geometry && this.geometry.getVertexCount();
    }
  }, {
    key: "drawMode",
    get: function get() {
      if (Number.isFinite(this.props.drawMode)) {
        return this.props.drawMode;
      }

      return this.geometry && this.geometry.drawMode;
    }
  }]);
  return Model;
}(_object3d.default);

exports.default = Model;
},{"@babel/runtime/helpers/esm/defineProperty":"DOnw","@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","./attribute":"lqt4","./object-3d":"VniL","../geometry/geometry":"wX6R","../webgl":"x2lE","../webgl-utils":"PmJk","../shadertools/src/shaders":"LbWh","../shadertools/src":"xR5I","../debug/seer-integration":"KAYd","../webgl-debug/debug-uniforms":"wjN2","../webgl-debug/debug-vertex-array":"wjGn","../webgl-debug/debug-program-configuration":"SQgV","../utils":"PFG0","../utils/assert":"wYRU"}],"gyOX":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof"));

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _webglContext = require("../webgl-context");

var _debugContext = require("../webgl-context/debug-context");

var _webglUtils = require("../webgl-utils");

var _utils = require("../utils");

var _assert = _interopRequireDefault(require("../utils/assert"));

var _webgl = require("../webgl");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/* global OffscreenCanvas */
// TODO - remove dependency on webgl classes
var DEFAULT_GL_OPTIONS = {
  preserveDrawingBuffer: true
};

var AnimationLoop =
/*#__PURE__*/
function () {
  /*
   * @param {HTMLCanvasElement} canvas - if provided, width and height will be passed to context
   */
  function AnimationLoop() {
    var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    (0, _classCallCheck2.default)(this, AnimationLoop);
    var _props$onCreateContex = props.onCreateContext,
        onCreateContext = _props$onCreateContex === void 0 ? function (opts) {
      return (0, _webglContext.createGLContext)(opts);
    } : _props$onCreateContex,
        _props$onAddHTML = props.onAddHTML,
        onAddHTML = _props$onAddHTML === void 0 ? null : _props$onAddHTML,
        _props$onInitialize = props.onInitialize,
        onInitialize = _props$onInitialize === void 0 ? function () {} : _props$onInitialize,
        _props$onRender = props.onRender,
        onRender = _props$onRender === void 0 ? function () {} : _props$onRender,
        _props$onFinalize = props.onFinalize,
        onFinalize = _props$onFinalize === void 0 ? function () {} : _props$onFinalize,
        _props$gl = props.gl,
        gl = _props$gl === void 0 ? null : _props$gl,
        _props$glOptions = props.glOptions,
        glOptions = _props$glOptions === void 0 ? {} : _props$glOptions,
        _props$debug = props.debug,
        debug = _props$debug === void 0 ? false : _props$debug,
        _props$createFramebuf = props.createFramebuffer,
        createFramebuffer = _props$createFramebuf === void 0 ? false : _props$createFramebuf,
        _props$autoResizeView = props.autoResizeViewport,
        autoResizeViewport = _props$autoResizeView === void 0 ? true : _props$autoResizeView,
        _props$autoResizeDraw = props.autoResizeDrawingBuffer,
        autoResizeDrawingBuffer = _props$autoResizeDraw === void 0 ? true : _props$autoResizeDraw;
    var _props$useDevicePixel = props.useDevicePixels,
        useDevicePixels = _props$useDevicePixel === void 0 ? true : _props$useDevicePixel;

    if ('useDevicePixelRatio' in props) {
      _utils.log.deprecated('useDevicePixelRatio', 'useDevicePixels')();

      useDevicePixels = props.useDevicePixelRatio;
    }

    this.props = {
      onCreateContext: onCreateContext,
      onAddHTML: onAddHTML,
      onInitialize: onInitialize,
      onRender: onRender,
      onFinalize: onFinalize,
      gl: gl,
      glOptions: glOptions,
      debug: debug,
      createFramebuffer: createFramebuffer
    }; // state

    this.gl = gl;
    this.needsRedraw = null;
    this._initialized = false;
    this._running = false;
    this._animationFrameId = null;
    this._startPromise = null;
    this.setProps({
      autoResizeViewport: autoResizeViewport,
      autoResizeDrawingBuffer: autoResizeDrawingBuffer,
      useDevicePixels: useDevicePixels
    }); // Bind methods

    this.start = this.start.bind(this);
    this.stop = this.stop.bind(this);
    this._onMousemove = this._onMousemove.bind(this);
    this._onMouseleave = this._onMouseleave.bind(this);
    return this;
  }

  (0, _createClass2.default)(AnimationLoop, [{
    key: "setNeedsRedraw",
    value: function setNeedsRedraw(reason) {
      (0, _assert.default)(typeof reason === 'string');
      this.needsRedraw = this.needsRedraw || reason;
      return this;
    }
  }, {
    key: "setProps",
    value: function setProps(props) {
      if ('autoResizeViewport' in props) {
        this.autoResizeViewport = props.autoResizeViewport;
      }

      if ('autoResizeDrawingBuffer' in props) {
        this.autoResizeDrawingBuffer = props.autoResizeDrawingBuffer;
      }

      if ('useDevicePixels' in props) {
        this.useDevicePixels = props.useDevicePixels;
      }

      return this;
    } // Starts a render loop if not already running
    // @param {Object} context - contains frame specific info (E.g. tick, width, height, etc)

  }, {
    key: "start",
    value: function start() {
      var _this = this;

      var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

      if (this._running) {
        return this;
      }

      this._running = true; // console.debug(`Starting ${this.constructor.name}`);
      // Wait for start promise before rendering frame

      this._startPromise = (0, _webglContext.getPageLoadPromise)().then(function () {
        if (!_this._running || _this._initialized) {
          return null;
        } // Create the WebGL context


        _this._createWebGLContext(opts);

        _this._createFramebuffer();

        _this._startEventHandling(); // Initialize the callback data


        _this._initializeCallbackData();

        _this._updateCallbackData(); // Default viewport setup, in case onInitialize wants to render


        _this._resizeCanvasDrawingBuffer();

        _this._resizeViewport(); // Note: onIntialize can return a promise (in case it needs to load resources)


        var initializationPromise = _this.onInitialize(_this.animationProps);

        _this._initialized = true;
        return initializationPromise;
      }).then(function (appContext) {
        if (_this._running) {
          _this._addCallbackData(appContext || {});

          if (appContext !== false) {
            _this._startLoop();
          }
        }
      });
      return this;
    } // Redraw now

  }, {
    key: "redraw",
    value: function redraw() {
      this._setupFrame();

      this._updateCallbackData(); // call callback


      this.onRender(this.animationProps); // end callback
      // clear needsRedraw flag

      this._clearNeedsRedraw(); // https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/commit
      // Chrome's offscreen canvas does not require gl.commit


      if (this.offScreen && this.gl.commit) {
        this.gl.commit();
      }

      return this;
    } // Stops a render loop if already running, finalizing

  }, {
    key: "stop",
    value: function stop() {
      // console.debug(`Stopping ${this.constructor.name}`);
      if (this._running) {
        this._finalizeCallbackData();

        (0, _webglUtils.cancelAnimationFrame)(this._animationFrameId);
        this._animationFrameId = null;
        this._running = false;
      }

      return this;
    }
  }, {
    key: "onCreateContext",
    value: function onCreateContext() {
      var _this$props;

      return (_this$props = this.props).onCreateContext.apply(_this$props, arguments);
    }
  }, {
    key: "onInitialize",
    value: function onInitialize() {
      var _this$props2;

      return (_this$props2 = this.props).onInitialize.apply(_this$props2, arguments);
    }
  }, {
    key: "onRender",
    value: function onRender() {
      var _this$props3;

      return (_this$props3 = this.props).onRender.apply(_this$props3, arguments);
    }
  }, {
    key: "onFinalize",
    value: function onFinalize() {
      var _this$props4;

      return (_this$props4 = this.props).onFinalize.apply(_this$props4, arguments);
    } // DEPRECATED/REMOVED METHODS

  }, {
    key: "getHTMLControlValue",
    value: function getHTMLControlValue(id) {
      var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
      var element = document.getElementById(id);
      return element ? Number(element.value) : defaultValue;
    } // Update parameters

  }, {
    key: "setViewParameters",
    value: function setViewParameters() {
      _utils.log.removed('AnimationLoop.setViewParameters', 'AnimationLoop.setProps')();

      return this;
    } // PRIVATE METHODS

  }, {
    key: "_startLoop",
    value: function _startLoop() {
      var _this2 = this;

      var renderFrame = function renderFrame() {
        if (!_this2._running) {
          return;
        }

        _this2.redraw();

        _this2._animationFrameId = (0, _webglUtils.requestAnimationFrame)(renderFrame);
      }; // cancel any pending renders to ensure only one loop can ever run


      (0, _webglUtils.cancelAnimationFrame)(this._animationFrameId);
      this._animationFrameId = (0, _webglUtils.requestAnimationFrame)(renderFrame);
    }
  }, {
    key: "_clearNeedsRedraw",
    value: function _clearNeedsRedraw() {
      this.needsRedraw = null;
    }
  }, {
    key: "_setupFrame",
    value: function _setupFrame() {
      if (this._onSetupFrame) {
        // call callback
        this._onSetupFrame(this.animationProps); // end callback

      } else {
        this._resizeCanvasDrawingBuffer();

        this._resizeViewport();

        this._resizeFramebuffer();
      }
    } // Initialize the  object that will be passed to app callbacks

  }, {
    key: "_initializeCallbackData",
    value: function _initializeCallbackData() {
      this.animationProps = {
        gl: this.gl,
        stop: this.stop,
        canvas: this.gl.canvas,
        framebuffer: this.framebuffer,
        // Initial values
        useDevicePixels: this.useDevicePixels,
        needsRedraw: null,
        // Animation props
        startTime: Date.now(),
        time: 0,
        tick: 0,
        tock: 0,
        // canvas
        // Experimental
        _loop: this,
        _animationLoop: this,
        _mousePosition: null // Event props

      };
    } // Update the context object that will be passed to app callbacks

  }, {
    key: "_updateCallbackData",
    value: function _updateCallbackData() {
      var _this$_getSizeAndAspe = this._getSizeAndAspect(),
          width = _this$_getSizeAndAspe.width,
          height = _this$_getSizeAndAspe.height,
          aspect = _this$_getSizeAndAspe.aspect;

      if (width !== this.animationProps.width || height !== this.animationProps.height) {
        this.setNeedsRedraw('drawing buffer resized');
      }

      if (aspect !== this.animationProps.aspect) {
        this.setNeedsRedraw('drawing buffer aspect changed');
      }

      this.animationProps.width = width;
      this.animationProps.height = height;
      this.animationProps.aspect = aspect;
      this.animationProps.needsRedraw = this.needsRedraw; // Increment tick

      this.animationProps.time = Date.now() - this.animationProps.startTime;
      this.animationProps.tick = Math.floor(this.animationProps.time / 1000 * 60);
      this.animationProps.tock++; // experimental

      this.animationProps._offScreen = this.offScreen;
    }
  }, {
    key: "_finalizeCallbackData",
    value: function _finalizeCallbackData() {
      // call callback
      this.onFinalize(this.animationProps); // end callback
    } // Add application's data to the app context object

  }, {
    key: "_addCallbackData",
    value: function _addCallbackData(appContext) {
      if ((0, _typeof2.default)(appContext) === 'object' && appContext !== null) {
        this.animationProps = Object.assign({}, this.animationProps, appContext);
      }
    } // Either uses supplied or existing context, or calls provided callback to create one

  }, {
    key: "_createWebGLContext",
    value: function _createWebGLContext(opts) {
      this.offScreen = opts.canvas && typeof OffscreenCanvas !== 'undefined' && opts.canvas instanceof OffscreenCanvas; // Create the WebGL context if necessary

      opts = Object.assign({}, opts, DEFAULT_GL_OPTIONS, this.props.glOptions);
      this.gl = this.props.gl || this.onCreateContext(opts);

      if (!(0, _webglUtils.isWebGL)(this.gl)) {
        throw new Error('AnimationLoop.onCreateContext - illegal context returned');
      }

      if (this.props.debug) {
        this.gl = (0, _debugContext.makeDebugContext)(this.gl);
      } // Reset the WebGL context.


      (0, _webglContext.resetParameters)(this.gl);

      this._createInfoDiv();
    }
  }, {
    key: "_createInfoDiv",
    value: function _createInfoDiv() {
      if (this.gl.canvas && this.props.onAddHTML) {
        /* global document */
        var wrapperDiv = document.createElement('div');
        document.body.appendChild(wrapperDiv);
        wrapperDiv.style.position = 'relative';
        var div = document.createElement('div');
        div.style.position = 'absolute';
        div.style.left = '10px';
        div.style.bottom = '10px';
        div.style.width = '300px';
        div.style.background = 'white';
        wrapperDiv.appendChild(this.gl.canvas);
        wrapperDiv.appendChild(div);
        var html = this.props.onAddHTML(div);

        if (html) {
          div.innerHTML = html;
        }
      }
    }
  }, {
    key: "_getSizeAndAspect",
    value: function _getSizeAndAspect() {
      // https://webglfundamentals.org/webgl/lessons/webgl-resizing-the-canvas.html
      var width = this.gl.drawingBufferWidth;
      var height = this.gl.drawingBufferHeight; // https://webglfundamentals.org/webgl/lessons/webgl-anti-patterns.html

      var aspect = 1;
      var _this$gl$canvas = this.gl.canvas,
          clientWidth = _this$gl$canvas.clientWidth,
          clientHeight = _this$gl$canvas.clientHeight;

      if (clientWidth >= 0 && clientHeight >= 0) {
        aspect = height > 0 ? clientWidth / clientHeight : 1;
      } else if (width > 0 && height > 0) {
        aspect = width / height;
      }

      return {
        width: width,
        height: height,
        aspect: aspect
      };
    } // Default viewport setup

  }, {
    key: "_resizeViewport",
    value: function _resizeViewport() {
      if (this.autoResizeViewport) {
        this.gl.viewport(0, 0, this.gl.drawingBufferWidth, this.gl.drawingBufferHeight);
      }
    } // Resize the render buffer of the canvas to match canvas client size
    // Optionally multiplying with devicePixel ratio

  }, {
    key: "_resizeCanvasDrawingBuffer",
    value: function _resizeCanvasDrawingBuffer() {
      if (this.autoResizeDrawingBuffer) {
        (0, _webglContext.resizeGLContext)(this.gl, {
          useDevicePixels: this.useDevicePixels
        });
      }
    } // TBD - deprecated?

  }, {
    key: "_createFramebuffer",
    value: function _createFramebuffer() {
      // Setup default framebuffer
      if (this.props.createFramebuffer) {
        this.framebuffer = new _webgl.Framebuffer(this.gl);
      }
    }
  }, {
    key: "_resizeFramebuffer",
    value: function _resizeFramebuffer() {
      if (this.framebuffer) {
        this.framebuffer.resize({
          width: this.gl.drawingBufferWidth,
          height: this.gl.drawingBufferHeight
        });
      }
    } // Event handling

  }, {
    key: "_startEventHandling",
    value: function _startEventHandling() {
      this.gl.canvas.addEventListener('mousemove', this._onMousemove);
      this.gl.canvas.addEventListener('mouseleave', this._onMouseleave);
    }
  }, {
    key: "_onMousemove",
    value: function _onMousemove(e) {
      this.animationProps._mousePosition = [e.offsetX, e.offsetY];
    }
  }, {
    key: "_onMouseleave",
    value: function _onMouseleave(e) {
      this.animationProps._mousePosition = null;
    }
  }]);
  return AnimationLoop;
}();

exports.default = AnimationLoop;
},{"@babel/runtime/helpers/esm/typeof":"Izky","@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","../webgl-context":"id7L","../webgl-context/debug-context":"lVQr","../webgl-utils":"PmJk","../utils":"PFG0","../utils/assert":"wYRU","../webgl":"x2lE"}],"ODk1":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = pickModels;

var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));

var _webgl = require("../webgl");

var _group = _interopRequireDefault(require("./group"));

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/* global window */
function getDevicePixelRatio() {
  return typeof window !== 'undefined' ? window.devicePixelRatio : 1;
}

function pickModels(gl, props) {
  var models = props.models,
      position = props.position,
      _props$uniforms = props.uniforms,
      uniforms = _props$uniforms === void 0 ? {} : _props$uniforms,
      _props$parameters = props.parameters,
      parameters = _props$parameters === void 0 ? {} : _props$parameters,
      settings = props.settings,
      _props$useDevicePixel = props.useDevicePixels,
      useDevicePixels = _props$useDevicePixel === void 0 ? true : _props$useDevicePixel,
      framebuffer = props.framebuffer,
      context = props.context;
  (0, _assert.default)((0, _webgl.isWebGL)(gl) && framebuffer && position);

  var _position = (0, _slicedToArray2.default)(position, 2),
      x = _position[0],
      y = _position[1]; // Match our picking framebuffer with the size of the canvas drawing buffer


  framebuffer.resize({
    width: gl.canvas.width,
    height: gl.canvas.height
  }); // Compensate for devicePixelRatio
  // Note: this assumes the canvas framebuffer has been matched

  var dpr = useDevicePixels ? getDevicePixelRatio() : 1; // Reverse the y coordinate

  var deviceX = x * dpr;
  var deviceY = gl.canvas.height - y * dpr; // return withParameters(gl, {
  //   // framebuffer,
  //   // // We are only interested in one pixel, no need to render anything else
  //   // scissorTest: {x: deviceX, y: deviceY, w: 1, h: 1}
  // }, () => {

  var group = new _group.default({
    children: models
  });
  return group.traverseReverse(function (model) {
    if (model.pickable) {
      // Clear the frame buffer
      (0, _webgl.clear)(gl, {
        framebuffer: framebuffer,
        color: true,
        depth: true
      }); // Render picking colors

      /* eslint-disable camelcase */

      model.setUniforms({
        picking_uActive: 1
      });
      model.draw(Object.assign({}, props, {
        uniforms: uniforms,
        parameters: parameters,
        settings: settings,
        framebuffer: framebuffer,
        context: context
      }));
      model.setUniforms({
        picking_uActive: 0
      }); // Sample Read color in the central pixel, to be mapped as a picking color

      var color = framebuffer.readPixels({
        x: deviceX,
        y: deviceY,
        width: 1,
        height: 1,
        format: 6408,
        type: 5121
      });
      var isPicked = color[0] !== 0 || color[1] !== 0 || color[2] !== 0; // Add the information to the stack

      if (isPicked) {
        return {
          model: model,
          color: color,
          x: x,
          y: y,
          deviceX: deviceX,
          deviceY: deviceY
        };
      }
    }

    return null;
  }); // });
}
},{"@babel/runtime/helpers/esm/slicedToArray":"U1JK","../webgl":"x2lE","./group":"gKrA","../utils/assert":"wYRU"}],"hRQS":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.encodePickingColor = encodePickingColor;
exports.decodePickingColor = decodePickingColor;
exports.getNullPickingColor = getNullPickingColor;

var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var NULL_PICKING_COLOR = new Uint8Array([0, 0, 0]); // Encodes an index as a Uint8Array([r, g, b]) format picking color

function encodePickingColor(i) {
  return [i + 1 & 255, i + 1 >> 8 & 255, i + 1 >> 16 & 255];
} // Decodes a picking color in [r, g, b] format to an index


function decodePickingColor(color) {
  // assert(color instanceof Uint8Array);
  var _color = (0, _slicedToArray2.default)(color, 3),
      i1 = _color[0],
      i2 = _color[1],
      i3 = _color[2]; // 1 was added to seperate from no selection


  var index = i1 + i2 * 256 + i3 * 65536 - 1;
  return index;
} // Return picking color representing no item at that pixel


function getNullPickingColor() {
  return NULL_PICKING_COLOR;
}
},{"@babel/runtime/helpers/esm/slicedToArray":"U1JK"}],"lt5T":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.updateForTextures = updateForTextures;
exports.getSizeUniforms = getSizeUniforms;
exports.getVaryingType = getVaryingType;
exports.processAttributeDefinition = processAttributeDefinition;

var _assert = _interopRequireDefault(require("assert"));

var _src = require("../shadertools/src");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var SAMPLER_UNIFORM_PREFIX = 'transform_uSampler_';
var SIZE_UNIFORM_PREFIX = 'transform_uSize_';
var VS_POS_VARIABLE = 'transform_position'; // Scan provided vertex shader
// for each texture attribute, inject sampler instructions and build uniforms for sampler
// for texture target, get varying type and inject position instruction

function updateForTextures(_ref) {
  var vs = _ref.vs,
      sourceTextureMap = _ref.sourceTextureMap,
      targetTextureVarying = _ref.targetTextureVarying,
      targetTexture = _ref.targetTexture;
  var texAttributeNames = Object.keys(sourceTextureMap);
  var sourceCount = texAttributeNames.length;
  var targetTextureType = null;
  var samplerTextureMap = {};
  var updatedVs = vs;
  var finalInject = {};

  if (sourceCount > 0 || targetTextureVarying) {
    var vsLines = updatedVs.split('\n');
    var updateVsLines = vsLines.slice();
    vsLines.forEach(function (line, index, lines) {
      // TODO add early exit
      if (sourceCount > 0) {
        var updated = processAttributeDefinition(line, sourceTextureMap);

        if (updated) {
          var updatedLine = updated.updatedLine,
              inject = updated.inject;
          updateVsLines[index] = updatedLine; // sampleInstructions.push(sampleInstruction);

          finalInject = (0, _src.combineInjects)([finalInject, inject]);
          Object.assign(samplerTextureMap, updated.samplerTextureMap);
          sourceCount--;
        }
      }

      if (targetTextureVarying && !targetTextureType) {
        targetTextureType = getVaryingType(line, targetTextureVarying);
      }
    });

    if (targetTextureVarying) {
      (0, _assert.default)(targetTexture);
      var sizeName = "".concat(SIZE_UNIFORM_PREFIX).concat(targetTextureVarying);
      var uniformDeclaration = "uniform vec2 ".concat(sizeName, ";\n");
      var posInstructions = "     vec2 ".concat(VS_POS_VARIABLE, " = transform_getPos(").concat(sizeName, ");\n     gl_Position = vec4(").concat(VS_POS_VARIABLE, ", 0, 1.);\n");
      var inject = {
        'vs:#decl': uniformDeclaration,
        'vs:#main-start': posInstructions
      };
      finalInject = (0, _src.combineInjects)([finalInject, inject]);
    }

    updatedVs = updateVsLines.join('\n');
  }

  return {
    // updated vertex shader (commented texture attribute definition)
    vs: updatedVs,
    // type (float, vec2, vec3 of vec4) target texture varying
    targetTextureType: targetTextureType,
    // required vertex and fragment shader injects
    inject: finalInject,
    // map of sampler name to texture name, can be used to set attributes
    // usefull when swapping textures, as source and destination texture change when swap is called.
    samplerTextureMap: samplerTextureMap
  };
} // builds and returns an object contaning size uniform for each texture


function getSizeUniforms(_ref2) {
  var sourceTextureMap = _ref2.sourceTextureMap,
      targetTextureVarying = _ref2.targetTextureVarying,
      targetTexture = _ref2.targetTexture;
  var uniforms = {};
  var width;
  var height;

  if (targetTextureVarying) {
    width = targetTexture.width;
    height = targetTexture.height;
    uniforms["".concat(SIZE_UNIFORM_PREFIX).concat(targetTextureVarying)] = [width, height];
  }

  for (var textureName in sourceTextureMap) {
    var _sourceTextureMap$tex = sourceTextureMap[textureName];
    width = _sourceTextureMap$tex.width;
    height = _sourceTextureMap$tex.height;
    uniforms["".concat(SIZE_UNIFORM_PREFIX).concat(textureName)] = [width, height];
  }

  return uniforms;
} // Checks if provided line is defining an attribute, if so returns details otherwise null


function getAttributeDefinition(line) {
  return (0, _src.getQualifierDetails)(line, ['attribute', 'in']);
}

function getSamplerDeclerations(textureName) {
  var samplerName = "".concat(SAMPLER_UNIFORM_PREFIX).concat(textureName);
  var sizeName = "".concat(SIZE_UNIFORM_PREFIX).concat(textureName);
  var uniformDeclerations = "  uniform sampler2D ".concat(samplerName, ";\n  uniform vec2 ").concat(sizeName, ";");
  return {
    samplerName: samplerName,
    sizeName: sizeName,
    uniformDeclerations: uniformDeclerations
  };
} // Return size (float, vec2 etc) of a given varying, null if doens't exist.


function getVaryingType(line, varying) {
  var qualaiferDetails = (0, _src.getQualifierDetails)(line, ['varying', 'out']);

  if (!qualaiferDetails) {
    return null;
  }

  return qualaiferDetails.name === varying ? qualaiferDetails.type : null;
} // build required definitions, sample instructions for each texture attribute


function processAttributeDefinition(line, textureMap) {
  var samplerTextureMap = {};
  var attributeData = getAttributeDefinition(line);

  if (!attributeData) {
    return null;
  }

  var type = attributeData.type,
      name = attributeData.name;

  if (name && textureMap[name]) {
    var updatedLine = "// ".concat(line, " => Replaced by Transform with a sampler");

    var _getSamplerDecleratio = getSamplerDeclerations(name),
        samplerName = _getSamplerDecleratio.samplerName,
        sizeName = _getSamplerDecleratio.sizeName,
        uniformDeclerations = _getSamplerDecleratio.uniformDeclerations;

    var channels = (0, _src.typeToChannelSuffix)(type);
    var sampleInstruction = "  ".concat(type, " ").concat(name, " = transform_getInput(").concat(samplerName, ", ").concat(sizeName, ").").concat(channels, ";\n");
    samplerTextureMap[samplerName] = name;
    var inject = {
      'vs:#decl': uniformDeclerations,
      'vs:#main-start': sampleInstruction
    }; // samplerNameMap

    return {
      // update vertex shader line.
      updatedLine: updatedLine,
      // inject object with sampler instructions.
      inject: inject,
      // sampler name to texture name map
      samplerTextureMap: samplerTextureMap
    };
  }

  return null;
}
},{"assert":"AoLc","../shadertools/src":"xR5I"}],"xrYx":[function(require,module,exports) {

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));

var _model = _interopRequireDefault(require("./model"));

var _buffer = _interopRequireDefault(require("../webgl/buffer"));

var _framebuffer = _interopRequireDefault(require("../webgl/framebuffer"));

var _texture2d = _interopRequireDefault(require("../webgl/texture-2d"));

var _transformFeedback = _interopRequireDefault(require("../webgl/transform-feedback"));

var _injectShader = require("../shadertools/src/lib/inject-shader");

var _src = require("../shadertools/src");

var _webglUtils = require("../webgl-utils");

var _assert = _interopRequireDefault(require("../utils/assert"));

var _utils = require("../utils");

var _transformShaderUtils = require("./transform-shader-utils");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _SRC_TEX_PARAMETER_OV;

// Texture parameters needed so sample can precisely pick pixel for given element id.
var SRC_TEX_PARAMETER_OVERRIDES = (_SRC_TEX_PARAMETER_OV = {}, (0, _defineProperty2.default)(_SRC_TEX_PARAMETER_OV, 10241, 9728), (0, _defineProperty2.default)(_SRC_TEX_PARAMETER_OV, 10240, 9728), (0, _defineProperty2.default)(_SRC_TEX_PARAMETER_OV, 10242, 33071), (0, _defineProperty2.default)(_SRC_TEX_PARAMETER_OV, 10243, 33071), _SRC_TEX_PARAMETER_OV);
var FS_OUTPUT_VARIABLE = 'transform_output';

var Transform =
/*#__PURE__*/
function () {
  (0, _createClass2.default)(Transform, null, [{
    key: "isSupported",
    value: function isSupported(gl) {
      // For now WebGL2 only
      return (0, _webglUtils.isWebGL2)(gl);
    }
  }]);

  function Transform(gl) {
    var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, Transform);
    (0, _webglUtils.assertWebGL2Context)(gl);
    this.gl = gl;
    this.model = null;
    this.elementCount = 0;
    this.currentIndex = 0; // Source and destination resources are stored in two element Arrays for easier swapping when
    // 'feedbackMap' is provided. If not only the first array elment is used.
    // Each array element is an object with attribute name as Key and Buffer object as value.

    this.sourceBuffers = new Array(2); // Each array element is an object with attribute name as Key and Texture object as value.

    this.sourceTextures = new Array(2); // Each array element is an object with varying name as Key and Buffer object as value.

    this.feedbackBuffers = new Array(2); // Each array element is a Texture object used as color attachment for framebuffer.

    this.targetTextures = new Array(2); // Each array element is a TransformFeedback object.

    this.transformFeedbacks = new Array(2); // Each array element is a Framebuffer object.

    this.framebuffers = new Array(2);
    this._createdBuffers = {};
    this.elementIDBuffer = null; // reference source texture name for target texture

    this._targetRefTexName = null;

    this._initialize(props);

    Object.seal(this);
  } // Delete owned resources.


  (0, _createClass2.default)(Transform, [{
    key: "delete",
    value: function _delete() {
      for (var name in this._createdBuffers) {
        this._createdBuffers[name].delete();
      }

      this.model.delete();
    } // Return Buffer object for given varying name.

  }, {
    key: "getBuffer",
    value: function getBuffer() {
      var varyingName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
      var bufferOrParams = varyingName ? this.feedbackBuffers[this.currentIndex][varyingName] : null;

      if (!bufferOrParams) {
        return null;
      }

      return bufferOrParams instanceof _buffer.default ? bufferOrParams : bufferOrParams.buffer;
    } // Returns the color attachment textuer from current framebuffer target

  }, {
    key: "_getTargetTexture",
    value: function _getTargetTexture() {
      if (this.framebuffers[this.currentIndex]) {
        return this.framebuffers[this.currentIndex].attachments[36064];
      }

      return null;
    } // Return data either from Buffer or from Texture

  }, {
    key: "getData",
    value: function getData() {
      var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          _ref$varyingName = _ref.varyingName,
          varyingName = _ref$varyingName === void 0 ? null : _ref$varyingName,
          _ref$packed = _ref.packed,
          packed = _ref$packed === void 0 ? false : _ref$packed; // Either there should be specified feedbackBuffer or we should be rendering to a texture


      var buffer = this.getBuffer(varyingName);

      if (buffer) {
        return buffer.getData();
      } // When varyingName is not provided return data from framebuffer object.


      (0, _assert.default)(!varyingName || varyingName === this.targetTextureVarying);
      var pixels = this.framebuffers[this.currentIndex].readPixels();

      if (!packed) {
        return pixels;
      } // readPixels returns 4 elements for each pixel, pack the elements when requested


      var ArrayType = pixels.constructor;
      var channelCount = (0, _src.typeToChannelCount)(this.targetTextureType);
      var packedPixels = new ArrayType(pixels.length * channelCount / 4);
      var packCount = 0;

      for (var i = 0; i < pixels.length; i += 4) {
        for (var j = 0; j < channelCount; j++) {
          packedPixels[packCount++] = pixels[i + j];
        }
      }

      return packedPixels;
    } // returns current framebuffer object that is being used.

  }, {
    key: "getFramebuffer",
    value: function getFramebuffer() {
      return this.framebuffers[this.currentIndex];
    }
  }, {
    key: "_getInputs",
    value: function _getInputs() {
      var uniforms = {};
      var current = this.currentIndex; // Buffer inputs

      var attributes = Object.assign({}, this.sourceBuffers[current]); // Texture inputs

      if (this.hasSourceTextures || this.targetTextureVarying) {
        // TODO: add option not generate position using element id.
        attributes.transform_elementID = this.elementIDBuffer;

        for (var sampler in this.samplerTextureMap) {
          var textureName = this.samplerTextureMap[sampler];
          uniforms[sampler] = this.sourceTextures[current][textureName];
        } // Also update size uniforms , add samplerSizeMap


        this._setSourceTextureParameters(); // get texture size uniforms


        var sizeUniforms = (0, _transformShaderUtils.getSizeUniforms)({
          sourceTextureMap: this.sourceTextures[current],
          targetTextureVarying: this.targetTextureVarying,
          targetTexture: this.targetTextures[current]
        });
        Object.assign(uniforms, sizeUniforms);
      }

      return {
        attributes: attributes,
        uniforms: uniforms
      };
    } // Run one transform feedback loop.

  }, {
    key: "run",
    value: function run() {
      var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

      var _this$_getInputs = this._getInputs(),
          attributes = _this$_getInputs.attributes,
          uniforms = _this$_getInputs.uniforms;

      Object.assign(uniforms, opts.uniforms);
      var parameters = Object.assign({}, opts.parameters);
      var _opts$clearRenderTarg = opts.clearRenderTarget,
          clearRenderTarget = _opts$clearRenderTarg === void 0 ? true : _opts$clearRenderTarg;
      var framebuffer = null;
      var discard = true;

      if (this.renderingToTexture) {
        discard = false;
        framebuffer = this.framebuffers[this.currentIndex];
        (0, _assert.default)(framebuffer);
        parameters.viewport = [0, 0, framebuffer.width, framebuffer.height];

        if (clearRenderTarget) {
          this.gl.clear(this.gl.COLOR_BUFFER_BIT);
        }
      }

      this.model.setAttributes(attributes);
      this.model.transform(Object.assign({}, opts, {
        transformFeedback: this.transformFeedbacks[this.currentIndex],
        uniforms: uniforms,
        discard: discard,
        framebuffer: framebuffer,
        parameters: parameters
      }));
    } // Swap source and destination buffers and textures.

  }, {
    key: "swapBuffers",
    value: function swapBuffers() {
      _utils.log.deprecated('swapBuffers()', 'swap()');

      this.swap();
    } // Swap source and destination buffers and textures.

  }, {
    key: "swap",
    value: function swap() {
      (0, _assert.default)(this.feedbackMap || this._swapTexture);
      this.currentIndex = (this.currentIndex + 1) % 2;
    } // Update some or all buffer bindings.

  }, {
    key: "update",
    value: function update() {
      var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

      if (opts.elementCount) {
        this._setElementCount(opts.elementCount);
      }

      var _opts$sourceBuffers = opts.sourceBuffers,
          sourceBuffers = _opts$sourceBuffers === void 0 ? null : _opts$sourceBuffers,
          _opts$feedbackBuffers = opts.feedbackBuffers,
          feedbackBuffers = _opts$feedbackBuffers === void 0 ? null : _opts$feedbackBuffers;
      var currentIndex = this.currentIndex;

      if (sourceBuffers || feedbackBuffers) {
        for (var bufferName in feedbackBuffers) {
          (0, _assert.default)(feedbackBuffers[bufferName] instanceof _buffer.default || feedbackBuffers[bufferName].buffer instanceof _buffer.default);
        }

        Object.assign(this.sourceBuffers[currentIndex], sourceBuffers);
        Object.assign(this.feedbackBuffers[currentIndex], feedbackBuffers);

        this._createFeedbackBuffers({
          feedbackBuffers: feedbackBuffers
        });

        if (this.transformFeedbacks[currentIndex]) {
          this.transformFeedbacks[currentIndex].setBuffers(this.feedbackBuffers[currentIndex]);
        } // Buffers have changed, need to re-setup swap buffers.


        this._setupSwapBuffers();
      }

      var _sourceTextures = opts._sourceTextures,
          _targetTexture = opts._targetTexture;

      if (_sourceTextures || _targetTexture) {
        Object.assign(this.sourceTextures[currentIndex], _sourceTextures); // if _targetTexture specified use it, other wise rebuild traget texture using
        // '_targetRefTexName' as coresponding source texture may have been update.

        this._updateTargetTexture(_targetTexture || this._targetRefTexName, currentIndex); // textures have changed, need to re-setup swap textures.


        this._setupSwapTextures();
      }
    } // set texture filtering parameters on source textures.

  }, {
    key: "_setSourceTextureParameters",
    value: function _setSourceTextureParameters() {
      var index = this.currentIndex;

      for (var name in this.sourceTextures[index]) {
        this.sourceTextures[index][name].setParameters(SRC_TEX_PARAMETER_OVERRIDES);
      }
    } // set element count and updated elementID buffer if needed.

  }, {
    key: "_setElementCount",
    value: function _setElementCount(elementCount) {
      if (this.elementCount === elementCount) {
        return;
      }

      if (this.elementCount < elementCount) {
        this._updateElementIDBuffer(elementCount);
      }

      this.model.setVertexCount(elementCount);
      this.elementCount = elementCount;
    } // sets target texture for rendering by updating framebuffer

  }, {
    key: "_updateTargetTexture",
    value: function _updateTargetTexture(texture, index) {
      var targetTexture = this._buildTargetTexture(texture);

      if (targetTexture) {
        this.targetTextures[index] = targetTexture;

        if (this.framebuffers[index]) {
          // First update texture without re-sizing attachments
          this.framebuffers[index].update({
            attachments: (0, _defineProperty2.default)({}, 36064, this.targetTextures[index]),
            resizeAttachments: false
          }); // Resize to new taget texture size

          this.framebuffers[index].resize({
            width: targetTexture.width,
            height: targetTexture.height
          });
        }
      }
    } // Private

  }, {
    key: "_initialize",
    value: function _initialize() {
      var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

      var _this$_validateProps = this._validateProps(props),
          feedbackBuffers = _this$_validateProps.feedbackBuffers,
          feedbackMap = _this$_validateProps.feedbackMap;

      var sourceBuffers = props.sourceBuffers,
          varyings = props.varyings,
          _targetTexture = props._targetTexture,
          _targetTextureVarying = props._targetTextureVarying,
          _swapTexture = props._swapTexture;
      var varyingsArray = varyings;

      if (feedbackMap && !Array.isArray(varyings)) {
        varyingsArray = Object.values(feedbackMap);
      }

      this.varyingsArray = varyingsArray;
      this.feedbackMap = feedbackMap;
      this._swapTexture = _swapTexture;

      if (_targetTexture) {
        this.targetTextureVarying = _targetTextureVarying;
        this.renderingToTexture = true;
        (0, _assert.default)(this.targetTextureVarying);
      }

      this._setupBuffers({
        sourceBuffers: sourceBuffers,
        feedbackBuffers: feedbackBuffers
      });

      this._setupTextures(props);

      this._setupSwapBuffers();

      this._setupSwapTextures();

      this._buildModel(Object.assign({}, props, {
        id: props.id || 'transform-model',
        drawMode: props.drawMode || 0,
        varyings: varyingsArray
      }));
    } // assert on required parameters

    /* eslint-disable complexity */

  }, {
    key: "_validateProps",
    value: function _validateProps(props) {
      var feedbackBuffers = props.feedbackBuffers,
          feedbackMap = props.feedbackMap; // backward compitability

      var destinationBuffers = props.destinationBuffers,
          sourceDestinationMap = props.sourceDestinationMap;

      if (destinationBuffers) {
        _utils.log.deprecated('destinationBuffers', 'feedbackBuffers')();

        feedbackBuffers = feedbackBuffers || destinationBuffers;
      }

      if (sourceDestinationMap) {
        _utils.log.deprecated('sourceDestinationMap', 'feedbackMap')();

        feedbackMap = feedbackMap || sourceDestinationMap;
      } // assert on required parameters


      var vs = props.vs,
          elementCount = props.elementCount,
          varyings = props.varyings;
      var _sourceTextures = props._sourceTextures,
          _targetTexture = props._targetTexture,
          _targetTextureVarying = props._targetTextureVarying,
          _swapTexture = props._swapTexture;
      (0, _assert.default)(vs && ( // destinations are provided
      varyings || feedbackMap || _targetTexture) && // when only writting to textures auto-duduce from texture dimenstions
      elementCount);

      for (var bufferName in feedbackBuffers || {}) {
        (0, _assert.default)(feedbackBuffers[bufferName] instanceof _buffer.default || feedbackBuffers[bufferName].buffer instanceof _buffer.default);
      }

      for (var textureName in _sourceTextures || {}) {
        (0, _assert.default)(_sourceTextures[textureName] instanceof _texture2d.default);
      } // If rendering to texture , varying is provided


      (0, _assert.default)(!_targetTexture || _targetTextureVarying); // swap texture must be a valid source texture

      (0, _assert.default)(!_swapTexture || _sourceTextures[_swapTexture]);
      return {
        feedbackBuffers: feedbackBuffers,
        feedbackMap: feedbackMap
      };
    }
    /* eslint-enable complexity */
    // setup source and destination buffers

  }, {
    key: "_setupBuffers",
    value: function _setupBuffers(_ref2) {
      var _ref2$sourceBuffers = _ref2.sourceBuffers,
          sourceBuffers = _ref2$sourceBuffers === void 0 ? null : _ref2$sourceBuffers,
          _ref2$feedbackBuffers = _ref2.feedbackBuffers,
          feedbackBuffers = _ref2$feedbackBuffers === void 0 ? null : _ref2$feedbackBuffers;
      this.sourceBuffers[0] = Object.assign({}, sourceBuffers);
      this.feedbackBuffers[0] = Object.assign({}, feedbackBuffers);

      this._createFeedbackBuffers({
        feedbackBuffers: feedbackBuffers
      });

      this.sourceBuffers[1] = {};
      this.feedbackBuffers[1] = {};
    } // setup source and destination textures

  }, {
    key: "_setupTextures",
    value: function _setupTextures() {
      var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      var _sourceTextures = props._sourceTextures,
          _targetTexture = props._targetTexture; // Setup source texture

      this.sourceTextures[0] = Object.assign({}, _sourceTextures);
      this.sourceTextures[1] = {};
      this.hasSourceTextures = Object.keys(this.sourceTextures[0]).length > 0;

      if (this.targetTextureVarying) {
        var texture = this._buildTargetTexture(_targetTexture); // Either a texture or refAttribute must be provided


        (0, _assert.default)(texture);
        this.targetTextures[0] = texture;
        this.targetTextures[1] = null;
      }
    } // Builds target texture using source reference or provided texture object.

  }, {
    key: "_buildTargetTexture",
    value: function _buildTargetTexture(textureOrAttribute) {
      var _parameters;

      if (textureOrAttribute instanceof _texture2d.default) {
        return textureOrAttribute;
      }

      var refTexture = this.sourceTextures[0][textureOrAttribute];

      if (!refTexture) {
        return null;
      } // save reference texture name, when corresponding source texture is updated
      // we also update target texture.


      this._targetRefTexName = textureOrAttribute;
      return (0, _webglUtils.cloneTextureFrom)(refTexture, {
        parameters: (_parameters = {}, (0, _defineProperty2.default)(_parameters, 10241, 9728), (0, _defineProperty2.default)(_parameters, 10240, 9728), (0, _defineProperty2.default)(_parameters, 10242, 33071), (0, _defineProperty2.default)(_parameters, 10243, 33071), _parameters),
        pixelStore: (0, _defineProperty2.default)({}, 37440, false)
      });
    } // auto create any feedback buffers

  }, {
    key: "_createFeedbackBuffers",
    value: function _createFeedbackBuffers(_ref3) {
      var feedbackBuffers = _ref3.feedbackBuffers;

      if (!this.feedbackMap) {
        // feedbackMap required to auto create buffers.
        return;
      }

      var current = this.currentIndex;

      for (var sourceBufferName in this.feedbackMap) {
        var feedbackBufferName = this.feedbackMap[sourceBufferName];

        if (feedbackBufferName !== this.targetTextureVarying && (!feedbackBuffers || !feedbackBuffers[feedbackBufferName])) {
          // Create new buffer with same layout and settings as source buffer
          var sourceBuffer = this.sourceBuffers[current][sourceBufferName];
          var bytes = sourceBuffer.bytes,
              type = sourceBuffer.type,
              usage = sourceBuffer.usage,
              accessor = sourceBuffer.accessor;
          var buffer = new _buffer.default(this.gl, {
            bytes: bytes,
            type: type,
            usage: usage,
            accessor: accessor
          });

          if (this._createdBuffers[feedbackBufferName]) {
            this._createdBuffers[feedbackBufferName].delete();
          }

          this._createdBuffers[feedbackBufferName] = buffer;
          this.feedbackBuffers[current][feedbackBufferName] = buffer;
        }
      }
    } // Create a buffer and add to list of buffers to be deleted.

  }, {
    key: "_createNewBuffer",
    value: function _createNewBuffer(name, opts) {
      var buffer = new _buffer.default(this.gl, opts);

      if (this._createdBuffers[name]) {
        this._createdBuffers[name].delete();

        this._createdBuffers[name] = buffer;
      }

      return buffer;
    } // setup buffers for swapping.
    // Second set of source and feedback objects are setup to point
    // to corresponding feedback and source buffers.

  }, {
    key: "_setupSwapBuffers",
    value: function _setupSwapBuffers() {
      if (!this.feedbackMap) {
        // feedbackMap required set up swap buffers.
        return;
      }

      var current = this.currentIndex;
      var next = (current + 1) % 2; // Copy all buffers/textures so un-mapped sources will remain same

      Object.assign(this.sourceBuffers[next], this.sourceBuffers[current]);
      Object.assign(this.feedbackBuffers[next], this.feedbackBuffers[current]);

      for (var srcName in this.feedbackMap) {
        var dstName = this.feedbackMap[srcName]; // TODO: add textureMap and remove this if loop

        if (dstName !== this.targetTextureVarying) {
          this.sourceBuffers[next][srcName] = this.feedbackBuffers[current][dstName];
          this.feedbackBuffers[next][dstName] = this.sourceBuffers[current][srcName]; // make sure the new destination buffer is a Buffer object

          (0, _assert.default)(this.feedbackBuffers[next][dstName] instanceof _buffer.default);
        }
      } // When triggered by `update()` TranformFeedback objects are already set up,
      // if so update buffers


      if (this.transformFeedbacks[next]) {
        this.transformFeedbacks[next].setBuffers(this.feedbackBuffers[next]);
      } // TODO: add swap support for targetTexture and framebuffers

    } // setup textures for swapping.

  }, {
    key: "_setupSwapTextures",
    value: function _setupSwapTextures() {
      if (!this._swapTexture || !this.targetTextureVarying) {
        // Must be rendering to a texture and _swapTexture is provided
        return;
      }

      var current = this.currentIndex;
      var next = (current + 1) % 2;
      Object.assign(this.sourceTextures[next], this.sourceTextures[current]);
      this.sourceTextures[next][this._swapTexture] = this.targetTextures[current];

      this._updateTargetTexture(this.sourceTextures[current][this._swapTexture], next);
    } // build Model and TransformFeedback objects

  }, {
    key: "_buildModel",
    value: function _buildModel() {
      var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

      var _this$_getShaders = this._getShaders(props),
          vs = _this$_getShaders.vs,
          fs = _this$_getShaders.fs,
          modules = _this$_getShaders.modules,
          uniforms = _this$_getShaders.uniforms,
          inject = _this$_getShaders.inject,
          samplerTextureMap = _this$_getShaders.samplerTextureMap;

      this.model = new _model.default(this.gl, Object.assign({}, props, {
        vs: vs,
        fs: fs,
        vertexCount: props.elementCount,
        modules: modules,
        uniforms: uniforms,
        inject: inject
      }));
      this.samplerTextureMap = samplerTextureMap; // setup TF to capture varyings.

      this._setupTransformFeedback(); // setup Framebuffer object for rendering to Texture.


      this._setupFramebuffers(); // create buffer to access source texture pixesl.


      this._setElementCount(props.elementCount);
    } // setup TransformFeedback objects to capture the results

  }, {
    key: "_setupTransformFeedback",
    value: function _setupTransformFeedback() {
      if ((0, _utils.isObjectEmpty)(this.feedbackBuffers[0])) {
        return;
      }

      this.transformFeedbacks[0] = new _transformFeedback.default(this.gl, {
        program: this.model.program,
        buffers: this.feedbackBuffers[0]
      }); // If buffers are swappable setup second transform feedback object.

      if (this.feedbackMap) {
        this.transformFeedbacks[1] = new _transformFeedback.default(this.gl, {
          program: this.model.program,
          buffers: this.feedbackBuffers[1]
        });
      }
    } // setup framebuffers with texture attachments, to which results are rendered

  }, {
    key: "_setupFramebuffers",
    value: function _setupFramebuffers() {
      if (!this.renderingToTexture) {
        return;
      }

      var _this$targetTextures$ = this.targetTextures[0],
          width = _this$targetTextures$.width,
          height = _this$targetTextures$.height;
      this.framebuffers[0] = new _framebuffer.default(this.gl, {
        id: "".concat(this.id || 'transform', "-framebuffer-0"),
        width: width,
        height: height,
        attachments: (0, _defineProperty2.default)({}, 36064, this.targetTextures[0])
      });

      if (this._swapTexture) {
        var _this$targetTextures$2 = this.targetTextures[1];
        width = _this$targetTextures$2.width;
        height = _this$targetTextures$2.height;
        this.framebuffers[1] = new _framebuffer.default(this.gl, {
          id: "".concat(this.id || 'transform', "-framebuffer-1"),
          width: width,
          height: height,
          attachments: (0, _defineProperty2.default)({}, 36064, this.targetTextures[1])
        });
      }
    } // create/update buffer to access source texture's individual pixels.

  }, {
    key: "_updateElementIDBuffer",
    value: function _updateElementIDBuffer(elementCount) {
      if (!this.hasSourceTextures && !this.targetTextureVarying) {
        return;
      } // NOTE: using float so this will work with GLSL 1.0 shaders.


      var elementIds = new Float32Array(elementCount);
      elementIds.forEach(function (_, index, array) {
        array[index] = index;
      });

      if (!this.elementIDBuffer) {
        this.elementIDBuffer = new _buffer.default(this.gl, {
          data: elementIds,
          size: 1
        });
      } else {
        this.elementIDBuffer.setData({
          data: elementIds
        });
      }
    } // build and return shader releated parameters

  }, {
    key: "_getShaders",
    value: function _getShaders() {
      var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

      var _this$_processVertexS = this._processVertexShader(props.vs),
          vs = _this$_processVertexS.vs,
          uniforms = _this$_processVertexS.uniforms,
          targetTextureType = _this$_processVertexS.targetTextureType,
          inject = _this$_processVertexS.inject,
          samplerTextureMap = _this$_processVertexS.samplerTextureMap;

      var combinedInject = (0, _injectShader.combineInjects)([props.inject || {}, inject]);
      this.targetTextureType = targetTextureType;
      var fs = (0, _src.getPassthroughFS)({
        version: (0, _webglUtils.getShaderVersion)(vs),
        input: this.targetTextureVarying,
        inputType: targetTextureType,
        output: FS_OUTPUT_VARIABLE
      });
      var modules = this.hasSourceTextures || this.targetTextureVarying ? [_src._transform].concat(props.modules || []) : props.modules;
      return {
        vs: vs,
        fs: fs,
        modules: modules,
        uniforms: uniforms,
        inject: combinedInject,
        samplerTextureMap: samplerTextureMap
      };
    } // scan and update vertex shader for texture atrributes.

  }, {
    key: "_processVertexShader",
    value: function _processVertexShader(vs) {
      return (0, _transformShaderUtils.updateForTextures)({
        vs: vs,
        sourceTextureMap: this.sourceTextures[this.currentIndex],
        targetTextureVarying: this.targetTextureVarying,
        targetTexture: this.targetTextures[this.currentIndex]
      });
    }
  }]);
  return Transform;
}();

exports.default = Transform;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/defineProperty":"DOnw","./model":"yJrb","../webgl/buffer":"Rc9V","../webgl/framebuffer":"RDBm","../webgl/texture-2d":"jx3X","../webgl/transform-feedback":"oKAe","../shadertools/src/lib/inject-shader":"NLS8","../shadertools/src":"xR5I","../webgl-utils":"PmJk","../utils/assert":"wYRU","../utils":"PFG0","./transform-shader-utils":"lt5T"}],"oFEt":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _shader = require("../webgl/shader");

var _program = _interopRequireDefault(require("../webgl/program"));

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var ShaderCache =
/*#__PURE__*/
function () {
  /**
   * A cache of compiled shaders, keyed by shader source strings.
   * Compilation of long shaders can be time consuming.
   * By using this class, the application can ensure that each shader
   * is only compiled once.
   */
  function ShaderCache() {
    var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
        gl = _ref.gl,
        _ref$_cachePrograms = _ref._cachePrograms,
        _cachePrograms = _ref$_cachePrograms === void 0 ? false : _ref$_cachePrograms;

    (0, _classCallCheck2.default)(this, ShaderCache);
    (0, _assert.default)(gl);
    this.gl = gl;
    this.vertexShaders = {};
    this.fragmentShaders = {};
    this.programs = {};
    this._cachePrograms = _cachePrograms;
  }
  /**
   * Deletes shader references
   * @return {ShaderCache} - returns this for chaining
   */


  (0, _createClass2.default)(ShaderCache, [{
    key: "delete",
    value: function _delete() {
      // TODO - requires reference counting to avoid deleting shaders in use
      return this;
    }
    /**
     * Returns a compiled `VertexShader` object corresponding to the supplied
     * GLSL source code string, if possible from cache.
     *
     * @param {WebGLRenderingContext} gl - gl context
     * @param {String} source - Source code for shader
     * @return {VertexShader} - a compiled vertex shader
     */

  }, {
    key: "getVertexShader",
    value: function getVertexShader(gl, source) {
      (0, _assert.default)(typeof source === 'string');
      (0, _assert.default)(this._compareContexts(gl, this.gl));
      var shader = this.vertexShaders[source];

      if (!shader) {
        shader = new _shader.VertexShader(gl, source);
        this.vertexShaders[source] = shader;
      }

      return shader;
    }
    /**
     * Returns a compiled `VertexShader` object corresponding to the supplied
     * GLSL source code string, if possible from cache.
     * @param {WebGLRenderingContext} gl - gl context
     * @param {String} source - Source code for shader
     * @return {FragmentShader} - a compiled fragment shader, possibly from chache
     */

  }, {
    key: "getFragmentShader",
    value: function getFragmentShader(gl, source) {
      (0, _assert.default)(typeof source === 'string');
      (0, _assert.default)(this._compareContexts(gl, this.gl));
      var shader = this.fragmentShaders[source];

      if (!shader) {
        shader = new _shader.FragmentShader(gl, source);
        this.fragmentShaders[source] = shader;
      }

      return shader;
    } // Retrive Shaders from cache if exists, otherwise create new instance.

  }, {
    key: "getProgram",
    value: function getProgram(gl, opts) {
      (0, _assert.default)(this._compareContexts(gl, this.gl));
      (0, _assert.default)(typeof opts.vs === 'string');
      (0, _assert.default)(typeof opts.fs === 'string');
      (0, _assert.default)(typeof opts.id === 'string');

      var cacheKey = this._getProgramKey(opts);

      var program = this.programs[cacheKey];

      if (program) {
        this._resetProgram(program);

        return program;
      }

      program = this._createNewProgram(gl, opts); // Check if program can be cached
      // Program caching is experimental and expects
      // each Model to have a unique-id (wich is used in key generation)

      if (this._cachePrograms && this._checkProgramProp(program)) {
        program._isCached = true;
        this.programs[cacheKey] = program;
      }

      return program;
    }
  }, {
    key: "_getProgramKey",
    value: function _getProgramKey(opts) {
      return "".concat(opts.id, "-").concat(opts.vs, "-").concat(opts.fs);
    }
  }, {
    key: "_checkProgramProp",
    value: function _checkProgramProp(program) {
      // Check for transform feedback props (varyings, etc), we can't key such programs for now
      return !program.varyings;
    }
  }, {
    key: "_createNewProgram",
    value: function _createNewProgram(gl, opts) {
      var vs = opts.vs,
          fs = opts.fs;
      var vertexShader = this.getVertexShader(gl, vs);
      var fragmentShader = this.getFragmentShader(gl, fs);
      return new _program.default(this.gl, Object.assign({}, opts, {
        vs: vertexShader,
        fs: fragmentShader
      }));
    }
  }, {
    key: "_resetProgram",
    value: function _resetProgram(program, opts) {
      program.reset();
    } // Handle debug contexts

  }, {
    key: "_compareContexts",
    value: function _compareContexts(gl1, gl2) {
      return (gl1.gl || gl1) === (gl2.gl || gl2);
    }
  }]);
  return ShaderCache;
}();

exports.default = ShaderCache;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","../webgl/shader":"pOhm","../webgl/program":"hOuK","../utils/assert":"wYRU"}],"npeM":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof"));

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _webglContext = require("../webgl-context");

var _webglUtils = require("../webgl-utils");

var _utils = require("../utils");

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/* global window, Worker */
var AnimationLoopProxy =
/*#__PURE__*/
function () {
  (0, _createClass2.default)(AnimationLoopProxy, null, [{
    key: "createWorker",
    // Create the script for the rendering worker.
    // @param opts {object} - options to construct an AnimationLoop instance
    value: function createWorker(animationLoop) {
      return function (self) {
        animationLoop.setProps({
          // Prevent the animation loop from trying to access DOM properties
          useDevicePixels: false,
          autoResizeDrawingBuffer: false
        });
        self.canvas = null;

        function initializeCanvas(canvas) {
          var eventHandlers = new Map();

          canvas.addEventListener = function (type, handler) {
            self.postMessage({
              command: 'addEventListener',
              type: type
            });

            if (!eventHandlers.has(type)) {
              eventHandlers.set(type, []);
            }

            eventHandlers.get(type).push(handler);
          };

          canvas.removeEventListener = function (type, handler) {
            self.postMessage({
              command: 'removeEventListener',
              type: type
            });
            var handlers = eventHandlers.get(type);

            if (handlers) {
              handlers.splice(handlers.indexOf(handler), 1);
            }
          };

          canvas.dispatchEvent = function (type, event) {
            var handlers = eventHandlers.get(type);

            if (handlers) {
              handlers.forEach(function (handler) {
                return handler(event);
              });
            }
          };

          self.canvas = canvas;
        }

        self.addEventListener('message', function (evt) {
          switch (evt.data.command) {
            case 'start':
              initializeCanvas(evt.data.opts.canvas);
              animationLoop.start(evt.data.opts);
              break;

            case 'stop':
              animationLoop.stop();
              break;

            case 'resize':
              self.canvas.width = evt.data.width;
              self.canvas.height = evt.data.height;
              break;

            case 'event':
              self.canvas.dispatchEvent(evt.data.type, evt.data.event);
              break;

            default:
          }
        });
      };
    }
    /*
     * @param {HTMLCanvasElement} canvas - if provided, width and height will be passed to context
     */

  }]);

  function AnimationLoopProxy(worker) {
    var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, AnimationLoopProxy);
    var _opts$onInitialize = opts.onInitialize,
        onInitialize = _opts$onInitialize === void 0 ? function () {} : _opts$onInitialize,
        _opts$onFinalize = opts.onFinalize,
        onFinalize = _opts$onFinalize === void 0 ? function () {} : _opts$onFinalize,
        _opts$useDevicePixels = opts.useDevicePixels,
        useDevicePixels = _opts$useDevicePixels === void 0 ? true : _opts$useDevicePixels,
        _opts$autoResizeDrawi = opts.autoResizeDrawingBuffer,
        autoResizeDrawingBuffer = _opts$autoResizeDrawi === void 0 ? true : _opts$autoResizeDrawi;
    this.props = {
      onInitialize: onInitialize,
      onFinalize: onFinalize
    };
    this.setProps({
      autoResizeDrawingBuffer: autoResizeDrawingBuffer,
      useDevicePixels: useDevicePixels
    }); // state

    (0, _assert.default)(worker instanceof Worker);
    this.worker = worker;
    this.canvas = null;
    this.width = null;
    this.height = null;
    this._stopped = true;
    this._animationFrameId = null;
    this._startPromise = null; // bind methods

    this._onMessage = this._onMessage.bind(this);
    this._onEvent = this._onEvent.bind(this);
    this._updateFrame = this._updateFrame.bind(this);
  }

  (0, _createClass2.default)(AnimationLoopProxy, [{
    key: "setProps",
    value: function setProps(props) {
      if ('autoResizeDrawingBuffer' in props) {
        this.autoResizeDrawingBuffer = props.autoResizeDrawingBuffer;
      }

      if ('useDevicePixels' in props) {
        this.useDevicePixels = props.useDevicePixels;
      }

      return this;
    }
    /* Public methods */
    // Starts a render loop if not already running

  }, {
    key: "start",
    value: function start() {
      var _this = this;

      var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      this._stopped = false; // console.debug(`Starting ${this.constructor.name}`);

      if (!this._animationFrameId) {
        this.worker.onmessage = this._onMessage; // Wait for start promise before rendering frame

        this._startPromise = (0, _webglContext.getPageLoadPromise)().then(function () {
          _this._createAndTransferCanvas(opts);

          return _this.props.onInitialize(_this);
        }).then(function () {
          if (!_this._stopped) {
            _this._animationFrameId = (0, _webglUtils.requestAnimationFrame)(_this._updateFrame);
          }
        });
      }

      return this;
    } // Stops a render loop if already running, finalizing

  }, {
    key: "stop",
    value: function stop() {
      if (this._animationFrameId) {
        (0, _webglUtils.cancelAnimationFrame)(this._animationFrameId);
        this._animationFrameId = null;
        this._stopped = true;
        this.props.onFinalize(this);
      }

      this.worker.postMessage({
        command: 'stop'
      });
      return this;
    } // PRIVATE METHODS

  }, {
    key: "_onMessage",
    value: function _onMessage(evt) {
      switch (evt.data.command) {
        case 'addEventListener':
          this.canvas.addEventListener(evt.data.type, this._onEvent);
          break;

        case 'removeEventListener':
          this.canvas.removeEventListener(evt.data.type, this._onEvent);
          break;

        default:
      }
    }
  }, {
    key: "_onEvent",
    value: function _onEvent(evt) {
      var devicePixelRatio = this.useDevicePixels ? window.devicePixelRatio || 1 : 1;
      var type = evt.type;
      var safeEvent = {};

      for (var key in evt) {
        var value = evt[key];
        var valueType = (0, _typeof2.default)(value);

        if (key === 'offsetX' || key === 'offsetY') {
          value *= devicePixelRatio;
        }

        if (valueType === 'number' || valueType === 'boolean' || valueType === 'string') {
          safeEvent[key] = value;
        }
      }

      this.worker.postMessage({
        command: 'event',
        type: type,
        event: safeEvent
      });
    }
  }, {
    key: "_updateFrame",
    value: function _updateFrame() {
      this._resizeCanvasDrawingBuffer();

      this._animationFrameId = (0, _webglUtils.requestAnimationFrame)(this._updateFrame);
    }
  }, {
    key: "_createAndTransferCanvas",
    value: function _createAndTransferCanvas(opts) {
      // Create a canvas on the main thread
      var screenCanvas = (0, _webglContext.getCanvas)(opts); // Create an offscreen canvas controlling the main canvas

      if (!screenCanvas.transferControlToOffscreen) {
        _utils.log.error('OffscreenCanvas is not available in your browser.')(); // eslint-disable-line

      }

      var offscreenCanvas = screenCanvas.transferControlToOffscreen(); // Transfer the offscreen canvas to the worker

      this.worker.postMessage({
        command: 'start',
        opts: Object.assign({}, opts, {
          canvas: offscreenCanvas
        })
      }, [offscreenCanvas]); // store the main canvas on the local thread

      this.canvas = screenCanvas;
    }
  }, {
    key: "_resizeCanvasDrawingBuffer",
    value: function _resizeCanvasDrawingBuffer() {
      if (this.autoResizeDrawingBuffer) {
        var devicePixelRatio = this.useDevicePixels ? window.devicePixelRatio || 1 : 1;
        var width = this.canvas.clientWidth * devicePixelRatio;
        var height = this.canvas.clientHeight * devicePixelRatio;

        if (this.width !== width || this.height !== height) {
          this.width = width;
          this.height = height;
          this.worker.postMessage({
            command: 'resize',
            width: width,
            height: height
          });
        }
      }
    }
  }]);
  return AnimationLoopProxy;
}();

exports.default = AnimationLoopProxy;
},{"@babel/runtime/helpers/esm/typeof":"Izky","@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","../webgl-context":"id7L","../webgl-utils":"PmJk","../utils":"PFG0","../utils/assert":"wYRU"}],"eTBq":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _webgl = require("../webgl");

var _webglContext = require("../webgl-context");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

//
// A base render pass.
//
// Attribution: This class and the multipass system were inspired by
// the THREE.js EffectComposer and *Pass classes
var Pass =
/*#__PURE__*/
function () {
  function Pass(gl, props) {
    (0, _classCallCheck2.default)(this, Pass);
    var _props$id = props.id,
        id = _props$id === void 0 ? 'pass' : _props$id;
    this.id = id; // id of this pass

    this.gl = gl;
    this.props = {
      enabled: true,
      screen: false,
      swap: false
    };
    Object.assign(this.props, props);
  }

  (0, _createClass2.default)(Pass, [{
    key: "setProps",
    value: function setProps(props) {
      Object.assign(this.props, props);
    }
  }, {
    key: "render",
    value: function render(renderState, animationProps) {
      var _this = this;

      if (!this.props.enabled) {
        return;
      }

      var gl = this.gl;
      var renderParams = {
        gl: gl,
        outputBuffer: renderState.writeBuffer,
        inputBuffer: renderState.readBuffer,
        animationProps: animationProps,
        swapBuffers: function swapBuffers() {
          return renderState._swapFramebuffers();
        }
      };

      if (this.props.screen) {
        renderParams.inputBuffer = renderParams.outputBuffer;
        renderParams.outputBuffer = _webgl.Framebuffer.getDefaultFramebuffer(gl);
      } else if (this.props.swap) {
        renderParams.inputBuffer = renderState.writeBuffer;
        renderParams.outputBuffer = renderState.readBuffer;
      }

      (0, _webglContext.withParameters)(gl, {
        framebuffer: renderParams.outputBuffer
      }, function () {
        return _this._renderPass(renderParams);
      });

      if (this.props.debug) {
        renderParams.outputBuffer.log(0, this.id);
      }

      if (this.props.swap) {
        renderState._swapFramebuffers();
      }
    }
    /**
     * Renders the effect.
     * This is an abstract method that should be overridden.
     * @param {Framebuffer} inputBuffer - Frame buffer that contains the result of the previous pass
     * @param {Framebuffer} outputBuffer - Frame buffer that serves as the output render target
     */

  }, {
    key: "_renderPass",
    value: function _renderPass(_ref) {
      // assert(false, 'Draw/render methods not implemented!');
      var gl = _ref.gl,
          inputBuffer = _ref.inputBuffer,
          outputBuffer = _ref.outputBuffer,
          animationProps = _ref.animationProps;
    }
  }]);
  return Pass;
}();

exports.default = Pass;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","../webgl":"x2lE","../webgl-context":"id7L"}],"MfJ8":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _pass = _interopRequireDefault(require("./pass"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

//
// A composite render pass.
//
// Attribution: This class and the multipass system were inspired by
// the THREE.js EffectComposer and *Pass classes
var CompositePass =
/*#__PURE__*/
function (_Pass) {
  (0, _inherits2.default)(CompositePass, _Pass);

  function CompositePass(gl, props) {
    (0, _classCallCheck2.default)(this, CompositePass);
    props = Array.isArray(props) ? {
      passes: props
    } : props;
    return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(CompositePass).call(this, gl, Object.assign({
      id: 'composite-pass'
    }, props)));
  } // Override render() to just forward the call


  (0, _createClass2.default)(CompositePass, [{
    key: "render",
    value: function render() {
      var _this$props$passes = this.props.passes,
          passes = _this$props$passes === void 0 ? [] : _this$props$passes;
      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = passes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var pass = _step.value;
          pass.render.apply(pass, arguments);
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return != null) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }
    }
  }]);
  return CompositePass;
}(_pass.default);

exports.default = CompositePass;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","./pass":"eTBq"}],"VsfT":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _webgl = require("../webgl");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

//
// Render state helper class for the multi pass system
//
// Attribution: This class and the multipass system were inspired by
// the THREE.js EffectComposer and *Pass classes
var RenderState =
/*#__PURE__*/
function () {
  function RenderState(gl) {
    var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, RenderState);
    this.gl = gl;
    this.framebuffer1 = new _webgl.Framebuffer(gl, {
      id: 'multi-pass-1',
      stencil: true
    });
    this.framebuffer2 = new _webgl.Framebuffer(gl, {
      id: 'multi-pass-2',
      stencil: true
    });
    this.reset();
  }

  (0, _createClass2.default)(RenderState, [{
    key: "reset",
    value: function reset() {
      this.framebuffer1.resize();
      this.framebuffer2.resize();
      this.writeBuffer = this.framebuffer1;
      this.readBuffer = this.framebuffer2;
      this.maskActive = false;
    }
  }, {
    key: "_swapFramebuffers",
    value: function _swapFramebuffers() {
      var tmp = this.readBuffer;
      this.readBuffer = this.writeBuffer;
      this.writeBuffer = tmp;
    }
  }]);
  return RenderState;
}();

exports.default = RenderState;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","../webgl":"x2lE"}],"ydWu":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _compositePass = _interopRequireDefault(require("./composite-pass"));

var _renderState = _interopRequireDefault(require("./render-state"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

//
// A top-level composite render pass, that manages render state
//
// Attribution: This class and the multipass system were inspired by
// the THREE.js EffectComposer and *Pass classes
var MultiPassRenderer =
/*#__PURE__*/
function (_CompositePass) {
  (0, _inherits2.default)(MultiPassRenderer, _CompositePass);

  function MultiPassRenderer(gl, props) {
    var _this;

    (0, _classCallCheck2.default)(this, MultiPassRenderer);
    props = Array.isArray(props) ? {
      passes: props
    } : props;
    _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(MultiPassRenderer).call(this, gl, Object.assign({
      id: 'multi-pass'
    }, props)));
    _this.renderState = new _renderState.default(gl, props);
    return _this;
  } // Override render() to just forward the call


  (0, _createClass2.default)(MultiPassRenderer, [{
    key: "render",
    value: function render(animationProps) {
      this.renderState.reset();
      var _this$props$passes = this.props.passes,
          passes = _this$props$passes === void 0 ? [] : _this$props$passes;
      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = passes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var pass = _step.value;
          pass.render(this.renderState, animationProps);
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return != null) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }

      return this;
    }
  }]);
  return MultiPassRenderer;
}(_compositePass.default);

exports.default = MultiPassRenderer;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","./composite-pass":"MfJ8","./render-state":"VsfT"}],"C4yk":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _pass = _interopRequireDefault(require("./pass"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

//
// A pass that clears the input buffer or the screen.
//
// Attribution: This class and the multipass system were inspired by
// the THREE.js EffectComposer and *Pass classes
var ClearPass =
/*#__PURE__*/
function (_Pass) {
  (0, _inherits2.default)(ClearPass, _Pass);

  function ClearPass(gl) {
    var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, ClearPass);
    return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(ClearPass).call(this, gl, Object.assign({
      id: 'clear-pass'
    }, props)));
  } // TODO - add support for colors, align with model.clear and framebuffer.clear
  // TODO - integrate with luma.gl clear, make sure right buffer is cleared


  (0, _createClass2.default)(ClearPass, [{
    key: "_renderPass",
    value: function _renderPass(_ref) {
      var gl = _ref.gl;
      var _this$props$clearBits = this.props.clearBits,
          clearBits = _this$props$clearBits === void 0 ? 16384 | 256 : _this$props$clearBits;
      gl.clear(clearBits);
    }
  }]);
  return ClearPass;
}(_pass.default);

exports.default = ClearPass;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","./pass":"eTBq"}],"dxPw":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _pass = _interopRequireDefault(require("./pass"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

//
// A pass that renders a given scene directly on screen or into the read buffer
// for further processing.
//
// Attribution: This class and the multipass system were inspired by
// the THREE.js EffectComposer and *Pass classes
var RenderPass =
/*#__PURE__*/
function (_Pass) {
  (0, _inherits2.default)(RenderPass, _Pass);

  function RenderPass(gl) {
    var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, RenderPass);
    return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(RenderPass).call(this, gl, Object.assign({
      id: 'render-pass'
    }, props)));
  }

  (0, _createClass2.default)(RenderPass, [{
    key: "_renderPass",
    value: function _renderPass(_ref) {
      var animationProps = _ref.animationProps;
      var _this$props = this.props,
          _this$props$models = _this$props.models,
          models = _this$props$models === void 0 ? [] : _this$props$models,
          drawParams = _this$props.drawParams;
      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = models[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var model = _step.value;
          model.draw(Object.assign({}, drawParams, {
            animationProps: animationProps
          }));
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return != null) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }
    }
  }]);
  return RenderPass;
}(_pass.default);

exports.default = RenderPass;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","./pass":"eTBq"}],"McnK":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _geometry = _interopRequireDefault(require("./geometry"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var INDEX_OFFSETS = {
  x: [2, 0, 1],
  y: [0, 1, 2],
  z: [1, 2, 0]
};

var TruncatedConeGeometry =
/*#__PURE__*/
function (_Geometry) {
  (0, _inherits2.default)(TruncatedConeGeometry, _Geometry); // Primitives inspired by TDL http://code.google.com/p/webglsamples/,
  // copyright 2011 Google Inc. new BSD License
  // (http://www.opensource.org/licenses/bsd-license.php).

  /* eslint-disable max-statements, complexity */

  function TruncatedConeGeometry() {
    var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    (0, _classCallCheck2.default)(this, TruncatedConeGeometry);
    var _opts$bottomRadius = opts.bottomRadius,
        bottomRadius = _opts$bottomRadius === void 0 ? 0 : _opts$bottomRadius,
        _opts$topRadius = opts.topRadius,
        topRadius = _opts$topRadius === void 0 ? 0 : _opts$topRadius,
        _opts$height = opts.height,
        height = _opts$height === void 0 ? 1 : _opts$height,
        _opts$nradial = opts.nradial,
        nradial = _opts$nradial === void 0 ? 10 : _opts$nradial,
        _opts$nvertical = opts.nvertical,
        nvertical = _opts$nvertical === void 0 ? 10 : _opts$nvertical,
        _opts$verticalAxis = opts.verticalAxis,
        verticalAxis = _opts$verticalAxis === void 0 ? 'y' : _opts$verticalAxis,
        _opts$topCap = opts.topCap,
        topCap = _opts$topCap === void 0 ? false : _opts$topCap,
        _opts$bottomCap = opts.bottomCap,
        bottomCap = _opts$bottomCap === void 0 ? false : _opts$bottomCap;
    var extra = (topCap ? 2 : 0) + (bottomCap ? 2 : 0);
    var numVertices = (nradial + 1) * (nvertical + 1 + extra);
    var slant = Math.atan2(bottomRadius - topRadius, height);
    var msin = Math.sin;
    var mcos = Math.cos;
    var mpi = Math.PI;
    var cosSlant = mcos(slant);
    var sinSlant = msin(slant);
    var start = topCap ? -2 : 0;
    var end = nvertical + (bottomCap ? 2 : 0);
    var vertsAroundEdge = nradial + 1;
    var positions = new Float32Array(numVertices * 3);
    var normals = new Float32Array(numVertices * 3);
    var texCoords = new Float32Array(numVertices * 2);
    var indices = new Uint16Array(nradial * (nvertical + extra) * 6);
    var indexOffset = INDEX_OFFSETS[verticalAxis];
    var i3 = 0;
    var i2 = 0;

    for (var i = start; i <= end; i++) {
      var v = i / nvertical;
      var y = height * v;
      var ringRadius = void 0;

      if (i < 0) {
        y = 0;
        v = 1;
        ringRadius = bottomRadius;
      } else if (i > nvertical) {
        y = height;
        v = 1;
        ringRadius = topRadius;
      } else {
        ringRadius = bottomRadius + (topRadius - bottomRadius) * (i / nvertical);
      }

      if (i === -2 || i === nvertical + 2) {
        ringRadius = 0;
        v = 0;
      }

      y -= height / 2;

      for (var j = 0; j < vertsAroundEdge; j++) {
        var sin = msin(j * mpi * 2 / nradial);
        var cos = mcos(j * mpi * 2 / nradial);
        positions[i3 + indexOffset[0]] = sin * ringRadius;
        positions[i3 + indexOffset[1]] = y;
        positions[i3 + indexOffset[2]] = cos * ringRadius;
        normals[i3 + indexOffset[0]] = i < 0 || i > nvertical ? 0 : sin * cosSlant;
        normals[i3 + indexOffset[1]] = i < 0 ? -1 : i > nvertical ? 1 : sinSlant;
        normals[i3 + indexOffset[2]] = i < 0 || i > nvertical ? 0 : cos * cosSlant;
        texCoords[i2 + 0] = j / nradial;
        texCoords[i2 + 1] = v;
        i2 += 2;
        i3 += 3;
      }
    }

    for (var _i = 0; _i < nvertical + extra; _i++) {
      for (var _j = 0; _j < nradial; _j++) {
        var index = (_i * nradial + _j) * 6;
        indices[index + 0] = vertsAroundEdge * (_i + 0) + 0 + _j;
        indices[index + 1] = vertsAroundEdge * (_i + 0) + 1 + _j;
        indices[index + 2] = vertsAroundEdge * (_i + 1) + 1 + _j;
        indices[index + 3] = vertsAroundEdge * (_i + 0) + 0 + _j;
        indices[index + 4] = vertsAroundEdge * (_i + 1) + 1 + _j;
        indices[index + 5] = vertsAroundEdge * (_i + 1) + 0 + _j;
      }
    }

    return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(TruncatedConeGeometry).call(this, Object.assign({}, opts, {
      attributes: {
        positions: positions,
        normals: normals,
        texCoords: texCoords,
        indices: indices
      }
    })));
  }

  return TruncatedConeGeometry;
}(_geometry.default);

exports.default = TruncatedConeGeometry;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","./geometry":"wX6R"}],"VcVT":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _truncatedConeGeometry = _interopRequireDefault(require("./truncated-cone-geometry"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var ConeGeometry =
/*#__PURE__*/
function (_TruncatedConeGeometr) {
  (0, _inherits2.default)(ConeGeometry, _TruncatedConeGeometr);

  function ConeGeometry() {
    var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    (0, _classCallCheck2.default)(this, ConeGeometry);
    var _opts$radius = opts.radius,
        radius = _opts$radius === void 0 ? 1 : _opts$radius,
        _opts$cap = opts.cap,
        cap = _opts$cap === void 0 ? true : _opts$cap;
    return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(ConeGeometry).call(this, Object.assign({}, opts, {
      topRadius: 0,
      topCap: Boolean(cap),
      bottomCap: Boolean(cap),
      bottomRadius: radius
    })));
  }

  return ConeGeometry;
}(_truncatedConeGeometry.default);

exports.default = ConeGeometry;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","./truncated-cone-geometry":"McnK"}],"zVIl":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _geometry = _interopRequireDefault(require("./geometry"));

var _utils = require("../utils");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var CubeGeometry =
/*#__PURE__*/
function (_Geometry) {
  (0, _inherits2.default)(CubeGeometry, _Geometry);

  function CubeGeometry() {
    var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    (0, _classCallCheck2.default)(this, CubeGeometry);
    var _opts$id = opts.id,
        id = _opts$id === void 0 ? (0, _utils.uid)('cube-geometry') : _opts$id;
    return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(CubeGeometry).call(this, Object.assign({}, opts, {
      id: id,
      attributes: getCubeAttributes()
    })));
  }

  return CubeGeometry;
}(_geometry.default);
/* eslint-disable no-multi-spaces, indent */


exports.default = CubeGeometry;
var CUBE_INDICES = new Uint16Array([0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, 8, 9, 10, 8, 10, 11, 12, 13, 14, 12, 14, 15, 16, 17, 18, 16, 18, 19, 20, 21, 22, 20, 22, 23]);
var CUBE_POSITIONS = new Float32Array([-1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1]);
var CUBE_NORMALS = new Float32Array([// Front face
0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, // Back face
0.0, 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, -1.0, // Top face
0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, // Bottom face
0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, // Right face
1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, // Left face
-1.0, 0.0, 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0]);
var CUBE_TEX_COORDS = new Float32Array([// Front face
0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, // Back face
1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0, // Top face
0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, // Bottom face
1.0, 1.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, // Right face
1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0, // Left face
0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0]);
/* eslint-enable no-multi-spaces, indent */

function getCubeAttributes() {
  return {
    indices: new Uint16Array(CUBE_INDICES),
    positions: new Float32Array(CUBE_POSITIONS),
    normals: new Float32Array(CUBE_NORMALS),
    texCoords: new Float32Array(CUBE_TEX_COORDS)
  };
}
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","./geometry":"wX6R","../utils":"PFG0"}],"KozP":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _truncatedConeGeometry = _interopRequireDefault(require("./truncated-cone-geometry"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var CylinderGeometry =
/*#__PURE__*/
function (_TruncatedConeGeometr) {
  (0, _inherits2.default)(CylinderGeometry, _TruncatedConeGeometr);

  function CylinderGeometry() {
    var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    (0, _classCallCheck2.default)(this, CylinderGeometry);
    var _opts$radius = opts.radius,
        radius = _opts$radius === void 0 ? 1 : _opts$radius;
    return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(CylinderGeometry).call(this, Object.assign({}, opts, {
      bottomRadius: radius,
      topRadius: radius
    })));
  }

  return CylinderGeometry;
}(_truncatedConeGeometry.default);

exports.default = CylinderGeometry;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","./truncated-cone-geometry":"McnK"}],"vALS":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _geometry = _interopRequireDefault(require("./geometry"));

var _math = require("math.gl");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/* eslint-disable comma-spacing, max-statements, complexity */
var ICO_POSITIONS = [-1, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 1, 0, -1, 0, 1, 0, 0];
var ICO_INDICES = [3, 4, 5, 3, 5, 1, 3, 1, 0, 3, 0, 4, 4, 0, 2, 4, 2, 5, 2, 0, 1, 5, 2, 1];

var IcoSphereGeometry =
/*#__PURE__*/
function (_Geometry) {
  (0, _inherits2.default)(IcoSphereGeometry, _Geometry);

  function IcoSphereGeometry() {
    var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    (0, _classCallCheck2.default)(this, IcoSphereGeometry);
    var _opts$iterations = opts.iterations,
        iterations = _opts$iterations === void 0 ? 0 : _opts$iterations;
    var PI = Math.PI;
    var PI2 = PI * 2;
    var positions = ICO_POSITIONS.concat();
    var indices = ICO_INDICES.concat();
    positions.push();
    indices.push();

    var getMiddlePoint = function () {
      var pointMemo = {};
      return function (i1, i2) {
        i1 *= 3;
        i2 *= 3;
        var mini = i1 < i2 ? i1 : i2;
        var maxi = i1 > i2 ? i1 : i2;
        var key = "".concat(mini, "|").concat(maxi);

        if (key in pointMemo) {
          return pointMemo[key];
        }

        var x1 = positions[i1];
        var y1 = positions[i1 + 1];
        var z1 = positions[i1 + 2];
        var x2 = positions[i2];
        var y2 = positions[i2 + 1];
        var z2 = positions[i2 + 2];
        var xm = (x1 + x2) / 2;
        var ym = (y1 + y2) / 2;
        var zm = (z1 + z2) / 2;
        var len = Math.sqrt(xm * xm + ym * ym + zm * zm);
        xm /= len;
        ym /= len;
        zm /= len;
        positions.push(xm, ym, zm);
        return pointMemo[key] = positions.length / 3 - 1;
      };
    }();

    for (var i = 0; i < iterations; i++) {
      var indices2 = [];

      for (var j = 0; j < indices.length; j += 3) {
        var a = getMiddlePoint(indices[j + 0], indices[j + 1]);
        var b = getMiddlePoint(indices[j + 1], indices[j + 2]);
        var c = getMiddlePoint(indices[j + 2], indices[j + 0]);
        indices2.push(c, indices[j + 0], a, a, indices[j + 1], b, b, indices[j + 2], c, a, b, c);
      }

      indices = indices2;
    } // Calculate texCoords and normals


    var normals = new Array(indices.length * 3);
    var texCoords = new Array(indices.length * 2);
    var l = indices.length;

    for (var _i = l - 3; _i >= 0; _i -= 3) {
      var i1 = indices[_i + 0];
      var i2 = indices[_i + 1];
      var i3 = indices[_i + 2];
      var in1 = i1 * 3;
      var in2 = i2 * 3;
      var in3 = i3 * 3;
      var iu1 = i1 * 2;
      var iu2 = i2 * 2;
      var iu3 = i3 * 2;
      var x1 = positions[in1 + 0];
      var y1 = positions[in1 + 1];
      var z1 = positions[in1 + 2];
      var theta1 = Math.acos(z1 / Math.sqrt(x1 * x1 + y1 * y1 + z1 * z1));
      var phi1 = Math.atan2(y1, x1) + PI;
      var v1 = theta1 / PI;
      var u1 = 1 - phi1 / PI2;
      var x2 = positions[in2 + 0];
      var y2 = positions[in2 + 1];
      var z2 = positions[in2 + 2];
      var theta2 = Math.acos(z2 / Math.sqrt(x2 * x2 + y2 * y2 + z2 * z2));
      var phi2 = Math.atan2(y2, x2) + PI;
      var v2 = theta2 / PI;
      var u2 = 1 - phi2 / PI2;
      var x3 = positions[in3 + 0];
      var y3 = positions[in3 + 1];
      var z3 = positions[in3 + 2];
      var theta3 = Math.acos(z3 / Math.sqrt(x3 * x3 + y3 * y3 + z3 * z3));
      var phi3 = Math.atan2(y3, x3) + PI;
      var v3 = theta3 / PI;
      var u3 = 1 - phi3 / PI2;
      var vec1 = [x3 - x2, y3 - y2, z3 - z2];
      var vec2 = [x1 - x2, y1 - y2, z1 - z2];
      var normal = new _math.Vector3(vec1).cross(vec2).normalize();
      var newIndex = void 0;

      if ((u1 === 0 || u2 === 0 || u3 === 0) && (u1 === 0 || u1 > 0.5) && (u2 === 0 || u2 > 0.5) && (u3 === 0 || u3 > 0.5)) {
        positions.push(positions[in1 + 0], positions[in1 + 1], positions[in1 + 2]);
        newIndex = positions.length / 3 - 1;
        indices.push(newIndex);
        texCoords[newIndex * 2 + 0] = 1;
        texCoords[newIndex * 2 + 1] = v1;
        normals[newIndex * 3 + 0] = normal.x;
        normals[newIndex * 3 + 1] = normal.y;
        normals[newIndex * 3 + 2] = normal.z;
        positions.push(positions[in2 + 0], positions[in2 + 1], positions[in2 + 2]);
        newIndex = positions.length / 3 - 1;
        indices.push(newIndex);
        texCoords[newIndex * 2 + 0] = 1;
        texCoords[newIndex * 2 + 1] = v2;
        normals[newIndex * 3 + 0] = normal.x;
        normals[newIndex * 3 + 1] = normal.y;
        normals[newIndex * 3 + 2] = normal.z;
        positions.push(positions[in3 + 0], positions[in3 + 1], positions[in3 + 2]);
        newIndex = positions.length / 3 - 1;
        indices.push(newIndex);
        texCoords[newIndex * 2 + 0] = 1;
        texCoords[newIndex * 2 + 1] = v3;
        normals[newIndex * 3 + 0] = normal.x;
        normals[newIndex * 3 + 1] = normal.y;
        normals[newIndex * 3 + 2] = normal.z;
      }

      normals[in1 + 0] = normals[in2 + 0] = normals[in3 + 0] = normal.x;
      normals[in1 + 1] = normals[in2 + 1] = normals[in3 + 1] = normal.y;
      normals[in1 + 2] = normals[in2 + 2] = normals[in3 + 2] = normal.z;
      texCoords[iu1 + 0] = u1;
      texCoords[iu1 + 1] = v1;
      texCoords[iu2 + 0] = u2;
      texCoords[iu2 + 1] = v2;
      texCoords[iu3 + 0] = u3;
      texCoords[iu3 + 1] = v3;
    }

    return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(IcoSphereGeometry).call(this, Object.assign({}, opts, {
      attributes: {
        positions: new Float32Array(positions),
        normals: new Float32Array(normals),
        texCoords: new Float32Array(texCoords),
        indices: new Uint16Array(indices)
      }
    })));
  }

  return IcoSphereGeometry;
}(_geometry.default);

exports.default = IcoSphereGeometry;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","./geometry":"wX6R","math.gl":"dl2t"}],"O11O":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _geometry = _interopRequireDefault(require("./geometry"));

var _utils = require("../utils");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var PlaneGeometry =
/*#__PURE__*/
function (_Geometry) {
  (0, _inherits2.default)(PlaneGeometry, _Geometry); // Primitives inspired by TDL http://code.google.com/p/webglsamples/,
  // copyright 2011 Google Inc. new BSD License
  // (http://www.opensource.org/licenses/bsd-license.php).

  /* eslint-disable max-statements, complexity */

  /* eslint-disable complexity, max-statements */

  function PlaneGeometry() {
    var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    (0, _classCallCheck2.default)(this, PlaneGeometry);
    var _opts$type = opts.type,
        type = _opts$type === void 0 ? 'x,y' : _opts$type,
        _opts$offset = opts.offset,
        offset = _opts$offset === void 0 ? 0 : _opts$offset,
        _opts$flipCull = opts.flipCull,
        flipCull = _opts$flipCull === void 0 ? false : _opts$flipCull,
        _opts$unpack = opts.unpack,
        unpack = _opts$unpack === void 0 ? false : _opts$unpack,
        _opts$id = opts.id,
        id = _opts$id === void 0 ? (0, _utils.uid)('plane-geometry') : _opts$id;
    var coords = type.split(','); // width, height

    var c1len = opts["".concat(coords[0], "len")];
    var c2len = opts["".concat(coords[1], "len")]; // subdivisionsWidth, subdivisionsDepth

    var subdivisions1 = opts["n".concat(coords[0])] || 1;
    var subdivisions2 = opts["n".concat(coords[1])] || 1;
    var numVertices = (subdivisions1 + 1) * (subdivisions2 + 1);
    var positions = new Float32Array(numVertices * 3);
    var normals = new Float32Array(numVertices * 3);
    var texCoords = new Float32Array(numVertices * 2);

    if (flipCull) {
      c1len = -c1len;
    }

    var i2 = 0;
    var i3 = 0;

    for (var z = 0; z <= subdivisions2; z++) {
      for (var x = 0; x <= subdivisions1; x++) {
        var u = x / subdivisions1;
        var v = z / subdivisions2;
        texCoords[i2 + 0] = flipCull ? 1 - u : u;
        texCoords[i2 + 1] = v;

        switch (type) {
          case 'x,y':
            positions[i3 + 0] = c1len * u - c1len * 0.5;
            positions[i3 + 1] = c2len * v - c2len * 0.5;
            positions[i3 + 2] = offset;
            normals[i3 + 0] = 0;
            normals[i3 + 1] = 0;
            normals[i3 + 2] = flipCull ? 1 : -1;
            break;

          case 'x,z':
            positions[i3 + 0] = c1len * u - c1len * 0.5;
            positions[i3 + 1] = offset;
            positions[i3 + 2] = c2len * v - c2len * 0.5;
            normals[i3 + 0] = 0;
            normals[i3 + 1] = flipCull ? 1 : -1;
            normals[i3 + 2] = 0;
            break;

          case 'y,z':
            positions[i3 + 0] = offset;
            positions[i3 + 1] = c1len * u - c1len * 0.5;
            positions[i3 + 2] = c2len * v - c2len * 0.5;
            normals[i3 + 0] = flipCull ? 1 : -1;
            normals[i3 + 1] = 0;
            normals[i3 + 2] = 0;
            break;

          default:
            break;
        }

        i2 += 2;
        i3 += 3;
      }
    }

    var numVertsAcross = subdivisions1 + 1;
    var indices = new Uint16Array(subdivisions1 * subdivisions2 * 6);

    for (var _z = 0; _z < subdivisions2; _z++) {
      for (var _x = 0; _x < subdivisions1; _x++) {
        var index = (_z * subdivisions1 + _x) * 6; // Make triangle 1 of quad.

        indices[index + 0] = (_z + 0) * numVertsAcross + _x;
        indices[index + 1] = (_z + 1) * numVertsAcross + _x;
        indices[index + 2] = (_z + 0) * numVertsAcross + _x + 1; // Make triangle 2 of quad.

        indices[index + 3] = (_z + 1) * numVertsAcross + _x;
        indices[index + 4] = (_z + 1) * numVertsAcross + _x + 1;
        indices[index + 5] = (_z + 0) * numVertsAcross + _x + 1;
      }
    } // Optionally, unpack indexed geometry


    if (unpack) {
      var positions2 = new Float32Array(indices.length * 3);
      var normals2 = new Float32Array(indices.length * 3);
      var texCoords2 = new Float32Array(indices.length * 2);

      for (var _x2 = 0; _x2 < indices.length; ++_x2) {
        var _index = indices[_x2];
        positions2[_x2 * 3 + 0] = positions[_index * 3 + 0];
        positions2[_x2 * 3 + 1] = positions[_index * 3 + 1];
        positions2[_x2 * 3 + 2] = positions[_index * 3 + 2];
        normals2[_x2 * 3 + 0] = normals[_index * 3 + 0];
        normals2[_x2 * 3 + 1] = normals[_index * 3 + 1];
        normals2[_x2 * 3 + 2] = normals[_index * 3 + 2];
        texCoords2[_x2 * 2 + 0] = texCoords[_index * 2 + 0];
        texCoords2[_x2 * 2 + 1] = texCoords[_index * 2 + 1];
      }

      positions = positions2;
      normals = normals2;
      texCoords = texCoords2;
      indices = undefined;
    }

    var attributes = {
      positions: positions,
      normals: normals,
      texCoords: texCoords
    };

    if (indices) {
      attributes.indices = indices;
    }

    return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(PlaneGeometry).call(this, Object.assign({}, opts, {
      attributes: attributes,
      id: id
    })));
  }

  return PlaneGeometry;
}(_geometry.default);

exports.default = PlaneGeometry;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","./geometry":"wX6R","../utils":"PFG0"}],"x67K":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _geometry = _interopRequireDefault(require("./geometry"));

var _utils = require("../utils");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var SphereGeometry =
/*#__PURE__*/
function (_Geometry) {
  (0, _inherits2.default)(SphereGeometry, _Geometry);

  function SphereGeometry() {
    var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    (0, _classCallCheck2.default)(this, SphereGeometry);
    var _opts$nlat = opts.nlat,
        nlat = _opts$nlat === void 0 ? 10 : _opts$nlat,
        _opts$nlong = opts.nlong,
        nlong = _opts$nlong === void 0 ? 10 : _opts$nlong,
        _opts$radius = opts.radius,
        radius = _opts$radius === void 0 ? 1 : _opts$radius,
        _opts$id = opts.id,
        id = _opts$id === void 0 ? (0, _utils.uid)('sphere-geometry') : _opts$id;
    return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(SphereGeometry).call(this, Object.assign({}, opts, {
      id: id,
      attributes: getSphereAttributes(nlat, nlong, radius)
    })));
  }

  return SphereGeometry;
}(_geometry.default); // Primitives inspired by TDL http://code.google.com/p/webglsamples/,
// copyright 2011 Google Inc. new BSD License
// (http://www.opensource.org/licenses/bsd-license.php).

/* eslint-disable max-statements, complexity */


exports.default = SphereGeometry;

function getSphereAttributes(nlat, nlong, radius) {
  var startLat = 0;
  var endLat = Math.PI;
  var latRange = endLat - startLat;
  var startLong = 0;
  var endLong = 2 * Math.PI;
  var longRange = endLong - startLong;
  var numVertices = (nlat + 1) * (nlong + 1);

  if (typeof radius === 'number') {
    var value = radius;

    radius = function radius(n1, n2, n3, u, v) {
      return value;
    };
  }

  var positions = new Float32Array(numVertices * 3);
  var normals = new Float32Array(numVertices * 3);
  var texCoords = new Float32Array(numVertices * 2);
  var indices = new Uint16Array(nlat * nlong * 6); // Create positions, normals and texCoords

  for (var y = 0; y <= nlat; y++) {
    for (var x = 0; x <= nlong; x++) {
      var u = x / nlong;
      var v = y / nlat;
      var index = x + y * (nlong + 1);
      var i2 = index * 2;
      var i3 = index * 3;
      var theta = longRange * u;
      var phi = latRange * v;
      var sinTheta = Math.sin(theta);
      var cosTheta = Math.cos(theta);
      var sinPhi = Math.sin(phi);
      var cosPhi = Math.cos(phi);
      var ux = cosTheta * sinPhi;
      var uy = cosPhi;
      var uz = sinTheta * sinPhi;
      var r = radius(ux, uy, uz, u, v);
      positions[i3 + 0] = r * ux;
      positions[i3 + 1] = r * uy;
      positions[i3 + 2] = r * uz;
      normals[i3 + 0] = ux;
      normals[i3 + 1] = uy;
      normals[i3 + 2] = uz;
      texCoords[i2 + 0] = u;
      texCoords[i2 + 1] = v;
    }
  } // Create indices


  var numVertsAround = nlat + 1;

  for (var _x = 0; _x < nlat; _x++) {
    for (var _y = 0; _y < nlong; _y++) {
      var _index = (_x * nlong + _y) * 6;

      indices[_index + 0] = _y * numVertsAround + _x;
      indices[_index + 1] = _y * numVertsAround + _x + 1;
      indices[_index + 2] = (_y + 1) * numVertsAround + _x;
      indices[_index + 3] = (_y + 1) * numVertsAround + _x;
      indices[_index + 4] = _y * numVertsAround + _x + 1;
      indices[_index + 5] = (_y + 1) * numVertsAround + _x + 1;
    }
  }

  return {
    positions: positions,
    indices: indices,
    normals: normals,
    texCoords: texCoords
  };
}
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","./geometry":"wX6R","../utils":"PFG0"}],"Cb5n":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "Geometry", {
  enumerable: true,
  get: function () {
    return _geometry.default;
  }
});
Object.defineProperty(exports, "ConeGeometry", {
  enumerable: true,
  get: function () {
    return _coneGeometry.default;
  }
});
Object.defineProperty(exports, "CubeGeometry", {
  enumerable: true,
  get: function () {
    return _cubeGeometry.default;
  }
});
Object.defineProperty(exports, "CylinderGeometry", {
  enumerable: true,
  get: function () {
    return _cylinderGeometry.default;
  }
});
Object.defineProperty(exports, "IcoSphereGeometry", {
  enumerable: true,
  get: function () {
    return _icoSphereGeometry.default;
  }
});
Object.defineProperty(exports, "PlaneGeometry", {
  enumerable: true,
  get: function () {
    return _planeGeometry.default;
  }
});
Object.defineProperty(exports, "SphereGeometry", {
  enumerable: true,
  get: function () {
    return _sphereGeometry.default;
  }
});
Object.defineProperty(exports, "TruncatedConeGeometry", {
  enumerable: true,
  get: function () {
    return _truncatedConeGeometry.default;
  }
});

var _geometry = _interopRequireDefault(require("./geometry"));

var _coneGeometry = _interopRequireDefault(require("./cone-geometry"));

var _cubeGeometry = _interopRequireDefault(require("./cube-geometry"));

var _cylinderGeometry = _interopRequireDefault(require("./cylinder-geometry"));

var _icoSphereGeometry = _interopRequireDefault(require("./ico-sphere-geometry"));

var _planeGeometry = _interopRequireDefault(require("./plane-geometry"));

var _sphereGeometry = _interopRequireDefault(require("./sphere-geometry"));

var _truncatedConeGeometry = _interopRequireDefault(require("./truncated-cone-geometry"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./geometry":"wX6R","./cone-geometry":"VcVT","./cube-geometry":"zVIl","./cylinder-geometry":"KozP","./ico-sphere-geometry":"vALS","./plane-geometry":"O11O","./sphere-geometry":"x67K","./truncated-cone-geometry":"McnK"}],"e1PQ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "AnimationLoop", {
  enumerable: true,
  get: function () {
    return _animationLoop.default;
  }
});
Object.defineProperty(exports, "AnimationLoopProxy", {
  enumerable: true,
  get: function () {
    return _animationLoopProxy.default;
  }
});
Object.defineProperty(exports, "Model", {
  enumerable: true,
  get: function () {
    return _model.default;
  }
});

var _animationLoop = _interopRequireDefault(require("./animation-loop"));

var _animationLoopProxy = _interopRequireDefault(require("./animation-loop-proxy"));

var _model = _interopRequireDefault(require("./model"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./animation-loop":"gyOX","./animation-loop-proxy":"npeM","./model":"yJrb"}],"rOZB":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _geometry = require("../geometry");

var _core = require("../core");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Cone =
/*#__PURE__*/
function (_Model) {
  (0, _inherits2.default)(Cone, _Model);

  function Cone(gl) {
    var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, Cone);
    return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Cone).call(this, gl, Object.assign({}, opts, {
      geometry: new _geometry.ConeGeometry(opts)
    })));
  }

  return Cone;
}(_core.Model);

exports.default = Cone;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","../geometry":"Cb5n","../core":"e1PQ"}],"kcZB":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _geometry = require("../geometry");

var _core = require("../core");

var _utils = require("../utils");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Cube =
/*#__PURE__*/
function (_Model) {
  (0, _inherits2.default)(Cube, _Model);

  function Cube(gl) {
    var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, Cube);
    var _opts$id = opts.id,
        id = _opts$id === void 0 ? (0, _utils.uid)('cube') : _opts$id;
    return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Cube).call(this, gl, Object.assign({}, opts, {
      id: id,
      geometry: new _geometry.CubeGeometry(opts)
    })));
  }

  return Cube;
}(_core.Model);

exports.default = Cube;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","../geometry":"Cb5n","../core":"e1PQ","../utils":"PFG0"}],"BEmD":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _geometry = require("../geometry");

var _model = _interopRequireDefault(require("../core/model"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Cylinder =
/*#__PURE__*/
function (_Model) {
  (0, _inherits2.default)(Cylinder, _Model);

  function Cylinder(gl) {
    var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, Cylinder);
    return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Cylinder).call(this, gl, Object.assign({}, opts, {
      geometry: new _geometry.CylinderGeometry(opts)
    })));
  }

  return Cylinder;
}(_model.default);

exports.default = Cylinder;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","../geometry":"Cb5n","../core/model":"yJrb"}],"qAxA":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _core = require("../core");

var _geometry = require("../geometry");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var IcoSphere =
/*#__PURE__*/
function (_Model) {
  (0, _inherits2.default)(IcoSphere, _Model);

  function IcoSphere(gl) {
    var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, IcoSphere);
    return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(IcoSphere).call(this, gl, Object.assign({}, opts, {
      geometry: new _geometry.IcoSphereGeometry(opts)
    })));
  }

  return IcoSphere;
}(_core.Model);

exports.default = IcoSphere;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","../core":"e1PQ","../geometry":"Cb5n"}],"HpLC":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _geometry = require("../geometry");

var _model = _interopRequireDefault(require("../core/model"));

var _utils = require("../utils");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Plane =
/*#__PURE__*/
function (_Model) {
  (0, _inherits2.default)(Plane, _Model);

  function Plane(gl) {
    var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, Plane);
    var _opts$id = opts.id,
        id = _opts$id === void 0 ? (0, _utils.uid)('plane') : _opts$id;
    return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Plane).call(this, gl, Object.assign({}, opts, {
      id: id,
      geometry: new _geometry.PlaneGeometry(opts)
    })));
  }

  return Plane;
}(_model.default);

exports.default = Plane;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","../geometry":"Cb5n","../core/model":"yJrb","../utils":"PFG0"}],"R8uP":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _core = require("../core");

var _geometry = require("../geometry");

var _utils = require("../utils");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Sphere =
/*#__PURE__*/
function (_Model) {
  (0, _inherits2.default)(Sphere, _Model);

  function Sphere(gl) {
    var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, Sphere);
    var _opts$id = opts.id,
        id = _opts$id === void 0 ? (0, _utils.uid)('sphere') : _opts$id;
    return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Sphere).call(this, gl, Object.assign({}, opts, {
      id: id,
      geometry: new _geometry.SphereGeometry(opts)
    })));
  }

  return Sphere;
}(_core.Model);

exports.default = Sphere;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","../core":"e1PQ","../geometry":"Cb5n","../utils":"PFG0"}],"jmnE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _geometry = require("../geometry");

var _core = require("../core");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var TruncatedCone =
/*#__PURE__*/
function (_Model) {
  (0, _inherits2.default)(TruncatedCone, _Model);

  function TruncatedCone(gl) {
    var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, TruncatedCone);
    return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(TruncatedCone).call(this, gl, Object.assign({}, opts, {
      geometry: new _geometry.TruncatedConeGeometry(opts)
    })));
  }

  return TruncatedCone;
}(_core.Model);

exports.default = TruncatedCone;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","../geometry":"Cb5n","../core":"e1PQ"}],"gkgF":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _core = require("../core");

var _geometry = require("../geometry");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// ClipSpace
var CLIPSPACE_VERTEX_SHADER = "attribute vec2 aClipSpacePosition;\nattribute vec2 aTexCoord;\nattribute vec2 aCoordinate;\n\nvarying vec2 position;\nvarying vec2 coordinate;\nvarying vec2 uv;\n\nvoid main(void) {\n  gl_Position = vec4(aClipSpacePosition, 0., 1.);\n  position = aClipSpacePosition;\n  coordinate = aCoordinate;\n  uv = aTexCoord;\n}\n";
/* eslint-disable indent, no-multi-spaces */

var POSITIONS = [-1, -1, 1, -1, -1, 1, 1, 1];

var ClipSpace =
/*#__PURE__*/
function (_Model) {
  (0, _inherits2.default)(ClipSpace, _Model);

  function ClipSpace(gl, opts) {
    var _this;

    (0, _classCallCheck2.default)(this, ClipSpace);
    var TEX_COORDS = POSITIONS.map(function (coord) {
      return coord === -1 ? 0 : coord;
    });
    _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(ClipSpace).call(this, gl, Object.assign({}, opts, {
      vs: CLIPSPACE_VERTEX_SHADER,
      geometry: new _geometry.Geometry({
        drawMode: 5,
        vertexCount: 4,
        attributes: {
          aClipSpacePosition: {
            size: 2,
            value: new Float32Array(POSITIONS)
          },
          aTexCoord: {
            size: 2,
            value: new Float32Array(TEX_COORDS)
          },
          aCoordinate: {
            size: 2,
            value: new Float32Array(TEX_COORDS)
          }
        }
      })
    })));

    _this.setVertexCount(4);

    return _this;
  }

  return ClipSpace;
}(_core.Model);

exports.default = ClipSpace;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","../core":"e1PQ","../geometry":"Cb5n"}],"uAzG":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "Cone", {
  enumerable: true,
  get: function () {
    return _cone.default;
  }
});
Object.defineProperty(exports, "Cube", {
  enumerable: true,
  get: function () {
    return _cube.default;
  }
});
Object.defineProperty(exports, "Cylinder", {
  enumerable: true,
  get: function () {
    return _cylinder.default;
  }
});
Object.defineProperty(exports, "IcoSphere", {
  enumerable: true,
  get: function () {
    return _icoSphere.default;
  }
});
Object.defineProperty(exports, "Plane", {
  enumerable: true,
  get: function () {
    return _plane.default;
  }
});
Object.defineProperty(exports, "Sphere", {
  enumerable: true,
  get: function () {
    return _sphere.default;
  }
});
Object.defineProperty(exports, "TruncatedCone", {
  enumerable: true,
  get: function () {
    return _truncatedCone.default;
  }
});
Object.defineProperty(exports, "ClipSpace", {
  enumerable: true,
  get: function () {
    return _clipSpace.default;
  }
});

var _cone = _interopRequireDefault(require("./cone"));

var _cube = _interopRequireDefault(require("./cube"));

var _cylinder = _interopRequireDefault(require("./cylinder"));

var _icoSphere = _interopRequireDefault(require("./ico-sphere"));

var _plane = _interopRequireDefault(require("./plane"));

var _sphere = _interopRequireDefault(require("./sphere"));

var _truncatedCone = _interopRequireDefault(require("./truncated-cone"));

var _clipSpace = _interopRequireDefault(require("./clip-space"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./cone":"rOZB","./cube":"kcZB","./cylinder":"BEmD","./ico-sphere":"qAxA","./plane":"HpLC","./sphere":"R8uP","./truncated-cone":"jmnE","./clip-space":"gkgF"}],"rTzV":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _models = require("../models");

var _pass = _interopRequireDefault(require("./pass"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

//
// A pass that disables stencil test.
//
// Attribution: This class and the multipass system were inspired by
// the THREE.js EffectComposer and *Pass classes
var fs = "uniform sampler2D uDiffuseSampler;\nuniform float uOpacity;\n\nvarying vec2 uv;\n\nvoid main() {\n  vec4 texel = texture2D(uDiffuseSampler, uv);\n  gl_FragColor = uOpacity * texel;\n}\n";

var CopyPass =
/*#__PURE__*/
function (_Pass) {
  (0, _inherits2.default)(CopyPass, _Pass);

  function CopyPass(gl) {
    var _this;

    var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, CopyPass);
    _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(CopyPass).call(this, gl, Object.assign({
      id: 'copy-pass',
      swap: true
    }, props)));
    _this.clipspace = new _models.ClipSpace(gl, {
      id: 'copy-pass',
      fs: fs
    });
    return _this;
  }

  (0, _createClass2.default)(CopyPass, [{
    key: "_renderPass",
    value: function _renderPass(_ref) {
      var inputBuffer = _ref.inputBuffer;
      var _this$props$opacity = this.props.opacity,
          opacity = _this$props$opacity === void 0 ? 1.0 : _this$props$opacity;
      this.clipspace.draw({
        uniforms: {
          uDiffuseSampler: inputBuffer,
          uOpacity: opacity
        },
        parameters: {
          depthWrite: false,
          depthTest: false
        }
      });
    }
  }]);
  return CopyPass;
}(_pass.default);

exports.default = CopyPass;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","../models":"uAzG","./pass":"eTBq"}],"nR2m":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _models = require("../models");

var _pass = _interopRequireDefault(require("./pass"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

//
// A pass that renders a given texture into screen space
//
// Attribution: This class and the multipass system were inspired by
// the THREE.js EffectComposer and *Pass classes
var fs = "uniform sampler2D uDiffuseSampler;\nuniform float uOpacity;\nvarying vec2 uv;\n\nvoid main() {\n  vec4 texel = texture2D(uDiffuseSampler, uv);\n  gl_FragColor = uOpacity * texel;\n}\n";

var TexturePass =
/*#__PURE__*/
function (_Pass) {
  (0, _inherits2.default)(TexturePass, _Pass);

  function TexturePass(gl) {
    var _this;

    var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, TexturePass);
    _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(TexturePass).call(this, gl, Object.assign({
      id: 'texture-pass'
    }, options)));
    var texture = options.texture,
        _options$opacity = options.opacity,
        opacity = _options$opacity === void 0 ? 1.0 : _options$opacity;
    _this.clipspace = new _models.ClipSpace(gl, {
      id: 'texture-pass',
      fs: fs,
      uniforms: {
        uDiffuseSampler: texture,
        uOpacity: opacity
      }
    });
    return _this;
  }

  (0, _createClass2.default)(TexturePass, [{
    key: "_renderPass",
    value: function _renderPass() {
      this.clipspace.draw({
        parameters: {
          depthWrite: false,
          depthTest: false
        }
      });
    }
  }]);
  return TexturePass;
}(_pass.default);

exports.default = TexturePass;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","../models":"uAzG","./pass":"eTBq"}],"FiR7":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _pass = _interopRequireDefault(require("./pass"));

var _pickModels = _interopRequireDefault(require("../core/pick-models"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

//
// A pass that renders a given scene directly on screen or into the read buffer
// for further processing.
//
// Attribution: This class and the multipass system were inspired by
// the THREE.js EffectComposer and *Pass classes
var PickingPass =
/*#__PURE__*/
function (_Pass) {
  (0, _inherits2.default)(PickingPass, _Pass);

  function PickingPass(gl) {
    var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, PickingPass);
    return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(PickingPass).call(this, gl, Object.assign({
      id: 'picking-pass'
    }, props)));
  }

  (0, _createClass2.default)(PickingPass, [{
    key: "_renderPass",
    value: function _renderPass(_ref) {
      var gl = _ref.gl,
          inputBuffer = _ref.inputBuffer,
          animationProps = _ref.animationProps;
      var props = this.props;
      var pickPosition = animationProps ? animationProps._mousePosition : props.mousePosition;
      var useDevicePixels = animationProps ? animationProps.useDevicePixels : props.useDevicePixels; // Clear picking position if not available

      if (!pickPosition) {
        var _iteratorNormalCompletion = true;
        var _didIteratorError = false;
        var _iteratorError = undefined;

        try {
          for (var _iterator = this.props.models[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
            var model = _step.value;
            model.updateModuleSettings({
              pickingSelectedColor: null
            });
          }
        } catch (err) {
          _didIteratorError = true;
          _iteratorError = err;
        } finally {
          try {
            if (!_iteratorNormalCompletion && _iterator.return != null) {
              _iterator.return();
            }
          } finally {
            if (_didIteratorError) {
              throw _iteratorError;
            }
          }
        }

        return;
      }

      var pickInfo = (0, _pickModels.default)(gl, {
        models: this.props.models,
        position: pickPosition,
        useDevicePixels: useDevicePixels,
        framebuffer: inputBuffer // Use as temporary frame buffer

      }); // Highlight it

      var _iteratorNormalCompletion2 = true;
      var _didIteratorError2 = false;
      var _iteratorError2 = undefined;

      try {
        for (var _iterator2 = this.props.models[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
          var _model = _step2.value;

          if (pickInfo && pickInfo.model === _model) {
            var pickingSelectedColor = pickInfo && pickInfo.color || null;

            _model.updateModuleSettings({
              pickingSelectedColor: pickingSelectedColor
            });
          }
        }
      } catch (err) {
        _didIteratorError2 = true;
        _iteratorError2 = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
            _iterator2.return();
          }
        } finally {
          if (_didIteratorError2) {
            throw _iteratorError2;
          }
        }
      }
    }
  }]);
  return PickingPass;
}(_pass.default);

exports.default = PickingPass;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","./pass":"eTBq","../core/pick-models":"ODk1"}],"VOCE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.parsePropTypes = parsePropTypes;

var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof"));

var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// // import assert from 'assert'; // TODO
var TYPE_DEFINITIONS = {
  boolean: {
    validate: function validate(value, propType) {
      return true;
    }
  },
  number: {
    validateType: function validateType(value, propType) {
      return 'value' in propType && (!('max' in propType) || Number.isFinite(propType.max)) && (!('min' in propType) || Number.isFinite(propType.min));
    },
    validate: function validate(value, propType) {
      return Number.isFinite(value) && (!('max' in propType) || value <= propType.max) && (!('min' in propType) || value >= propType.min);
    }
  }
};

function parsePropTypes(propDefs) {
  var propTypes = {};
  var defaultProps = {};

  var _arr = Object.entries(propDefs);

  for (var _i = 0; _i < _arr.length; _i++) {
    var _arr$_i = (0, _slicedToArray2.default)(_arr[_i], 2),
        propName = _arr$_i[0],
        propDef = _arr$_i[1];

    var propType = parsePropType(propName, propDef);
    propTypes[propName] = propType;
    defaultProps[propName] = propType.value;
  }

  return {
    propTypes: propTypes,
    defaultProps: defaultProps
  };
} // Parses one property definition entry. Either contains:
// * a valid prop type object ({type, ...})
// * or just a default value, in which case type and name inference is used


function parsePropType(name, propDef) {
  switch (getTypeOf(propDef)) {
    case 'object':
      propDef = normalizePropType(name, propDef);
      return parsePropDefinition(propDef);

    case 'array':
      return guessArrayType(name, propDef);

    case 'boolean':
      return {
        name: name,
        type: 'boolean',
        value: propDef
      };

    case 'number':
      return guessNumberType(name, propDef);

    case 'function':
      return {
        name: name,
        type: 'function',
        value: propDef
      };
    // return guessFunctionType(name, propDef);

    default:
      return {
        name: name,
        type: 'unknown',
        value: propDef
      };
  }
}

function guessArrayType(name, array) {
  if (/color/i.test(name) && (array.length === 3 || array.length === 4)) {
    return {
      name: name,
      type: 'color',
      value: array
    };
  }

  return {
    name: name,
    type: 'array',
    value: array
  };
}

function normalizePropType(name, propDef) {
  if (!('type' in propDef)) {
    if (!('value' in propDef)) {
      // If no type and value this object is likely the value
      return {
        name: name,
        type: 'object',
        value: propDef
      };
    }

    return Object.assign({
      name: name,
      type: getTypeOf(propDef.value)
    }, propDef);
  }

  return Object.assign({
    name: name
  }, propDef);
}

function parsePropDefinition(propDef) {
  var type = propDef.type;
  var typeDefinition = TYPE_DEFINITIONS[type] || {};
  var typeValidator = typeDefinition.typeValidator;

  if (typeValidator) {// assert(typeValidator(propDef), 'Illegal prop type');
  }

  return propDef;
}

function guessNumberType(name, value) {
  var isKnownProp = /radius|scale|width|height|pixel|size|miter/i.test(name) && /^((?!scale).)*$/.test(name);
  var max = isKnownProp ? 100 : 1;
  var min = 0;
  return {
    name: name,
    type: 'number',
    max: Math.max(value, max),
    min: Math.min(value, min),
    value: value
  };
} // improved version of javascript typeof that can distinguish arrays and null values


function getTypeOf(value) {
  if (Array.isArray(value) || ArrayBuffer.isView(value)) {
    return 'array';
  }

  if (value === null) {
    return 'null';
  }

  return (0, _typeof2.default)(value);
}
},{"@babel/runtime/helpers/esm/typeof":"Izky","@babel/runtime/helpers/esm/slicedToArray":"U1JK"}],"VhlE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.normalizeShaderModule = normalizeShaderModule;

var _propTypes = require("./prop-types");

function defaultGetUniforms(module, props) {
  var uniforms = {};

  if (props === undefined) {
    for (var key in module.uniforms) {
      uniforms[key] = module.uniforms[key].value;
    }

    return uniforms;
  }

  for (var _key in props) {
    // TODO validate, clamp etc
    uniforms[_key] = props[_key];
  }

  return uniforms;
} // Note: modifies and returns the same module


function normalizeShaderModule(module) {
  if (!module.normalized) {
    module.normalized = true; // Normalize uniforms

    if (module.uniforms) {
      var _parsePropTypes = (0, _propTypes.parsePropTypes)(module.uniforms),
          propTypes = _parsePropTypes.propTypes;

      module.uniforms = propTypes;
    } // Build a getUniforms from the uniforms array


    if (module.uniforms && !module.getUniforms) {
      module.getUniforms = defaultGetUniforms.bind(null, module);
    }
  }

  return module;
}
},{"./prop-types":"VOCE"}],"z1ry":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _pass = _interopRequireDefault(require("./pass"));

var _compositePass = _interopRequireDefault(require("./composite-pass"));

var _clipSpace = _interopRequireDefault(require("../models/clip-space"));

var _normalizeModule = require("../shadertools/src/lib/filters/normalize-module");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

//
// A pass that renders a given texture into screen space
//
var ShaderModuleSinglePass =
/*#__PURE__*/
function (_Pass) {
  (0, _inherits2.default)(ShaderModuleSinglePass, _Pass);

  function ShaderModuleSinglePass(gl) {
    var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, ShaderModuleSinglePass);
    return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(ShaderModuleSinglePass).call(this, gl, Object.assign({
      swap: true
    }, props)));
  }

  (0, _createClass2.default)(ShaderModuleSinglePass, [{
    key: "_renderPass",
    value: function _renderPass(_ref) {
      var inputBuffer = _ref.inputBuffer,
          swapBuffers = _ref.swapBuffers;
      this.props.model.setUniforms(this.props); // swapBuffers();

      this.props.model.draw({
        uniforms: {
          texture: inputBuffer,
          texSize: [inputBuffer.width, inputBuffer.height]
        },
        parameters: {
          depthWrite: false,
          depthTest: false
        }
      });
    }
  }]);
  return ShaderModuleSinglePass;
}(_pass.default);

var ShaderModulePass =
/*#__PURE__*/
function (_CompositePass) {
  (0, _inherits2.default)(ShaderModulePass, _CompositePass);

  function ShaderModulePass(gl, module) {
    var _this;

    var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
    (0, _classCallCheck2.default)(this, ShaderModulePass);
    var id = "".concat(module.name, "-pass");
    (0, _normalizeModule.normalizeShaderModule)(module);
    var passes = normalizePasses(gl, module, id, props);
    _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(ShaderModulePass).call(this, gl, Object.assign({
      id: id,
      passes: passes
    }, props)));
    _this.module = module;
    return _this;
  }

  (0, _createClass2.default)(ShaderModulePass, [{
    key: "_renderPass",
    value: function _renderPass(_ref2) {
      var inputBuffer = _ref2.inputBuffer,
          swapBuffers = _ref2.swapBuffers;
      var first = true;
      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = this.module.passes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var pass = _step.value;

          if (!first) {
            swapBuffers();
          }

          first = false;

          if (pass.uniforms) {
            pass.model.setUniforms(pass.uniforms);
          } // swapBuffers();


          pass.model.draw({
            uniforms: {
              texture: inputBuffer,
              texSize: [inputBuffer.width, inputBuffer.height]
            },
            parameters: {
              depthWrite: false,
              depthTest: false
            }
          });
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return != null) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }
    }
  }]);
  return ShaderModulePass;
}(_compositePass.default);

exports.default = ShaderModulePass;

function normalizePasses(gl, module, id, props) {
  if (module.filter || module.sampler) {
    var fs = getFragmentShaderForRenderPass(module);
    var pass = new ShaderModuleSinglePass(gl, {
      id: id,
      model: getModel(gl, module, fs, id, props),
      uniforms: null
    });
    return [pass];
  }

  var passes = module.passes || [];
  return passes.map(function (pass) {
    var fs = getFragmentShaderForRenderPass(module, pass);
    var idn = "".concat(id, "-").concat(passes.length + 1);
    return new ShaderModuleSinglePass(gl, Object.assign({
      id: idn,
      model: getModel(gl, module, fs, idn, props),
      uniforms: pass.uniforms
    }, props));
  });
}

function getModel(gl, module, fs, id, props) {
  var model = new _clipSpace.default(gl, {
    id: id,
    fs: fs,
    modules: [module]
  });
  var uniforms = Object.assign(module.getUniforms(), module.getUniforms(props));
  model.setUniforms(uniforms);
  return model;
}

var FILTER_FS_TEMPLATE = function FILTER_FS_TEMPLATE(func) {
  return "uniform sampler2D texture;\nuniform vec2 texSize;\n\nvarying vec2 position;\nvarying vec2 coordinate;\nvarying vec2 uv;\n\nvoid main() {\n  vec2 texCoord = coordinate;\n\n  gl_FragColor = texture2D(texture, texCoord);\n  gl_FragColor = ".concat(func, "(gl_FragColor, texSize, texCoord);\n}\n");
};

var SAMPLER_FS_TEMPLATE = function SAMPLER_FS_TEMPLATE(func) {
  return "uniform sampler2D texture;\nuniform vec2 texSize;\n\nvarying vec2 position;\nvarying vec2 coordinate;\nvarying vec2 uv;\n\nvoid main() {\n  vec2 texCoord = coordinate;\n\n  gl_FragColor = ".concat(func, "(texture, texSize, texCoord);\n}\n");
};

function getFragmentShaderForRenderPass(module) {
  var pass = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : module;

  if (pass.filter) {
    var func = typeof pass.filter === 'string' ? pass.filter : "".concat(module.name, "_filterColor");
    return FILTER_FS_TEMPLATE(func);
  }

  if (pass.sampler) {
    var _func = typeof pass.sampler === 'string' ? pass.sampler : "".concat(module.name, "_sampleColor");

    return SAMPLER_FS_TEMPLATE(_func);
  } // console.error(`${module.name} no fragment shader generated`);


  return null;
}
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","./pass":"eTBq","./composite-pass":"MfJ8","../models/clip-space":"gkgF","../shadertools/src/lib/filters/normalize-module":"VhlE"}],"IKAG":[function(require,module,exports) {
function _interopRequireDefault(obj) {
  return obj && obj.__esModule ? obj : {
    "default": obj
  };
}

module.exports = _interopRequireDefault;
},{}],"x3DH":[function(require,module,exports) {
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;
}

module.exports = _defineProperty;
},{}],"PBp7":[function(require,module,exports) {
"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.installParameterDefinitions = installParameterDefinitions;
exports.TEXTURE_PARAMETERS = exports.SAMPLER_PARAMETERS = exports.RENDERBUFFER_PARAMETERS = exports.PROGRAM_PARAMETERS = exports.FRAMEBUFFER_STATUS = exports.FRAMEBUFFER_ATTACHMENT_PARAMETERS = exports.FENCE_SYNC_PARAMETERS = exports.BUFFER_PARAMETERS = exports.GLboolean = exports.GLuint = exports.GLint = exports.GLfloat = exports.GLenum = void 0;

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

var _BUFFER_PARAMETERS, _FRAMEBUFFER_STATUS, _PROGRAM_PARAMETERS, _RENDERBUFFER_PARAMET, _SAMPLER_PARAMETERS, _TEXTURE_PARAMETERS;

// Parameter support.
// Installs definitions that enable querying an object for all its parameters
// with resource.getParameters(). This is mainly useful during debugging.
// Note: Kept separate to avoid bundling in production applications
// WebGL specification 'types'
var GLenum = 'GLenum';
exports.GLenum = GLenum;
var GLfloat = 'GLfloat';
exports.GLfloat = GLfloat;
var GLint = 'GLint';
exports.GLint = GLint;
var GLuint = 'GLint';
exports.GLuint = GLuint;
var GLboolean = 'GLboolean';
/*
 TODO - will most likely remove some of these fields from the main struct
 but they can be useful for debugging/seer integration, so keep them here for now
export const DBG_PARAMETERS = {
  blend: {
    type: GLboolean,
    params: GL.BLEND,
    value: false,
    setter: (gl, value) => value ? gl.enable(GL.BLEND) : gl.disable(GL.BLEND)
  },

  blendColor: {
    type: new Float32Array(4),
    value: new Float32Array([0, 0, 0, 0]),
    params: GL.BLEND_COLOR,
    setter: (gl, value) => gl.blendColor(...value)
  },

  blendEquation: {
    type: [GLenum, GLenum],
    object: ['rgb', 'alpha'],
    alias: 'blendEquationSeparate',
    value: [GL.FUNC_ADD, GL.FUNC_ADD],
    params: [GL.BLEND_EQUATION_RGB, GL.BLEND_EQUATION_ALPHA],
    setter: (gl, value) => gl.blendEquationSeparate(...value),
    normalizeArgs: args => isArray(args) ? args : [args, args]
  },

  // blend func
  blendFunc: {
    type: [GLenum, GLenum, GLenum, GLenum],
    object: ['srcRgb', 'dstRgb', 'srcAlpha', 'dstAlpha'],
    value: [GL.ONE, GL.ZERO, GL.ONE, GL.ZERO],
    params: [GL.BLEND_SRC_RGB, GL.BLEND_DST_RGB, GL.BLEND_SRC_ALPHA, GL.BLEND_DST_ALPHA],
    setter: (gl, value) => gl.blendFuncSeparate(...value),
    normalizeArgs: args => isArray(args) && args.length === 3 ? [...args, ...args] : args
  },

  clearColor: {
    type: new Float32Array(4),
    params: GL.COLOR_CLEAR_VALUE,
    value: new Float32Array([0, 0, 0, 0]), // TBD
    setter: (gl, value) => gl.clearColor(...value)
  },

  colorMask: {
    type: [GLboolean, GLboolean, GLboolean, GLboolean],
    params: GL.COLOR_WRITEMASK,
    value: [true, true, true, true],
    setter: (gl, value) => gl.colorMask(...value)
  },

  // TODO - We have a name clash here
  cullFace: {
    type: GLboolean,
    params: GL.CULL_FACE,
    value: false,
    setter: (gl, value) => value ? gl.enable(GL.CULL_FACE) : gl.disable(GL.CULL_FACE)
  },

  cullFaceMode: {
    type: GLenum,
    params: GL.CULL_FACE_MODE,
    value: GL.BACK,
    setter: (gl, value) => gl.cullFace(value)
  },

  depthTest: {
    type: GLboolean,
    params: GL.DEPTH_TEST,
    value: false,
    setter: (gl, value) => value ? gl.enable(GL.DEPTH_TEST) : gl.disable(GL.DEPTH_TEST)
  },

  depthClearValue: {
    type: GLfloat,
    params: GL.DEPTH_CLEAR_VALUE,
    value: 1,
    setter: (gl, value) => gl.clearDepth(value)
  },

  depthFunc: {
    type: GLenum,
    params: GL.DEPTH_FUNC,
    value: GL.LESS,
    setter: (gl, value) => gl.depthFunc(value)
  },

  depthRange: {
    type: new Float32Array(2),
    object: ['min', 'max'],
    params: GL.DEPTH_RANGE,
    value: new Float32Array([0, 1]), // TBD
    setter: (gl, value) => gl.depthRange(...value)
  },

  depthWritemask: {
    type: GLboolean,
    params: GL.DEPTH_WRITEMASK,
    value: true,
    setter: (gl, value) => gl.depthMask(value)
  },

  dither: {
    type: GLboolean,
    params: GL.DITHER,
    value: true,
    setter: (gl, value) => value ? gl.enable(GL.DITHER) : gl.disable(GL.DITHER)
  },

  fragmentShaderDerivativeHint: {
    type: GLenum,
    params: GL.FRAGMENT_SHADER_DERIVATIVE_HINT,
    value: GL.DONT_CARE,
    setter: (gl, value) => gl.hint(GL.FRAGMENT_SHADER_DERIVATIVE_HINT, value),
    gl1: 'OES_standard_derivatives'
  },

  frontFace: {
    type: GLenum,
    params: GL.FRONT_FACE,
    value: GL.CCW,
    setter: (gl, value) => gl.frontFace(value)
  },

  // Hint for quality of images generated with glGenerateMipmap
  generateMipmapHint: {
    type: GLenum,
    params: GL.GENERATE_MIPMAP_HINT,
    value: GL.DONT_CARE,
    setter: (gl, value) => gl.hint(GL.GENERATE_MIPMAP_HINT, value)
  },

  lineWidth: {
    type: GLfloat,
    params: GL.LINE_WIDTH,
    value: 1,
    setter: (gl, value) => gl.lineWidth(value)
  },

  polygonOffsetFill: {
    type: GLboolean,
    params: GL.POLYGON_OFFSET_FILL,
    value: false,
    setter: (gl, value) =>
      value ? gl.enable(GL.POLYGON_OFFSET_FILL) : gl.disable(GL.POLYGON_OFFSET_FILL)
  },

  // Add small offset to fragment depth values (by factor × DZ + r × units)
  // Useful for rendering hidden-line images, for applying decals to surfaces,
  // and for rendering solids with highlighted edges.
  // https://www.khronos.org/opengles/sdk/docs/man/xhtml/glPolygonOffset.xml
  polygonOffset: {
    type: [GLfloat, GLfloat],
    object: ['factor', 'units'],
    params: [GL.POLYGON_OFFSET_FACTOR, GL.POLYGON_OFFSET_UNITS],
    value: [0, 0],
    setter: (gl, value) => gl.polygonOffset(...value)
  },

  // TODO - enabling multisampling
  // glIsEnabled with argument GL_SAMPLE_ALPHA_TO_COVERAGE
  // glIsEnabled with argument GL_SAMPLE_COVERAGE

  // specify multisample coverage parameters
  // https://www.khronos.org/opengles/sdk/docs/man/xhtml/glSampleCoverage.xml
  sampleCoverage: {
    type: [GLfloat, GLboolean],
    object: ['value', 'invert'],
    params: [GL.SAMPLE_COVERAGE_VALUE, GL.SAMPLE_COVERAGE_INVERT],
    value: [1.0, false],
    setter: (gl, value) => gl.sampleCoverage(...value)
  },

  scissorTest: {
    type: GLboolean,
    params: GL.SCISSOR_TEST,
    value: false,
    setter: (gl, value) => value ? gl.enable(GL.SCISSOR_TEST) : gl.disable(GL.SCISSOR_TEST)
  },

  scissorBox: {
    type: new Int32Array(4),
    object: ['x', 'y', 'width', 'height'],
    // When scissor test enabled we expect users to set correct scissor box,
    // otherwise we default to following value array.
    params: GL.SCISSOR_BOX,
    value: new Int32Array([0, 0, 1024, 1024]),
    setter: (gl, value) => gl.scissor(...value)
  },

  stencilTest: {
    type: GLboolean,
    params: GL.STENCIL_TEST,
    value: false,
    setter: (gl, value) => value ? gl.enable(GL.STENCIL_TEST) : gl.disable(GL.STENCIL_TEST)
  },

  // Sets index used when stencil buffer is cleared.
  stencilClearValue: {
    type: GLint,
    params: GL.STENCIL_CLEAR_VALUE,
    value: 0,
    setter: (gl, value) => gl.clearStencil(value)
  },

  // Sets bit mask enabling writing of individual bits in the stencil planes
  // https://www.khronos.org/opengles/sdk/docs/man/xhtml/glStencilMaskSeparate.xml
  stencilMask: {
    type: [GLuint, GLuint],
    object: ['mask', 'backMask'],
    value: [0xFFFFFFFF, 0xFFFFFFFF],
    params: [GL.STENCIL_WRITEMASK, GL.STENCIL_BACK_WRITEMASK],
    setter: (gl, value) => {
      value = isArray(value) ? value : [value, value];
      const [mask, backMask] = value;
      gl.stencilMaskSeparate(GL.FRONT, mask);
      gl.stencilMaskSeparate(GL.BACK, backMask);
    }
  },

  // Set stencil testing function, reference value and mask for front and back
  // https://www.khronos.org/opengles/sdk/docs/man/xhtml/glStencilFuncSeparate.xml
  stencilFunc: {
    type: [GLenum, GLint, GLuint, GLenum, GLint, GLuint],
    object: [
      'func', 'ref', 'valueMask', 'backFunc', 'backRef', 'backValueMask'
    ],
    value: [GL.ALWAYS, 0, 0xFFFFFFFF, GL.ALWAYS, 0, 0xFFFFFFFF],
    params: [
      // front
      GL.STENCIL_FUNC,
      GL.STENCIL_REF,
      GL.STENCIL_VALUE_MASK,
      // back
      GL.STENCIL_BACK_FUNC,
      GL.STENCIL_BACK_REF,
      GL.STENCIL_BACK_VALUE_MASK
    ],
    setter: (gl, value) => {
      const [func, ref, mask, backFunc, backRef, backMask] = value;
      gl.stencilFuncSeparate(GL.FRONT, func, ref, mask);
      gl.stencilFuncSeparate(GL.BACK, backFunc, backRef, backMask);
    }
  },

  // Specifies the action to take when the stencil test fails, front and back.
  // Stencil test fail action, depth test fail action, pass action
  // GL.KEEP, GL.ZERO, GL.REPLACE, GL.INCR, GL.INCR_WRAP, GL.DECR, GL.DECR_WRAP,
  // and GL.INVERT
  // https://www.khronos.org/opengles/sdk/docs/man/xhtml/glStencilOpSeparate.xml
  stencilOp: {
    type: [GLenum, GLenum, GLenum, GLenum, GLenum, GLenum],
    object: [
      'fail', 'passDepthFail', 'passDepthPass',
      'backFail', 'backPassDepthFail', 'backPassDepthPass'
    ],
    params: [
      // front
      GL.STENCIL_FAIL,
      GL.STENCIL_PASS_DEPTH_FAIL,
      GL.STENCIL_PASS_DEPTH_PASS,
      // back
      GL.STENCIL_BACK_FAIL,
      GL.STENCIL_BACK_PASS_DEPTH_FAIL,
      GL.STENCIL_BACK_PASS_DEPTH_PASS
    ],
    value: [GL.KEEP, GL.KEEP, GL.KEEP, GL.KEEP, GL.KEEP, GL.KEEP],
    setter: (gl, value) => {
      const [sfail, dpfail, dppass, backSfail, backDpfail, backDppass] = value;
      gl.stencilOpSeparate(GL.FRONT, sfail, dpfail, dppass);
      gl.stencilOpSeparate(GL.BACK, backSfail, backDpfail, backDppass);
    }
  },

  viewport: {
    type: new Int32Array(4),
    object: ['x', 'y', 'width', 'height'],
    // We use [0, 0, 1024, 1024] as default, but usually this is updated in each frame.
    params: GL.VIEWPORT,
    value: new Int32Array([0, 0, 1024, 1024]),
    setter: (gl, value) => gl.viewport(...value)
  },

  // WEBGL1 PIXEL PACK/UNPACK MODES

  // Packing of pixel data in memory (1,2,4,8)
  [GL.PACK_ALIGNMENT]: {
    type: GLint,
    params: GL.PACK_ALIGNMENT,
    value: 4,
    setter: (gl, value) => gl.pixelStorei(GL.PACK_ALIGNMENT, value)
  },
  // Unpacking pixel data from memory(1,2,4,8)
  [GL.UNPACK_ALIGNMENT]: {
    type: GLint,
    params: GL.UNPACK_ALIGNMENT,
    value: 4,
    setter: (gl, value) => gl.pixelStorei(GL.UNPACK_ALIGNMENT, value)
  },
  // Flip source data along its vertical axis
  [GL.UNPACK_FLIP_Y_WEBGL]: {
    type: GLboolean,
    params: GL.UNPACK_FLIP_Y_WEBGL,
    value: false,
    setter: (gl, value) => gl.pixelStorei(GL.UNPACK_FLIP_Y_WEBGL, value)
  },
  // Multiplies the alpha channel into the other color channels
  [GL.UNPACK_PREMULTIPLY_ALPHA_WEBGL]: {
    type: GLboolean,
    params: GL.UNPACK_PREMULTIPLY_ALPHA_WEBGL,
    value: false,
    setter: (gl, value) => gl.pixelStorei(GL.UNPACK_PREMULTIPLY_ALPHA_WEBGL, value)
  },
  // Default color space conversion or no color space conversion.
  [GL.UNPACK_COLORSPACE_CONVERSION_WEBGL]: {
    type: GLenum,
    params: GL.UNPACK_COLORSPACE_CONVERSION_WEBGL,
    value: GL.BROWSER_DEFAULT_WEBGL,
    setter: (gl, value) => gl.pixelStorei(GL.UNPACK_COLORSPACE_CONVERSION_WEBGL, value)
  },

  // WEBGL2 PIXEL PACK/UNPACK MODES

  // Number of pixels in a row.
  [GL.PACK_ROW_LENGTH]: {
    type: GLint,
    params: GL.PACK_ROW_LENGTH,
    value: 0,
    setter: (gl, value) => gl.pixelStorei(GL.PACK_ROW_LENGTH, value),
    webgl2: true
  },
  // Number of pixels skipped before the first pixel is written into memory.
  [GL.PACK_SKIP_PIXELS]: {
    type: GLint,
    params: GL.PACK_SKIP_PIXELS,
    value: 0,
    setter: (gl, value) => gl.pixelStorei(GL.PACK_SKIP_PIXELS, value),
    webgl2: true
  },
  // Number of rows of pixels skipped before first pixel is written to memory.
  [GL.PACK_SKIP_ROWS]: {
    type: GLint,
    params: GL.PACK_SKIP_ROWS,
    value: 0,
    setter: (gl, value) => gl.pixelStorei(GL.PACK_SKIP_ROWS, value),
    webgl2: true
  },
  // Number of pixels in a row.
  [GL.UNPACK_ROW_LENGTH]: {
    type: GLint,
    params: GL.UNPACK_ROW_LENGTH,
    value: 0,
    setter: (gl, value) => gl.pixelStorei(GL.UNPACK_ROW_LENGTH, value),
    webgl2: true
  },
  // Image height used for reading pixel data from memory
  [GL.UNPACK_IMAGE_HEIGHT]: {
    type: GLint,
    params: GL.UNPACK_IMAGE_HEIGHT,
    value: 0,
    setter: (gl, value) => gl.pixelStorei(GL.UNPACK_IMAGE_HEIGHT, value),
    webgl2: true
  },
  // Number of pixel images skipped before first pixel is read from memory
  [GL.UNPACK_SKIP_PIXELS]: {
    type: GLint,
    params: GL.UNPACK_SKIP_PIXELS,
    value: 0,
    setter: (gl, value) => gl.pixelStorei(GL.UNPACK_SKIP_PIXELS, value),
    webgl2: true
  },
  // Number of rows of pixels skipped before first pixel is read from memory
  [GL.UNPACK_SKIP_ROWS]: {
    type: GLint,
    params: GL.UNPACK_SKIP_ROWS,
    value: 0,
    setter: (gl, value) => gl.pixelStorei(GL.UNPACK_SKIP_ROWS, value),
    webgl2: true
  },
  // Number of pixel images skipped before first pixel is read from memory
  [GL.UNPACK_SKIP_IMAGES]: {
    type: GLint,
    params: GL.UNPACK_SKIP_IMAGES,
    value: 0,
    setter: (gl, value) => gl.pixelStorei(GL.UNPACK_SKIP_IMAGES, value),
    webgl2: true
  }
};
*/

exports.GLboolean = GLboolean;
var BUFFER_PARAMETERS = (_BUFFER_PARAMETERS = {}, (0, _defineProperty2.default)(_BUFFER_PARAMETERS, 34660, {
  webgl1: 0
}), (0, _defineProperty2.default)(_BUFFER_PARAMETERS, 34661, {
  webgl1: 0 // GLenum indicating the usage pattern of the buffer.

}), _BUFFER_PARAMETERS);
exports.BUFFER_PARAMETERS = BUFFER_PARAMETERS;
var FENCE_SYNC_PARAMETERS = [37138, // GLenum, type of sync object (always GL.SYNC_FENCE).
37140, // GLenum, status of sync object (GL.SIGNALED/GL.UNSIGNALED)
37139, // GLenum. object condition (always GL.SYNC_GPU_COMMANDS_COMPLETE).
37141 // GLenum, flags sync object was created with (always 0)
];
exports.FENCE_SYNC_PARAMETERS = FENCE_SYNC_PARAMETERS;
var FRAMEBUFFER_ATTACHMENT_PARAMETERS = [36049, // WebGLRenderbuffer or WebGLTexture
36048, // GL.RENDERBUFFER, GL.TEXTURE, GL.NONE
36051, // GL.TEXTURE_CUBE_MAP_POSITIVE_X, etc.
36050, // GLint
// EXT_sRGB or WebGL2
33296, // GL.LINEAR, GL.SRBG
// WebGL2
36052, // GLint
33298, // GLint
33299, // GLint
33300, // GLint
33301, // GLint
33302, // GLint
33303, // GLint
33297 // GL.FLOAT, GL.INT, GL.UNSIGNED_INT, GL.SIGNED_NORMALIZED, OR GL.UNSIGNED_NORMALIZED.
];
exports.FRAMEBUFFER_ATTACHMENT_PARAMETERS = FRAMEBUFFER_ATTACHMENT_PARAMETERS;
var FRAMEBUFFER_STATUS = (_FRAMEBUFFER_STATUS = {}, (0, _defineProperty2.default)(_FRAMEBUFFER_STATUS, 36053, 'Success. Framebuffer is correctly set up'), (0, _defineProperty2.default)(_FRAMEBUFFER_STATUS, 36054, 'Framebuffer attachment types mismatched or some attachment point not attachment complete'), (0, _defineProperty2.default)(_FRAMEBUFFER_STATUS, 36055, 'Framebuffer has no attachment'), (0, _defineProperty2.default)(_FRAMEBUFFER_STATUS, 36057, 'Framebuffer attachments do not have the same size'), (0, _defineProperty2.default)(_FRAMEBUFFER_STATUS, 36061, 'Framebuffer attachment format not supported or depth and stencil attachments are not same'), (0, _defineProperty2.default)(_FRAMEBUFFER_STATUS, 36182, 'Framebuffer attachement SAMPLES differs among renderbuffers, or are mixed with textures'), _FRAMEBUFFER_STATUS);
exports.FRAMEBUFFER_STATUS = FRAMEBUFFER_STATUS;
var PROGRAM_PARAMETERS = (_PROGRAM_PARAMETERS = {}, (0, _defineProperty2.default)(_PROGRAM_PARAMETERS, 35712, {
  webgl1: 0
}), (0, _defineProperty2.default)(_PROGRAM_PARAMETERS, 35714, {
  webgl1: 0
}), (0, _defineProperty2.default)(_PROGRAM_PARAMETERS, 35715, {
  webgl1: 0
}), (0, _defineProperty2.default)(_PROGRAM_PARAMETERS, 35717, {
  webgl1: 0
}), (0, _defineProperty2.default)(_PROGRAM_PARAMETERS, 35721, {
  webgl1: 0
}), (0, _defineProperty2.default)(_PROGRAM_PARAMETERS, 35718, {
  webgl1: 0
}), (0, _defineProperty2.default)(_PROGRAM_PARAMETERS, 35967, {
  webgl2: 0
}), (0, _defineProperty2.default)(_PROGRAM_PARAMETERS, 35971, {
  webgl2: 0
}), (0, _defineProperty2.default)(_PROGRAM_PARAMETERS, 35382, {
  webgl2: 0 // GLint

}), _PROGRAM_PARAMETERS); //  parameters

exports.PROGRAM_PARAMETERS = PROGRAM_PARAMETERS;
var RENDERBUFFER_PARAMETERS = (_RENDERBUFFER_PARAMET = {}, (0, _defineProperty2.default)(_RENDERBUFFER_PARAMET, 36162, {
  webgl1: 0
}), (0, _defineProperty2.default)(_RENDERBUFFER_PARAMET, 36163, {
  webgl1: 0
}), (0, _defineProperty2.default)(_RENDERBUFFER_PARAMET, 36164, {
  type: 'GLenum',
  webgl1: 32854
}), (0, _defineProperty2.default)(_RENDERBUFFER_PARAMET, 36177, {
  webgl1: 0
}), (0, _defineProperty2.default)(_RENDERBUFFER_PARAMET, 36178, {
  webgl1: 0
}), (0, _defineProperty2.default)(_RENDERBUFFER_PARAMET, 36176, {
  webgl1: 0
}), (0, _defineProperty2.default)(_RENDERBUFFER_PARAMET, 36179, {
  webgl1: 0
}), (0, _defineProperty2.default)(_RENDERBUFFER_PARAMET, 36180, {
  webgl1: 0
}), (0, _defineProperty2.default)(_RENDERBUFFER_PARAMET, 36181, {
  webgl1: 0
}), (0, _defineProperty2.default)(_RENDERBUFFER_PARAMET, 36011, {
  webgl2: 1
}), _RENDERBUFFER_PARAMET);
exports.RENDERBUFFER_PARAMETERS = RENDERBUFFER_PARAMETERS;
var SAMPLER_PARAMETERS = (_SAMPLER_PARAMETERS = {}, (0, _defineProperty2.default)(_SAMPLER_PARAMETERS, 10240, {
  webgl2: true
}), (0, _defineProperty2.default)(_SAMPLER_PARAMETERS, 10241, {
  webgl2: true
}), (0, _defineProperty2.default)(_SAMPLER_PARAMETERS, 10242, {
  webgl2: true
}), (0, _defineProperty2.default)(_SAMPLER_PARAMETERS, 10243, {
  webgl2: true
}), (0, _defineProperty2.default)(_SAMPLER_PARAMETERS, 32882, {
  webgl2: true
}), (0, _defineProperty2.default)(_SAMPLER_PARAMETERS, 33084, {
  webgl2: true
}), (0, _defineProperty2.default)(_SAMPLER_PARAMETERS, 33085, {
  webgl2: true
}), (0, _defineProperty2.default)(_SAMPLER_PARAMETERS, 34893, {
  webgl2: true
}), (0, _defineProperty2.default)(_SAMPLER_PARAMETERS, 34892, {
  webgl2: true
}), (0, _defineProperty2.default)(_SAMPLER_PARAMETERS, 33082, {
  webgl2: true
}), (0, _defineProperty2.default)(_SAMPLER_PARAMETERS, 33083, {
  webgl2: true // maximum level-of-detail value
  // [GL.TEXTURE_MAX_ANISOTROPY_EXT]: {webgl2: 'EXT_texture_filter_anisotropic'}

}), _SAMPLER_PARAMETERS); // const SHADER_PARAMETERS = [
//   GL.DELETE_STATUS, // GLboolean - whether shader is flagged for deletion.
//   GL.COMPILE_STATUS, // GLboolean - was last shader compilation successful.
//   GL.SHADER_TYPE // GLenum - GL.VERTEX_SHADER or GL.FRAGMENT_SHADER.
// ];

exports.SAMPLER_PARAMETERS = SAMPLER_PARAMETERS;
var TEXTURE_PARAMETERS = (_TEXTURE_PARAMETERS = {}, (0, _defineProperty2.default)(_TEXTURE_PARAMETERS, 10240, {
  type: 'GLenum',
  webgl1: 9729
}), (0, _defineProperty2.default)(_TEXTURE_PARAMETERS, 10241, {
  type: 'GLenum',
  webgl1: 9986
}), (0, _defineProperty2.default)(_TEXTURE_PARAMETERS, 10242, {
  type: 'GLenum',
  webgl1: 10497
}), (0, _defineProperty2.default)(_TEXTURE_PARAMETERS, 10243, {
  type: 'GLenum',
  webgl1: 10497
}), (0, _defineProperty2.default)(_TEXTURE_PARAMETERS, 32882, {
  type: 'GLenum',
  webgl2: 10497
}), (0, _defineProperty2.default)(_TEXTURE_PARAMETERS, 33084, {
  webgl2: 0
}), (0, _defineProperty2.default)(_TEXTURE_PARAMETERS, 33085, {
  webgl2: 1000
}), (0, _defineProperty2.default)(_TEXTURE_PARAMETERS, 34893, {
  type: 'GLenum',
  webgl2: 515
}), (0, _defineProperty2.default)(_TEXTURE_PARAMETERS, 34892, {
  type: 'GLenum',
  webgl2: 0
}), (0, _defineProperty2.default)(_TEXTURE_PARAMETERS, 33082, {
  webgl2: -1000
}), (0, _defineProperty2.default)(_TEXTURE_PARAMETERS, 33083, {
  webgl2: 1000
}), (0, _defineProperty2.default)(_TEXTURE_PARAMETERS, 4096, {
  webgl1: 0
}), (0, _defineProperty2.default)(_TEXTURE_PARAMETERS, 4097, {
  webgl1: 0
}), _TEXTURE_PARAMETERS); // TODO - separate install parameter definitions function from api metadata

/*
import Buffer from '../buffer';
import FenceSync from '../fence-sync';
import Framebuffer from '../framebuffer';
import Program from '../program';
import Renderbuffer from '../renderbuffer';
import Sampler from '../sampler';
// import Shader from './shader';
import Texture from '../texture';
*/

exports.TEXTURE_PARAMETERS = TEXTURE_PARAMETERS;

function installParameterDefinitions() {// Buffer.PARAMETERS = BUFFER_PARAMETERS;
  // FenceSync.PARAMETERS = FENCE_SYNC_PARAMETERS;
  // Framebuffer.ATTACHMENT_PARAMETERS = FRAMEBUFFER_ATTACHMENT_PARAMETERS;
  // Framebuffer.STATUS = FRAMEBUFFER_STATUS;
  // Program.PARAMETERS = PROGRAM_PARAMETERS;
  // Renderbuffer.PARAMETERS = RENDERBUFFER_PARAMETERS;
  // Sampler.PARAMETERS = SAMPLER_PARAMETERS;
  // // Shader.PARAMETERS = SHADER_PARAMETERS;
  // Texture.PARAMETERS = TEXTURE_PARAMETERS;
}
//# sourceMappingURL=debug-parameters.js.map
},{"@babel/runtime/helpers/interopRequireDefault":"IKAG","@babel/runtime/helpers/defineProperty":"x3DH"}],"xdH3":[function(require,module,exports) {
var global = arguments[3];
/*
** Copyright (c) 2012 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
** "Materials"), to deal in the Materials without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Materials, and to
** permit persons to whom the Materials are 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 Materials.
**
** THE MATERIALS ARE 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
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/

//Ported to node by Marcin Ignac on 2016-05-20

// Various functions for helping debug WebGL apps.

WebGLDebugUtils = function() {
var window

//polyfill window in node
if (typeof(window) == 'undefined') {
    window = global;
}

/**
 * Wrapped logging function.
 * @param {string} msg Message to log.
 */
var log = function(msg) {
  if (window.console && window.console.log) {
    window.console.log(msg);
  }
};

/**
 * Wrapped error logging function.
 * @param {string} msg Message to log.
 */
var error = function(msg) {
  if (window.console && window.console.error) {
    window.console.error(msg);
  } else {
    log(msg);
  }
};


/**
 * Which arguments are enums based on the number of arguments to the function.
 * So
 *    'texImage2D': {
 *       9: { 0:true, 2:true, 6:true, 7:true },
 *       6: { 0:true, 2:true, 3:true, 4:true },
 *    },
 *
 * means if there are 9 arguments then 6 and 7 are enums, if there are 6
 * arguments 3 and 4 are enums
 *
 * @type {!Object.<number, !Object.<number, string>}
 */
var glValidEnumContexts = {
  // Generic setters and getters

  'enable': {1: { 0:true }},
  'disable': {1: { 0:true }},
  'getParameter': {1: { 0:true }},

  // Rendering

  'drawArrays': {3:{ 0:true }},
  'drawElements': {4:{ 0:true, 2:true }},

  // Shaders

  'createShader': {1: { 0:true }},
  'getShaderParameter': {2: { 1:true }},
  'getProgramParameter': {2: { 1:true }},
  'getShaderPrecisionFormat': {2: { 0: true, 1:true }},

  // Vertex attributes

  'getVertexAttrib': {2: { 1:true }},
  'vertexAttribPointer': {6: { 2:true }},

  // Textures

  'bindTexture': {2: { 0:true }},
  'activeTexture': {1: { 0:true }},
  'getTexParameter': {2: { 0:true, 1:true }},
  'texParameterf': {3: { 0:true, 1:true }},
  'texParameteri': {3: { 0:true, 1:true, 2:true }},
  // texImage2D and texSubImage2D are defined below with WebGL 2 entrypoints
  'copyTexImage2D': {8: { 0:true, 2:true }},
  'copyTexSubImage2D': {8: { 0:true }},
  'generateMipmap': {1: { 0:true }},
  // compressedTexImage2D and compressedTexSubImage2D are defined below with WebGL 2 entrypoints

  // Buffer objects

  'bindBuffer': {2: { 0:true }},
  // bufferData and bufferSubData are defined below with WebGL 2 entrypoints
  'getBufferParameter': {2: { 0:true, 1:true }},

  // Renderbuffers and framebuffers

  'pixelStorei': {2: { 0:true, 1:true }},
  // readPixels is defined below with WebGL 2 entrypoints
  'bindRenderbuffer': {2: { 0:true }},
  'bindFramebuffer': {2: { 0:true }},
  'checkFramebufferStatus': {1: { 0:true }},
  'framebufferRenderbuffer': {4: { 0:true, 1:true, 2:true }},
  'framebufferTexture2D': {5: { 0:true, 1:true, 2:true }},
  'getFramebufferAttachmentParameter': {3: { 0:true, 1:true, 2:true }},
  'getRenderbufferParameter': {2: { 0:true, 1:true }},
  'renderbufferStorage': {4: { 0:true, 1:true }},

  // Frame buffer operations (clear, blend, depth test, stencil)

  'clear': {1: { 0: { 'enumBitwiseOr': ['COLOR_BUFFER_BIT', 'DEPTH_BUFFER_BIT', 'STENCIL_BUFFER_BIT'] }}},
  'depthFunc': {1: { 0:true }},
  'blendFunc': {2: { 0:true, 1:true }},
  'blendFuncSeparate': {4: { 0:true, 1:true, 2:true, 3:true }},
  'blendEquation': {1: { 0:true }},
  'blendEquationSeparate': {2: { 0:true, 1:true }},
  'stencilFunc': {3: { 0:true }},
  'stencilFuncSeparate': {4: { 0:true, 1:true }},
  'stencilMaskSeparate': {2: { 0:true }},
  'stencilOp': {3: { 0:true, 1:true, 2:true }},
  'stencilOpSeparate': {4: { 0:true, 1:true, 2:true, 3:true }},

  // Culling

  'cullFace': {1: { 0:true }},
  'frontFace': {1: { 0:true }},

  // ANGLE_instanced_arrays extension

  'drawArraysInstancedANGLE': {4: { 0:true }},
  'drawElementsInstancedANGLE': {5: { 0:true, 2:true }},

  // EXT_blend_minmax extension

  'blendEquationEXT': {1: { 0:true }},

  // WebGL 2 Buffer objects

  'bufferData': {
    3: { 0:true, 2:true }, // WebGL 1
    4: { 0:true, 2:true }, // WebGL 2
    5: { 0:true, 2:true }  // WebGL 2
  },
  'bufferSubData': {
    3: { 0:true }, // WebGL 1
    4: { 0:true }, // WebGL 2
    5: { 0:true }  // WebGL 2
  },
  'copyBufferSubData': {5: { 0:true, 1:true }},
  'getBufferSubData': {3: { 0:true }, 4: { 0:true }, 5: { 0:true }},

  // WebGL 2 Framebuffer objects

  'blitFramebuffer': {10: { 8: { 'enumBitwiseOr': ['COLOR_BUFFER_BIT', 'DEPTH_BUFFER_BIT', 'STENCIL_BUFFER_BIT'] }, 9:true }},
  'framebufferTextureLayer': {5: { 0:true, 1:true }},
  'invalidateFramebuffer': {2: { 0:true }},
  'invalidateSubFramebuffer': {6: { 0:true }},
  'readBuffer': {1: { 0:true }},

  // WebGL 2 Renderbuffer objects

  'getInternalformatParameter': {3: { 0:true, 1:true, 2:true }},
  'renderbufferStorageMultisample': {5: { 0:true, 2:true }},

  // WebGL 2 Texture objects

  'texStorage2D': {5: { 0:true, 2:true }},
  'texStorage3D': {6: { 0:true, 2:true }},
  'texImage2D': {
    9: { 0:true, 2:true, 6:true, 7:true }, // WebGL 1 & 2
    6: { 0:true, 2:true, 3:true, 4:true }, // WebGL 1
    10: { 0:true, 2:true, 6:true, 7:true } // WebGL 2
  },
  'texImage3D': {
    10: { 0:true, 2:true, 7:true, 8:true },
    11: { 0:true, 2:true, 7:true, 8:true }
  },
  'texSubImage2D': {
    9: { 0:true, 6:true, 7:true }, // WebGL 1 & 2
    7: { 0:true, 4:true, 5:true }, // WebGL 1
    10: { 0:true, 6:true, 7:true } // WebGL 2
  },
  'texSubImage3D': {
    11: { 0:true, 8:true, 9:true },
    12: { 0:true, 8:true, 9:true }
  },
  'copyTexSubImage3D': {9: { 0:true }},
  'compressedTexImage2D': {
    7: { 0: true, 2:true }, // WebGL 1 & 2
    8: { 0: true, 2:true }, // WebGL 2
    9: { 0: true, 2:true }  // WebGL 2
  },
  'compressedTexImage3D': {
    8: { 0: true, 2:true },
    9: { 0: true, 2:true },
    10: { 0: true, 2:true }
  },
  'compressedTexSubImage2D': {
    8: { 0: true, 6:true }, // WebGL 1 & 2
    9: { 0: true, 6:true }, // WebGL 2
    10: { 0: true, 6:true } // WebGL 2
  },
  'compressedTexSubImage3D': {
    10: { 0: true, 8:true },
    11: { 0: true, 8:true },
    12: { 0: true, 8:true }
  },

  // WebGL 2 Vertex attribs

  'vertexAttribIPointer': {5: { 2:true }},

  // WebGL 2 Writing to the drawing buffer

  'drawArraysInstanced': {4: { 0:true }},
  'drawElementsInstanced': {5: { 0:true, 2:true }},
  'drawRangeElements': {6: { 0:true, 4:true }},

  // WebGL 2 Reading back pixels

  'readPixels': {
    7: { 4:true, 5:true }, // WebGL 1 & 2
    8: { 4:true, 5:true }  // WebGL 2
  },

  // WebGL 2 Multiple Render Targets

  'clearBufferfv': {3: { 0:true }, 4: { 0:true }},
  'clearBufferiv': {3: { 0:true }, 4: { 0:true }},
  'clearBufferuiv': {3: { 0:true }, 4: { 0:true }},
  'clearBufferfi': {4: { 0:true }},

  // WebGL 2 Query objects

  'beginQuery': {2: { 0:true }},
  'endQuery': {1: { 0:true }},
  'getQuery': {2: { 0:true, 1:true }},
  'getQueryParameter': {2: { 1:true }},

  // WebGL 2 Sampler objects

  'samplerParameteri': {3: { 1:true, 2:true }},
  'samplerParameterf': {3: { 1:true }},
  'getSamplerParameter': {2: { 1:true }},

  // WebGL 2 Sync objects

  'fenceSync': {2: { 0:true, 1: { 'enumBitwiseOr': [] } }},
  'clientWaitSync': {3: { 1: { 'enumBitwiseOr': ['SYNC_FLUSH_COMMANDS_BIT'] } }},
  'waitSync': {3: { 1: { 'enumBitwiseOr': [] } }},
  'getSyncParameter': {2: { 1:true }},

  // WebGL 2 Transform Feedback

  'bindTransformFeedback': {2: { 0:true }},
  'beginTransformFeedback': {1: { 0:true }},
  'transformFeedbackVaryings': {3: { 2:true }},

  // WebGL2 Uniform Buffer Objects and Transform Feedback Buffers

  'bindBufferBase': {3: { 0:true }},
  'bindBufferRange': {5: { 0:true }},
  'getIndexedParameter': {2: { 0:true }},
  'getActiveUniforms': {3: { 2:true }},
  'getActiveUniformBlockParameter': {3: { 2:true }}
};

/**
 * Map of numbers to names.
 * @type {Object}
 */
var glEnums = null;

/**
 * Map of names to numbers.
 * @type {Object}
 */
var enumStringToValue = null;

/**
 * Initializes this module. Safe to call more than once.
 * @param {!WebGLRenderingContext} ctx A WebGL context. If
 *    you have more than one context it doesn't matter which one
 *    you pass in, it is only used to pull out constants.
 */
function init(ctx) {
  if (glEnums == null) {
    glEnums = { };
    enumStringToValue = { };
    for (var propertyName in ctx) {
      if (typeof ctx[propertyName] == 'number') {
        glEnums[ctx[propertyName]] = propertyName;
        enumStringToValue[propertyName] = ctx[propertyName];
      }
    }
  }
}

/**
 * Checks the utils have been initialized.
 */
function checkInit() {
  if (glEnums == null) {
    throw 'WebGLDebugUtils.init(ctx) not called';
  }
}

/**
 * Returns true or false if value matches any WebGL enum
 * @param {*} value Value to check if it might be an enum.
 * @return {boolean} True if value matches one of the WebGL defined enums
 */
function mightBeEnum(value) {
  checkInit();
  return (glEnums[value] !== undefined);
}

/**
 * Gets an string version of an WebGL enum.
 *
 * Example:
 *   var str = WebGLDebugUtil.glEnumToString(ctx.getError());
 *
 * @param {number} value Value to return an enum for
 * @return {string} The string version of the enum.
 */
function glEnumToString(value) {
  checkInit();
  var name = glEnums[value];
  return (name !== undefined) ? ("gl." + name) :
      ("/*UNKNOWN WebGL ENUM*/ 0x" + value.toString(16) + "");
}

/**
 * Returns the string version of a WebGL argument.
 * Attempts to convert enum arguments to strings.
 * @param {string} functionName the name of the WebGL function.
 * @param {number} numArgs the number of arguments passed to the function.
 * @param {number} argumentIndx the index of the argument.
 * @param {*} value The value of the argument.
 * @return {string} The value as a string.
 */
function glFunctionArgToString(functionName, numArgs, argumentIndex, value) {
  var funcInfo = glValidEnumContexts[functionName];
  if (funcInfo !== undefined) {
    var funcInfo = funcInfo[numArgs];
    if (funcInfo !== undefined) {
      if (funcInfo[argumentIndex]) {
        if (typeof funcInfo[argumentIndex] === 'object' &&
            funcInfo[argumentIndex]['enumBitwiseOr'] !== undefined) {
          var enums = funcInfo[argumentIndex]['enumBitwiseOr'];
          var orResult = 0;
          var orEnums = [];
          for (var i = 0; i < enums.length; ++i) {
            var enumValue = enumStringToValue[enums[i]];
            if ((value & enumValue) !== 0) {
              orResult |= enumValue;
              orEnums.push(glEnumToString(enumValue));
            }
          }
          if (orResult === value) {
            return orEnums.join(' | ');
          } else {
            return glEnumToString(value);
          }
        } else {
          return glEnumToString(value);
        }
      }
    }
  }
  if (value === null) {
    return "null";
  } else if (value === undefined) {
    return "undefined";
  } else {
    return value.toString();
  }
}

/**
 * Converts the arguments of a WebGL function to a string.
 * Attempts to convert enum arguments to strings.
 *
 * @param {string} functionName the name of the WebGL function.
 * @param {number} args The arguments.
 * @return {string} The arguments as a string.
 */
function glFunctionArgsToString(functionName, args) {
  // apparently we can't do args.join(",");
  var argStr = "";
  var numArgs = args.length;
  for (var ii = 0; ii < numArgs; ++ii) {
    argStr += ((ii == 0) ? '' : ', ') +
        glFunctionArgToString(functionName, numArgs, ii, args[ii]);
  }
  return argStr;
};


function makePropertyWrapper(wrapper, original, propertyName) {
  //log("wrap prop: " + propertyName);
  wrapper.__defineGetter__(propertyName, function() {
    return original[propertyName];
  });
  // TODO(gmane): this needs to handle properties that take more than
  // one value?
  wrapper.__defineSetter__(propertyName, function(value) {
    //log("set: " + propertyName);
    original[propertyName] = value;
  });
}

// Makes a function that calls a function on another object.
function makeFunctionWrapper(original, functionName) {
  //log("wrap fn: " + functionName);
  var f = original[functionName];
  return function() {
    //log("call: " + functionName);
    var result = f.apply(original, arguments);
    return result;
  };
}

/**
 * Given a WebGL context returns a wrapped context that calls
 * gl.getError after every command and calls a function if the
 * result is not gl.NO_ERROR.
 *
 * @param {!WebGLRenderingContext} ctx The webgl context to
 *        wrap.
 * @param {!function(err, funcName, args): void} opt_onErrorFunc
 *        The function to call when gl.getError returns an
 *        error. If not specified the default function calls
 *        console.log with a message.
 * @param {!function(funcName, args): void} opt_onFunc The
 *        function to call when each webgl function is called.
 *        You can use this to log all calls for example.
 * @param {!WebGLRenderingContext} opt_err_ctx The webgl context
 *        to call getError on if different than ctx.
 */
function makeDebugContext(ctx, opt_onErrorFunc, opt_onFunc, opt_err_ctx) {
  opt_err_ctx = opt_err_ctx || ctx;
  init(ctx);
  opt_onErrorFunc = opt_onErrorFunc || function(err, functionName, args) {
        // apparently we can't do args.join(",");
        var argStr = "";
        var numArgs = args.length;
        for (var ii = 0; ii < numArgs; ++ii) {
          argStr += ((ii == 0) ? '' : ', ') +
              glFunctionArgToString(functionName, numArgs, ii, args[ii]);
        }
        error("WebGL error "+ glEnumToString(err) + " in "+ functionName +
              "(" + argStr + ")");
      };

  // Holds booleans for each GL error so after we get the error ourselves
  // we can still return it to the client app.
  var glErrorShadow = { };

  // Makes a function that calls a WebGL function and then calls getError.
  function makeErrorWrapper(ctx, functionName) {
    return function() {
      if (opt_onFunc) {
        opt_onFunc(functionName, arguments);
      }
      var result = ctx[functionName].apply(ctx, arguments);
      var err = opt_err_ctx.getError();
      if (err != 0) {
        glErrorShadow[err] = true;
        opt_onErrorFunc(err, functionName, arguments);
      }
      return result;
    };
  }

  // Make a an object that has a copy of every property of the WebGL context
  // but wraps all functions.
  var wrapper = {};
  for (var propertyName in ctx) {
    if (typeof ctx[propertyName] == 'function') {
      if (propertyName != 'getExtension') {
        wrapper[propertyName] = makeErrorWrapper(ctx, propertyName);
      } else {
        var wrapped = makeErrorWrapper(ctx, propertyName);
        wrapper[propertyName] = function () {
          var result = wrapped.apply(ctx, arguments);
          if (!result) {
            return null;
          }
          return makeDebugContext(result, opt_onErrorFunc, opt_onFunc, opt_err_ctx);
        };
      }
    } else {
      makePropertyWrapper(wrapper, ctx, propertyName);
    }
  }

  // Override the getError function with one that returns our saved results.
  wrapper.getError = function() {
    for (var err in glErrorShadow) {
      if (glErrorShadow.hasOwnProperty(err)) {
        if (glErrorShadow[err]) {
          glErrorShadow[err] = false;
          return err;
        }
      }
    }
    return ctx.NO_ERROR;
  };

  return wrapper;
}

function resetToInitialState(ctx) {
  var isWebGL2RenderingContext = !!ctx.createTransformFeedback;

  if (isWebGL2RenderingContext) {
    ctx.bindVertexArray(null);
  }

  var numAttribs = ctx.getParameter(ctx.MAX_VERTEX_ATTRIBS);
  var tmp = ctx.createBuffer();
  ctx.bindBuffer(ctx.ARRAY_BUFFER, tmp);
  for (var ii = 0; ii < numAttribs; ++ii) {
    ctx.disableVertexAttribArray(ii);
    ctx.vertexAttribPointer(ii, 4, ctx.FLOAT, false, 0, 0);
    ctx.vertexAttrib1f(ii, 0);
    if (isWebGL2RenderingContext) {
      ctx.vertexAttribDivisor(ii, 0);
    }
  }
  ctx.deleteBuffer(tmp);

  var numTextureUnits = ctx.getParameter(ctx.MAX_TEXTURE_IMAGE_UNITS);
  for (var ii = 0; ii < numTextureUnits; ++ii) {
    ctx.activeTexture(ctx.TEXTURE0 + ii);
    ctx.bindTexture(ctx.TEXTURE_CUBE_MAP, null);
    ctx.bindTexture(ctx.TEXTURE_2D, null);
    if (isWebGL2RenderingContext) {
      ctx.bindTexture(ctx.TEXTURE_2D_ARRAY, null);
      ctx.bindTexture(ctx.TEXTURE_3D, null);
      ctx.bindSampler(ii, null);
    }
  }

  ctx.activeTexture(ctx.TEXTURE0);
  ctx.useProgram(null);
  ctx.bindBuffer(ctx.ARRAY_BUFFER, null);
  ctx.bindBuffer(ctx.ELEMENT_ARRAY_BUFFER, null);
  ctx.bindFramebuffer(ctx.FRAMEBUFFER, null);
  ctx.bindRenderbuffer(ctx.RENDERBUFFER, null);
  ctx.disable(ctx.BLEND);
  ctx.disable(ctx.CULL_FACE);
  ctx.disable(ctx.DEPTH_TEST);
  ctx.disable(ctx.DITHER);
  ctx.disable(ctx.SCISSOR_TEST);
  ctx.blendColor(0, 0, 0, 0);
  ctx.blendEquation(ctx.FUNC_ADD);
  ctx.blendFunc(ctx.ONE, ctx.ZERO);
  ctx.clearColor(0, 0, 0, 0);
  ctx.clearDepth(1);
  ctx.clearStencil(-1);
  ctx.colorMask(true, true, true, true);
  ctx.cullFace(ctx.BACK);
  ctx.depthFunc(ctx.LESS);
  ctx.depthMask(true);
  ctx.depthRange(0, 1);
  ctx.frontFace(ctx.CCW);
  ctx.hint(ctx.GENERATE_MIPMAP_HINT, ctx.DONT_CARE);
  ctx.lineWidth(1);
  ctx.pixelStorei(ctx.PACK_ALIGNMENT, 4);
  ctx.pixelStorei(ctx.UNPACK_ALIGNMENT, 4);
  ctx.pixelStorei(ctx.UNPACK_FLIP_Y_WEBGL, false);
  ctx.pixelStorei(ctx.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
  // TODO: Delete this IF.
  if (ctx.UNPACK_COLORSPACE_CONVERSION_WEBGL) {
    ctx.pixelStorei(ctx.UNPACK_COLORSPACE_CONVERSION_WEBGL, ctx.BROWSER_DEFAULT_WEBGL);
  }
  ctx.polygonOffset(0, 0);
  ctx.sampleCoverage(1, false);
  ctx.scissor(0, 0, ctx.canvas.width, ctx.canvas.height);
  ctx.stencilFunc(ctx.ALWAYS, 0, 0xFFFFFFFF);
  ctx.stencilMask(0xFFFFFFFF);
  ctx.stencilOp(ctx.KEEP, ctx.KEEP, ctx.KEEP);
  ctx.viewport(0, 0, ctx.canvas.width, ctx.canvas.height);
  ctx.clear(ctx.COLOR_BUFFER_BIT | ctx.DEPTH_BUFFER_BIT | ctx.STENCIL_BUFFER_BIT);

  if (isWebGL2RenderingContext) {
    ctx.drawBuffers([ctx.BACK]);
    ctx.readBuffer(ctx.BACK);
    ctx.bindBuffer(ctx.COPY_READ_BUFFER, null);
    ctx.bindBuffer(ctx.COPY_WRITE_BUFFER, null);
    ctx.bindBuffer(ctx.PIXEL_PACK_BUFFER, null);
    ctx.bindBuffer(ctx.PIXEL_UNPACK_BUFFER, null);
    var numTransformFeedbacks = ctx.getParameter(ctx.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS);
    for (var ii = 0; ii < numTransformFeedbacks; ++ii) {
      ctx.bindBufferBase(ctx.TRANSFORM_FEEDBACK_BUFFER, ii, null);
    }
    var numUBOs = ctx.getParameter(ctx.MAX_UNIFORM_BUFFER_BINDINGS);
    for (var ii = 0; ii < numUBOs; ++ii) {
      ctx.bindBufferBase(ctx.UNIFORM_BUFFER, ii, null);
    }
    ctx.disable(ctx.RASTERIZER_DISCARD);
    ctx.pixelStorei(ctx.UNPACK_IMAGE_HEIGHT, 0);
    ctx.pixelStorei(ctx.UNPACK_SKIP_IMAGES, 0);
    ctx.pixelStorei(ctx.UNPACK_ROW_LENGTH, 0);
    ctx.pixelStorei(ctx.UNPACK_SKIP_ROWS, 0);
    ctx.pixelStorei(ctx.UNPACK_SKIP_PIXELS, 0);
    ctx.pixelStorei(ctx.PACK_ROW_LENGTH, 0);
    ctx.pixelStorei(ctx.PACK_SKIP_ROWS, 0);
    ctx.pixelStorei(ctx.PACK_SKIP_PIXELS, 0);
    ctx.hint(ctx.FRAGMENT_SHADER_DERIVATIVE_HINT, ctx.DONT_CARE);
  }

  // TODO: This should NOT be needed but Firefox fails with 'hint'
  while(ctx.getError());
}

function makeLostContextSimulatingCanvas(canvas) {
  var unwrappedContext_;
  var wrappedContext_;
  var onLost_ = [];
  var onRestored_ = [];
  var wrappedContext_ = {};
  var contextId_ = 1;
  var contextLost_ = false;
  var resourceId_ = 0;
  var resourceDb_ = [];
  var numCallsToLoseContext_ = 0;
  var numCalls_ = 0;
  var canRestore_ = false;
  var restoreTimeout_ = 0;
  var isWebGL2RenderingContext;

  // Holds booleans for each GL error so can simulate errors.
  var glErrorShadow_ = { };

  canvas.getContext = function(f) {
    return function() {
      var ctx = f.apply(canvas, arguments);
      // Did we get a context and is it a WebGL context?
      if ((ctx instanceof WebGLRenderingContext) || (window.WebGL2RenderingContext && (ctx instanceof WebGL2RenderingContext))) {
        if (ctx != unwrappedContext_) {
          if (unwrappedContext_) {
            throw "got different context"
          }
          isWebGL2RenderingContext = window.WebGL2RenderingContext && (ctx instanceof WebGL2RenderingContext);
          unwrappedContext_ = ctx;
          wrappedContext_ = makeLostContextSimulatingContext(unwrappedContext_);
        }
        return wrappedContext_;
      }
      return ctx;
    }
  }(canvas.getContext);

  function wrapEvent(listener) {
    if (typeof(listener) == "function") {
      return listener;
    } else {
      return function(info) {
        listener.handleEvent(info);
      }
    }
  }

  var addOnContextLostListener = function(listener) {
    onLost_.push(wrapEvent(listener));
  };

  var addOnContextRestoredListener = function(listener) {
    onRestored_.push(wrapEvent(listener));
  };


  function wrapAddEventListener(canvas) {
    var f = canvas.addEventListener;
    canvas.addEventListener = function(type, listener, bubble) {
      switch (type) {
        case 'webglcontextlost':
          addOnContextLostListener(listener);
          break;
        case 'webglcontextrestored':
          addOnContextRestoredListener(listener);
          break;
        default:
          f.apply(canvas, arguments);
      }
    };
  }

  wrapAddEventListener(canvas);

  canvas.loseContext = function() {
    if (!contextLost_) {
      contextLost_ = true;
      numCallsToLoseContext_ = 0;
      ++contextId_;
      while (unwrappedContext_.getError());
      clearErrors();
      glErrorShadow_[unwrappedContext_.CONTEXT_LOST_WEBGL] = true;
      var event = makeWebGLContextEvent("context lost");
      var callbacks = onLost_.slice();
      setTimeout(function() {
          //log("numCallbacks:" + callbacks.length);
          for (var ii = 0; ii < callbacks.length; ++ii) {
            //log("calling callback:" + ii);
            callbacks[ii](event);
          }
          if (restoreTimeout_ >= 0) {
            setTimeout(function() {
                canvas.restoreContext();
              }, restoreTimeout_);
          }
        }, 0);
    }
  };

  canvas.restoreContext = function() {
    if (contextLost_) {
      if (onRestored_.length) {
        setTimeout(function() {
            if (!canRestore_) {
              throw "can not restore. webglcontestlost listener did not call event.preventDefault";
            }
            freeResources();
            resetToInitialState(unwrappedContext_);
            contextLost_ = false;
            numCalls_ = 0;
            canRestore_ = false;
            var callbacks = onRestored_.slice();
            var event = makeWebGLContextEvent("context restored");
            for (var ii = 0; ii < callbacks.length; ++ii) {
              callbacks[ii](event);
            }
          }, 0);
      }
    }
  };

  canvas.loseContextInNCalls = function(numCalls) {
    if (contextLost_) {
      throw "You can not ask a lost contet to be lost";
    }
    numCallsToLoseContext_ = numCalls_ + numCalls;
  };

  canvas.getNumCalls = function() {
    return numCalls_;
  };

  canvas.setRestoreTimeout = function(timeout) {
    restoreTimeout_ = timeout;
  };

  function isWebGLObject(obj) {
    //return false;
    return (obj instanceof WebGLBuffer ||
            obj instanceof WebGLFramebuffer ||
            obj instanceof WebGLProgram ||
            obj instanceof WebGLRenderbuffer ||
            obj instanceof WebGLShader ||
            obj instanceof WebGLTexture);
  }

  function checkResources(args) {
    for (var ii = 0; ii < args.length; ++ii) {
      var arg = args[ii];
      if (isWebGLObject(arg)) {
        return arg.__webglDebugContextLostId__ == contextId_;
      }
    }
    return true;
  }

  function clearErrors() {
    var k = Object.keys(glErrorShadow_);
    for (var ii = 0; ii < k.length; ++ii) {
      delete glErrorShadow_[k[ii]];
    }
  }

  function loseContextIfTime() {
    ++numCalls_;
    if (!contextLost_) {
      if (numCallsToLoseContext_ == numCalls_) {
        canvas.loseContext();
      }
    }
  }

  // Makes a function that simulates WebGL when out of context.
  function makeLostContextFunctionWrapper(ctx, functionName) {
    var f = ctx[functionName];
    return function() {
      // log("calling:" + functionName);
      // Only call the functions if the context is not lost.
      loseContextIfTime();
      if (!contextLost_) {
        //if (!checkResources(arguments)) {
        //  glErrorShadow_[wrappedContext_.INVALID_OPERATION] = true;
        //  return;
        //}
        var result = f.apply(ctx, arguments);
        return result;
      }
    };
  }

  function freeResources() {
    for (var ii = 0; ii < resourceDb_.length; ++ii) {
      var resource = resourceDb_[ii];
      if (resource instanceof WebGLBuffer) {
        unwrappedContext_.deleteBuffer(resource);
      } else if (resource instanceof WebGLFramebuffer) {
        unwrappedContext_.deleteFramebuffer(resource);
      } else if (resource instanceof WebGLProgram) {
        unwrappedContext_.deleteProgram(resource);
      } else if (resource instanceof WebGLRenderbuffer) {
        unwrappedContext_.deleteRenderbuffer(resource);
      } else if (resource instanceof WebGLShader) {
        unwrappedContext_.deleteShader(resource);
      } else if (resource instanceof WebGLTexture) {
        unwrappedContext_.deleteTexture(resource);
      }
      else if (isWebGL2RenderingContext) {
        if (resource instanceof WebGLQuery) {
          unwrappedContext_.deleteQuery(resource);
        } else if (resource instanceof WebGLSampler) {
          unwrappedContext_.deleteSampler(resource);
        } else if (resource instanceof WebGLSync) {
          unwrappedContext_.deleteSync(resource);
        } else if (resource instanceof WebGLTransformFeedback) {
          unwrappedContext_.deleteTransformFeedback(resource);
        } else if (resource instanceof WebGLVertexArrayObject) {
          unwrappedContext_.deleteVertexArray(resource);
        }
      }
    }
  }

  function makeWebGLContextEvent(statusMessage) {
    return {
      statusMessage: statusMessage,
      preventDefault: function() {
          canRestore_ = true;
        }
    };
  }

  return canvas;

  function makeLostContextSimulatingContext(ctx) {
    // copy all functions and properties to wrapper
    for (var propertyName in ctx) {
      if (typeof ctx[propertyName] == 'function') {
         wrappedContext_[propertyName] = makeLostContextFunctionWrapper(
             ctx, propertyName);
       } else {
         makePropertyWrapper(wrappedContext_, ctx, propertyName);
       }
    }

    // Wrap a few functions specially.
    wrappedContext_.getError = function() {
      loseContextIfTime();
      if (!contextLost_) {
        var err;
        while (err = unwrappedContext_.getError()) {
          glErrorShadow_[err] = true;
        }
      }
      for (var err in glErrorShadow_) {
        if (glErrorShadow_[err]) {
          delete glErrorShadow_[err];
          return err;
        }
      }
      return wrappedContext_.NO_ERROR;
    };

    var creationFunctions = [
      "createBuffer",
      "createFramebuffer",
      "createProgram",
      "createRenderbuffer",
      "createShader",
      "createTexture"
    ];
    if (isWebGL2RenderingContext) {
      creationFunctions.push(
        "createQuery",
        "createSampler",
        "fenceSync",
        "createTransformFeedback",
        "createVertexArray"
      );
    }
    for (var ii = 0; ii < creationFunctions.length; ++ii) {
      var functionName = creationFunctions[ii];
      wrappedContext_[functionName] = function(f) {
        return function() {
          loseContextIfTime();
          if (contextLost_) {
            return null;
          }
          var obj = f.apply(ctx, arguments);
          obj.__webglDebugContextLostId__ = contextId_;
          resourceDb_.push(obj);
          return obj;
        };
      }(ctx[functionName]);
    }

    var functionsThatShouldReturnNull = [
      "getActiveAttrib",
      "getActiveUniform",
      "getBufferParameter",
      "getContextAttributes",
      "getAttachedShaders",
      "getFramebufferAttachmentParameter",
      "getParameter",
      "getProgramParameter",
      "getProgramInfoLog",
      "getRenderbufferParameter",
      "getShaderParameter",
      "getShaderInfoLog",
      "getShaderSource",
      "getTexParameter",
      "getUniform",
      "getUniformLocation",
      "getVertexAttrib"
    ];
    if (isWebGL2RenderingContext) {
      functionsThatShouldReturnNull.push(
        "getInternalformatParameter",
        "getQuery",
        "getQueryParameter",
        "getSamplerParameter",
        "getSyncParameter",
        "getTransformFeedbackVarying",
        "getIndexedParameter",
        "getUniformIndices",
        "getActiveUniforms",
        "getActiveUniformBlockParameter",
        "getActiveUniformBlockName"
      );
    }
    for (var ii = 0; ii < functionsThatShouldReturnNull.length; ++ii) {
      var functionName = functionsThatShouldReturnNull[ii];
      wrappedContext_[functionName] = function(f) {
        return function() {
          loseContextIfTime();
          if (contextLost_) {
            return null;
          }
          return f.apply(ctx, arguments);
        }
      }(wrappedContext_[functionName]);
    }

    var isFunctions = [
      "isBuffer",
      "isEnabled",
      "isFramebuffer",
      "isProgram",
      "isRenderbuffer",
      "isShader",
      "isTexture"
    ];
    if (isWebGL2RenderingContext) {
      isFunctions.push(
        "isQuery",
        "isSampler",
        "isSync",
        "isTransformFeedback",
        "isVertexArray"
      );
    }
    for (var ii = 0; ii < isFunctions.length; ++ii) {
      var functionName = isFunctions[ii];
      wrappedContext_[functionName] = function(f) {
        return function() {
          loseContextIfTime();
          if (contextLost_) {
            return false;
          }
          return f.apply(ctx, arguments);
        }
      }(wrappedContext_[functionName]);
    }

    wrappedContext_.checkFramebufferStatus = function(f) {
      return function() {
        loseContextIfTime();
        if (contextLost_) {
          return wrappedContext_.FRAMEBUFFER_UNSUPPORTED;
        }
        return f.apply(ctx, arguments);
      };
    }(wrappedContext_.checkFramebufferStatus);

    wrappedContext_.getAttribLocation = function(f) {
      return function() {
        loseContextIfTime();
        if (contextLost_) {
          return -1;
        }
        return f.apply(ctx, arguments);
      };
    }(wrappedContext_.getAttribLocation);

    wrappedContext_.getVertexAttribOffset = function(f) {
      return function() {
        loseContextIfTime();
        if (contextLost_) {
          return 0;
        }
        return f.apply(ctx, arguments);
      };
    }(wrappedContext_.getVertexAttribOffset);

    wrappedContext_.isContextLost = function() {
      return contextLost_;
    };

    if (isWebGL2RenderingContext) {
      wrappedContext_.getFragDataLocation = function(f) {
        return function() {
          loseContextIfTime();
          if (contextLost_) {
            return -1;
          }
          return f.apply(ctx, arguments);
        };
      }(wrappedContext_.getFragDataLocation);

      wrappedContext_.clientWaitSync = function(f) {
        return function() {
          loseContextIfTime();
          if (contextLost_) {
            return wrappedContext_.WAIT_FAILED;
          }
          return f.apply(ctx, arguments);
        };
      }(wrappedContext_.clientWaitSync);

      wrappedContext_.getUniformBlockIndex = function(f) {
        return function() {
          loseContextIfTime();
          if (contextLost_) {
            return wrappedContext_.INVALID_INDEX;
          }
          return f.apply(ctx, arguments);
        };
      }(wrappedContext_.getUniformBlockIndex);
    }

    return wrappedContext_;
  }
}

return {
  /**
   * Initializes this module. Safe to call more than once.
   * @param {!WebGLRenderingContext} ctx A WebGL context. If
   *    you have more than one context it doesn't matter which one
   *    you pass in, it is only used to pull out constants.
   */
  'init': init,

  /**
   * Returns true or false if value matches any WebGL enum
   * @param {*} value Value to check if it might be an enum.
   * @return {boolean} True if value matches one of the WebGL defined enums
   */
  'mightBeEnum': mightBeEnum,

  /**
   * Gets an string version of an WebGL enum.
   *
   * Example:
   *   WebGLDebugUtil.init(ctx);
   *   var str = WebGLDebugUtil.glEnumToString(ctx.getError());
   *
   * @param {number} value Value to return an enum for
   * @return {string} The string version of the enum.
   */
  'glEnumToString': glEnumToString,

  /**
   * Converts the argument of a WebGL function to a string.
   * Attempts to convert enum arguments to strings.
   *
   * Example:
   *   WebGLDebugUtil.init(ctx);
   *   var str = WebGLDebugUtil.glFunctionArgToString('bindTexture', 2, 0, gl.TEXTURE_2D);
   *
   * would return 'TEXTURE_2D'
   *
   * @param {string} functionName the name of the WebGL function.
   * @param {number} numArgs The number of arguments
   * @param {number} argumentIndx the index of the argument.
   * @param {*} value The value of the argument.
   * @return {string} The value as a string.
   */
  'glFunctionArgToString': glFunctionArgToString,

  /**
   * Converts the arguments of a WebGL function to a string.
   * Attempts to convert enum arguments to strings.
   *
   * @param {string} functionName the name of the WebGL function.
   * @param {number} args The arguments.
   * @return {string} The arguments as a string.
   */
  'glFunctionArgsToString': glFunctionArgsToString,

  /**
   * Given a WebGL context returns a wrapped context that calls
   * gl.getError after every command and calls a function if the
   * result is not NO_ERROR.
   *
   * You can supply your own function if you want. For example, if you'd like
   * an exception thrown on any GL error you could do this
   *
   *    function throwOnGLError(err, funcName, args) {
   *      throw WebGLDebugUtils.glEnumToString(err) +
   *            " was caused by call to " + funcName;
   *    };
   *
   *    ctx = WebGLDebugUtils.makeDebugContext(
   *        canvas.getContext("webgl"), throwOnGLError);
   *
   * @param {!WebGLRenderingContext} ctx The webgl context to wrap.
   * @param {!function(err, funcName, args): void} opt_onErrorFunc The function
   *     to call when gl.getError returns an error. If not specified the default
   *     function calls console.log with a message.
   * @param {!function(funcName, args): void} opt_onFunc The
   *     function to call when each webgl function is called. You
   *     can use this to log all calls for example.
   */
  'makeDebugContext': makeDebugContext,

  /**
   * Given a canvas element returns a wrapped canvas element that will
   * simulate lost context. The canvas returned adds the following functions.
   *
   * loseContext:
   *   simulates a lost context event.
   *
   * restoreContext:
   *   simulates the context being restored.
   *
   * lostContextInNCalls:
   *   loses the context after N gl calls.
   *
   * getNumCalls:
   *   tells you how many gl calls there have been so far.
   *
   * setRestoreTimeout:
   *   sets the number of milliseconds until the context is restored
   *   after it has been lost. Defaults to 0. Pass -1 to prevent
   *   automatic restoring.
   *
   * @param {!Canvas} canvas The canvas element to wrap.
   */
  'makeLostContextSimulatingCanvas': makeLostContextSimulatingCanvas,

  /**
   * Resets a context to the initial state.
   * @param {!WebGLRenderingContext} ctx The webgl context to
   *     reset.
   */
  'resetToInitialState': resetToInitialState
};

}();

module.exports = WebGLDebugUtils;

},{}],"nyBM":[function(require,module,exports) {
var global = arguments[3];
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = installDebugger;

var _debugParameters = require("./webgl-debug/debug-parameters");

// Expose Khronos Debug support module on global context

/* global window, global */
var WebGLDebug = require('webgl-debug');

var global_ = typeof global !== 'undefined' ? global : window;
global_.WebGLDebug = WebGLDebug;
console.log('luma.gl: WebGL debug support imported'); // eslint-disable-line
// eslint-disable-next-line

function installDebugger() {
  (0, _debugParameters.installParameterDefinitions)();
  console.log('luma.gl: WebGL debug support installed'); // eslint-disable-line
}
//# sourceMappingURL=debug.js.map
},{"./webgl-debug/debug-parameters":"PBp7","webgl-debug":"xdH3"}],"qO0c":[function(require,module,exports) {
// eslint-disable-next-line
module.exports = require('./dist/es5/debug');

},{"./dist/es5/debug":"nyBM"}],"dptw":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

require("luma.gl/debug");

var _luma = require("luma.gl");

var _shaderModulePass = _interopRequireDefault(require("./shader-module-pass"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/* global document */
var DEFAULT_VS = "attribute vec2 vertex;\nattribute vec2 _texCoord;\nvarying vec2 texCoord;\nvoid main() {\n  texCoord = _texCoord;\n  gl_Position = vec4(vertex * 2.0 - 1.0, 0.0, 1.0);\n}\n";

var Canvas =
/*#__PURE__*/
function () {
  function Canvas() {
    (0, _classCallCheck2.default)(this, Canvas);
    this.canvas = document.createElement('canvas');
    this.width = this.canvas.clientWidth;
    this.height = this.canvas.clientHeight;
    this.gl = (0, _luma.createGLContext)({
      canvas: this.canvas,
      opts: {
        premultipliedAlpha: false
      }
    });

    if (!this.gl) {
      throw new Error('This browser does not support WebGL');
    }

    this.texture = null;
    this.spareTexture = null;
    this.flippedModel = null;
  }

  (0, _createClass2.default)(Canvas, [{
    key: "installFiltersAsMethods",
    value: function installFiltersAsMethods(filters) {
      var _this = this;

      var _loop = function _loop(key) {
        if (key !== 'canvas') {
          _this[key] = function (props) {
            return _this.filter(filters[key], props).bind(_this);
          };
        }
      }; // // Filter methods


      for (var key in filters) {
        _loop(key);
      }
    }
  }, {
    key: "setTexture",
    value: function setTexture(element) {
      this.texture = new _luma.Texture2D(this.gl, {
        pixels: element
      });
      this.resize(this.gl, this.texture.width, this.texture.height);
      return this;
    }
  }, {
    key: "resize",
    value: function resize(gl, width, height) {
      var realToCSSPixels = 1; // window.devicePixelRatio || 1;
      // Check if the canvas is not the same size.

      if (gl.canvas.width !== width || gl.canvas.height !== height) {
        // Make the canvas the same size
        gl.canvas.width = width;
        gl.canvas.height = height; // Lookup the size the browser is displaying the canvas in CSS pixels
        // and compute a size needed to make our drawingbuffer match it in
        // device pixels.

        var displayWidth = Math.floor(width / realToCSSPixels);
        var displayHeight = Math.floor(height / realToCSSPixels);
        gl.canvas.style.width = "".concat(displayWidth, "px");
        gl.canvas.style.height = "".concat(displayHeight, "px");
        gl.viewport(0, 0, width, height);
        this.width = displayWidth;
        this.height = displayHeight;
      }
    }
  }, {
    key: "replace",
    value: function replace(node) {
      node.parentNode.insertBefore(this.canvas, node);
      node.parentNode.removeChild(node);
      return this;
    } // Draw a texture to the canvas, with an optional width and height to scale to.
    // If no width and height are given then the original texture width and height
    // are used.

  }, {
    key: "draw",
    value: function draw() {
      this.multiPassRenderer = new _luma._MultiPassRenderer(this.gl, [new _luma._ClearPass(this.gl), new _luma._TexturePass(this.gl, {
        texture: this.texture
      }), new _luma._CopyPass(this.gl, {
        screen: true
      })]);
      this.multiPassRenderer.render();
      return this;
    }
  }, {
    key: "update",
    value: function update() {
      this.multiPassRenderer.render({});
      return this;
    }
  }, {
    key: "filter",
    value: function filter(shaderModule, props) {
      this.multiPassRenderer = new _luma._MultiPassRenderer(this.gl, [new _luma._ClearPass(this.gl), new _luma._TexturePass(this.gl, {
        texture: this.texture
      }), new _shaderModulePass.default(this.gl, shaderModule, props), new _luma._CopyPass(this.gl, {
        screen: true
      })]);
      this.multiPassRenderer.render();
      return this;
    }
    /*
    contents() {
      // const gl = this.gl;
      // const texture = new Texture2D(this.gl, {
      //   width: this.texture.width,
      //   height: this.texture.height,
      //   format: gl.RGBA,
      //   type: gl.UNSIGNED_BYTE
      // });
      // this.texture.use();
      // texture.drawTo(() => this.getDefaultModel(this.gl).drawRect());
      // return wrapTexture(texture);
    }
    */
    // Get a Uint8 array of pixel values: [r, g, b, a, r, g, b, a, ...]
    // Length of the array will be width * height * 4.

  }, {
    key: "getPixelArray",
    value: function getPixelArray() {
      var gl = this.gl;
      var w = this.texture.width;
      var h = this.texture.height;
      var array = new Uint8Array(w * h * 4);
      this.texture.drawTo(function () {
        return gl.readPixels(0, 0, w, h, 6408, 5121, array);
      });
      return array;
    }
  }, {
    key: "_initialize",
    value: function _initialize(width, height) {
      var gl = this.gl;
      var type = 5121; // Go for floating point buffer textures if we can, it'll make the bokeh
      // filter look a lot better. Note that on Windows, ANGLE does not let you
      // render to a floating-point texture when linear filtering is enabled.
      // See http://crbug.com/172278 for more information.

      if (this.gl.getExtension('OES_texture_float') && gl.getExtension('OES_texture_float_linear')) {
        var testTexture = new _luma.Texture2D(this.gl, {
          width: 100,
          height: 100,
          format: 6408,
          type: 5126
        });

        try {
          // Only use gl.FLOAT if we can render to it
          testTexture.drawTo(function () {
            type = 5126;
          });
        } catch (error) {// ignore
        }

        testTexture.destroy();
      }

      if (this.spareTexture) {
        this.spareTexture.destroy();
      }

      this.width = width;
      this.height = height;
      this.texture = new _luma.Texture2D(this.gl, {
        width: width,
        height: height,
        format: 6408,
        type: type
      });
      this.spareTexture = new _luma.Texture2D(this.gl, {
        width: width,
        height: height,
        format: 6408,
        type: type
      });
      this.extraTexture = this.extraTexture || new _luma.Texture2D(this.gl, {
        width: 0,
        height: 0,
        format: 6408,
        type: type
      });
      this.flippedModel = this.flippedModel || new _luma.Model(this.gl, {
        vs: DEFAULT_VS,
        fs: "uniform sampler2D texture;\nvarying vec2 texCoord;\nvoid main() {\n  gl_FragColor = texture2D(texture, vec2(texCoord.x, 1.0 - texCoord.y));\n}\n"
      });
      this.isInitialized = true;
    }
  }]);
  return Canvas;
}();

exports.default = Canvas;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","luma.gl/debug":"qO0c","luma.gl":"GAQa","./shader-module-pass":"z1ry"}],"epJL":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.requestFile = requestFile;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Supports loading (requesting) assets with XHR (XmlHttpRequest)

/* eslint-disable guard-for-in, complexity, no-try-catch */

/* global XMLHttpRequest */
function noop() {}

var XHR_STATES = {
  UNINITIALIZED: 0,
  LOADING: 1,
  LOADED: 2,
  INTERACTIVE: 3,
  COMPLETED: 4
};

var XHR =
/*#__PURE__*/
function () {
  function XHR(_ref) {
    var url = _ref.url,
        _ref$path = _ref.path,
        path = _ref$path === void 0 ? null : _ref$path,
        _ref$method = _ref.method,
        method = _ref$method === void 0 ? 'GET' : _ref$method,
        _ref$asynchronous = _ref.asynchronous,
        asynchronous = _ref$asynchronous === void 0 ? true : _ref$asynchronous,
        _ref$noCache = _ref.noCache,
        noCache = _ref$noCache === void 0 ? false : _ref$noCache,
        _ref$sendAsBinary = _ref.sendAsBinary,
        sendAsBinary = _ref$sendAsBinary === void 0 ? false : _ref$sendAsBinary,
        _ref$responseType = _ref.responseType,
        responseType = _ref$responseType === void 0 ? false : _ref$responseType,
        _ref$onProgress = _ref.onProgress,
        onProgress = _ref$onProgress === void 0 ? noop : _ref$onProgress,
        _ref$onError = _ref.onError,
        onError = _ref$onError === void 0 ? noop : _ref$onError,
        _ref$onAbort = _ref.onAbort,
        onAbort = _ref$onAbort === void 0 ? noop : _ref$onAbort,
        _ref$onComplete = _ref.onComplete,
        onComplete = _ref$onComplete === void 0 ? noop : _ref$onComplete;
    (0, _classCallCheck2.default)(this, XHR);
    this.url = path ? path.join(path, url) : url;
    this.method = method;
    this.async = asynchronous;
    this.noCache = noCache;
    this.sendAsBinary = sendAsBinary;
    this.responseType = responseType;
    this.req = new XMLHttpRequest();

    this.req.onload = function (e) {
      return onComplete(e);
    };

    this.req.onerror = function (e) {
      return onError(e);
    };

    this.req.onabort = function (e) {
      return onAbort(e);
    };

    this.req.onprogress = function (e) {
      if (e.lengthComputable) {
        onProgress(e, Math.round(e.loaded / e.total * 100));
      } else {
        onProgress(e, -1);
      }
    };
  }

  (0, _createClass2.default)(XHR, [{
    key: "setRequestHeader",
    value: function setRequestHeader(header, value) {
      this.req.setRequestHeader(header, value);
      return this;
    } // /* eslint-disable max-statements */

  }, {
    key: "sendAsync",
    value: function sendAsync() {
      var _this = this;

      var body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.body || null;
      return new Promise(function (resolve, reject) {
        try {
          var req = _this.req,
              method = _this.method,
              noCache = _this.noCache,
              sendAsBinary = _this.sendAsBinary,
              responseType = _this.responseType;
          var url = noCache ? _this.url + (_this.url.indexOf('?') >= 0 ? '&' : '?') + Date.now() : _this.url;
          req.open(method, url, _this.async);

          if (responseType) {
            req.responseType = responseType;
          }

          if (_this.async) {
            req.onreadystatechange = function (e) {
              if (req.readyState === XHR_STATES.COMPLETED) {
                if (req.status === 200) {
                  resolve(req.responseType ? req.response : req.responseText);
                } else {
                  reject(new Error("".concat(req.status, ": ").concat(url)));
                }
              }
            };
          }

          if (sendAsBinary) {
            req.sendAsBinary(body);
          } else {
            req.send(body);
          }

          if (!_this.async) {
            if (req.status === 200) {
              resolve(req.responseType ? req.response : req.responseText);
            } else {
              reject(new Error("".concat(req.status, ": ").concat(url)));
            }
          }
        } catch (error) {
          reject(error);
        }
      });
    }
    /* eslint-enable max-statements */

  }]);
  return XHR;
}();

function requestFile(opts) {
  var xhr = new XHR(opts);
  return xhr.sendAsync();
}
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky"}],"s35v":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.setPathPrefix = setPathPrefix;
exports.loadFile = loadFile;
exports.loadImage = loadImage;

var _browserRequestFile = require("./browser-request-file");

var pathPrefix = '';
/*
 * Set a relative path prefix
 */

function setPathPrefix(prefix) {
  pathPrefix = prefix;
}

function loadFile(url, opts) {
  if (typeof url !== 'string' && !opts) {
    // TODO - warn for deprecated mode
    opts = url;
    url = opts.url;
  }

  opts.url = pathPrefix ? pathPrefix + url : url;
  return (0, _browserRequestFile.requestFile)(opts);
}
/* global Image, Blob, URL, createImageBitmap, location */

/*
 * Loads images asynchronously
 * image.crossOrigin can be set via opts.crossOrigin, default to 'anonymous'
 * returns a promise tracking the load
 */


function loadImage(url, opts) {
  url = pathPrefix ? pathPrefix + url : url;

  if (typeof Image === 'undefined') {
    // In a web worker
    // XMLHttpRequest throws invalid URL error if using relative path
    // resolve url relative to original base
    url = new URL(url, location.pathname).href;
    return (0, _browserRequestFile.requestFile)({
      url: url,
      responseType: 'arraybuffer'
    }).then(function (arraybuffer) {
      var blob = new Blob([new Uint8Array(arraybuffer)]);
      return createImageBitmap(blob);
    });
  }

  return new Promise(function (resolve, reject) {
    try {
      var image = new Image();

      image.onload = function () {
        return resolve(image);
      };

      image.onerror = function () {
        return reject(new Error("Could not load image ".concat(url, ".")));
      };

      image.crossOrigin = opts && opts.crossOrigin || 'anonymous';
      image.src = url;
    } catch (error) {
      reject(error);
    }
  });
}
},{"./browser-request-file":"epJL"}],"neEB":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.loadTexture = loadTexture;
exports.loadFiles = loadFiles;
exports.loadImages = loadImages;
exports.loadTextures = loadTextures;
exports.loadProgram = loadProgram;
exports.loadModel = loadModel;
exports.parseModel = parseModel;

var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));

var _assert = _interopRequireDefault(require("../utils/assert"));

var _browserLoad = require("./browser-load");

var _webgl = require("../webgl");

var _core = require("../core");

var _geometry = require("../geometry");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/* eslint-disable guard-for-in, complexity, no-try-catch */
function noop() {}

function loadTexture(gl, url) {
  var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  (0, _assert.default)(typeof url === 'string', 'loadTexture: url must be string');
  return (0, _browserLoad.loadImage)(url, opts).then(function (image) {
    return new _webgl.Texture2D(gl, Object.assign({
      id: url
    }, opts, {
      data: image
    }));
  });
}
/*
 * Loads (Requests) multiple files asynchronously
 */


function loadFiles() {
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  var urls = opts.urls,
      _opts$onProgress = opts.onProgress,
      onProgress = _opts$onProgress === void 0 ? noop : _opts$onProgress;
  (0, _assert.default)(urls.every(function (url) {
    return typeof url === 'string';
  }), 'loadImages: {urls} must be array of strings');
  var count = 0;
  return Promise.all(urls.map(function (url) {
    var promise = (0, _browserLoad.loadFile)(Object.assign({
      url: url
    }, opts));
    promise.then(function (file) {
      return onProgress({
        progress: ++count / urls.length,
        count: count,
        total: urls.length,
        url: url
      });
    });
    return promise;
  }));
}
/*
 * Loads (requests) multiple images asynchronously
 */


function loadImages() {
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  var urls = opts.urls,
      _opts$onProgress2 = opts.onProgress,
      onProgress = _opts$onProgress2 === void 0 ? noop : _opts$onProgress2;
  (0, _assert.default)(urls.every(function (url) {
    return typeof url === 'string';
  }), 'loadImages: {urls} must be array of strings');
  var count = 0;
  return Promise.all(urls.map(function (url) {
    var promise = (0, _browserLoad.loadImage)(url, opts);
    promise.then(function (file) {
      return onProgress({
        progress: ++count / urls.length,
        count: count,
        total: urls.length,
        url: url
      });
    });
    return promise;
  }));
}

function loadTextures(gl) {
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  var urls = opts.urls,
      _opts$onProgress3 = opts.onProgress,
      onProgress = _opts$onProgress3 === void 0 ? noop : _opts$onProgress3;
  (0, _assert.default)(urls.every(function (url) {
    return typeof url === 'string';
  }), 'loadTextures: {urls} must be array of strings');
  return loadImages(Object.assign({
    urls: urls,
    onProgress: onProgress
  }, opts)).then(function (images) {
    return images.map(function (img, i) {
      return new _webgl.Texture2D(gl, Object.assign({
        id: urls[i]
      }, opts, {
        data: img
      }));
    });
  });
}

function loadProgram(gl) {
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  var vs = opts.vs,
      fs = opts.fs,
      _opts$onProgress4 = opts.onProgress,
      onProgress = _opts$onProgress4 === void 0 ? noop : _opts$onProgress4;
  return loadFiles(Object.assign({
    urls: [vs, fs],
    onProgress: onProgress
  }, opts)).then(function (_ref) {
    var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
        vsText = _ref2[0],
        fsText = _ref2[1];

    return new _webgl.Program(gl, Object.assign({
      vs: vsText,
      fs: fsText
    }, opts));
  });
} // Loads a simple JSON format


function loadModel(gl) {
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  var url = opts.url,
      _opts$onProgress5 = opts.onProgress,
      onProgress = _opts$onProgress5 === void 0 ? noop : _opts$onProgress5;
  return loadFiles(Object.assign({
    urls: [url],
    onProgress: onProgress
  }, opts)).then(function (_ref3) {
    var _ref4 = (0, _slicedToArray2.default)(_ref3, 1),
        file = _ref4[0];

    return parseModel(gl, Object.assign({
      file: file
    }, opts));
  });
}

function parseModel(gl) {
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  var file = opts.file,
      _opts$program = opts.program,
      program = _opts$program === void 0 ? new _webgl.Program(gl) : _opts$program;
  var json = typeof file === 'string' ? parseJSON(file) : file; // Remove any attributes so that we can create a geometry
  // TODO - change format to put these in geometry sub object?

  var attributes = {};
  var modelOptions = {};

  for (var key in json) {
    var value = json[key];

    if (Array.isArray(value)) {
      attributes[key] = key === 'indices' ? new Uint16Array(value) : new Float32Array(value);
    } else {
      modelOptions[key] = value;
    }
  }

  return new _core.Model(gl, Object.assign({
    program: program,
    geometry: new _geometry.Geometry({
      attributes: attributes
    })
  }, modelOptions, opts));
}

function parseJSON(file) {
  try {
    return JSON.parse(file);
  } catch (error) {
    throw new Error("Failed to parse JSON: ".concat(error));
  }
}
},{"@babel/runtime/helpers/esm/slicedToArray":"U1JK","../utils/assert":"wYRU","./browser-load":"s35v","../webgl":"x2lE","../core":"e1PQ","../geometry":"Cb5n"}],"Ex2v":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "setPathPrefix", {
  enumerable: true,
  get: function () {
    return _browserLoad.setPathPrefix;
  }
});
Object.defineProperty(exports, "loadFile", {
  enumerable: true,
  get: function () {
    return _browserLoad.loadFile;
  }
});
Object.defineProperty(exports, "loadImage", {
  enumerable: true,
  get: function () {
    return _browserLoad.loadImage;
  }
});
Object.defineProperty(exports, "loadTexture", {
  enumerable: true,
  get: function () {
    return _loadFiles.loadTexture;
  }
});
Object.defineProperty(exports, "loadFiles", {
  enumerable: true,
  get: function () {
    return _loadFiles.loadFiles;
  }
});
Object.defineProperty(exports, "loadImages", {
  enumerable: true,
  get: function () {
    return _loadFiles.loadImages;
  }
});
Object.defineProperty(exports, "loadTextures", {
  enumerable: true,
  get: function () {
    return _loadFiles.loadTextures;
  }
});
Object.defineProperty(exports, "loadProgram", {
  enumerable: true,
  get: function () {
    return _loadFiles.loadProgram;
  }
});
Object.defineProperty(exports, "loadModel", {
  enumerable: true,
  get: function () {
    return _loadFiles.loadModel;
  }
});
Object.defineProperty(exports, "parseModel", {
  enumerable: true,
  get: function () {
    return _loadFiles.parseModel;
  }
});

var _browserLoad = require("./browser-load");

var _loadFiles = require("./load-files");
},{"./browser-load":"s35v","./load-files":"neEB"}],"r1pn":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _default = "uniform mat4 u_MVPMatrix;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_NormalMatrix;\n";
exports.default = _default;
},{}],"Z0ZQ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _project2Vertex = _interopRequireDefault(require("./project2.vertex.glsl"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _default = {
  name: 'project2',
  vs: _project2Vertex.default,
  fs: _project2Vertex.default
};
exports.default = _default;
},{"./project2.vertex.glsl":"r1pn"}],"Mc3G":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _default = "varying vec3 pbr_vPosition;\nvarying vec2 pbr_vUV;\n\n#ifdef HAS_NORMALS\n# ifdef HAS_TANGENTS\nvarying mat3 pbr_vTBN;\n# else\nvarying vec3 pbr_vNormal;\n# endif\n#endif\n\nvoid pbr_setPositionNormalTangentUV(vec4 position, vec4 normal, vec4 tangent, vec2 uv)\n{\n  vec4 pos = u_ModelMatrix * position;\n  pbr_vPosition = vec3(pos.xyz) / pos.w;\n\n#ifdef HAS_NORMALS\n#ifdef HAS_TANGENTS\n  vec3 normalW = normalize(vec3(u_NormalMatrix * vec4(normal.xyz, 0.0)));\n  vec3 tangentW = normalize(vec3(u_ModelMatrix * vec4(tangent.xyz, 0.0)));\n  vec3 bitangentW = cross(normalW, tangentW) * tangent.w;\n  pbr_vTBN = mat3(tangentW, bitangentW, normalW);\n#else\n  pbr_vNormal = normalize(vec3(u_ModelMatrix * vec4(normal.xyz, 0.0)));\n#endif\n#endif\n\n#ifdef HAS_UV\n  pbr_vUV = uv;\n#else\n  pbr_vUV = vec2(0.,0.);\n#endif\n}\n";
exports.default = _default;
},{}],"r952":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// This fragment shader defines a reference implementation for Physically Based Shading of
// a microfacet surface material defined by a glTF model.
//
// Attribution:
// MIT license, Copyright (c) 2016-2017 Mohamad Moneimne and Contributors
var _default = "#extension GL_EXT_shader_texture_lod: enable\n#extension GL_OES_standard_derivatives : enable\n\nprecision highp float;\n\nuniform vec3 u_LightDirection;\nuniform vec3 u_LightColor;\n\n#ifdef USE_IBL\nuniform samplerCube u_DiffuseEnvSampler;\nuniform samplerCube u_SpecularEnvSampler;\nuniform sampler2D u_brdfLUT;\n#endif\n\n#ifdef HAS_BASECOLORMAP\nuniform sampler2D u_BaseColorSampler;\n#endif\n#ifdef HAS_NORMALMAP\nuniform sampler2D u_NormalSampler;\nuniform float u_NormalScale;\n#endif\n#ifdef HAS_EMISSIVEMAP\nuniform sampler2D u_EmissiveSampler;\nuniform vec3 u_EmissiveFactor;\n#endif\n#ifdef HAS_METALROUGHNESSMAP\nuniform sampler2D u_MetallicRoughnessSampler;\n#endif\n#ifdef HAS_OCCLUSIONMAP\nuniform sampler2D u_OcclusionSampler;\nuniform float u_OcclusionStrength;\n#endif\n\nuniform vec2 u_MetallicRoughnessValues;\nuniform vec4 u_BaseColorFactor;\n\nuniform vec3 u_Camera;\nuniform vec4 u_ScaleDiffBaseMR;\nuniform vec4 u_ScaleFGDSpec;\nuniform vec4 u_ScaleIBLAmbient;\n\nvarying vec3 pbr_vPosition;\n\nvarying vec2 pbr_vUV;\n\n#ifdef HAS_NORMALS\n#ifdef HAS_TANGENTS\nvarying mat3 pbr_vTBN;\n#else\nvarying vec3 pbr_vNormal;\n#endif\n#endif\n\n\nstruct PBRInfo\n{\n  float NdotL;\n  float NdotV;\n  float NdotH;\n  float LdotH;\n  float VdotH;\n  float perceptualRoughness;\n  float metalness;\n  vec3 reflectance0;\n  vec3 reflectance90;\n  float alphaRoughness;\n  vec3 diffuseColor;\n  vec3 specularColor;\n};\n\nconst float M_PI = 3.141592653589793;\nconst float c_MinRoughness = 0.04;\n\nvec4 SRGBtoLINEAR(vec4 srgbIn)\n{\n  #ifdef MANUAL_SRGB\n  #ifdef SRGB_FAST_APPROXIMATION\n  vec3 linOut = pow(srgbIn.xyz,vec3(2.2));\n  #else\n  vec3 bLess = step(vec3(0.04045),srgbIn.xyz);\n  vec3 linOut = mix( srgbIn.xyz/vec3(12.92), pow((srgbIn.xyz+vec3(0.055))/vec3(1.055),vec3(2.4)), bLess );\n  #endif\n  return vec4(linOut,srgbIn.w);;\n  #else\n  return srgbIn;\n  #endif\n}\n\nvec3 getNormal()\n{\n#ifndef HAS_TANGENTS\n  vec3 pos_dx = dFdx(pbr_vPosition);\n  vec3 pos_dy = dFdy(pbr_vPosition);\n  vec3 tex_dx = dFdx(vec3(pbr_vUV, 0.0));\n  vec3 tex_dy = dFdy(vec3(pbr_vUV, 0.0));\n  vec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);\n\n#ifdef HAS_NORMALS\n  vec3 ng = normalize(pbr_vNormal);\n#else\n  vec3 ng = cross(pos_dx, pos_dy);\n#endif\n\n  t = normalize(t - ng * dot(ng, t));\n  vec3 b = normalize(cross(ng, t));\n  mat3 tbn = mat3(t, b, ng);\n#else\n  mat3 tbn = pbr_vTBN;\n#endif\n\n#ifdef HAS_NORMALMAP\n  vec3 n = texture2D(u_NormalSampler, pbr_vUV).rgb;\n  n = normalize(tbn * ((2.0 * n - 1.0) * vec3(u_NormalScale, u_NormalScale, 1.0)));\n#else\n  vec3 n = normalize(tbn[2].xyz);\n#endif\n\n  return n;\n}\n\n\n#ifdef USE_IBL\nvec3 getIBLContribution(PBRInfo pbrInputs, vec3 n, vec3 reflection)\n{\n  float mipCount = 9.0;\n  float lod = (pbrInputs.perceptualRoughness * mipCount);\n  vec3 brdf = SRGBtoLINEAR(texture2D(u_brdfLUT,\n    vec2(pbrInputs.NdotV, 1.0 - pbrInputs.perceptualRoughness))).rgb;\n  vec3 diffuseLight = SRGBtoLINEAR(textureCube(u_DiffuseEnvSampler, n)).rgb;\n\n#ifdef USE_TEX_LOD\n  vec3 specularLight = SRGBtoLINEAR(textureCubeLodEXT(u_SpecularEnvSampler, reflection, lod)).rgb;\n#else\n  vec3 specularLight = SRGBtoLINEAR(textureCube(u_SpecularEnvSampler, reflection)).rgb;\n#endif\n\n  vec3 diffuse = diffuseLight * pbrInputs.diffuseColor;\n  vec3 specular = specularLight * (pbrInputs.specularColor * brdf.x + brdf.y);\n  diffuse *= u_ScaleIBLAmbient.x;\n  specular *= u_ScaleIBLAmbient.y;\n\n  return diffuse + specular;\n}\n#endif\n\n\nvec3 diffuse(PBRInfo pbrInputs)\n{\n  return pbrInputs.diffuseColor / M_PI;\n}\n\nvec3 specularReflection(PBRInfo pbrInputs)\n{\n  return pbrInputs.reflectance0 +\n    (pbrInputs.reflectance90 - pbrInputs.reflectance0) *\n    pow(clamp(1.0 - pbrInputs.VdotH, 0.0, 1.0), 5.0);\n}\n\n\n\nfloat geometricOcclusion(PBRInfo pbrInputs)\n{\n  float NdotL = pbrInputs.NdotL;\n  float NdotV = pbrInputs.NdotV;\n  float r = pbrInputs.alphaRoughness;\n\n  float attenuationL = 2.0 * NdotL / (NdotL + sqrt(r * r + (1.0 - r * r) * (NdotL * NdotL)));\n  float attenuationV = 2.0 * NdotV / (NdotV + sqrt(r * r + (1.0 - r * r) * (NdotV * NdotV)));\n  return attenuationL * attenuationV;\n}\n\n\n\n\n\nfloat microfacetDistribution(PBRInfo pbrInputs)\n{\n  float roughnessSq = pbrInputs.alphaRoughness * pbrInputs.alphaRoughness;\n  float f = (pbrInputs.NdotH * roughnessSq - pbrInputs.NdotH) * pbrInputs.NdotH + 1.0;\n  return roughnessSq / (M_PI * f * f);\n}\n\nvec4 pbr_filterColor(vec4 colorUnused)\n{\n\n\n  float perceptualRoughness = u_MetallicRoughnessValues.y;\n  float metallic = u_MetallicRoughnessValues.x;\n#ifdef HAS_METALROUGHNESSMAP\n\n  vec4 mrSample = texture2D(u_MetallicRoughnessSampler, pbr_vUV);\n  perceptualRoughness = mrSample.g * perceptualRoughness;\n  metallic = mrSample.b * metallic;\n#endif\n  perceptualRoughness = clamp(perceptualRoughness, c_MinRoughness, 1.0);\n  metallic = clamp(metallic, 0.0, 1.0);\n\n  float alphaRoughness = perceptualRoughness * perceptualRoughness;\n#ifdef HAS_BASECOLORMAP\n  vec4 baseColor = SRGBtoLINEAR(texture2D(u_BaseColorSampler, pbr_vUV)) * u_BaseColorFactor;\n#else\n  vec4 baseColor = u_BaseColorFactor;\n#endif\n\n  vec3 f0 = vec3(0.04);\n  vec3 diffuseColor = baseColor.rgb * (vec3(1.0) - f0);\n  diffuseColor *= 1.0 - metallic;\n  vec3 specularColor = mix(f0, baseColor.rgb, metallic);\n  float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);\n\n\n\n  float reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0);\n  vec3 specularEnvironmentR0 = specularColor.rgb;\n  vec3 specularEnvironmentR90 = vec3(1.0, 1.0, 1.0) * reflectance90;\n\n  vec3 n = getNormal();\n  vec3 v = normalize(u_Camera - pbr_vPosition);\n  vec3 l = normalize(u_LightDirection);\n  vec3 h = normalize(l+v);\n  vec3 reflection = -normalize(reflect(v, n));\n\n  float NdotL = clamp(dot(n, l), 0.001, 1.0);\n  float NdotV = clamp(abs(dot(n, v)), 0.001, 1.0);\n  float NdotH = clamp(dot(n, h), 0.0, 1.0);\n  float LdotH = clamp(dot(l, h), 0.0, 1.0);\n  float VdotH = clamp(dot(v, h), 0.0, 1.0);\n\n  PBRInfo pbrInputs = PBRInfo(\n    NdotL,\n    NdotV,\n    NdotH,\n    LdotH,\n    VdotH,\n    perceptualRoughness,\n    metallic,\n    specularEnvironmentR0,\n    specularEnvironmentR90,\n    alphaRoughness,\n    diffuseColor,\n    specularColor\n  );\n  vec3 F = specularReflection(pbrInputs);\n  float G = geometricOcclusion(pbrInputs);\n  float D = microfacetDistribution(pbrInputs);\n  vec3 diffuseContrib = (1.0 - F) * diffuse(pbrInputs);\n  vec3 specContrib = F * G * D / (4.0 * NdotL * NdotV);\n  vec3 color = NdotL * u_LightColor * (diffuseContrib + specContrib);\n#ifdef USE_IBL\n  color += getIBLContribution(pbrInputs, n, reflection);\n#endif\n#ifdef HAS_OCCLUSIONMAP\n  float ao = texture2D(u_OcclusionSampler, pbr_vUV).r;\n  color = mix(color, color * ao, u_OcclusionStrength);\n#endif\n\n#ifdef HAS_EMISSIVEMAP\n  vec3 emissive = SRGBtoLINEAR(texture2D(u_EmissiveSampler, pbr_vUV)).rgb * u_EmissiveFactor;\n  color += emissive;\n#endif\n\n  color = mix(color, F, u_ScaleFGDSpec.x);\n  color = mix(color, vec3(G), u_ScaleFGDSpec.y);\n  color = mix(color, vec3(D), u_ScaleFGDSpec.z);\n  color = mix(color, specContrib, u_ScaleFGDSpec.w);\n\n  color = mix(color, diffuseContrib, u_ScaleDiffBaseMR.x);\n  color = mix(color, baseColor.rgb, u_ScaleDiffBaseMR.y);\n  color = mix(color, vec3(metallic), u_ScaleDiffBaseMR.z);\n  color = mix(color, vec3(perceptualRoughness), u_ScaleDiffBaseMR.w);\n\n  return vec4(pow(color,vec3(1.0/2.2)), baseColor.a);\n}\n";
exports.default = _default;
},{}],"ZdP7":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _project = _interopRequireDefault(require("../project2/project2"));

var _pbrVertex = _interopRequireDefault(require("./pbr-vertex.glsl"));

var _pbrFragment = _interopRequireDefault(require("./pbr-fragment.glsl"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _default = {
  name: 'pbr',
  vs: _pbrVertex.default,
  fs: _pbrFragment.default,
  dependencies: [_project.default] // getUniforms

};
exports.default = _default;
},{"../project2/project2":"Z0ZQ","./pbr-vertex.glsl":"Mc3G","./pbr-fragment.glsl":"r952"}],"GAQa":[function(require,module,exports) {
var global = arguments[3];
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "isWebGL", {
  enumerable: true,
  get: function () {
    return _webglChecks.isWebGL;
  }
});
Object.defineProperty(exports, "isWebGL2", {
  enumerable: true,
  get: function () {
    return _webglChecks.isWebGL2;
  }
});
Object.defineProperty(exports, "cloneTextureFrom", {
  enumerable: true,
  get: function () {
    return _textureUtils.cloneTextureFrom;
  }
});
Object.defineProperty(exports, "getKeyValue", {
  enumerable: true,
  get: function () {
    return _constantsToKeys.getKeyValue;
  }
});
Object.defineProperty(exports, "getKey", {
  enumerable: true,
  get: function () {
    return _constantsToKeys.getKey;
  }
});
Object.defineProperty(exports, "glGet", {
  enumerable: true,
  get: function () {
    return _constantsToKeys.glGet;
  }
});
Object.defineProperty(exports, "glKey", {
  enumerable: true,
  get: function () {
    return _constantsToKeys.glKey;
  }
});
Object.defineProperty(exports, "glKeyType", {
  enumerable: true,
  get: function () {
    return _constantsToKeys.glKeyType;
  }
});
Object.defineProperty(exports, "createGLContext", {
  enumerable: true,
  get: function () {
    return _context.createGLContext;
  }
});
Object.defineProperty(exports, "destroyGLContext", {
  enumerable: true,
  get: function () {
    return _context.destroyGLContext;
  }
});
Object.defineProperty(exports, "resizeGLContext", {
  enumerable: true,
  get: function () {
    return _context.resizeGLContext;
  }
});
Object.defineProperty(exports, "pollGLContext", {
  enumerable: true,
  get: function () {
    return _context.pollGLContext;
  }
});
Object.defineProperty(exports, "setContextDefaults", {
  enumerable: true,
  get: function () {
    return _context.setContextDefaults;
  }
});
Object.defineProperty(exports, "trackContextState", {
  enumerable: true,
  get: function () {
    return _webglContext.trackContextState;
  }
});
Object.defineProperty(exports, "resetParameters", {
  enumerable: true,
  get: function () {
    return _contextState.resetParameters;
  }
});
Object.defineProperty(exports, "getParameter", {
  enumerable: true,
  get: function () {
    return _contextState.getParameter;
  }
});
Object.defineProperty(exports, "getParameters", {
  enumerable: true,
  get: function () {
    return _contextState.getParameters;
  }
});
Object.defineProperty(exports, "setParameter", {
  enumerable: true,
  get: function () {
    return _contextState.setParameter;
  }
});
Object.defineProperty(exports, "setParameters", {
  enumerable: true,
  get: function () {
    return _contextState.setParameters;
  }
});
Object.defineProperty(exports, "withParameters", {
  enumerable: true,
  get: function () {
    return _contextState.withParameters;
  }
});
Object.defineProperty(exports, "getModifiedParameters", {
  enumerable: true,
  get: function () {
    return _contextState.getModifiedParameters;
  }
});
Object.defineProperty(exports, "getContextInfo", {
  enumerable: true,
  get: function () {
    return _contextLimits.getContextInfo;
  }
});
Object.defineProperty(exports, "getGLContextInfo", {
  enumerable: true,
  get: function () {
    return _contextLimits.getGLContextInfo;
  }
});
Object.defineProperty(exports, "getContextLimits", {
  enumerable: true,
  get: function () {
    return _contextLimits.getContextLimits;
  }
});
Object.defineProperty(exports, "glGetDebugInfo", {
  enumerable: true,
  get: function () {
    return _contextLimits.glGetDebugInfo;
  }
});
Object.defineProperty(exports, "FEATURES", {
  enumerable: true,
  get: function () {
    return _contextFeatures.FEATURES;
  }
});
Object.defineProperty(exports, "hasFeature", {
  enumerable: true,
  get: function () {
    return _contextFeatures.hasFeature;
  }
});
Object.defineProperty(exports, "hasFeatures", {
  enumerable: true,
  get: function () {
    return _contextFeatures.hasFeatures;
  }
});
Object.defineProperty(exports, "getFeatures", {
  enumerable: true,
  get: function () {
    return _contextFeatures.getFeatures;
  }
});
Object.defineProperty(exports, "canCompileGLGSExtension", {
  enumerable: true,
  get: function () {
    return _contextFeatures.canCompileGLGSExtension;
  }
});
Object.defineProperty(exports, "Buffer", {
  enumerable: true,
  get: function () {
    return _buffer.default;
  }
});
Object.defineProperty(exports, "Shader", {
  enumerable: true,
  get: function () {
    return _shader.Shader;
  }
});
Object.defineProperty(exports, "VertexShader", {
  enumerable: true,
  get: function () {
    return _shader.VertexShader;
  }
});
Object.defineProperty(exports, "FragmentShader", {
  enumerable: true,
  get: function () {
    return _shader.FragmentShader;
  }
});
Object.defineProperty(exports, "Program", {
  enumerable: true,
  get: function () {
    return _program.default;
  }
});
Object.defineProperty(exports, "Framebuffer", {
  enumerable: true,
  get: function () {
    return _framebuffer.default;
  }
});
Object.defineProperty(exports, "Renderbuffer", {
  enumerable: true,
  get: function () {
    return _renderbuffer.default;
  }
});
Object.defineProperty(exports, "Texture2D", {
  enumerable: true,
  get: function () {
    return _texture2d.default;
  }
});
Object.defineProperty(exports, "TextureCube", {
  enumerable: true,
  get: function () {
    return _textureCube.default;
  }
});
Object.defineProperty(exports, "clear", {
  enumerable: true,
  get: function () {
    return _clear.clear;
  }
});
Object.defineProperty(exports, "clearBuffer", {
  enumerable: true,
  get: function () {
    return _clear.clearBuffer;
  }
});
Object.defineProperty(exports, "_clearBuffer", {
  enumerable: true,
  get: function () {
    return _clear.clearBuffer;
  }
});
Object.defineProperty(exports, "FenceSync", {
  enumerable: true,
  get: function () {
    return _fenceSync.default;
  }
});
Object.defineProperty(exports, "Query", {
  enumerable: true,
  get: function () {
    return _query.default;
  }
});
Object.defineProperty(exports, "Sampler", {
  enumerable: true,
  get: function () {
    return _sampler.default;
  }
});
Object.defineProperty(exports, "Texture3D", {
  enumerable: true,
  get: function () {
    return _texture3d.default;
  }
});
Object.defineProperty(exports, "Texture2DArray", {
  enumerable: true,
  get: function () {
    return _texture2dArray.default;
  }
});
Object.defineProperty(exports, "TransformFeedback", {
  enumerable: true,
  get: function () {
    return _transformFeedback.default;
  }
});
Object.defineProperty(exports, "VertexArrayObject", {
  enumerable: true,
  get: function () {
    return _vertexArrayObject.default;
  }
});
Object.defineProperty(exports, "VertexArray", {
  enumerable: true,
  get: function () {
    return _vertexArray.default;
  }
});
Object.defineProperty(exports, "UniformBufferLayout", {
  enumerable: true,
  get: function () {
    return _uniformBufferLayout.default;
  }
});
Object.defineProperty(exports, "_Accessor", {
  enumerable: true,
  get: function () {
    return _accessor.default;
  }
});
Object.defineProperty(exports, "Object3D", {
  enumerable: true,
  get: function () {
    return _object3d.default;
  }
});
Object.defineProperty(exports, "Group", {
  enumerable: true,
  get: function () {
    return _group.default;
  }
});
Object.defineProperty(exports, "Model", {
  enumerable: true,
  get: function () {
    return _model.default;
  }
});
Object.defineProperty(exports, "AnimationLoop", {
  enumerable: true,
  get: function () {
    return _animationLoop.default;
  }
});
Object.defineProperty(exports, "pickModels", {
  enumerable: true,
  get: function () {
    return _pickModels.default;
  }
});
Object.defineProperty(exports, "encodePickingColor", {
  enumerable: true,
  get: function () {
    return _pickingColors.encodePickingColor;
  }
});
Object.defineProperty(exports, "decodePickingColor", {
  enumerable: true,
  get: function () {
    return _pickingColors.decodePickingColor;
  }
});
Object.defineProperty(exports, "getNullPickingColor", {
  enumerable: true,
  get: function () {
    return _pickingColors.getNullPickingColor;
  }
});
Object.defineProperty(exports, "Transform", {
  enumerable: true,
  get: function () {
    return _transform.default;
  }
});
Object.defineProperty(exports, "_Attribute", {
  enumerable: true,
  get: function () {
    return _attribute.default;
  }
});
Object.defineProperty(exports, "_ShaderCache", {
  enumerable: true,
  get: function () {
    return _shaderCache.default;
  }
});
Object.defineProperty(exports, "_AnimationLoopProxy", {
  enumerable: true,
  get: function () {
    return _animationLoopProxy.default;
  }
});
Object.defineProperty(exports, "_MultiPassRenderer", {
  enumerable: true,
  get: function () {
    return _multiPassRenderer.default;
  }
});
Object.defineProperty(exports, "_RenderState", {
  enumerable: true,
  get: function () {
    return _renderState.default;
  }
});
Object.defineProperty(exports, "_Pass", {
  enumerable: true,
  get: function () {
    return _pass.default;
  }
});
Object.defineProperty(exports, "_CompositePass", {
  enumerable: true,
  get: function () {
    return _compositePass.default;
  }
});
Object.defineProperty(exports, "_ClearPass", {
  enumerable: true,
  get: function () {
    return _clearPass.default;
  }
});
Object.defineProperty(exports, "_RenderPass", {
  enumerable: true,
  get: function () {
    return _renderPass.default;
  }
});
Object.defineProperty(exports, "_CopyPass", {
  enumerable: true,
  get: function () {
    return _copyPass.default;
  }
});
Object.defineProperty(exports, "_TexturePass", {
  enumerable: true,
  get: function () {
    return _texturePass.default;
  }
});
Object.defineProperty(exports, "_PickingPass", {
  enumerable: true,
  get: function () {
    return _pickingPass.default;
  }
});
Object.defineProperty(exports, "_ShaderModulePass", {
  enumerable: true,
  get: function () {
    return _shaderModulePass.default;
  }
});
Object.defineProperty(exports, "_Canvas", {
  enumerable: true,
  get: function () {
    return _canvas.default;
  }
});
Object.defineProperty(exports, "Geometry", {
  enumerable: true,
  get: function () {
    return _geometry.default;
  }
});
Object.defineProperty(exports, "ConeGeometry", {
  enumerable: true,
  get: function () {
    return _coneGeometry.default;
  }
});
Object.defineProperty(exports, "CubeGeometry", {
  enumerable: true,
  get: function () {
    return _cubeGeometry.default;
  }
});
Object.defineProperty(exports, "CylinderGeometry", {
  enumerable: true,
  get: function () {
    return _cylinderGeometry.default;
  }
});
Object.defineProperty(exports, "IcoSphereGeometry", {
  enumerable: true,
  get: function () {
    return _icoSphereGeometry.default;
  }
});
Object.defineProperty(exports, "PlaneGeometry", {
  enumerable: true,
  get: function () {
    return _planeGeometry.default;
  }
});
Object.defineProperty(exports, "SphereGeometry", {
  enumerable: true,
  get: function () {
    return _sphereGeometry.default;
  }
});
Object.defineProperty(exports, "TruncatedConeGeometry", {
  enumerable: true,
  get: function () {
    return _truncatedConeGeometry.default;
  }
});
Object.defineProperty(exports, "Cone", {
  enumerable: true,
  get: function () {
    return _cone.default;
  }
});
Object.defineProperty(exports, "Cube", {
  enumerable: true,
  get: function () {
    return _cube.default;
  }
});
Object.defineProperty(exports, "Cylinder", {
  enumerable: true,
  get: function () {
    return _cylinder.default;
  }
});
Object.defineProperty(exports, "IcoSphere", {
  enumerable: true,
  get: function () {
    return _icoSphere.default;
  }
});
Object.defineProperty(exports, "Plane", {
  enumerable: true,
  get: function () {
    return _plane.default;
  }
});
Object.defineProperty(exports, "Sphere", {
  enumerable: true,
  get: function () {
    return _sphere.default;
  }
});
Object.defineProperty(exports, "TruncatedCone", {
  enumerable: true,
  get: function () {
    return _truncatedCone.default;
  }
});
Object.defineProperty(exports, "ClipSpace", {
  enumerable: true,
  get: function () {
    return _clipSpace.default;
  }
});
Object.defineProperty(exports, "ClipSpaceQuad", {
  enumerable: true,
  get: function () {
    return _clipSpace.default;
  }
});
Object.defineProperty(exports, "setPathPrefix", {
  enumerable: true,
  get: function () {
    return _io.setPathPrefix;
  }
});
Object.defineProperty(exports, "loadFile", {
  enumerable: true,
  get: function () {
    return _io.loadFile;
  }
});
Object.defineProperty(exports, "loadImage", {
  enumerable: true,
  get: function () {
    return _io.loadImage;
  }
});
Object.defineProperty(exports, "loadTexture", {
  enumerable: true,
  get: function () {
    return _io.loadTexture;
  }
});
Object.defineProperty(exports, "loadFiles", {
  enumerable: true,
  get: function () {
    return _io.loadFiles;
  }
});
Object.defineProperty(exports, "loadImages", {
  enumerable: true,
  get: function () {
    return _io.loadImages;
  }
});
Object.defineProperty(exports, "loadTextures", {
  enumerable: true,
  get: function () {
    return _io.loadTextures;
  }
});
Object.defineProperty(exports, "loadProgram", {
  enumerable: true,
  get: function () {
    return _io.loadProgram;
  }
});
Object.defineProperty(exports, "loadModel", {
  enumerable: true,
  get: function () {
    return _io.loadModel;
  }
});
Object.defineProperty(exports, "parseModel", {
  enumerable: true,
  get: function () {
    return _io.parseModel;
  }
});
Object.defineProperty(exports, "setDefaultShaderModules", {
  enumerable: true,
  get: function () {
    return _resolveModules.setDefaultShaderModules;
  }
});
Object.defineProperty(exports, "registerShaderModules", {
  enumerable: true,
  get: function () {
    return _resolveModules.registerShaderModules;
  }
});
Object.defineProperty(exports, "assembleShaders", {
  enumerable: true,
  get: function () {
    return _assembleShaders.assembleShaders;
  }
});
Object.defineProperty(exports, "normalizeShaderModule", {
  enumerable: true,
  get: function () {
    return _normalizeModule.normalizeShaderModule;
  }
});
Object.defineProperty(exports, "fp32", {
  enumerable: true,
  get: function () {
    return _fp.default;
  }
});
Object.defineProperty(exports, "fp64", {
  enumerable: true,
  get: function () {
    return _fp2.default;
  }
});
Object.defineProperty(exports, "project", {
  enumerable: true,
  get: function () {
    return _project.default;
  }
});
Object.defineProperty(exports, "lighting", {
  enumerable: true,
  get: function () {
    return _lighting.default;
  }
});
Object.defineProperty(exports, "dirlight", {
  enumerable: true,
  get: function () {
    return _dirlight.default;
  }
});
Object.defineProperty(exports, "picking", {
  enumerable: true,
  get: function () {
    return _picking.default;
  }
});
Object.defineProperty(exports, "diffuse", {
  enumerable: true,
  get: function () {
    return _diffuse.default;
  }
});
Object.defineProperty(exports, "pbr", {
  enumerable: true,
  get: function () {
    return _pbr.default;
  }
});
Object.defineProperty(exports, "assert", {
  enumerable: true,
  get: function () {
    return _assert.default;
  }
});
Object.defineProperty(exports, "log", {
  enumerable: true,
  get: function () {
    return _log.default;
  }
});
Object.defineProperty(exports, "global", {
  enumerable: true,
  get: function () {
    return _globals.global;
  }
});
Object.defineProperty(exports, "window", {
  enumerable: true,
  get: function () {
    return _globals.window;
  }
});
Object.defineProperty(exports, "document", {
  enumerable: true,
  get: function () {
    return _globals.document;
  }
});
Object.defineProperty(exports, "self", {
  enumerable: true,
  get: function () {
    return _globals.self;
  }
});
Object.defineProperty(exports, "isBrowser", {
  enumerable: true,
  get: function () {
    return _isBrowser.default;
  }
});
Object.defineProperty(exports, "isOldIE", {
  enumerable: true,
  get: function () {
    return _isOldIe.default;
  }
});
Object.defineProperty(exports, "stubRemovedMethods", {
  enumerable: true,
  get: function () {
    return _stubMethods.stubRemovedMethods;
  }
});
Object.defineProperty(exports, "makeDebugContext", {
  enumerable: true,
  get: function () {
    return _debugContext.makeDebugContext;
  }
});

var _webglChecks = require("./webgl-utils/webgl-checks");

var _textureUtils = require("./webgl-utils/texture-utils");

var _constantsToKeys = require("./webgl-utils/constants-to-keys");

var _context = require("./webgl-context/context");

var _webglContext = require("./webgl-context");

var _contextState = require("./webgl-context/context-state");

var _contextLimits = require("./webgl-context/context-limits");

var _contextFeatures = require("./webgl-context/context-features");

var _buffer = _interopRequireDefault(require("./webgl/buffer"));

var _shader = require("./webgl/shader");

var _program = _interopRequireDefault(require("./webgl/program"));

var _framebuffer = _interopRequireDefault(require("./webgl/framebuffer"));

var _renderbuffer = _interopRequireDefault(require("./webgl/renderbuffer"));

var _texture2d = _interopRequireDefault(require("./webgl/texture-2d"));

var _textureCube = _interopRequireDefault(require("./webgl/texture-cube"));

var _clear = require("./webgl/clear");

var _fenceSync = _interopRequireDefault(require("./webgl/fence-sync"));

var _query = _interopRequireDefault(require("./webgl/query"));

var _sampler = _interopRequireDefault(require("./webgl/sampler"));

var _texture3d = _interopRequireDefault(require("./webgl/texture-3d"));

var _texture2dArray = _interopRequireDefault(require("./webgl/texture-2d-array"));

var _transformFeedback = _interopRequireDefault(require("./webgl/transform-feedback"));

var _vertexArrayObject = _interopRequireDefault(require("./webgl/vertex-array-object"));

var _vertexArray = _interopRequireDefault(require("./webgl/vertex-array"));

var _uniformBufferLayout = _interopRequireDefault(require("./webgl/uniform-buffer-layout"));

var _accessor = _interopRequireDefault(require("./webgl/accessor"));

var _object3d = _interopRequireDefault(require("./core/object-3d"));

var _group = _interopRequireDefault(require("./core/group"));

var _model = _interopRequireDefault(require("./core/model"));

var _animationLoop = _interopRequireDefault(require("./core/animation-loop"));

var _pickModels = _interopRequireDefault(require("./core/pick-models"));

var _pickingColors = require("./core/picking-colors");

var _transform = _interopRequireDefault(require("./core/transform"));

var _attribute = _interopRequireDefault(require("./core/attribute"));

var _shaderCache = _interopRequireDefault(require("./core/shader-cache"));

var _animationLoopProxy = _interopRequireDefault(require("./core/animation-loop-proxy"));

var _multiPassRenderer = _interopRequireDefault(require("./multipass/multi-pass-renderer"));

var _renderState = _interopRequireDefault(require("./multipass/render-state"));

var _pass = _interopRequireDefault(require("./multipass/pass"));

var _compositePass = _interopRequireDefault(require("./multipass/composite-pass"));

var _clearPass = _interopRequireDefault(require("./multipass/clear-pass"));

var _renderPass = _interopRequireDefault(require("./multipass/render-pass"));

var _copyPass = _interopRequireDefault(require("./multipass/copy-pass"));

var _texturePass = _interopRequireDefault(require("./multipass/texture-pass"));

var _pickingPass = _interopRequireDefault(require("./multipass/picking-pass"));

var _shaderModulePass = _interopRequireDefault(require("./multipass/shader-module-pass"));

var _canvas = _interopRequireDefault(require("./multipass/canvas"));

var _geometry = _interopRequireDefault(require("./geometry/geometry"));

var _coneGeometry = _interopRequireDefault(require("./geometry/cone-geometry"));

var _cubeGeometry = _interopRequireDefault(require("./geometry/cube-geometry"));

var _cylinderGeometry = _interopRequireDefault(require("./geometry/cylinder-geometry"));

var _icoSphereGeometry = _interopRequireDefault(require("./geometry/ico-sphere-geometry"));

var _planeGeometry = _interopRequireDefault(require("./geometry/plane-geometry"));

var _sphereGeometry = _interopRequireDefault(require("./geometry/sphere-geometry"));

var _truncatedConeGeometry = _interopRequireDefault(require("./geometry/truncated-cone-geometry"));

var _cone = _interopRequireDefault(require("./models/cone"));

var _cube = _interopRequireDefault(require("./models/cube"));

var _cylinder = _interopRequireDefault(require("./models/cylinder"));

var _icoSphere = _interopRequireDefault(require("./models/ico-sphere"));

var _plane = _interopRequireDefault(require("./models/plane"));

var _sphere = _interopRequireDefault(require("./models/sphere"));

var _truncatedCone = _interopRequireDefault(require("./models/truncated-cone"));

var _clipSpace = _interopRequireDefault(require("./models/clip-space"));

var _io = require("./io");

var _resolveModules = require("./shadertools/src/lib/resolve-modules");

var _assembleShaders = require("./shadertools/src/lib/assemble-shaders");

var _normalizeModule = require("./shadertools/src/lib/filters/normalize-module");

var _fp = _interopRequireDefault(require("./shadertools/src/modules/fp32/fp32"));

var _fp2 = _interopRequireDefault(require("./shadertools/src/modules/fp64/fp64"));

var _project = _interopRequireDefault(require("./shadertools/src/modules/project/project"));

var _lighting = _interopRequireDefault(require("./shadertools/src/modules/lighting/lighting"));

var _dirlight = _interopRequireDefault(require("./shadertools/src/modules/dirlight/dirlight"));

var _picking = _interopRequireDefault(require("./shadertools/src/modules/picking/picking"));

var _diffuse = _interopRequireDefault(require("./shadertools/src/modules/diffuse/diffuse"));

var _pbr = _interopRequireDefault(require("./shadertools/src/modules/pbr/pbr"));

var _assert = _interopRequireDefault(require("./utils/assert"));

var _log = _interopRequireDefault(require("./utils/log"));

var _globals = require("./utils/globals");

var _isBrowser = _interopRequireDefault(require("./utils/is-browser"));

var _isOldIe = _interopRequireDefault(require("./utils/is-old-ie"));

var _stubMethods = require("./utils/stub-methods");

var _debugContext = require("./webgl-context/debug-context");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Export core modules for luma.gl
// Initialize any global state
require('./init'); // WebGL
},{"./init":"OBdb","./webgl-utils/webgl-checks":"D8hV","./webgl-utils/texture-utils":"r7vO","./webgl-utils/constants-to-keys":"OZ1B","./webgl-context/context":"P3M9","./webgl-context":"id7L","./webgl-context/context-state":"cIIw","./webgl-context/context-limits":"fdIS","./webgl-context/context-features":"pWl5","./webgl/buffer":"Rc9V","./webgl/shader":"pOhm","./webgl/program":"hOuK","./webgl/framebuffer":"RDBm","./webgl/renderbuffer":"jd4o","./webgl/texture-2d":"jx3X","./webgl/texture-cube":"Bnce","./webgl/clear":"Zd9V","./webgl/fence-sync":"SG5X","./webgl/query":"kye1","./webgl/sampler":"ZcU1","./webgl/texture-3d":"q4cN","./webgl/texture-2d-array":"LuHO","./webgl/transform-feedback":"oKAe","./webgl/vertex-array-object":"HYHI","./webgl/vertex-array":"yiqH","./webgl/uniform-buffer-layout":"wMBm","./webgl/accessor":"SwrD","./core/object-3d":"VniL","./core/group":"gKrA","./core/model":"yJrb","./core/animation-loop":"gyOX","./core/pick-models":"ODk1","./core/picking-colors":"hRQS","./core/transform":"xrYx","./core/attribute":"lqt4","./core/shader-cache":"oFEt","./core/animation-loop-proxy":"npeM","./multipass/multi-pass-renderer":"ydWu","./multipass/render-state":"VsfT","./multipass/pass":"eTBq","./multipass/composite-pass":"MfJ8","./multipass/clear-pass":"C4yk","./multipass/render-pass":"dxPw","./multipass/copy-pass":"rTzV","./multipass/texture-pass":"nR2m","./multipass/picking-pass":"FiR7","./multipass/shader-module-pass":"z1ry","./multipass/canvas":"dptw","./geometry/geometry":"wX6R","./geometry/cone-geometry":"VcVT","./geometry/cube-geometry":"zVIl","./geometry/cylinder-geometry":"KozP","./geometry/ico-sphere-geometry":"vALS","./geometry/plane-geometry":"O11O","./geometry/sphere-geometry":"x67K","./geometry/truncated-cone-geometry":"McnK","./models/cone":"rOZB","./models/cube":"kcZB","./models/cylinder":"BEmD","./models/ico-sphere":"qAxA","./models/plane":"HpLC","./models/sphere":"R8uP","./models/truncated-cone":"jmnE","./models/clip-space":"gkgF","./io":"Ex2v","./shadertools/src/lib/resolve-modules":"oOWu","./shadertools/src/lib/assemble-shaders":"xBou","./shadertools/src/lib/filters/normalize-module":"VhlE","./shadertools/src/modules/fp32/fp32":"oP7N","./shadertools/src/modules/fp64/fp64":"bGYC","./shadertools/src/modules/project/project":"EnWH","./shadertools/src/modules/lighting/lighting":"Zq4p","./shadertools/src/modules/dirlight/dirlight":"PhBq","./shadertools/src/modules/picking/picking":"ShTP","./shadertools/src/modules/diffuse/diffuse":"Wm5i","./shadertools/src/modules/pbr/pbr":"ZdP7","./utils/assert":"wYRU","./utils/log":"na3T","./utils/globals":"AlqY","./utils/is-browser":"noZ1","./utils/is-old-ie":"kIcs","./utils/stub-methods":"kw5T","./webgl-context/debug-context":"lVQr"}],"DmRv":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.PROJECT_COORDINATE_SYSTEM = void 0;
var PROJECT_COORDINATE_SYSTEM = {
  // Underscore required because GLSL code expects COORDINATE_SYSTEM_LNG_LAT
  LNG_LAT: 1.0,
  // Previously known as LNGLAT_EXPERIMENTAL (in 6.0)
  LNGLAT_AUTO_OFFSET: 4.0,
  METER_OFFSETS: 2.0,
  LNGLAT_OFFSETS: 3.0,
  IDENTITY: 0.0
};
exports.PROJECT_COORDINATE_SYSTEM = PROJECT_COORDINATE_SYSTEM;
},{}],"FKfJ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _constants = require("./constants");

// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
// We are generating these from the js code in constants.js
var COORDINATE_SYSTEM_GLSL_CONSTANTS = Object.keys(_constants.PROJECT_COORDINATE_SYSTEM).map(function (key) {
  return "const float COORDINATE_SYSTEM_".concat(key, " = ").concat(_constants.PROJECT_COORDINATE_SYSTEM[key], ".;");
}).join('');

var _default = "".concat(COORDINATE_SYSTEM_GLSL_CONSTANTS, "\n\nuniform float project_uCoordinateSystem;\nuniform float project_uScale;\nuniform bool project_uWrapLongitude;\nuniform float project_uAntimeridian;\nuniform vec3 project_uPixelsPerMeter;\nuniform vec3 project_uPixelsPerDegree;\nuniform vec3 project_uPixelsPerUnit;\nuniform vec3 project_uPixelsPerUnit2;\nuniform vec4 project_uCenter;\nuniform mat4 project_uModelMatrix;\nuniform mat4 project_uViewProjectionMatrix;\nuniform vec2 project_uViewportSize;\nuniform float project_uDevicePixelRatio;\nuniform float project_uFocalDistance;\nuniform vec3 project_uCameraPosition;\nuniform vec2 project_coordinate_origin;\n\nconst float TILE_SIZE = 512.0;\nconst float PI = 3.1415926536;\nconst float WORLD_SCALE = TILE_SIZE / (PI * 2.0);\nconst vec2 ZERO_64_XY_LOW = vec2(0.0, 0.0);\n\n//\n// Scaling offsets - scales meters to \"pixels\"\n// Note the scalar version of project_scale is for scaling the z component only\n//\nfloat project_scale(float meters) {\n  return meters * project_uPixelsPerMeter.z;\n}\n\nvec2 project_scale(vec2 meters) {\n  return meters * project_uPixelsPerMeter.xy;\n}\n\nvec3 project_scale(vec3 meters) {\n  return meters * project_uPixelsPerMeter;\n}\n\nvec4 project_scale(vec4 meters) {\n  return vec4(meters.xyz * project_uPixelsPerMeter, meters.w);\n}\n\n//\n// Projecting normal - transform deltas from current coordinate system to\n// normals in the worldspace\n//\nvec3 project_normal(vec3 vector) {\n  if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNG_LAT ||\n    project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSETS) {\n    return normalize(vector * project_uPixelsPerDegree);\n  }\n  // Apply model matrix\n  vec4 normal_modelspace = project_uModelMatrix * vec4(vector, 0.0);\n  return normalize(normal_modelspace.xyz * project_uPixelsPerMeter);\n}\n\nvec4 project_offset_(vec4 offset) {\n  float dy = offset.y;\n  if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT_AUTO_OFFSET) {\n    dy = clamp(dy, -1., 1.);\n  }\n  vec3 pixelsPerUnit = project_uPixelsPerUnit + project_uPixelsPerUnit2 * dy;\n  return vec4(offset.xyz * pixelsPerUnit, offset.w);\n}\n\n//\n// Projecting positions - non-linear projection: lnglats => unit tile [0-1, 0-1]\n//\nvec2 project_mercator_(vec2 lnglat) {\n  float x = lnglat.x;\n  if (project_uWrapLongitude) {\n    x = mod(x - project_uAntimeridian, 360.0) + project_uAntimeridian;\n  }\n  return vec2(\n    radians(x) + PI,\n    PI - log(tan_fp32(PI * 0.25 + radians(lnglat.y) * 0.5))\n  );\n}\n\n//\n// Projects lnglats (or meter offsets, depending on mode) to pixels\n//\nvec4 project_position(vec4 position, vec2 position64xyLow) {\n  // TODO - why not simply subtract center and fall through?\n  if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNG_LAT) {\n    return project_uModelMatrix * vec4(\n      project_mercator_(position.xy) * WORLD_SCALE * project_uScale,\n      project_scale(position.z),\n      position.w\n    );\n  }\n\n  if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT_AUTO_OFFSET) {\n    // Subtract high part of 64 bit value. Convert remainder to float32, preserving precision.\n    float X = position.x - project_coordinate_origin.x;\n    float Y = position.y - project_coordinate_origin.y;\n    return project_offset_(vec4(X + position64xyLow.x, Y + position64xyLow.y, position.z, position.w));\n  }\n\n  if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSETS) {\n    return project_offset_(position);\n  }\n\n  // METER_OFFSETS or IDENTITY\n  // Apply model matrix\n  vec4 position_modelspace = project_uModelMatrix * position;\n  return project_offset_(position_modelspace);\n}\n\nvec4 project_position(vec4 position) {\n  return project_position(position, ZERO_64_XY_LOW);\n}\n\nvec3 project_position(vec3 position, vec2 position64xyLow) {\n  vec4 projected_position = project_position(vec4(position, 1.0), position64xyLow);\n  return projected_position.xyz;\n}\n\nvec3 project_position(vec3 position) {\n  vec4 projected_position = project_position(vec4(position, 1.0), ZERO_64_XY_LOW);\n  return projected_position.xyz;\n}\n\nvec2 project_position(vec2 position) {\n  vec4 projected_position = project_position(vec4(position, 0.0, 1.0), ZERO_64_XY_LOW);\n  return projected_position.xy;\n}\n\n//\n// Projects from \"world\" coordinates to clip space.\n// Uses project_uViewProjectionMatrix\n//\nvec4 project_to_clipspace(vec4 position) {\n  if (project_uCoordinateSystem == COORDINATE_SYSTEM_METER_OFFSETS ||\n    project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSETS) {\n    // Needs to be divided with project_uPixelsPerMeter\n    position.w *= project_uPixelsPerMeter.z;\n  }\n  return project_uViewProjectionMatrix * position + project_uCenter;\n}\n\n// Returns a clip space offset that corresponds to a given number of **non-device** pixels\nvec4 project_pixel_to_clipspace(vec2 pixels) {\n  vec2 offset = pixels / project_uViewportSize * project_uDevicePixelRatio * 2.0;\n  return vec4(offset * project_uFocalDistance, 0.0, 0.0);\n}\n");

exports.default = _default;
},{"./constants":"DmRv"}],"GfMx":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.EVENTS = exports.COORDINATE_SYSTEM = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
// Note: The numeric values here are matched by shader code in the
// "project" and "project64" shader modules. Both places need to be
// updated.
// TODO: Maybe "POSITIONS" would be a better name?
var COORDINATE_SYSTEM = {
  // Positions are interpreted as [lng, lat, elevation]
  // lng lat are degrees, elevation is meters. distances as meters.
  LNGLAT: 1,
  LNGLAT_EXPERIMENTAL: 1,
  LNGLAT_DEPRECATED: 5,
  // Positions are interpreted as meter offsets, distances as meters
  METER_OFFSETS: 2,
  // Planned to deprecate in later versions, in favor of METER_OFFSETS
  METERS: 2,
  // Positions are interpreted as lng lat offsets: [deltaLng, deltaLat, elevation]
  // deltaLng, deltaLat are delta degrees, elevation is meters.
  // distances as meters.
  LNGLAT_OFFSETS: 3,
  // Positions and distances are not transformed: [x, y, z] in unit coordinates
  IDENTITY: 0
};
exports.COORDINATE_SYSTEM = COORDINATE_SYSTEM;
var EVENTS = {
  panstart: {
    handler: 'onDragStart'
  },
  panmove: {
    handler: 'onDrag'
  },
  panend: {
    handler: 'onDragEnd'
  }
};
exports.EVENTS = EVENTS;
},{}],"IYCc":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = memoize;

function isEqual(a, b) {
  if (a === b) {
    return true;
  }

  if (Array.isArray(a)) {
    // Special treatment for arrays: compare 1-level deep
    // This is to support equality of matrix/coordinate props
    var len = a.length;

    if (!b || b.length !== len) {
      return false;
    }

    for (var i = 0; i < len; i++) {
      if (a[i] !== b[i]) {
        return false;
      }
    }

    return true;
  }

  return false;
}
/**
 * Speed up consecutive function calls by caching the result of calls with identical input
 * https://en.wikipedia.org/wiki/Memoization
 * @param {function} compute - the function to be memoized
 */


function memoize(compute) {
  var cachedArgs = {};
  var cachedResult;
  return function (args) {
    for (var key in args) {
      if (!isEqual(args[key], cachedArgs[key])) {
        cachedResult = compute(args);
        cachedArgs = args;
        break;
      }
    }

    return cachedResult;
  };
}
},{}],"sRS1":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = assert;

// Replacement for the external assert method to reduce bundle size
// Note: We don't use the second "message" argument in calling code,
// so no need to support it here
function assert(condition, message) {
  if (!condition) {
    throw new Error(message || 'deck.gl: assertion failed.');
  }
}
},{}],"cVdS":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getUniformsFromViewport = getUniformsFromViewport;
exports.LNGLAT_AUTO_OFFSET_ZOOM_THRESHOLD = void 0;

var mat4 = _interopRequireWildcard(require("gl-matrix/mat4"));

var vec4 = _interopRequireWildcard(require("gl-matrix/vec4"));

var _constants = require("../../lib/constants");

var _memoize = _interopRequireDefault(require("../../utils/memoize"));

var _log = _interopRequireDefault(require("../../utils/log"));

var _assert = _interopRequireDefault(require("../../utils/assert"));

var _constants2 = require("./constants");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
// To quickly set a vector to zero
var ZERO_VECTOR = [0, 0, 0, 0]; // 4x4 matrix that drops 4th component of vector

var VECTOR_TO_POINT_MATRIX = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0];
var IDENTITY_MATRIX = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
var DEFAULT_PIXELS_PER_UNIT2 = [0, 0, 0];
var DEFAULT_COORDINATE_ORIGIN = [0, 0, 0]; // Based on viewport-mercator-project/test/fp32-limits.js

var LNGLAT_AUTO_OFFSET_ZOOM_THRESHOLD = 12;
exports.LNGLAT_AUTO_OFFSET_ZOOM_THRESHOLD = LNGLAT_AUTO_OFFSET_ZOOM_THRESHOLD;
var getMemoizedViewportUniforms = (0, _memoize.default)(calculateViewportUniforms);

function getShaderCoordinateSystem(coordinateSystem) {
  switch (coordinateSystem) {
    case _constants.COORDINATE_SYSTEM.LNGLAT:
    case _constants.COORDINATE_SYSTEM.LNGLAT_EXPERIMENTAL:
    default:
      return _constants2.PROJECT_COORDINATE_SYSTEM.LNGLAT_AUTO_OFFSET;

    case _constants.COORDINATE_SYSTEM.LNGLAT_DEPRECATED:
      return _constants2.PROJECT_COORDINATE_SYSTEM.LNG_LAT;

    case _constants.COORDINATE_SYSTEM.METER_OFFSETS:
    case _constants.COORDINATE_SYSTEM.METERS:
      return _constants2.PROJECT_COORDINATE_SYSTEM.METER_OFFSETS;

    case _constants.COORDINATE_SYSTEM.LNGLAT_OFFSETS:
      return _constants2.PROJECT_COORDINATE_SYSTEM.LNGLAT_OFFSETS;

    case _constants.COORDINATE_SYSTEM.IDENTITY:
      return _constants2.PROJECT_COORDINATE_SYSTEM.IDENTITY;
  }
} // The code that utilizes Matrix4 does the same calculation as their mat4 counterparts,
// has lower performance but provides error checking.
// Uncomment when debugging


function calculateMatrixAndOffset(_ref) {
  var viewport = _ref.viewport,
      coordinateSystem = _ref.coordinateSystem,
      coordinateOrigin = _ref.coordinateOrigin,
      coordinateZoom = _ref.coordinateZoom;
  var viewMatrixUncentered = viewport.viewMatrixUncentered;
  var viewMatrix = viewport.viewMatrix;
  var projectionMatrix = viewport.projectionMatrix;
  var viewProjectionMatrix = viewport.viewProjectionMatrix;
  var projectionCenter;
  var shaderCoordinateSystem = getShaderCoordinateSystem(coordinateSystem);
  var shaderCoordinateOrigin = coordinateOrigin;

  if (shaderCoordinateSystem === _constants2.PROJECT_COORDINATE_SYSTEM.LNGLAT_AUTO_OFFSET) {
    if (coordinateZoom < LNGLAT_AUTO_OFFSET_ZOOM_THRESHOLD) {
      // Use LNG_LAT projection if not zooming
      shaderCoordinateSystem = _constants2.PROJECT_COORDINATE_SYSTEM.LNG_LAT;
    } else {
      // Use LNGLAT_AUTO_OFFSET
      var lng = Math.fround(viewport.longitude);
      var lat = Math.fround(viewport.latitude);
      shaderCoordinateOrigin = [lng, lat];
    }
  }

  switch (shaderCoordinateSystem) {
    case _constants2.PROJECT_COORDINATE_SYSTEM.IDENTITY:
    case _constants2.PROJECT_COORDINATE_SYSTEM.LNG_LAT:
      projectionCenter = ZERO_VECTOR;
      break;
    // TODO: make lighting work for meter offset mode

    case _constants2.PROJECT_COORDINATE_SYSTEM.LNGLAT_OFFSETS:
    case _constants2.PROJECT_COORDINATE_SYSTEM.METER_OFFSETS:
    case _constants2.PROJECT_COORDINATE_SYSTEM.LNGLAT_AUTO_OFFSET:
      // Calculate transformed projectionCenter (using 64 bit precision JS)
      // This is the key to offset mode precision
      // (avoids doing this addition in 32 bit precision in GLSL)
      var positionPixels = viewport.projectFlat(shaderCoordinateOrigin, Math.pow(2, coordinateZoom)); // projectionCenter = new Matrix4(viewProjectionMatrix)
      //   .transformVector([positionPixels[0], positionPixels[1], 0.0, 1.0]);

      projectionCenter = vec4.transformMat4([], [positionPixels[0], positionPixels[1], 0.0, 1.0], viewProjectionMatrix); // Always apply uncentered projection matrix if available (shader adds center)

      viewMatrix = viewMatrixUncentered || viewMatrix; // Zero out 4th coordinate ("after" model matrix) - avoids further translations
      // viewMatrix = new Matrix4(viewMatrixUncentered || viewMatrix)
      //   .multiplyRight(VECTOR_TO_POINT_MATRIX);

      viewProjectionMatrix = mat4.multiply([], projectionMatrix, viewMatrix);
      viewProjectionMatrix = mat4.multiply([], viewProjectionMatrix, VECTOR_TO_POINT_MATRIX);
      break;

    default:
      throw new Error('Unknown projection mode');
  }

  return {
    viewMatrix: viewMatrix,
    viewProjectionMatrix: viewProjectionMatrix,
    projectionCenter: projectionCenter,
    cameraPos: viewport.cameraPosition,
    shaderCoordinateSystem: shaderCoordinateSystem,
    shaderCoordinateOrigin: shaderCoordinateOrigin
  };
}
/**
 * Returns uniforms for shaders based on current projection
 * includes: projection matrix suitable for shaders
 *
 * TODO - Ensure this works with any viewport, not just WebMercatorViewports
 *
 * @param {WebMercatorViewport} viewport -
 * @return {Float32Array} - 4x4 projection matrix that can be used in shaders
 */


function getUniformsFromViewport() {
  var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
      viewport = _ref2.viewport,
      _ref2$devicePixelRati = _ref2.devicePixelRatio,
      devicePixelRatio = _ref2$devicePixelRati === void 0 ? 1 : _ref2$devicePixelRati,
      _ref2$modelMatrix = _ref2.modelMatrix,
      modelMatrix = _ref2$modelMatrix === void 0 ? null : _ref2$modelMatrix,
      _ref2$coordinateSyste = _ref2.coordinateSystem,
      coordinateSystem = _ref2$coordinateSyste === void 0 ? _constants.COORDINATE_SYSTEM.LNGLAT : _ref2$coordinateSyste,
      _ref2$coordinateOrigi = _ref2.coordinateOrigin,
      coordinateOrigin = _ref2$coordinateOrigi === void 0 ? DEFAULT_COORDINATE_ORIGIN : _ref2$coordinateOrigi,
      _ref2$wrapLongitude = _ref2.wrapLongitude,
      wrapLongitude = _ref2$wrapLongitude === void 0 ? false : _ref2$wrapLongitude,
      projectionMode = _ref2.projectionMode,
      positionOrigin = _ref2.positionOrigin;

  (0, _assert.default)(viewport);

  if (projectionMode !== undefined) {
    _log.default.removed('projectionMode', 'coordinateSystem')();
  }

  if (positionOrigin !== undefined) {
    _log.default.removed('positionOrigin', 'coordinateOrigin')();
  }

  return Object.assign({
    project_uModelMatrix: modelMatrix || IDENTITY_MATRIX
  }, getMemoizedViewportUniforms({
    viewport: viewport,
    devicePixelRatio: devicePixelRatio,
    coordinateSystem: coordinateSystem,
    coordinateOrigin: coordinateOrigin,
    wrapLongitude: wrapLongitude
  }));
}

function calculateViewportUniforms(_ref3) {
  var viewport = _ref3.viewport,
      devicePixelRatio = _ref3.devicePixelRatio,
      coordinateSystem = _ref3.coordinateSystem,
      coordinateOrigin = _ref3.coordinateOrigin,
      wrapLongitude = _ref3.wrapLongitude;
  var coordinateZoom = viewport.zoom;

  var _calculateMatrixAndOf = calculateMatrixAndOffset({
    coordinateSystem: coordinateSystem,
    coordinateOrigin: coordinateOrigin,
    coordinateZoom: coordinateZoom,
    viewport: viewport
  }),
      projectionCenter = _calculateMatrixAndOf.projectionCenter,
      viewProjectionMatrix = _calculateMatrixAndOf.viewProjectionMatrix,
      cameraPos = _calculateMatrixAndOf.cameraPos,
      shaderCoordinateSystem = _calculateMatrixAndOf.shaderCoordinateSystem,
      shaderCoordinateOrigin = _calculateMatrixAndOf.shaderCoordinateOrigin;

  (0, _assert.default)(viewProjectionMatrix, 'Viewport missing modelViewProjectionMatrix'); // Calculate projection pixels per unit

  var distanceScales = viewport.getDistanceScales();
  var viewportSize = [viewport.width * devicePixelRatio, viewport.height * devicePixelRatio];
  var uniforms = {
    // Projection mode values
    project_uCoordinateSystem: shaderCoordinateSystem,
    project_uCenter: projectionCenter,
    project_uWrapLongitude: wrapLongitude,
    project_uAntimeridian: (viewport.longitude || 0) - 180,
    // Screen size
    project_uViewportSize: viewportSize,
    project_uDevicePixelRatio: devicePixelRatio,
    // Distance at which screen pixels are projected
    project_uFocalDistance: viewport.focalDistance || 1,
    project_uPixelsPerMeter: distanceScales.pixelsPerMeter,
    project_uPixelsPerDegree: distanceScales.pixelsPerDegree,
    project_uPixelsPerUnit: distanceScales.pixelsPerMeter,
    project_uPixelsPerUnit2: DEFAULT_PIXELS_PER_UNIT2,
    project_uScale: viewport.scale,
    // This is the mercator scale (2 ** zoom)
    project_uViewProjectionMatrix: viewProjectionMatrix,
    // This is for lighting calculations
    project_uCameraPosition: cameraPos
  };
  var distanceScalesAtOrigin = viewport.getDistanceScales(shaderCoordinateOrigin);

  switch (shaderCoordinateSystem) {
    case _constants2.PROJECT_COORDINATE_SYSTEM.METER_OFFSETS:
      uniforms.project_uPixelsPerUnit = distanceScalesAtOrigin.pixelsPerMeter;
      uniforms.project_uPixelsPerUnit2 = distanceScalesAtOrigin.pixelsPerMeter2;
      break;

    case _constants2.PROJECT_COORDINATE_SYSTEM.LNGLAT_AUTO_OFFSET:
      uniforms.project_coordinate_origin = shaderCoordinateOrigin;
    // eslint-disable-line no-fallthrough

    case _constants2.PROJECT_COORDINATE_SYSTEM.LNGLAT_OFFSETS:
      uniforms.project_uPixelsPerUnit = distanceScalesAtOrigin.pixelsPerDegree;
      uniforms.project_uPixelsPerUnit2 = distanceScalesAtOrigin.pixelsPerDegree2;
      break;

    default:
      break;
  }

  return uniforms;
}
},{"gl-matrix/mat4":"Nd3D","gl-matrix/vec4":"i3i1","../../lib/constants":"GfMx","../../utils/memoize":"IYCc","../../utils/log":"q39U","../../utils/assert":"sRS1","./constants":"DmRv"}],"LUEV":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _luma = require("luma.gl");

var _project = _interopRequireDefault(require("./project.glsl"));

var _viewportUniforms = require("./viewport-uniforms");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var INITIAL_MODULE_OPTIONS = {};

function getUniforms() {
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INITIAL_MODULE_OPTIONS;

  if (opts.viewport) {
    return (0, _viewportUniforms.getUniformsFromViewport)(opts);
  }

  return {};
}

var _default = {
  name: 'project',
  dependencies: [_luma.fp32],
  vs: _project.default,
  getUniforms: getUniforms,
  deprecations: [// Removed custom picking uinforms
  // These don't really belong here but we need to check them for all shaders
  // the project module is by default included for all
  {
    type: 'uniform vec3',
    old: 'selectedPickingColor',
    new: "luma.gl's picking module"
  }, {
    type: 'uniform float',
    old: 'renderPickingBuffer',
    new: "luma.gl's picking module"
  }, {
    type: 'uniform float',
    old: 'pickingEnabled',
    new: "luma.gl's picking module"
  }, // Removed project uniforms
  {
    type: 'uniform float',
    old: 'projectionMode',
    new: 'project_uCoordinateSystem'
  }, {
    type: 'uniform vec4',
    old: 'projectionCenter',
    new: 'project_uCenter'
  }, {
    type: 'uniform vec2',
    old: 'projectionOrigin'
  }, {
    type: 'uniform mat4',
    old: 'modelMatrix',
    new: 'project_uModelMatrix'
  }, {
    type: 'uniform mat4',
    old: 'viewMatrix'
  }, {
    type: 'uniform mat4',
    old: 'projectionMatrix',
    new: 'project_uViewProjectionMatrix'
  }, {
    type: 'uniform vec3',
    old: 'projectionPixelsPerUnit',
    new: 'project_uPixelsPerUnit'
  }, {
    type: 'uniform float',
    old: 'projectionScale',
    new: 'project_uScale'
  }, {
    type: 'uniform vec2',
    old: 'viewportSize',
    new: 'project_uViewportSize'
  }, {
    type: 'uniform float',
    old: 'devicePixelRatio',
    new: 'project_uDevicePixelRatio'
  }, {
    type: 'uniform vec3',
    old: 'cameraPos',
    new: 'project_uCameraPosition'
  }, // Removed project functions
  {
    type: 'function',
    old: 'scale',
    new: 'project_scale'
  }, {
    type: 'function',
    old: 'preproject',
    new: 'project_position'
  }, {
    type: 'function',
    old: 'project',
    new: 'project_to_clipspace'
  }]
};
exports.default = _default;
},{"luma.gl":"GAQa","./project.glsl":"FKfJ","./viewport-uniforms":"cVdS"}],"wwLN":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _project = _interopRequireDefault(require("../project/project"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var vs = "\nvec4 project_position_to_clipspace(\n  vec3 position, vec2 position64xyLow, vec3 offset, out vec4 worldPosition\n) {\n  vec3 projectedPosition = project_position(position, position64xyLow);\n  worldPosition = vec4(projectedPosition + offset, 1.0);\n  return project_to_clipspace(worldPosition);\n}\n\nvec4 project_position_to_clipspace(\n  vec3 position, vec2 position64xyLow, vec3 offset\n) {\n  vec4 worldPosition;\n  return project_position_to_clipspace(position, position64xyLow, offset, worldPosition);\n}\n";
var _default = {
  name: 'project32',
  dependencies: [_project.default],
  vs: vs
};
exports.default = _default;
},{"../project/project":"LUEV"}],"FSf7":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var _default = "\nconst vec2 WORLD_SCALE_FP64 = vec2(81.4873275756836, 0.0000032873668232014097);\n\nuniform vec2 project64_uScale;\nuniform vec2 project_uViewProjectionMatrixFP64[16];\n\n// longitude: lnglat_fp64.xy; latitude: lnglat_fp64.zw\nvoid mercatorProject_fp64(vec4 lnglat_fp64, out vec2 out_val[2]) {\n\n#if defined(NVIDIA_FP64_WORKAROUND)\n  out_val[0] = sum_fp64(radians_fp64(lnglat_fp64.xy), PI_FP64 * ONE);\n#else\n  out_val[0] = sum_fp64(radians_fp64(lnglat_fp64.xy), PI_FP64);\n#endif\n  out_val[1] = sub_fp64(PI_FP64,\n    log_fp64(tan_fp64(sum_fp64(PI_4_FP64, radians_fp64(lnglat_fp64.zw) / 2.0))));\n  return;\n}\n\nvoid project_position_fp64(vec4 position_fp64, out vec2 out_val[2]) {\n  vec2 pos_fp64[2];\n  mercatorProject_fp64(position_fp64, pos_fp64);\n  vec2 x_fp64 = mul_fp64(pos_fp64[0], project64_uScale);\n  vec2 y_fp64 = mul_fp64(pos_fp64[1], project64_uScale);\n  out_val[0] = mul_fp64(x_fp64, WORLD_SCALE_FP64);\n  out_val[1] = mul_fp64(y_fp64, WORLD_SCALE_FP64);\n\n  return;\n}\n\nvoid project_position_fp64(vec2 position, vec2 position64xyLow, out vec2 out_val[2]) {\n  vec4 position64xy = vec4(\n    position.x, position64xyLow.x,\n    position.y, position64xyLow.y);\n\n  project_position_fp64(position64xy, out_val);\n}\n\nvec4 project_to_clipspace_fp64(vec2 vertex_pos_modelspace[4]) {\n  vec2 vertex_pos_clipspace[4];\n  mat4_vec4_mul_fp64(project_uViewProjectionMatrixFP64, vertex_pos_modelspace,\n    vertex_pos_clipspace);\n  return vec4(\n    vertex_pos_clipspace[0].x,\n    vertex_pos_clipspace[1].x,\n    vertex_pos_clipspace[2].x,\n    vertex_pos_clipspace[3].x\n    );\n}\n\nvec4 project_position_to_clipspace(\n  vec3 position, vec2 position64xyLow, vec3 offset, out vec4 worldPosition\n) {\n  // This is the local offset to the instance position\n  vec2 offset64[4];\n  vec4_fp64(vec4(offset, 0.0), offset64);\n\n  float z = project_scale(position.z);\n\n  // Apply web mercator projection (depends on coordinate system imn use)\n  vec2 projectedPosition64xy[2];\n  project_position_fp64(position.xy, position64xyLow, projectedPosition64xy);\n\n  vec2 worldPosition64[4];\n  worldPosition64[0] = sum_fp64(offset64[0], projectedPosition64xy[0]);\n  worldPosition64[1] = sum_fp64(offset64[1], projectedPosition64xy[1]);\n  worldPosition64[2] = sum_fp64(offset64[2], vec2(z, 0.0));\n  worldPosition64[3] = vec2(1.0, 0.0);\n\n  worldPosition = vec4(projectedPosition64xy[0].x, projectedPosition64xy[1].x, z, 1.0);\n\n  return project_to_clipspace_fp64(worldPosition64);\n}\n\nvec4 project_position_to_clipspace(\n  vec3 position, vec2 position64xyLow, vec3 offset\n) {\n  vec4 worldPosition;\n  return project_position_to_clipspace(\n    position, position64xyLow, offset, worldPosition\n  );\n}\n";
exports.default = _default;
},{}],"v9HK":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _luma = require("luma.gl");

var _project = _interopRequireDefault(require("../project/project"));

var _memoize = _interopRequireDefault(require("../../utils/memoize"));

var _project2 = _interopRequireDefault(require("./project64.glsl"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var fp64ify = _luma.fp64.fp64ify,
    fp64ifyMatrix4 = _luma.fp64.fp64ifyMatrix4;
var _default = {
  name: 'project64',
  dependencies: [_project.default, _luma.fp64],
  vs: _project2.default,
  getUniforms: getUniforms,
  deprecations: [{
    type: 'uniform vec2',
    old: 'projectionFP64[16]',
    new: 'project_uViewProjectionMatrixFP64'
  }, {
    type: 'uniform vec2',
    old: 'projectionScaleFP64',
    new: 'project64_uScale'
  }]
}; // TODO - this module should calculate the 64 bit uniforms
// It is currently done by project to minimize duplicated work

exports.default = _default;
var DEFAULT_MODULE_OPTIONS = {};
var getMemoizedUniforms = (0, _memoize.default)(calculateUniforms);

function getUniforms() {
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_MODULE_OPTIONS;
  var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; // These two uniforms are generated by the fp32 project module

  var project_uViewProjectionMatrix = context.project_uViewProjectionMatrix,
      project_uScale = context.project_uScale;

  if (project_uViewProjectionMatrix && project_uScale) {
    // We only need to update fp64 uniforms if fp32 projection is being updated
    return getMemoizedUniforms({
      project_uViewProjectionMatrix: project_uViewProjectionMatrix,
      project_uScale: project_uScale
    });
  }

  return {};
}

function calculateUniforms(_ref) {
  var project_uViewProjectionMatrix = _ref.project_uViewProjectionMatrix,
      project_uScale = _ref.project_uScale;
  var glViewProjectionMatrixFP64 = fp64ifyMatrix4(project_uViewProjectionMatrix);
  var scaleFP64 = fp64ify(project_uScale);
  return {
    project_uViewProjectionMatrixFP64: glViewProjectionMatrixFP64,
    project64_uViewProjectionMatrix: glViewProjectionMatrixFP64,
    project64_uScale: scaleFP64
  };
}
},{"luma.gl":"GAQa","../project/project":"LUEV","../../utils/memoize":"IYCc","./project64.glsl":"FSf7"}],"Pygi":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
// lighting
var _default = "#define MAX_NUM_OF_LIGHTS 5\n\n// TODO these should be using lighting_ prefix\nuniform vec3 lighting_lightPositions[MAX_NUM_OF_LIGHTS];\nuniform vec2 lighting_lightStrengths[MAX_NUM_OF_LIGHTS];\nuniform float lighting_ambientRatio;\nuniform float lighting_diffuseRatio;\nuniform float lighting_specularRatio;\nuniform int lighting_numberOfLights;\n\nfloat lighting_getLightWeight(vec3 position_worldspace_vec3, vec3 normals_worldspace) {\n  float lightWeight = 0.0;\n\n  vec3 normals_worldspace_vec3 = normals_worldspace.xyz;\n\n  vec3 camera_pos_worldspace = project_uCameraPosition;\n  vec3 view_direction = normalize(camera_pos_worldspace - position_worldspace_vec3);\n\n  for (int i = 0; i < MAX_NUM_OF_LIGHTS; i++) {\n    if (i >= lighting_numberOfLights) {\n      break;\n    }\n    vec3 light_position_worldspace = lighting_lightPositions[i];\n    vec3 light_direction = normalize(light_position_worldspace - position_worldspace_vec3);\n\n    vec3 halfway_direction = normalize(light_direction + view_direction);\n    float lambertian = dot(light_direction, normals_worldspace_vec3);\n    float specular = 0.0;\n    if (lambertian > 0.0) {\n      float specular_angle = max(dot(normals_worldspace_vec3, halfway_direction), 0.0);\n      specular = pow(specular_angle, 32.0);\n    }\n    lambertian = max(lambertian, 0.0);\n    lightWeight += (lighting_ambientRatio + lambertian * lighting_diffuseRatio + specular * lighting_specularRatio) *\n      lighting_lightStrengths[i].x;\n  }\n\n  return lightWeight;\n}\n\n// DEPRECATED - Backwards compatibility\n\nfloat getLightWeight(vec3 position_worldspace_vec3, vec3 normals_worldspace) {\n  return lighting_getLightWeight(position_worldspace_vec3, normals_worldspace);\n}\n";
exports.default = _default;
},{}],"YXeS":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.createMat4 = createMat4;
exports.transformVector = transformVector;
exports.mod = mod;
exports.lerp = lerp;

var vec4 = _interopRequireWildcard(require("gl-matrix/vec4"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function createMat4() {
  return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
}

function transformVector(matrix, vector) {
  var result = vec4.transformMat4([], vector, matrix);
  vec4.scale(result, result, 1 / result[3]);
  return result;
}

function mod(value, divisor) {
  var modulus = value % divisor;
  return modulus < 0 ? divisor + modulus : modulus;
}

function lerp(start, end, step) {
  return step * end + (1 - step) * start;
}
},{"gl-matrix/vec4":"i3i1"}],"AiuT":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = assert;

function assert(condition, message) {
  if (!condition) {
    throw new Error(message || 'viewport-mercator-project: assertion failed.');
  }
}
},{}],"mG7W":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.zoomToScale = zoomToScale;
exports.scaleToZoom = scaleToZoom;
exports.lngLatToWorld = lngLatToWorld;
exports.worldToLngLat = worldToLngLat;
exports.getMeterZoom = getMeterZoom;
exports.getDistanceScales = getDistanceScales;
exports.addMetersToLngLat = addMetersToLngLat;
exports.getViewMatrix = getViewMatrix;
exports.getProjectionParameters = getProjectionParameters;
exports.getProjectionMatrix = getProjectionMatrix;
exports.worldToPixels = worldToPixels;
exports.pixelsToWorld = pixelsToWorld;

var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));

var _mathUtils = require("./math-utils");

var mat4 = _interopRequireWildcard(require("gl-matrix/mat4"));

var vec2 = _interopRequireWildcard(require("gl-matrix/vec2"));

var vec3 = _interopRequireWildcard(require("gl-matrix/vec3"));

var _assert = _interopRequireDefault(require("./assert"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var PI = Math.PI;
var PI_4 = PI / 4;
var DEGREES_TO_RADIANS = PI / 180;
var RADIANS_TO_DEGREES = 180 / PI;
var TILE_SIZE = 512;
var EARTH_CIRCUMFERENCE = 40.03e6;
var DEFAULT_ALTITUDE = 1.5;

function zoomToScale(zoom) {
  return Math.pow(2, zoom);
}

function scaleToZoom(scale) {
  return Math.log2(scale);
}

function lngLatToWorld(_ref, scale) {
  var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
      lng = _ref2[0],
      lat = _ref2[1];

  (0, _assert.default)(Number.isFinite(lng) && Number.isFinite(scale));
  (0, _assert.default)(Number.isFinite(lat) && lat >= -90 && lat <= 90, 'invalid latitude');
  scale *= TILE_SIZE;
  var lambda2 = lng * DEGREES_TO_RADIANS;
  var phi2 = lat * DEGREES_TO_RADIANS;
  var x = scale * (lambda2 + PI) / (2 * PI);
  var y = scale * (PI - Math.log(Math.tan(PI_4 + phi2 * 0.5))) / (2 * PI);
  return [x, y];
}

function worldToLngLat(_ref3, scale) {
  var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
      x = _ref4[0],
      y = _ref4[1];

  scale *= TILE_SIZE;
  var lambda2 = x / scale * (2 * PI) - PI;
  var phi2 = 2 * (Math.atan(Math.exp(PI - y / scale * (2 * PI))) - PI_4);
  return [lambda2 * RADIANS_TO_DEGREES, phi2 * RADIANS_TO_DEGREES];
}

function getMeterZoom(_ref5) {
  var latitude = _ref5.latitude;
  (0, _assert.default)(Number.isFinite(latitude));
  var latCosine = Math.cos(latitude * DEGREES_TO_RADIANS);
  return scaleToZoom(EARTH_CIRCUMFERENCE * latCosine) - 9;
}

function getDistanceScales(_ref6) {
  var latitude = _ref6.latitude,
      longitude = _ref6.longitude,
      zoom = _ref6.zoom,
      scale = _ref6.scale,
      _ref6$highPrecision = _ref6.highPrecision,
      highPrecision = _ref6$highPrecision === void 0 ? false : _ref6$highPrecision;
  scale = scale !== undefined ? scale : zoomToScale(zoom);
  (0, _assert.default)(Number.isFinite(latitude) && Number.isFinite(longitude) && Number.isFinite(scale));
  var result = {};
  var worldSize = TILE_SIZE * scale;
  var latCosine = Math.cos(latitude * DEGREES_TO_RADIANS);
  var pixelsPerDegreeX = worldSize / 360;
  var pixelsPerDegreeY = pixelsPerDegreeX / latCosine;
  var altPixelsPerMeter = worldSize / EARTH_CIRCUMFERENCE / latCosine;
  result.pixelsPerMeter = [altPixelsPerMeter, -altPixelsPerMeter, altPixelsPerMeter];
  result.metersPerPixel = [1 / altPixelsPerMeter, -1 / altPixelsPerMeter, 1 / altPixelsPerMeter];
  result.pixelsPerDegree = [pixelsPerDegreeX, -pixelsPerDegreeY, altPixelsPerMeter];
  result.degreesPerPixel = [1 / pixelsPerDegreeX, -1 / pixelsPerDegreeY, 1 / altPixelsPerMeter];

  if (highPrecision) {
    var latCosine2 = DEGREES_TO_RADIANS * Math.tan(latitude * DEGREES_TO_RADIANS) / latCosine;
    var pixelsPerDegreeY2 = pixelsPerDegreeX * latCosine2 / 2;
    var altPixelsPerDegree2 = worldSize / EARTH_CIRCUMFERENCE * latCosine2;
    var altPixelsPerMeter2 = altPixelsPerDegree2 / pixelsPerDegreeY * altPixelsPerMeter;
    result.pixelsPerDegree2 = [0, -pixelsPerDegreeY2, altPixelsPerDegree2];
    result.pixelsPerMeter2 = [altPixelsPerMeter2, 0, altPixelsPerMeter2];
  }

  return result;
}

function addMetersToLngLat(lngLatZ, xyz) {
  var _lngLatZ = (0, _slicedToArray2.default)(lngLatZ, 3),
      longitude = _lngLatZ[0],
      latitude = _lngLatZ[1],
      z0 = _lngLatZ[2];

  var _xyz = (0, _slicedToArray2.default)(xyz, 3),
      x = _xyz[0],
      y = _xyz[1],
      z = _xyz[2];

  var scale = 1;

  var _getDistanceScales = getDistanceScales({
    longitude: longitude,
    latitude: latitude,
    scale: scale,
    highPrecision: true
  }),
      pixelsPerMeter = _getDistanceScales.pixelsPerMeter,
      pixelsPerMeter2 = _getDistanceScales.pixelsPerMeter2;

  var worldspace = lngLatToWorld(lngLatZ, scale);
  worldspace[0] += x * (pixelsPerMeter[0] + pixelsPerMeter2[0] * y);
  worldspace[1] += y * (pixelsPerMeter[1] + pixelsPerMeter2[1] * y);
  var newLngLat = worldToLngLat(worldspace, scale);
  var newZ = (z0 || 0) + (z || 0);
  return Number.isFinite(z0) || Number.isFinite(z) ? [newLngLat[0], newLngLat[1], newZ] : newLngLat;
}

function getViewMatrix(_ref7) {
  var height = _ref7.height,
      pitch = _ref7.pitch,
      bearing = _ref7.bearing,
      altitude = _ref7.altitude,
      _ref7$center = _ref7.center,
      center = _ref7$center === void 0 ? null : _ref7$center,
      _ref7$flipY = _ref7.flipY,
      flipY = _ref7$flipY === void 0 ? false : _ref7$flipY;
  var vm = (0, _mathUtils.createMat4)();
  mat4.translate(vm, vm, [0, 0, -altitude]);
  mat4.scale(vm, vm, [1, 1, 1 / height]);
  mat4.rotateX(vm, vm, -pitch * DEGREES_TO_RADIANS);
  mat4.rotateZ(vm, vm, bearing * DEGREES_TO_RADIANS);

  if (flipY) {
    mat4.scale(vm, vm, [1, -1, 1]);
  }

  if (center) {
    mat4.translate(vm, vm, vec3.negate([], center));
  }

  return vm;
}

function getProjectionParameters(_ref8) {
  var width = _ref8.width,
      height = _ref8.height,
      _ref8$altitude = _ref8.altitude,
      altitude = _ref8$altitude === void 0 ? DEFAULT_ALTITUDE : _ref8$altitude,
      _ref8$pitch = _ref8.pitch,
      pitch = _ref8$pitch === void 0 ? 0 : _ref8$pitch,
      _ref8$nearZMultiplier = _ref8.nearZMultiplier,
      nearZMultiplier = _ref8$nearZMultiplier === void 0 ? 1 : _ref8$nearZMultiplier,
      _ref8$farZMultiplier = _ref8.farZMultiplier,
      farZMultiplier = _ref8$farZMultiplier === void 0 ? 1 : _ref8$farZMultiplier;
  var pitchRadians = pitch * DEGREES_TO_RADIANS;
  var halfFov = Math.atan(0.5 / altitude);
  var topHalfSurfaceDistance = Math.sin(halfFov) * altitude / Math.sin(Math.PI / 2 - pitchRadians - halfFov);
  var farZ = Math.cos(Math.PI / 2 - pitchRadians) * topHalfSurfaceDistance + altitude;
  return {
    fov: 2 * Math.atan(height / 2 / altitude),
    aspect: width / height,
    focalDistance: altitude,
    near: nearZMultiplier,
    far: farZ * farZMultiplier
  };
}

function getProjectionMatrix(_ref9) {
  var width = _ref9.width,
      height = _ref9.height,
      pitch = _ref9.pitch,
      altitude = _ref9.altitude,
      nearZMultiplier = _ref9.nearZMultiplier,
      farZMultiplier = _ref9.farZMultiplier;

  var _getProjectionParamet = getProjectionParameters({
    width: width,
    height: height,
    altitude: altitude,
    pitch: pitch,
    nearZMultiplier: nearZMultiplier,
    farZMultiplier: farZMultiplier
  }),
      fov = _getProjectionParamet.fov,
      aspect = _getProjectionParamet.aspect,
      near = _getProjectionParamet.near,
      far = _getProjectionParamet.far;

  var projectionMatrix = mat4.perspective([], fov, aspect, near, far);
  return projectionMatrix;
}

function worldToPixels(xyz, pixelProjectionMatrix) {
  var _xyz2 = (0, _slicedToArray2.default)(xyz, 3),
      x = _xyz2[0],
      y = _xyz2[1],
      _xyz2$ = _xyz2[2],
      z = _xyz2$ === void 0 ? 0 : _xyz2$;

  (0, _assert.default)(Number.isFinite(x) && Number.isFinite(y) && Number.isFinite(z));
  return (0, _mathUtils.transformVector)(pixelProjectionMatrix, [x, y, z, 1]);
}

function pixelsToWorld(xyz, pixelUnprojectionMatrix) {
  var targetZ = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;

  var _xyz3 = (0, _slicedToArray2.default)(xyz, 3),
      x = _xyz3[0],
      y = _xyz3[1],
      z = _xyz3[2];

  (0, _assert.default)(Number.isFinite(x) && Number.isFinite(y), 'invalid pixel coordinate');

  if (Number.isFinite(z)) {
    var coord = (0, _mathUtils.transformVector)(pixelUnprojectionMatrix, [x, y, z, 1]);
    return coord;
  }

  var coord0 = (0, _mathUtils.transformVector)(pixelUnprojectionMatrix, [x, y, 0, 1]);
  var coord1 = (0, _mathUtils.transformVector)(pixelUnprojectionMatrix, [x, y, 1, 1]);
  var z0 = coord0[2];
  var z1 = coord1[2];
  var t = z0 === z1 ? 0 : ((targetZ || 0) - z0) / (z1 - z0);
  return vec2.lerp([], coord0, coord1, t);
}
},{"@babel/runtime/helpers/esm/slicedToArray":"U1JK","./math-utils":"YXeS","gl-matrix/mat4":"Nd3D","gl-matrix/vec2":"iP3z","gl-matrix/vec3":"vuBh","./assert":"AiuT"}],"lofO":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _mathUtils = require("./math-utils");

var _webMercatorUtils = require("./web-mercator-utils");

var mat4 = _interopRequireWildcard(require("gl-matrix/mat4"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var IDENTITY = (0, _mathUtils.createMat4)();

var Viewport = function () {
  function Viewport() {
    var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
        width = _ref.width,
        height = _ref.height,
        _ref$viewMatrix = _ref.viewMatrix,
        viewMatrix = _ref$viewMatrix === void 0 ? IDENTITY : _ref$viewMatrix,
        _ref$projectionMatrix = _ref.projectionMatrix,
        projectionMatrix = _ref$projectionMatrix === void 0 ? IDENTITY : _ref$projectionMatrix;

    (0, _classCallCheck2.default)(this, Viewport);
    this.width = width || 1;
    this.height = height || 1;
    this.scale = 1;
    this.pixelsPerMeter = 1;
    this.viewMatrix = viewMatrix;
    this.projectionMatrix = projectionMatrix;
    var vpm = (0, _mathUtils.createMat4)();
    mat4.multiply(vpm, vpm, this.projectionMatrix);
    mat4.multiply(vpm, vpm, this.viewMatrix);
    this.viewProjectionMatrix = vpm;
    var m = (0, _mathUtils.createMat4)();
    mat4.scale(m, m, [this.width / 2, -this.height / 2, 1]);
    mat4.translate(m, m, [1, -1, 0]);
    mat4.multiply(m, m, this.viewProjectionMatrix);
    var mInverse = mat4.invert((0, _mathUtils.createMat4)(), m);

    if (!mInverse) {
      throw new Error('Pixel project matrix not invertible');
    }

    this.pixelProjectionMatrix = m;
    this.pixelUnprojectionMatrix = mInverse;
    this.equals = this.equals.bind(this);
    this.project = this.project.bind(this);
    this.unproject = this.unproject.bind(this);
    this.projectPosition = this.projectPosition.bind(this);
    this.unprojectPosition = this.unprojectPosition.bind(this);
    this.projectFlat = this.projectFlat.bind(this);
    this.unprojectFlat = this.unprojectFlat.bind(this);
  }

  (0, _createClass2.default)(Viewport, [{
    key: "equals",
    value: function equals(viewport) {
      if (!(viewport instanceof Viewport)) {
        return false;
      }

      return viewport.width === this.width && viewport.height === this.height && mat4.equals(viewport.projectionMatrix, this.projectionMatrix) && mat4.equals(viewport.viewMatrix, this.viewMatrix);
    }
  }, {
    key: "project",
    value: function project(xyz) {
      var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
          _ref2$topLeft = _ref2.topLeft,
          topLeft = _ref2$topLeft === void 0 ? true : _ref2$topLeft;

      var worldPosition = this.projectPosition(xyz);
      var coord = (0, _webMercatorUtils.worldToPixels)(worldPosition, this.pixelProjectionMatrix);

      var _coord = (0, _slicedToArray2.default)(coord, 2),
          x = _coord[0],
          y = _coord[1];

      var y2 = topLeft ? y : this.height - y;
      return xyz.length === 2 ? [x, y2] : [x, y2, coord[2]];
    }
  }, {
    key: "unproject",
    value: function unproject(xyz) {
      var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
          _ref3$topLeft = _ref3.topLeft,
          topLeft = _ref3$topLeft === void 0 ? true : _ref3$topLeft,
          targetZ = _ref3.targetZ;

      var _xyz = (0, _slicedToArray2.default)(xyz, 3),
          x = _xyz[0],
          y = _xyz[1],
          z = _xyz[2];

      var y2 = topLeft ? y : this.height - y;
      var targetZWorld = targetZ && targetZ * this.pixelsPerMeter;
      var coord = (0, _webMercatorUtils.pixelsToWorld)([x, y2, z], this.pixelUnprojectionMatrix, targetZWorld);

      var _this$unprojectPositi = this.unprojectPosition(coord),
          _this$unprojectPositi2 = (0, _slicedToArray2.default)(_this$unprojectPositi, 3),
          X = _this$unprojectPositi2[0],
          Y = _this$unprojectPositi2[1],
          Z = _this$unprojectPositi2[2];

      if (Number.isFinite(z)) {
        return [X, Y, Z];
      }

      return Number.isFinite(targetZ) ? [X, Y, targetZ] : [X, Y];
    }
  }, {
    key: "projectPosition",
    value: function projectPosition(xyz) {
      var _this$projectFlat = this.projectFlat(xyz),
          _this$projectFlat2 = (0, _slicedToArray2.default)(_this$projectFlat, 2),
          X = _this$projectFlat2[0],
          Y = _this$projectFlat2[1];

      var Z = (xyz[2] || 0) * this.pixelsPerMeter;
      return [X, Y, Z];
    }
  }, {
    key: "unprojectPosition",
    value: function unprojectPosition(xyz) {
      var _this$unprojectFlat = this.unprojectFlat(xyz),
          _this$unprojectFlat2 = (0, _slicedToArray2.default)(_this$unprojectFlat, 2),
          X = _this$unprojectFlat2[0],
          Y = _this$unprojectFlat2[1];

      var Z = (xyz[2] || 0) / this.pixelsPerMeter;
      return [X, Y, Z];
    }
  }, {
    key: "projectFlat",
    value: function projectFlat(xyz) {
      var scale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.scale;
      return xyz;
    }
  }, {
    key: "unprojectFlat",
    value: function unprojectFlat(xyz) {
      var scale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.scale;
      return xyz;
    }
  }]);
  return Viewport;
}();

exports.default = Viewport;
},{"@babel/runtime/helpers/esm/slicedToArray":"U1JK","@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","./math-utils":"YXeS","./web-mercator-utils":"mG7W","gl-matrix/mat4":"Nd3D"}],"zFfS":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = fitBounds;

var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));

var _webMercatorViewport = _interopRequireDefault(require("./web-mercator-viewport"));

var _assert = _interopRequireDefault(require("./assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function fitBounds(_ref) {
  var width = _ref.width,
      height = _ref.height,
      bounds = _ref.bounds,
      _ref$minExtent = _ref.minExtent,
      minExtent = _ref$minExtent === void 0 ? 0 : _ref$minExtent,
      _ref$maxZoom = _ref.maxZoom,
      maxZoom = _ref$maxZoom === void 0 ? 24 : _ref$maxZoom,
      _ref$padding = _ref.padding,
      padding = _ref$padding === void 0 ? 0 : _ref$padding,
      _ref$offset = _ref.offset,
      offset = _ref$offset === void 0 ? [0, 0] : _ref$offset;

  var _bounds = (0, _slicedToArray2.default)(bounds, 2),
      _bounds$ = (0, _slicedToArray2.default)(_bounds[0], 2),
      west = _bounds$[0],
      south = _bounds$[1],
      _bounds$2 = (0, _slicedToArray2.default)(_bounds[1], 2),
      east = _bounds$2[0],
      north = _bounds$2[1];

  if (Number.isFinite(padding)) {
    var p = padding;
    padding = {
      top: p,
      bottom: p,
      left: p,
      right: p
    };
  } else {
    (0, _assert.default)(Number.isFinite(padding.top) && Number.isFinite(padding.bottom) && Number.isFinite(padding.left) && Number.isFinite(padding.right));
  }

  var viewport = new _webMercatorViewport.default({
    width: width,
    height: height,
    longitude: 0,
    latitude: 0,
    zoom: 0
  });
  var nw = viewport.project([west, north]);
  var se = viewport.project([east, south]);
  var size = [Math.max(Math.abs(se[0] - nw[0]), minExtent), Math.max(Math.abs(se[1] - nw[1]), minExtent)];
  var targetSize = [width - padding.left - padding.right - Math.abs(offset[0]) * 2, height - padding.top - padding.bottom - Math.abs(offset[1]) * 2];
  (0, _assert.default)(targetSize[0] > 0 && targetSize[1] > 0);
  var scaleX = targetSize[0] / size[0];
  var scaleY = targetSize[1] / size[1];
  var offsetX = (padding.right - padding.left) / 2 / scaleX;
  var offsetY = (padding.bottom - padding.top) / 2 / scaleY;
  var center = [(se[0] + nw[0]) / 2 + offsetX, (se[1] + nw[1]) / 2 + offsetY];
  var centerLngLat = viewport.unproject(center);
  var zoom = viewport.zoom + Math.log2(Math.abs(Math.min(scaleX, scaleY)));
  return {
    longitude: centerLngLat[0],
    latitude: centerLngLat[1],
    zoom: Math.min(zoom, maxZoom)
  };
}
},{"@babel/runtime/helpers/esm/slicedToArray":"U1JK","./web-mercator-viewport":"BxsL","./assert":"AiuT"}],"BxsL":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));

var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/assertThisInitialized"));

var _viewport = _interopRequireDefault(require("./viewport"));

var _webMercatorUtils = require("./web-mercator-utils");

var _fitBounds3 = _interopRequireDefault(require("./fit-bounds"));

var vec2 = _interopRequireWildcard(require("gl-matrix/vec2"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var WebMercatorViewport = function (_Viewport) {
  (0, _inherits2.default)(WebMercatorViewport, _Viewport);

  function WebMercatorViewport() {
    var _this;

    var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
        width = _ref.width,
        height = _ref.height,
        _ref$latitude = _ref.latitude,
        latitude = _ref$latitude === void 0 ? 0 : _ref$latitude,
        _ref$longitude = _ref.longitude,
        longitude = _ref$longitude === void 0 ? 0 : _ref$longitude,
        _ref$zoom = _ref.zoom,
        zoom = _ref$zoom === void 0 ? 0 : _ref$zoom,
        _ref$pitch = _ref.pitch,
        pitch = _ref$pitch === void 0 ? 0 : _ref$pitch,
        _ref$bearing = _ref.bearing,
        bearing = _ref$bearing === void 0 ? 0 : _ref$bearing,
        _ref$altitude = _ref.altitude,
        altitude = _ref$altitude === void 0 ? 1.5 : _ref$altitude,
        nearZMultiplier = _ref.nearZMultiplier,
        farZMultiplier = _ref.farZMultiplier;

    (0, _classCallCheck2.default)(this, WebMercatorViewport);
    width = width || 1;
    height = height || 1;
    var scale = (0, _webMercatorUtils.zoomToScale)(zoom);
    altitude = Math.max(0.75, altitude);
    var center = (0, _webMercatorUtils.lngLatToWorld)([longitude, latitude], scale);
    center[2] = 0;
    var projectionMatrix = (0, _webMercatorUtils.getProjectionMatrix)({
      width: width,
      height: height,
      pitch: pitch,
      bearing: bearing,
      altitude: altitude,
      nearZMultiplier: nearZMultiplier || 1 / height,
      farZMultiplier: farZMultiplier || 1.01
    });
    var viewMatrix = (0, _webMercatorUtils.getViewMatrix)({
      height: height,
      center: center,
      pitch: pitch,
      bearing: bearing,
      altitude: altitude,
      flipY: true
    });
    _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(WebMercatorViewport).call(this, {
      width: width,
      height: height,
      viewMatrix: viewMatrix,
      projectionMatrix: projectionMatrix
    }));
    _this.latitude = latitude;
    _this.longitude = longitude;
    _this.zoom = zoom;
    _this.pitch = pitch;
    _this.bearing = bearing;
    _this.altitude = altitude;
    _this.scale = scale;
    _this.center = center;
    _this.pixelsPerMeter = (0, _webMercatorUtils.getDistanceScales)((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this))).pixelsPerMeter[2];
    Object.freeze((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
    return _this;
  }

  (0, _createClass2.default)(WebMercatorViewport, [{
    key: "projectFlat",
    value: function projectFlat(lngLat) {
      var scale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.scale;
      return (0, _webMercatorUtils.lngLatToWorld)(lngLat, scale);
    }
  }, {
    key: "unprojectFlat",
    value: function unprojectFlat(xy) {
      var scale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.scale;
      return (0, _webMercatorUtils.worldToLngLat)(xy, scale);
    }
  }, {
    key: "getMapCenterByLngLatPosition",
    value: function getMapCenterByLngLatPosition(_ref2) {
      var lngLat = _ref2.lngLat,
          pos = _ref2.pos;
      var fromLocation = (0, _webMercatorUtils.pixelsToWorld)(pos, this.pixelUnprojectionMatrix);
      var toLocation = (0, _webMercatorUtils.lngLatToWorld)(lngLat, this.scale);
      var translate = vec2.add([], toLocation, vec2.negate([], fromLocation));
      var newCenter = vec2.add([], this.center, translate);
      return (0, _webMercatorUtils.worldToLngLat)(newCenter, this.scale);
    }
  }, {
    key: "getLocationAtPoint",
    value: function getLocationAtPoint(_ref3) {
      var lngLat = _ref3.lngLat,
          pos = _ref3.pos;
      return this.getMapCenterByLngLatPosition({
        lngLat: lngLat,
        pos: pos
      });
    }
  }, {
    key: "fitBounds",
    value: function fitBounds(bounds) {
      var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      var width = this.width,
          height = this.height;

      var _fitBounds2 = (0, _fitBounds3.default)(Object.assign({
        width: width,
        height: height,
        bounds: bounds
      }, options)),
          longitude = _fitBounds2.longitude,
          latitude = _fitBounds2.latitude,
          zoom = _fitBounds2.zoom;

      return new WebMercatorViewport({
        width: width,
        height: height,
        longitude: longitude,
        latitude: latitude,
        zoom: zoom
      });
    }
  }]);
  return WebMercatorViewport;
}(_viewport.default);

exports.default = WebMercatorViewport;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","@babel/runtime/helpers/esm/possibleConstructorReturn":"pQSE","@babel/runtime/helpers/esm/getPrototypeOf":"i2He","@babel/runtime/helpers/esm/inherits":"NNOi","@babel/runtime/helpers/esm/assertThisInitialized":"b9Zy","./viewport":"lofO","./web-mercator-utils":"mG7W","./fit-bounds":"zFfS","gl-matrix/vec2":"iP3z"}],"b7UA":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = normalizeViewportProps;

var _webMercatorViewport = _interopRequireDefault(require("./web-mercator-viewport"));

var _mathUtils = require("./math-utils");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var MAX_LATITUDE = 85.05113;
var MIN_LATITUDE = -85.05113;

function normalizeViewportProps(_ref) {
  var width = _ref.width,
      height = _ref.height,
      longitude = _ref.longitude,
      latitude = _ref.latitude,
      zoom = _ref.zoom,
      _ref$pitch = _ref.pitch,
      pitch = _ref$pitch === void 0 ? 0 : _ref$pitch,
      _ref$bearing = _ref.bearing,
      bearing = _ref$bearing === void 0 ? 0 : _ref$bearing;

  if (longitude < -180 || longitude > 180) {
    longitude = (0, _mathUtils.mod)(longitude + 180, 360) - 180;
  }

  if (bearing < -180 || bearing > 180) {
    bearing = (0, _mathUtils.mod)(bearing + 180, 360) - 180;
  }

  var flatViewport = new _webMercatorViewport.default({
    width: width,
    height: height,
    longitude: longitude,
    latitude: latitude,
    zoom: zoom
  });
  var topY = flatViewport.project([longitude, MAX_LATITUDE])[1];
  var bottomY = flatViewport.project([longitude, MIN_LATITUDE])[1];
  var shiftY = 0;

  if (bottomY - topY < height) {
    zoom += Math.log2(height / (bottomY - topY));
    flatViewport = new _webMercatorViewport.default({
      width: width,
      height: height,
      longitude: longitude,
      latitude: latitude,
      zoom: zoom
    });
    topY = flatViewport.project([longitude, MAX_LATITUDE])[1];
    bottomY = flatViewport.project([longitude, MIN_LATITUDE])[1];
  }

  if (topY > 0) {
    shiftY = topY;
  } else if (bottomY < height) {
    shiftY = bottomY - height;
  }

  if (shiftY) {
    latitude = flatViewport.unproject([width / 2, height / 2 + shiftY])[1];
  }

  return {
    width: width,
    height: height,
    longitude: longitude,
    latitude: latitude,
    zoom: zoom,
    pitch: pitch,
    bearing: bearing
  };
}
},{"./web-mercator-viewport":"BxsL","./math-utils":"YXeS"}],"tw94":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = flyToViewport;
exports.getFlyToDuration = getFlyToDuration;

var _mathUtils = require("./math-utils");

var _webMercatorUtils = require("./web-mercator-utils");

var vec2 = _interopRequireWildcard(require("gl-matrix/vec2"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var EPSILON = 0.01;
var VIEWPORT_TRANSITION_PROPS = ['longitude', 'latitude', 'zoom'];
var DEFAULT_OPTS = {
  curve: 1.414,
  speed: 1.2
};

function flyToViewport(startProps, endProps, t) {
  var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
  var viewport = {};

  var _getFlyToTransitionPa = getFlyToTransitionParams(startProps, endProps, opts),
      startZoom = _getFlyToTransitionPa.startZoom,
      startCenterXY = _getFlyToTransitionPa.startCenterXY,
      uDelta = _getFlyToTransitionPa.uDelta,
      w0 = _getFlyToTransitionPa.w0,
      u1 = _getFlyToTransitionPa.u1,
      S = _getFlyToTransitionPa.S,
      rho = _getFlyToTransitionPa.rho,
      rho2 = _getFlyToTransitionPa.rho2,
      r0 = _getFlyToTransitionPa.r0;

  if (Math.abs(u1) < EPSILON) {
    for (var _i = 0; _i < VIEWPORT_TRANSITION_PROPS.length; _i++) {
      var key = VIEWPORT_TRANSITION_PROPS[_i];
      var startValue = startProps[key];
      var endValue = endProps[key];
      viewport[key] = (0, _mathUtils.lerp)(startValue, endValue, t);
    }

    return viewport;
  }

  var s = t * S;
  var w = Math.cosh(r0) / Math.cosh(r0 + rho * s);
  var u = w0 * ((Math.cosh(r0) * Math.tanh(r0 + rho * s) - Math.sinh(r0)) / rho2) / u1;
  var scaleIncrement = 1 / w;
  var newZoom = startZoom + (0, _webMercatorUtils.scaleToZoom)(scaleIncrement);
  var newCenterWorld = vec2.scale([], uDelta, u);
  vec2.add(newCenterWorld, newCenterWorld, startCenterXY);
  vec2.scale(newCenterWorld, newCenterWorld, scaleIncrement);
  var newCenter = (0, _webMercatorUtils.worldToLngLat)(newCenterWorld, (0, _webMercatorUtils.zoomToScale)(newZoom));
  viewport.longitude = newCenter[0];
  viewport.latitude = newCenter[1];
  viewport.zoom = newZoom;
  return viewport;
}

function getFlyToDuration(startProps, endProps) {
  var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  opts = Object.assign({}, DEFAULT_OPTS, opts);
  var _opts = opts,
      screenSpeed = _opts.screenSpeed,
      speed = _opts.speed,
      maxDuration = _opts.maxDuration;

  var _getFlyToTransitionPa2 = getFlyToTransitionParams(startProps, endProps, opts),
      S = _getFlyToTransitionPa2.S,
      rho = _getFlyToTransitionPa2.rho;

  var length = 1000 * S;
  var duration;

  if (Number.isFinite(screenSpeed)) {
    duration = length / (screenSpeed / rho);
  } else {
    duration = length / speed;
  }

  return Number.isFinite(maxDuration) && duration > maxDuration ? 0 : duration;
}

function getFlyToTransitionParams(startProps, endProps, opts) {
  opts = Object.assign({}, DEFAULT_OPTS, opts);
  var rho = opts.curve;
  var startZoom = startProps.zoom;
  var startCenter = [startProps.longitude, startProps.latitude];
  var startScale = (0, _webMercatorUtils.zoomToScale)(startZoom);
  var endZoom = endProps.zoom;
  var endCenter = [endProps.longitude, endProps.latitude];
  var scale = (0, _webMercatorUtils.zoomToScale)(endZoom - startZoom);
  var startCenterXY = (0, _webMercatorUtils.lngLatToWorld)(startCenter, startScale);
  var endCenterXY = (0, _webMercatorUtils.lngLatToWorld)(endCenter, startScale);
  var uDelta = vec2.sub([], endCenterXY, startCenterXY);
  var w0 = Math.max(startProps.width, startProps.height);
  var w1 = w0 / scale;
  var u1 = vec2.length(uDelta);
  var rho2 = rho * rho;
  var b0 = (w1 * w1 - w0 * w0 + rho2 * rho2 * u1 * u1) / (2 * w0 * rho2 * u1);
  var b1 = (w1 * w1 - w0 * w0 - rho2 * rho2 * u1 * u1) / (2 * w1 * rho2 * u1);
  var r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0);
  var r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
  var S = (r1 - r0) / rho;
  return {
    startZoom: startZoom,
    startCenterXY: startCenterXY,
    uDelta: uDelta,
    w0: w0,
    u1: u1,
    S: S,
    rho: rho,
    rho2: rho2,
    r0: r0,
    r1: r1
  };
}
},{"./math-utils":"YXeS","./web-mercator-utils":"mG7W","gl-matrix/vec2":"iP3z"}],"K6fX":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "default", {
  enumerable: true,
  get: function () {
    return _webMercatorViewport.default;
  }
});
Object.defineProperty(exports, "WebMercatorViewport", {
  enumerable: true,
  get: function () {
    return _webMercatorViewport.default;
  }
});
Object.defineProperty(exports, "PerspectiveMercatorViewport", {
  enumerable: true,
  get: function () {
    return _webMercatorViewport.default;
  }
});
Object.defineProperty(exports, "fitBounds", {
  enumerable: true,
  get: function () {
    return _fitBounds.default;
  }
});
Object.defineProperty(exports, "normalizeViewportProps", {
  enumerable: true,
  get: function () {
    return _normalizeViewportProps.default;
  }
});
Object.defineProperty(exports, "flyToViewport", {
  enumerable: true,
  get: function () {
    return _flyToViewport.default;
  }
});
Object.defineProperty(exports, "getFlyToDuration", {
  enumerable: true,
  get: function () {
    return _flyToViewport.getFlyToDuration;
  }
});
Object.defineProperty(exports, "lngLatToWorld", {
  enumerable: true,
  get: function () {
    return _webMercatorUtils.lngLatToWorld;
  }
});
Object.defineProperty(exports, "worldToLngLat", {
  enumerable: true,
  get: function () {
    return _webMercatorUtils.worldToLngLat;
  }
});
Object.defineProperty(exports, "worldToPixels", {
  enumerable: true,
  get: function () {
    return _webMercatorUtils.worldToPixels;
  }
});
Object.defineProperty(exports, "pixelsToWorld", {
  enumerable: true,
  get: function () {
    return _webMercatorUtils.pixelsToWorld;
  }
});
Object.defineProperty(exports, "getMeterZoom", {
  enumerable: true,
  get: function () {
    return _webMercatorUtils.getMeterZoom;
  }
});
Object.defineProperty(exports, "getDistanceScales", {
  enumerable: true,
  get: function () {
    return _webMercatorUtils.getDistanceScales;
  }
});
Object.defineProperty(exports, "addMetersToLngLat", {
  enumerable: true,
  get: function () {
    return _webMercatorUtils.addMetersToLngLat;
  }
});
Object.defineProperty(exports, "getViewMatrix", {
  enumerable: true,
  get: function () {
    return _webMercatorUtils.getViewMatrix;
  }
});
Object.defineProperty(exports, "getProjectionMatrix", {
  enumerable: true,
  get: function () {
    return _webMercatorUtils.getProjectionMatrix;
  }
});
Object.defineProperty(exports, "getProjectionParameters", {
  enumerable: true,
  get: function () {
    return _webMercatorUtils.getProjectionParameters;
  }
});
Object.defineProperty(exports, "getUncenteredViewMatrix", {
  enumerable: true,
  get: function () {
    return _webMercatorUtils.getViewMatrix;
  }
});
Object.defineProperty(exports, "projectFlat", {
  enumerable: true,
  get: function () {
    return _webMercatorUtils.lngLatToWorld;
  }
});
Object.defineProperty(exports, "unprojectFlat", {
  enumerable: true,
  get: function () {
    return _webMercatorUtils.worldToLngLat;
  }
});

var _webMercatorViewport = _interopRequireDefault(require("./web-mercator-viewport"));

var _fitBounds = _interopRequireDefault(require("./fit-bounds"));

var _normalizeViewportProps = _interopRequireDefault(require("./normalize-viewport-props"));

var _flyToViewport = _interopRequireWildcard(require("./fly-to-viewport"));

var _webMercatorUtils = require("./web-mercator-utils");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./web-mercator-viewport":"BxsL","./fit-bounds":"zFfS","./normalize-viewport-props":"b7UA","./fly-to-viewport":"tw94","./web-mercator-utils":"mG7W"}],"YebI":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getWorldPosition = getWorldPosition;
exports.projectPosition = projectPosition;

var _constants = require("../../lib/constants");

var _viewportUniforms = require("./viewport-uniforms");

var vec4 = _interopRequireWildcard(require("gl-matrix/vec4"));

var vec3 = _interopRequireWildcard(require("gl-matrix/vec3"));

var _viewportMercatorProject = require("viewport-mercator-project");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _slicedToArray(arr, i) {
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
}

function _nonIterableRest() {
  throw new TypeError("Invalid attempt to destructure non-iterable instance");
}

function _iterableToArrayLimit(arr, i) {
  var _arr = [];
  var _n = true;
  var _d = false;
  var _e = undefined;

  try {
    for (var _i = arr[Symbol.iterator](), _s; !(_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;
}

function _arrayWithHoles(arr) {
  if (Array.isArray(arr)) return arr;
}
/**
 * Projection utils
 * TODO: move to Viewport class?
 */


// In project.glsl, offset modes calculate z differently from LNG_LAT mode.
// offset modes apply the y adjustment (pixelsPerMeter2) when projecting z
// LNG_LAT mode only use the linear scale.
function lngLatZToWorldPosition(lngLatZ, viewport) {
  var offsetMode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;

  var _lngLatZ = _slicedToArray(lngLatZ, 3),
      longitude = _lngLatZ[0],
      latitude = _lngLatZ[1],
      _lngLatZ$ = _lngLatZ[2],
      z = _lngLatZ$ === void 0 ? 0 : _lngLatZ$;

  var _viewport$projectFlat = viewport.projectFlat(lngLatZ),
      _viewport$projectFlat2 = _slicedToArray(_viewport$projectFlat, 2),
      X = _viewport$projectFlat2[0],
      Y = _viewport$projectFlat2[1];

  var distanceScales = offsetMode ? (0, _viewportMercatorProject.getDistanceScales)({
    longitude: longitude,
    latitude: latitude,
    scale: viewport.scale
  }) : viewport.getDistanceScales();
  var Z = z * distanceScales.pixelsPerMeter[2];
  return [X, Y, Z];
}

function normalizeParameters(opts) {
  var normalizedParams = Object.assign({}, opts);
  var viewport = opts.viewport,
      coordinateSystem = opts.coordinateSystem,
      coordinateOrigin = opts.coordinateOrigin,
      fromCoordinateSystem = opts.fromCoordinateSystem,
      fromCoordinateOrigin = opts.fromCoordinateOrigin;

  if (fromCoordinateSystem === undefined) {
    normalizedParams.fromCoordinateSystem = coordinateSystem;
  }

  if (fromCoordinateOrigin === undefined) {
    normalizedParams.fromCoordinateOrigin = coordinateOrigin;
  }

  if (coordinateSystem === _constants.COORDINATE_SYSTEM.LNGLAT && viewport.zoom >= _viewportUniforms.LNGLAT_AUTO_OFFSET_ZOOM_THRESHOLD) {
    normalizedParams.coordinateSystem = _constants.COORDINATE_SYSTEM.LNGLAT_OFFSETS;
    normalizedParams.coordinateOrigin = [Math.fround(viewport.longitude), Math.fround(viewport.latitude)];
  }

  return normalizedParams;
}

function getWorldPosition(position, _ref) {
  var viewport = _ref.viewport,
      modelMatrix = _ref.modelMatrix,
      coordinateSystem = _ref.coordinateSystem,
      coordinateOrigin = _ref.coordinateOrigin,
      offsetMode = _ref.offsetMode;

  var _position = _slicedToArray(position, 3),
      x = _position[0],
      y = _position[1],
      z = _position[2];

  if (modelMatrix) {
    var _vec4$transformMat = vec4.transformMat4([], [x, y, z, 1.0], modelMatrix);

    var _vec4$transformMat2 = _slicedToArray(_vec4$transformMat, 3);

    x = _vec4$transformMat2[0];
    y = _vec4$transformMat2[1];
    z = _vec4$transformMat2[2];
  }

  switch (coordinateSystem) {
    case _constants.COORDINATE_SYSTEM.LNGLAT:
    case _constants.COORDINATE_SYSTEM.LNGLAT_DEPRECATED:
      return lngLatZToWorldPosition([x, y, z], viewport, offsetMode);

    case _constants.COORDINATE_SYSTEM.LNGLAT_OFFSETS:
      return lngLatZToWorldPosition([x + coordinateOrigin[0], y + coordinateOrigin[1], z + (coordinateOrigin[2] || 0)], viewport, offsetMode);

    case _constants.COORDINATE_SYSTEM.METER_OFFSETS:
      return lngLatZToWorldPosition((0, _viewportMercatorProject.addMetersToLngLat)(coordinateOrigin, [x, y, z]), viewport, offsetMode);

    case _constants.COORDINATE_SYSTEM.IDENTITY:
    default:
      return [x, y, z];
  }
}
/**
 * Equivalent to project_position in project.glsl
 * projects a user supplied position to world position in the target coordinates system
 * @param {array} position - [x, y, z]
 * @param {object} params
 * @param {Viewport} params.viewport - the current viewport
 * @param {number} params.coordinateSystem - the coordinate system to project into
 * @param {array} params.coordinateOrigin - the coordinate origin to project into
 * @param {Matrix4} [params.modelMatrix] - the model matrix of the supplied position
 * @param {number} [params.fromCoordinateSystem] - the coordinate system that the
 *   supplied position is in. Default to the same as `coordinateSystem`.
 * @param {array} [params.fromCoordinateOrigin] - the coordinate origin that the
 *   supplied position is in. Default to the same as `coordinateOrigin`.
 */


function projectPosition(position, params) {
  var _normalizeParameters = normalizeParameters(params),
      viewport = _normalizeParameters.viewport,
      coordinateSystem = _normalizeParameters.coordinateSystem,
      coordinateOrigin = _normalizeParameters.coordinateOrigin,
      modelMatrix = _normalizeParameters.modelMatrix,
      fromCoordinateSystem = _normalizeParameters.fromCoordinateSystem,
      fromCoordinateOrigin = _normalizeParameters.fromCoordinateOrigin;

  switch (coordinateSystem) {
    case _constants.COORDINATE_SYSTEM.LNGLAT_OFFSETS:
    case _constants.COORDINATE_SYSTEM.METER_OFFSETS:
      {
        var worldPosition = getWorldPosition(position, {
          viewport: viewport,
          modelMatrix: modelMatrix,
          coordinateSystem: fromCoordinateSystem,
          coordinateOrigin: fromCoordinateOrigin,
          offsetMode: true
        });
        var originWorld = lngLatZToWorldPosition(coordinateOrigin, viewport, true);
        vec3.sub(worldPosition, worldPosition, originWorld);
        return worldPosition;
      }

    case _constants.COORDINATE_SYSTEM.LNGLAT:
    case _constants.COORDINATE_SYSTEM.LNGLAT_DEPRECATED:
    case _constants.COORDINATE_SYSTEM.IDENTITY:
    default:
      return getWorldPosition(position, {
        viewport: viewport,
        modelMatrix: modelMatrix,
        coordinateSystem: fromCoordinateSystem,
        coordinateOrigin: fromCoordinateOrigin,
        offsetMode: false
      });
  }
}
},{"../../lib/constants":"GfMx","./viewport-uniforms":"cVdS","gl-matrix/vec4":"i3i1","gl-matrix/vec3":"vuBh","viewport-mercator-project":"K6fX"}],"ZHHu":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _lighting = _interopRequireDefault(require("./lighting.glsl"));

var _project = _interopRequireDefault(require("../project/project"));

var _projectFunctions = require("../project/project-functions");

var _memoize = _interopRequireDefault(require("../../utils/memoize"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var _default = {
  name: 'lighting',
  dependencies: [_project.default],
  vs: _lighting.default,
  getUniforms: getUniforms,
  deprecations: [// Deprecated lighting functions
  {
    type: 'function',
    old: 'getLightWeight',
    new: 'lighting_getLightWeight',
    deprecated: true
  }]
};
exports.default = _default;
var INITIAL_MODULE_OPTIONS = {};
var DEFAULT_LIGHTS_POSITION = [-122.45, 37.75, 8000];
var DEFAULT_LIGHTS_STRENGTH = [2.0, 0.0];
var DEFAULT_AMBIENT_RATIO = 0.4;
var DEFAULT_DIFFUSE_RATIO = 0.6;
var DEFAULT_SPECULAR_RATIO = 0.8;
var getMemoizedLightPositions = (0, _memoize.default)(preprojectLightPositions); // TODO: support partial update, e.g.
// `lightedModel.setModuleParameters({diffuseRatio: 0.3});`

function getUniforms() {
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INITIAL_MODULE_OPTIONS;

  if (!opts.lightSettings) {
    return {};
  }

  var coordinateSystem = opts.coordinateSystem,
      coordinateOrigin = opts.coordinateOrigin,
      _opts$lightSettings = opts.lightSettings,
      _opts$lightSettings$n = _opts$lightSettings.numberOfLights,
      numberOfLights = _opts$lightSettings$n === void 0 ? 1 : _opts$lightSettings$n,
      _opts$lightSettings$l = _opts$lightSettings.lightsPosition,
      lightsPosition = _opts$lightSettings$l === void 0 ? DEFAULT_LIGHTS_POSITION : _opts$lightSettings$l,
      _opts$lightSettings$l2 = _opts$lightSettings.lightsStrength,
      lightsStrength = _opts$lightSettings$l2 === void 0 ? DEFAULT_LIGHTS_STRENGTH : _opts$lightSettings$l2,
      fromCoordinateSystem = _opts$lightSettings.coordinateSystem,
      fromCoordinateOrigin = _opts$lightSettings.coordinateOrigin,
      _opts$lightSettings$m = _opts$lightSettings.modelMatrix,
      modelMatrix = _opts$lightSettings$m === void 0 ? null : _opts$lightSettings$m,
      _opts$lightSettings$a = _opts$lightSettings.ambientRatio,
      ambientRatio = _opts$lightSettings$a === void 0 ? DEFAULT_AMBIENT_RATIO : _opts$lightSettings$a,
      _opts$lightSettings$d = _opts$lightSettings.diffuseRatio,
      diffuseRatio = _opts$lightSettings$d === void 0 ? DEFAULT_DIFFUSE_RATIO : _opts$lightSettings$d,
      _opts$lightSettings$s = _opts$lightSettings.specularRatio,
      specularRatio = _opts$lightSettings$s === void 0 ? DEFAULT_SPECULAR_RATIO : _opts$lightSettings$s; // Pre-project light positions

  var lightsPositionWorld = getMemoizedLightPositions({
    lightsPosition: lightsPosition,
    numberOfLights: numberOfLights,
    viewport: opts.viewport,
    modelMatrix: modelMatrix,
    coordinateSystem: coordinateSystem,
    coordinateOrigin: coordinateOrigin,
    fromCoordinateSystem: fromCoordinateSystem,
    fromCoordinateOrigin: fromCoordinateOrigin
  });
  return {
    lighting_lightPositions: lightsPositionWorld,
    lighting_lightStrengths: lightsStrength,
    lighting_ambientRatio: ambientRatio,
    lighting_diffuseRatio: diffuseRatio,
    lighting_specularRatio: specularRatio,
    lighting_numberOfLights: numberOfLights
  };
} // Pre-project light positions


function preprojectLightPositions(_ref) {
  var lightsPosition = _ref.lightsPosition,
      numberOfLights = _ref.numberOfLights,
      viewport = _ref.viewport,
      modelMatrix = _ref.modelMatrix,
      coordinateSystem = _ref.coordinateSystem,
      coordinateOrigin = _ref.coordinateOrigin,
      fromCoordinateSystem = _ref.fromCoordinateSystem,
      fromCoordinateOrigin = _ref.fromCoordinateOrigin;
  var projectionParameters = {
    viewport: viewport,
    modelMatrix: modelMatrix,
    coordinateSystem: coordinateSystem,
    coordinateOrigin: coordinateOrigin,
    fromCoordinateSystem: fromCoordinateSystem,
    fromCoordinateOrigin: fromCoordinateOrigin
  };
  var lightsPositionWorld = [];

  for (var i = 0; i < numberOfLights; i++) {
    var position = (0, _projectFunctions.projectPosition)(lightsPosition.slice(i * 3, i * 3 + 3), projectionParameters);
    lightsPositionWorld[i * 3] = position[0];
    lightsPositionWorld[i * 3 + 1] = position[1];
    lightsPositionWorld[i * 3 + 2] = position[2];
  }

  return lightsPositionWorld;
}
},{"./lighting.glsl":"Pygi","../project/project":"LUEV","../project/project-functions":"YebI","../../utils/memoize":"IYCc"}],"DJFh":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.initializeShaderModules = initializeShaderModules;
Object.defineProperty(exports, "fp32", {
  enumerable: true,
  get: function () {
    return _luma.fp32;
  }
});
Object.defineProperty(exports, "fp64", {
  enumerable: true,
  get: function () {
    return _luma.fp64;
  }
});
Object.defineProperty(exports, "picking", {
  enumerable: true,
  get: function () {
    return _luma.picking;
  }
});
Object.defineProperty(exports, "project", {
  enumerable: true,
  get: function () {
    return _project.default;
  }
});
Object.defineProperty(exports, "project64", {
  enumerable: true,
  get: function () {
    return _project3.default;
  }
});
Object.defineProperty(exports, "lighting", {
  enumerable: true,
  get: function () {
    return _lighting.default;
  }
});

var _luma = require("luma.gl");

var _project = _interopRequireDefault(require("../shaderlib/project/project"));

var _project2 = _interopRequireDefault(require("../shaderlib/project32/project32"));

var _project3 = _interopRequireDefault(require("../shaderlib/project64/project64"));

var _lighting = _interopRequireDefault(require("../shaderlib/lighting/lighting"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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 initializeShaderModules() {
  (0, _luma.registerShaderModules)([_luma.fp32, _luma.fp64, _project.default, _project2.default, _project3.default, _lighting.default, _luma.picking]);
  (0, _luma.setDefaultShaderModules)([_project.default]);
}

initializeShaderModules();
},{"luma.gl":"GAQa","../shaderlib/project/project":"LUEV","../shaderlib/project32/project32":"wwLN","../shaderlib/project64/project64":"v9HK","../shaderlib/lighting/lighting":"ZHHu"}],"eMZP":[function(require,module,exports) {
"use strict";

// GL constants, copied from Mozilla documentation
// https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants
// Standard WebGL 1 constants
// These constants are defined on the WebGLRenderingContext interface.

/* eslint-disable key-spacing, max-len, no-inline-comments, camelcase */
// eslint-disable-next-line
module.exports = {
  // Clearing buffers
  // Constants passed to clear() to clear buffer masks.
  DEPTH_BUFFER_BIT: 0x00000100,
  STENCIL_BUFFER_BIT: 0x00000400,
  COLOR_BUFFER_BIT: 0x00004000,
  // Rendering primitives
  // Constants passed to drawElements() or drawArrays() to specify what kind of primitive to render.
  POINTS: 0x0000,
  LINES: 0x0001,
  LINE_LOOP: 0x0002,
  LINE_STRIP: 0x0003,
  TRIANGLES: 0x0004,
  TRIANGLE_STRIP: 0x0005,
  TRIANGLE_FAN: 0x0006,
  // Blending modes
  // Constants passed to blendFunc() or blendFuncSeparate() to specify the blending mode (for both, RBG and alpha, or separately).
  ZERO: 0,
  ONE: 1,
  SRC_COLOR: 0x0300,
  ONE_MINUS_SRC_COLOR: 0x0301,
  SRC_ALPHA: 0x0302,
  ONE_MINUS_SRC_ALPHA: 0x0303,
  DST_ALPHA: 0x0304,
  ONE_MINUS_DST_ALPHA: 0x0305,
  DST_COLOR: 0x0306,
  ONE_MINUS_DST_COLOR: 0x0307,
  SRC_ALPHA_SATURATE: 0x0308,
  CONSTANT_COLOR: 0x8001,
  ONE_MINUS_CONSTANT_COLOR: 0x8002,
  CONSTANT_ALPHA: 0x8003,
  ONE_MINUS_CONSTANT_ALPHA: 0x8004,
  // Blending equations
  // Constants passed to blendEquation() or blendEquationSeparate() to control
  // how the blending is calculated (for both, RBG and alpha, or separately).
  FUNC_ADD: 0x8006,
  FUNC_SUBTRACT: 0x800a,
  FUNC_REVERSE_SUBTRACT: 0x800b,
  // Getting GL parameter information
  // Constants passed to getParameter() to specify what information to return.
  BLEND_EQUATION: 0x8009,
  BLEND_EQUATION_RGB: 0x8009,
  BLEND_EQUATION_ALPHA: 0x883d,
  BLEND_DST_RGB: 0x80c8,
  BLEND_SRC_RGB: 0x80c9,
  BLEND_DST_ALPHA: 0x80ca,
  BLEND_SRC_ALPHA: 0x80cb,
  BLEND_COLOR: 0x8005,
  ARRAY_BUFFER_BINDING: 0x8894,
  ELEMENT_ARRAY_BUFFER_BINDING: 0x8895,
  LINE_WIDTH: 0x0b21,
  ALIASED_POINT_SIZE_RANGE: 0x846d,
  ALIASED_LINE_WIDTH_RANGE: 0x846e,
  CULL_FACE_MODE: 0x0b45,
  FRONT_FACE: 0x0b46,
  DEPTH_RANGE: 0x0b70,
  DEPTH_WRITEMASK: 0x0b72,
  DEPTH_CLEAR_VALUE: 0x0b73,
  DEPTH_FUNC: 0x0b74,
  STENCIL_CLEAR_VALUE: 0x0b91,
  STENCIL_FUNC: 0x0b92,
  STENCIL_FAIL: 0x0b94,
  STENCIL_PASS_DEPTH_FAIL: 0x0b95,
  STENCIL_PASS_DEPTH_PASS: 0x0b96,
  STENCIL_REF: 0x0b97,
  STENCIL_VALUE_MASK: 0x0b93,
  STENCIL_WRITEMASK: 0x0b98,
  STENCIL_BACK_FUNC: 0x8800,
  STENCIL_BACK_FAIL: 0x8801,
  STENCIL_BACK_PASS_DEPTH_FAIL: 0x8802,
  STENCIL_BACK_PASS_DEPTH_PASS: 0x8803,
  STENCIL_BACK_REF: 0x8ca3,
  STENCIL_BACK_VALUE_MASK: 0x8ca4,
  STENCIL_BACK_WRITEMASK: 0x8ca5,
  VIEWPORT: 0x0ba2,
  SCISSOR_BOX: 0x0c10,
  COLOR_CLEAR_VALUE: 0x0c22,
  COLOR_WRITEMASK: 0x0c23,
  UNPACK_ALIGNMENT: 0x0cf5,
  PACK_ALIGNMENT: 0x0d05,
  MAX_TEXTURE_SIZE: 0x0d33,
  MAX_VIEWPORT_DIMS: 0x0d3a,
  SUBPIXEL_BITS: 0x0d50,
  RED_BITS: 0x0d52,
  GREEN_BITS: 0x0d53,
  BLUE_BITS: 0x0d54,
  ALPHA_BITS: 0x0d55,
  DEPTH_BITS: 0x0d56,
  STENCIL_BITS: 0x0d57,
  POLYGON_OFFSET_UNITS: 0x2a00,
  POLYGON_OFFSET_FACTOR: 0x8038,
  TEXTURE_BINDING_2D: 0x8069,
  SAMPLE_BUFFERS: 0x80a8,
  SAMPLES: 0x80a9,
  SAMPLE_COVERAGE_VALUE: 0x80aa,
  SAMPLE_COVERAGE_INVERT: 0x80ab,
  COMPRESSED_TEXTURE_FORMATS: 0x86a3,
  VENDOR: 0x1f00,
  RENDERER: 0x1f01,
  VERSION: 0x1f02,
  IMPLEMENTATION_COLOR_READ_TYPE: 0x8b9a,
  IMPLEMENTATION_COLOR_READ_FORMAT: 0x8b9b,
  BROWSER_DEFAULT_WEBGL: 0x9244,
  // Buffers
  // Constants passed to bufferData(), bufferSubData(), bindBuffer(), or
  // getBufferParameter().
  STATIC_DRAW: 0x88e4,
  STREAM_DRAW: 0x88e0,
  DYNAMIC_DRAW: 0x88e8,
  ARRAY_BUFFER: 0x8892,
  ELEMENT_ARRAY_BUFFER: 0x8893,
  BUFFER_SIZE: 0x8764,
  BUFFER_USAGE: 0x8765,
  // Vertex attributes
  // Constants passed to getVertexAttrib().
  CURRENT_VERTEX_ATTRIB: 0x8626,
  VERTEX_ATTRIB_ARRAY_ENABLED: 0x8622,
  VERTEX_ATTRIB_ARRAY_SIZE: 0x8623,
  VERTEX_ATTRIB_ARRAY_STRIDE: 0x8624,
  VERTEX_ATTRIB_ARRAY_TYPE: 0x8625,
  VERTEX_ATTRIB_ARRAY_NORMALIZED: 0x886a,
  VERTEX_ATTRIB_ARRAY_POINTER: 0x8645,
  VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: 0x889f,
  // Culling
  // Constants passed to cullFace().
  CULL_FACE: 0x0b44,
  FRONT: 0x0404,
  BACK: 0x0405,
  FRONT_AND_BACK: 0x0408,
  // Enabling and disabling
  // Constants passed to enable() or disable().
  BLEND: 0x0be2,
  DEPTH_TEST: 0x0b71,
  DITHER: 0x0bd0,
  POLYGON_OFFSET_FILL: 0x8037,
  SAMPLE_ALPHA_TO_COVERAGE: 0x809e,
  SAMPLE_COVERAGE: 0x80a0,
  SCISSOR_TEST: 0x0c11,
  STENCIL_TEST: 0x0b90,
  // Errors
  // Constants returned from getError().
  NO_ERROR: 0,
  INVALID_ENUM: 0x0500,
  INVALID_VALUE: 0x0501,
  INVALID_OPERATION: 0x0502,
  OUT_OF_MEMORY: 0x0505,
  CONTEXT_LOST_WEBGL: 0x9242,
  // Front face directions
  // Constants passed to frontFace().
  CW: 0x0900,
  CCW: 0x0901,
  // Hints
  // Constants passed to hint()
  DONT_CARE: 0x1100,
  FASTEST: 0x1101,
  NICEST: 0x1102,
  GENERATE_MIPMAP_HINT: 0x8192,
  // Data types
  BYTE: 0x1400,
  UNSIGNED_BYTE: 0x1401,
  SHORT: 0x1402,
  UNSIGNED_SHORT: 0x1403,
  INT: 0x1404,
  UNSIGNED_INT: 0x1405,
  FLOAT: 0x1406,
  // Pixel formats
  DEPTH_COMPONENT: 0x1902,
  ALPHA: 0x1906,
  RGB: 0x1907,
  RGBA: 0x1908,
  LUMINANCE: 0x1909,
  LUMINANCE_ALPHA: 0x190a,
  // Pixel types
  // UNSIGNED_BYTE: 0x1401,
  UNSIGNED_SHORT_4_4_4_4: 0x8033,
  UNSIGNED_SHORT_5_5_5_1: 0x8034,
  UNSIGNED_SHORT_5_6_5: 0x8363,
  // Shaders
  // Constants passed to createShader() or getShaderParameter()
  FRAGMENT_SHADER: 0x8b30,
  VERTEX_SHADER: 0x8b31,
  COMPILE_STATUS: 0x8b81,
  DELETE_STATUS: 0x8b80,
  LINK_STATUS: 0x8b82,
  VALIDATE_STATUS: 0x8b83,
  ATTACHED_SHADERS: 0x8b85,
  ACTIVE_ATTRIBUTES: 0x8b89,
  ACTIVE_UNIFORMS: 0x8b86,
  MAX_VERTEX_ATTRIBS: 0x8869,
  MAX_VERTEX_UNIFORM_VECTORS: 0x8dfb,
  MAX_VARYING_VECTORS: 0x8dfc,
  MAX_COMBINED_TEXTURE_IMAGE_UNITS: 0x8b4d,
  MAX_VERTEX_TEXTURE_IMAGE_UNITS: 0x8b4c,
  MAX_TEXTURE_IMAGE_UNITS: 0x8872,
  MAX_FRAGMENT_UNIFORM_VECTORS: 0x8dfd,
  SHADER_TYPE: 0x8b4f,
  SHADING_LANGUAGE_VERSION: 0x8b8c,
  CURRENT_PROGRAM: 0x8b8d,
  // Depth or stencil tests
  // Constants passed to depthFunc() or stencilFunc().
  NEVER: 0x0200,
  ALWAYS: 0x0207,
  LESS: 0x0201,
  EQUAL: 0x0202,
  LEQUAL: 0x0203,
  GREATER: 0x0204,
  GEQUAL: 0x0206,
  NOTEQUAL: 0x0205,
  // Stencil actions
  // Constants passed to stencilOp().
  KEEP: 0x1e00,
  REPLACE: 0x1e01,
  INCR: 0x1e02,
  DECR: 0x1e03,
  INVERT: 0x150a,
  INCR_WRAP: 0x8507,
  DECR_WRAP: 0x8508,
  // Textures
  // Constants passed to texParameteri(),
  // texParameterf(), bindTexture(), texImage2D(), and others.
  NEAREST: 0x2600,
  LINEAR: 0x2601,
  NEAREST_MIPMAP_NEAREST: 0x2700,
  LINEAR_MIPMAP_NEAREST: 0x2701,
  NEAREST_MIPMAP_LINEAR: 0x2702,
  LINEAR_MIPMAP_LINEAR: 0x2703,
  TEXTURE_MAG_FILTER: 0x2800,
  TEXTURE_MIN_FILTER: 0x2801,
  TEXTURE_WRAP_S: 0x2802,
  TEXTURE_WRAP_T: 0x2803,
  TEXTURE_2D: 0x0de1,
  TEXTURE: 0x1702,
  TEXTURE_CUBE_MAP: 0x8513,
  TEXTURE_BINDING_CUBE_MAP: 0x8514,
  TEXTURE_CUBE_MAP_POSITIVE_X: 0x8515,
  TEXTURE_CUBE_MAP_NEGATIVE_X: 0x8516,
  TEXTURE_CUBE_MAP_POSITIVE_Y: 0x8517,
  TEXTURE_CUBE_MAP_NEGATIVE_Y: 0x8518,
  TEXTURE_CUBE_MAP_POSITIVE_Z: 0x8519,
  TEXTURE_CUBE_MAP_NEGATIVE_Z: 0x851a,
  MAX_CUBE_MAP_TEXTURE_SIZE: 0x851c,
  // TEXTURE0 - 31 0x84C0 - 0x84DF A texture unit.
  TEXTURE0: 0x84c0,
  ACTIVE_TEXTURE: 0x84e0,
  REPEAT: 0x2901,
  CLAMP_TO_EDGE: 0x812f,
  MIRRORED_REPEAT: 0x8370,
  // Emulation
  TEXTURE_WIDTH: 0x1000,
  TEXTURE_HEIGHT: 0x1001,
  // Uniform types
  FLOAT_VEC2: 0x8b50,
  FLOAT_VEC3: 0x8b51,
  FLOAT_VEC4: 0x8b52,
  INT_VEC2: 0x8b53,
  INT_VEC3: 0x8b54,
  INT_VEC4: 0x8b55,
  BOOL: 0x8b56,
  BOOL_VEC2: 0x8b57,
  BOOL_VEC3: 0x8b58,
  BOOL_VEC4: 0x8b59,
  FLOAT_MAT2: 0x8b5a,
  FLOAT_MAT3: 0x8b5b,
  FLOAT_MAT4: 0x8b5c,
  SAMPLER_2D: 0x8b5e,
  SAMPLER_CUBE: 0x8b60,
  // Shader precision-specified types
  LOW_FLOAT: 0x8df0,
  MEDIUM_FLOAT: 0x8df1,
  HIGH_FLOAT: 0x8df2,
  LOW_INT: 0x8df3,
  MEDIUM_INT: 0x8df4,
  HIGH_INT: 0x8df5,
  // Framebuffers and renderbuffers
  FRAMEBUFFER: 0x8d40,
  RENDERBUFFER: 0x8d41,
  RGBA4: 0x8056,
  RGB5_A1: 0x8057,
  RGB565: 0x8d62,
  DEPTH_COMPONENT16: 0x81a5,
  STENCIL_INDEX: 0x1901,
  STENCIL_INDEX8: 0x8d48,
  DEPTH_STENCIL: 0x84f9,
  RENDERBUFFER_WIDTH: 0x8d42,
  RENDERBUFFER_HEIGHT: 0x8d43,
  RENDERBUFFER_INTERNAL_FORMAT: 0x8d44,
  RENDERBUFFER_RED_SIZE: 0x8d50,
  RENDERBUFFER_GREEN_SIZE: 0x8d51,
  RENDERBUFFER_BLUE_SIZE: 0x8d52,
  RENDERBUFFER_ALPHA_SIZE: 0x8d53,
  RENDERBUFFER_DEPTH_SIZE: 0x8d54,
  RENDERBUFFER_STENCIL_SIZE: 0x8d55,
  FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: 0x8cd0,
  FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: 0x8cd1,
  FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: 0x8cd2,
  FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: 0x8cd3,
  COLOR_ATTACHMENT0: 0x8ce0,
  DEPTH_ATTACHMENT: 0x8d00,
  STENCIL_ATTACHMENT: 0x8d20,
  DEPTH_STENCIL_ATTACHMENT: 0x821a,
  NONE: 0,
  FRAMEBUFFER_COMPLETE: 0x8cd5,
  FRAMEBUFFER_INCOMPLETE_ATTACHMENT: 0x8cd6,
  FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: 0x8cd7,
  FRAMEBUFFER_INCOMPLETE_DIMENSIONS: 0x8cd9,
  FRAMEBUFFER_UNSUPPORTED: 0x8cdd,
  FRAMEBUFFER_BINDING: 0x8ca6,
  RENDERBUFFER_BINDING: 0x8ca7,
  READ_FRAMEBUFFER: 0x8ca8,
  DRAW_FRAMEBUFFER: 0x8ca9,
  MAX_RENDERBUFFER_SIZE: 0x84e8,
  INVALID_FRAMEBUFFER_OPERATION: 0x0506,
  // Pixel storage modes
  // Constants passed to pixelStorei().
  UNPACK_FLIP_Y_WEBGL: 0x9240,
  UNPACK_PREMULTIPLY_ALPHA_WEBGL: 0x9241,
  UNPACK_COLORSPACE_CONVERSION_WEBGL: 0x9243,
  // /////////////////////////////////////////////////////
  // Additional constants defined WebGL 2
  // These constants are defined on the WebGL2RenderingContext interface.
  // All WebGL 1 constants are also available in a WebGL 2 context.
  // /////////////////////////////////////////////////////
  // Getting GL parameter information
  // Constants passed to getParameter()
  // to specify what information to return.
  READ_BUFFER: 0x0c02,
  UNPACK_ROW_LENGTH: 0x0cf2,
  UNPACK_SKIP_ROWS: 0x0cf3,
  UNPACK_SKIP_PIXELS: 0x0cf4,
  PACK_ROW_LENGTH: 0x0d02,
  PACK_SKIP_ROWS: 0x0d03,
  PACK_SKIP_PIXELS: 0x0d04,
  TEXTURE_BINDING_3D: 0x806a,
  UNPACK_SKIP_IMAGES: 0x806d,
  UNPACK_IMAGE_HEIGHT: 0x806e,
  MAX_3D_TEXTURE_SIZE: 0x8073,
  MAX_ELEMENTS_VERTICES: 0x80e8,
  MAX_ELEMENTS_INDICES: 0x80e9,
  MAX_TEXTURE_LOD_BIAS: 0x84fd,
  MAX_FRAGMENT_UNIFORM_COMPONENTS: 0x8b49,
  MAX_VERTEX_UNIFORM_COMPONENTS: 0x8b4a,
  MAX_ARRAY_TEXTURE_LAYERS: 0x88ff,
  MIN_PROGRAM_TEXEL_OFFSET: 0x8904,
  MAX_PROGRAM_TEXEL_OFFSET: 0x8905,
  MAX_VARYING_COMPONENTS: 0x8b4b,
  FRAGMENT_SHADER_DERIVATIVE_HINT: 0x8b8b,
  RASTERIZER_DISCARD: 0x8c89,
  VERTEX_ARRAY_BINDING: 0x85b5,
  MAX_VERTEX_OUTPUT_COMPONENTS: 0x9122,
  MAX_FRAGMENT_INPUT_COMPONENTS: 0x9125,
  MAX_SERVER_WAIT_TIMEOUT: 0x9111,
  MAX_ELEMENT_INDEX: 0x8d6b,
  // Textures
  // Constants passed to texParameteri(),
  // texParameterf(), bindTexture(), texImage2D(), and others.
  RED: 0x1903,
  RGB8: 0x8051,
  RGBA8: 0x8058,
  RGB10_A2: 0x8059,
  TEXTURE_3D: 0x806f,
  TEXTURE_WRAP_R: 0x8072,
  TEXTURE_MIN_LOD: 0x813a,
  TEXTURE_MAX_LOD: 0x813b,
  TEXTURE_BASE_LEVEL: 0x813c,
  TEXTURE_MAX_LEVEL: 0x813d,
  TEXTURE_COMPARE_MODE: 0x884c,
  TEXTURE_COMPARE_FUNC: 0x884d,
  SRGB: 0x8c40,
  SRGB8: 0x8c41,
  SRGB8_ALPHA8: 0x8c43,
  COMPARE_REF_TO_TEXTURE: 0x884e,
  RGBA32F: 0x8814,
  RGB32F: 0x8815,
  RGBA16F: 0x881a,
  RGB16F: 0x881b,
  TEXTURE_2D_ARRAY: 0x8c1a,
  TEXTURE_BINDING_2D_ARRAY: 0x8c1d,
  R11F_G11F_B10F: 0x8c3a,
  RGB9_E5: 0x8c3d,
  RGBA32UI: 0x8d70,
  RGB32UI: 0x8d71,
  RGBA16UI: 0x8d76,
  RGB16UI: 0x8d77,
  RGBA8UI: 0x8d7c,
  RGB8UI: 0x8d7d,
  RGBA32I: 0x8d82,
  RGB32I: 0x8d83,
  RGBA16I: 0x8d88,
  RGB16I: 0x8d89,
  RGBA8I: 0x8d8e,
  RGB8I: 0x8d8f,
  RED_INTEGER: 0x8d94,
  RGB_INTEGER: 0x8d98,
  RGBA_INTEGER: 0x8d99,
  R8: 0x8229,
  RG8: 0x822b,
  R16F: 0x822d,
  R32F: 0x822e,
  RG16F: 0x822f,
  RG32F: 0x8230,
  R8I: 0x8231,
  R8UI: 0x8232,
  R16I: 0x8233,
  R16UI: 0x8234,
  R32I: 0x8235,
  R32UI: 0x8236,
  RG8I: 0x8237,
  RG8UI: 0x8238,
  RG16I: 0x8239,
  RG16UI: 0x823a,
  RG32I: 0x823b,
  RG32UI: 0x823c,
  R8_SNORM: 0x8f94,
  RG8_SNORM: 0x8f95,
  RGB8_SNORM: 0x8f96,
  RGBA8_SNORM: 0x8f97,
  RGB10_A2UI: 0x906f,

  /* covered by extension
  COMPRESSED_R11_EAC : 0x9270,
  COMPRESSED_SIGNED_R11_EAC: 0x9271,
  COMPRESSED_RG11_EAC: 0x9272,
  COMPRESSED_SIGNED_RG11_EAC : 0x9273,
  COMPRESSED_RGB8_ETC2 : 0x9274,
  COMPRESSED_SRGB8_ETC2: 0x9275,
  COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 : 0x9276,
  COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC : 0x9277,
  COMPRESSED_RGBA8_ETC2_EAC: 0x9278,
  COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : 0x9279,
  */
  TEXTURE_IMMUTABLE_FORMAT: 0x912f,
  TEXTURE_IMMUTABLE_LEVELS: 0x82df,
  // Pixel types
  UNSIGNED_INT_2_10_10_10_REV: 0x8368,
  UNSIGNED_INT_10F_11F_11F_REV: 0x8c3b,
  UNSIGNED_INT_5_9_9_9_REV: 0x8c3e,
  FLOAT_32_UNSIGNED_INT_24_8_REV: 0x8dad,
  UNSIGNED_INT_24_8: 0x84fa,
  HALF_FLOAT: 0x140b,
  RG: 0x8227,
  RG_INTEGER: 0x8228,
  INT_2_10_10_10_REV: 0x8d9f,
  // Queries
  CURRENT_QUERY: 0x8865,
  QUERY_RESULT: 0x8866,
  QUERY_RESULT_AVAILABLE: 0x8867,
  ANY_SAMPLES_PASSED: 0x8c2f,
  ANY_SAMPLES_PASSED_CONSERVATIVE: 0x8d6a,
  // Draw buffers
  MAX_DRAW_BUFFERS: 0x8824,
  DRAW_BUFFER0: 0x8825,
  DRAW_BUFFER1: 0x8826,
  DRAW_BUFFER2: 0x8827,
  DRAW_BUFFER3: 0x8828,
  DRAW_BUFFER4: 0x8829,
  DRAW_BUFFER5: 0x882a,
  DRAW_BUFFER6: 0x882b,
  DRAW_BUFFER7: 0x882c,
  DRAW_BUFFER8: 0x882d,
  DRAW_BUFFER9: 0x882e,
  DRAW_BUFFER10: 0x882f,
  DRAW_BUFFER11: 0x8830,
  DRAW_BUFFER12: 0x8831,
  DRAW_BUFFER13: 0x8832,
  DRAW_BUFFER14: 0x8833,
  DRAW_BUFFER15: 0x8834,
  MAX_COLOR_ATTACHMENTS: 0x8cdf,
  COLOR_ATTACHMENT1: 0x8ce1,
  COLOR_ATTACHMENT2: 0x8ce2,
  COLOR_ATTACHMENT3: 0x8ce3,
  COLOR_ATTACHMENT4: 0x8ce4,
  COLOR_ATTACHMENT5: 0x8ce5,
  COLOR_ATTACHMENT6: 0x8ce6,
  COLOR_ATTACHMENT7: 0x8ce7,
  COLOR_ATTACHMENT8: 0x8ce8,
  COLOR_ATTACHMENT9: 0x8ce9,
  COLOR_ATTACHMENT10: 0x8cea,
  COLOR_ATTACHMENT11: 0x8ceb,
  COLOR_ATTACHMENT12: 0x8cec,
  COLOR_ATTACHMENT13: 0x8ced,
  COLOR_ATTACHMENT14: 0x8cee,
  COLOR_ATTACHMENT15: 0x8cef,
  // Samplers
  SAMPLER_3D: 0x8b5f,
  SAMPLER_2D_SHADOW: 0x8b62,
  SAMPLER_2D_ARRAY: 0x8dc1,
  SAMPLER_2D_ARRAY_SHADOW: 0x8dc4,
  SAMPLER_CUBE_SHADOW: 0x8dc5,
  INT_SAMPLER_2D: 0x8dca,
  INT_SAMPLER_3D: 0x8dcb,
  INT_SAMPLER_CUBE: 0x8dcc,
  INT_SAMPLER_2D_ARRAY: 0x8dcf,
  UNSIGNED_INT_SAMPLER_2D: 0x8dd2,
  UNSIGNED_INT_SAMPLER_3D: 0x8dd3,
  UNSIGNED_INT_SAMPLER_CUBE: 0x8dd4,
  UNSIGNED_INT_SAMPLER_2D_ARRAY: 0x8dd7,
  MAX_SAMPLES: 0x8d57,
  SAMPLER_BINDING: 0x8919,
  // Buffers
  PIXEL_PACK_BUFFER: 0x88eb,
  PIXEL_UNPACK_BUFFER: 0x88ec,
  PIXEL_PACK_BUFFER_BINDING: 0x88ed,
  PIXEL_UNPACK_BUFFER_BINDING: 0x88ef,
  COPY_READ_BUFFER: 0x8f36,
  COPY_WRITE_BUFFER: 0x8f37,
  COPY_READ_BUFFER_BINDING: 0x8f36,
  COPY_WRITE_BUFFER_BINDING: 0x8f37,
  // Data types
  FLOAT_MAT2x3: 0x8b65,
  FLOAT_MAT2x4: 0x8b66,
  FLOAT_MAT3x2: 0x8b67,
  FLOAT_MAT3x4: 0x8b68,
  FLOAT_MAT4x2: 0x8b69,
  FLOAT_MAT4x3: 0x8b6a,
  UNSIGNED_INT_VEC2: 0x8dc6,
  UNSIGNED_INT_VEC3: 0x8dc7,
  UNSIGNED_INT_VEC4: 0x8dc8,
  UNSIGNED_NORMALIZED: 0x8c17,
  SIGNED_NORMALIZED: 0x8f9c,
  // Vertex attributes
  VERTEX_ATTRIB_ARRAY_INTEGER: 0x88fd,
  VERTEX_ATTRIB_ARRAY_DIVISOR: 0x88fe,
  // Transform feedback
  TRANSFORM_FEEDBACK_BUFFER_MODE: 0x8c7f,
  MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: 0x8c80,
  TRANSFORM_FEEDBACK_VARYINGS: 0x8c83,
  TRANSFORM_FEEDBACK_BUFFER_START: 0x8c84,
  TRANSFORM_FEEDBACK_BUFFER_SIZE: 0x8c85,
  TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: 0x8c88,
  MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: 0x8c8a,
  MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: 0x8c8b,
  INTERLEAVED_ATTRIBS: 0x8c8c,
  SEPARATE_ATTRIBS: 0x8c8d,
  TRANSFORM_FEEDBACK_BUFFER: 0x8c8e,
  TRANSFORM_FEEDBACK_BUFFER_BINDING: 0x8c8f,
  TRANSFORM_FEEDBACK: 0x8e22,
  TRANSFORM_FEEDBACK_PAUSED: 0x8e23,
  TRANSFORM_FEEDBACK_ACTIVE: 0x8e24,
  TRANSFORM_FEEDBACK_BINDING: 0x8e25,
  // Framebuffers and renderbuffers
  FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: 0x8210,
  FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: 0x8211,
  FRAMEBUFFER_ATTACHMENT_RED_SIZE: 0x8212,
  FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: 0x8213,
  FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: 0x8214,
  FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: 0x8215,
  FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: 0x8216,
  FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: 0x8217,
  FRAMEBUFFER_DEFAULT: 0x8218,
  // DEPTH_STENCIL_ATTACHMENT : 0x821A,
  // DEPTH_STENCIL: 0x84F9,
  DEPTH24_STENCIL8: 0x88f0,
  DRAW_FRAMEBUFFER_BINDING: 0x8ca6,
  READ_FRAMEBUFFER_BINDING: 0x8caa,
  RENDERBUFFER_SAMPLES: 0x8cab,
  FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: 0x8cd4,
  FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: 0x8d56,
  // Uniforms
  UNIFORM_BUFFER: 0x8a11,
  UNIFORM_BUFFER_BINDING: 0x8a28,
  UNIFORM_BUFFER_START: 0x8a29,
  UNIFORM_BUFFER_SIZE: 0x8a2a,
  MAX_VERTEX_UNIFORM_BLOCKS: 0x8a2b,
  MAX_FRAGMENT_UNIFORM_BLOCKS: 0x8a2d,
  MAX_COMBINED_UNIFORM_BLOCKS: 0x8a2e,
  MAX_UNIFORM_BUFFER_BINDINGS: 0x8a2f,
  MAX_UNIFORM_BLOCK_SIZE: 0x8a30,
  MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS: 0x8a31,
  MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS: 0x8a33,
  UNIFORM_BUFFER_OFFSET_ALIGNMENT: 0x8a34,
  ACTIVE_UNIFORM_BLOCKS: 0x8a36,
  UNIFORM_TYPE: 0x8a37,
  UNIFORM_SIZE: 0x8a38,
  UNIFORM_BLOCK_INDEX: 0x8a3a,
  UNIFORM_OFFSET: 0x8a3b,
  UNIFORM_ARRAY_STRIDE: 0x8a3c,
  UNIFORM_MATRIX_STRIDE: 0x8a3d,
  UNIFORM_IS_ROW_MAJOR: 0x8a3e,
  UNIFORM_BLOCK_BINDING: 0x8a3f,
  UNIFORM_BLOCK_DATA_SIZE: 0x8a40,
  UNIFORM_BLOCK_ACTIVE_UNIFORMS: 0x8a42,
  UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES: 0x8a43,
  UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER: 0x8a44,
  UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER: 0x8a46,
  // Sync objects
  OBJECT_TYPE: 0x9112,
  SYNC_CONDITION: 0x9113,
  SYNC_STATUS: 0x9114,
  SYNC_FLAGS: 0x9115,
  SYNC_FENCE: 0x9116,
  SYNC_GPU_COMMANDS_COMPLETE: 0x9117,
  UNSIGNALED: 0x9118,
  SIGNALED: 0x9119,
  ALREADY_SIGNALED: 0x911a,
  TIMEOUT_EXPIRED: 0x911b,
  CONDITION_SATISFIED: 0x911c,
  WAIT_FAILED: 0x911d,
  SYNC_FLUSH_COMMANDS_BIT: 0x00000001,
  // Miscellaneous constants
  COLOR: 0x1800,
  DEPTH: 0x1801,
  STENCIL: 0x1802,
  MIN: 0x8007,
  MAX: 0x8008,
  DEPTH_COMPONENT24: 0x81a6,
  STREAM_READ: 0x88e1,
  STREAM_COPY: 0x88e2,
  STATIC_READ: 0x88e5,
  STATIC_COPY: 0x88e6,
  DYNAMIC_READ: 0x88e9,
  DYNAMIC_COPY: 0x88ea,
  DEPTH_COMPONENT32F: 0x8cac,
  DEPTH32F_STENCIL8: 0x8cad,
  INVALID_INDEX: 0xffffffff,
  TIMEOUT_IGNORED: -1,
  MAX_CLIENT_WAIT_TIMEOUT_WEBGL: 0x9247,
  // Constants defined in WebGL extensions
  // ANGLE_instanced_arrays
  VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: 0x88fe,
  // WEBGL_debug_renderer_info
  UNMASKED_VENDOR_WEBGL: 0x9245,
  UNMASKED_RENDERER_WEBGL: 0x9246,
  // EXT_texture_filter_anisotropic
  MAX_TEXTURE_MAX_ANISOTROPY_EXT: 0x84ff,
  TEXTURE_MAX_ANISOTROPY_EXT: 0x84fe,
  // WEBGL_compressed_texture_s3tc
  COMPRESSED_RGB_S3TC_DXT1_EXT: 0x83f0,
  COMPRESSED_RGBA_S3TC_DXT1_EXT: 0x83f1,
  COMPRESSED_RGBA_S3TC_DXT3_EXT: 0x83f2,
  COMPRESSED_RGBA_S3TC_DXT5_EXT: 0x83f3,
  // WEBGL_compressed_texture_es3
  COMPRESSED_R11_EAC: 0x9270,
  COMPRESSED_SIGNED_R11_EAC: 0x9271,
  COMPRESSED_RG11_EAC: 0x9272,
  COMPRESSED_SIGNED_RG11_EAC: 0x9273,
  COMPRESSED_RGB8_ETC2: 0x9274,
  COMPRESSED_RGBA8_ETC2_EAC: 0x9275,
  COMPRESSED_SRGB8_ETC2: 0x9276,
  COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: 0x9277,
  COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: 0x9278,
  COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: 0x9279,
  // WEBGL_compressed_texture_pvrtc
  COMPRESSED_RGB_PVRTC_4BPPV1_IMG: 0x8c00,
  COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: 0x8c02,
  COMPRESSED_RGB_PVRTC_2BPPV1_IMG: 0x8c01,
  COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: 0x8c03,
  // WEBGL_compressed_texture_etc1
  COMPRESSED_RGB_ETC1_WEBGL: 0x8d64,
  // WEBGL_compressed_texture_atc
  COMPRESSED_RGB_ATC_WEBGL: 0x8c92,
  COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL: 0x8c92,
  COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL: 0x87ee,
  // WEBGL_depth_texture
  UNSIGNED_INT_24_8_WEBGL: 0x84fa,
  // OES_texture_half_float
  HALF_FLOAT_OES: 0x8d61,
  // WEBGL_color_buffer_float
  RGBA32F_EXT: 0x8814,
  RGB32F_EXT: 0x8815,
  FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT: 0x8211,
  UNSIGNED_NORMALIZED_EXT: 0x8c17,
  // EXT_blend_minmax
  MIN_EXT: 0x8007,
  MAX_EXT: 0x8008,
  // EXT_sRGB
  SRGB_EXT: 0x8c40,
  SRGB_ALPHA_EXT: 0x8c42,
  SRGB8_ALPHA8_EXT: 0x8c43,
  FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT: 0x8210,
  // OES_standard_derivatives
  FRAGMENT_SHADER_DERIVATIVE_HINT_OES: 0x8b8b,
  // WEBGL_draw_buffers
  COLOR_ATTACHMENT0_WEBGL: 0x8ce0,
  COLOR_ATTACHMENT1_WEBGL: 0x8ce1,
  COLOR_ATTACHMENT2_WEBGL: 0x8ce2,
  COLOR_ATTACHMENT3_WEBGL: 0x8ce3,
  COLOR_ATTACHMENT4_WEBGL: 0x8ce4,
  COLOR_ATTACHMENT5_WEBGL: 0x8ce5,
  COLOR_ATTACHMENT6_WEBGL: 0x8ce6,
  COLOR_ATTACHMENT7_WEBGL: 0x8ce7,
  COLOR_ATTACHMENT8_WEBGL: 0x8ce8,
  COLOR_ATTACHMENT9_WEBGL: 0x8ce9,
  COLOR_ATTACHMENT10_WEBGL: 0x8cea,
  COLOR_ATTACHMENT11_WEBGL: 0x8ceb,
  COLOR_ATTACHMENT12_WEBGL: 0x8cec,
  COLOR_ATTACHMENT13_WEBGL: 0x8ced,
  COLOR_ATTACHMENT14_WEBGL: 0x8cee,
  COLOR_ATTACHMENT15_WEBGL: 0x8cef,
  DRAW_BUFFER0_WEBGL: 0x8825,
  DRAW_BUFFER1_WEBGL: 0x8826,
  DRAW_BUFFER2_WEBGL: 0x8827,
  DRAW_BUFFER3_WEBGL: 0x8828,
  DRAW_BUFFER4_WEBGL: 0x8829,
  DRAW_BUFFER5_WEBGL: 0x882a,
  DRAW_BUFFER6_WEBGL: 0x882b,
  DRAW_BUFFER7_WEBGL: 0x882c,
  DRAW_BUFFER8_WEBGL: 0x882d,
  DRAW_BUFFER9_WEBGL: 0x882e,
  DRAW_BUFFER10_WEBGL: 0x882f,
  DRAW_BUFFER11_WEBGL: 0x8830,
  DRAW_BUFFER12_WEBGL: 0x8831,
  DRAW_BUFFER13_WEBGL: 0x8832,
  DRAW_BUFFER14_WEBGL: 0x8833,
  DRAW_BUFFER15_WEBGL: 0x8834,
  MAX_COLOR_ATTACHMENTS_WEBGL: 0x8cdf,
  MAX_DRAW_BUFFERS_WEBGL: 0x8824,
  // OES_vertex_array_object
  VERTEX_ARRAY_BINDING_OES: 0x85b5,
  // EXT_disjoint_timer_query
  QUERY_COUNTER_BITS_EXT: 0x8864,
  CURRENT_QUERY_EXT: 0x8865,
  QUERY_RESULT_EXT: 0x8866,
  QUERY_RESULT_AVAILABLE_EXT: 0x8867,
  TIME_ELAPSED_EXT: 0x88bf,
  TIMESTAMP_EXT: 0x8e28,
  GPU_DISJOINT_EXT: 0x8fbb // A Boolean indicating whether or not the GPU performed any disjoint operation.

};
//# sourceMappingURL=constants.js.map
},{}],"lMsC":[function(require,module,exports) {
// eslint-disable-next-line
module.exports = require('./dist/es5/constants');

},{"./dist/es5/constants":"eMZP"}],"JblB":[function(require,module,exports) {

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.glArrayFromType = glArrayFromType;
exports.default = void 0;

var _assert = _interopRequireDefault(require("../utils/assert"));

var _constants = _interopRequireDefault(require("luma.gl/constants"));

var _luma = require("luma.gl");

var _log = _interopRequireDefault(require("../utils/log"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
}
/* eslint-disable complexity */


var DEFAULT_STATE = {
  isExternalBuffer: false,
  needsUpdate: true,
  needsRedraw: false,
  allocedInstances: -1
};

var LayerAttribute =
/*#__PURE__*/
function (_Attribute) {
  _inherits(LayerAttribute, _Attribute);

  function LayerAttribute(gl) {
    var _this;

    var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

    _classCallCheck(this, LayerAttribute);

    _this = _possibleConstructorReturn(this, _getPrototypeOf(LayerAttribute).call(this, gl, opts));
    var _opts$transition = opts.transition,
        transition = _opts$transition === void 0 ? false : _opts$transition,
        _opts$noAlloc = opts.noAlloc,
        noAlloc = _opts$noAlloc === void 0 ? false : _opts$noAlloc,
        _opts$update = opts.update,
        update = _opts$update === void 0 ? null : _opts$update,
        _opts$accessor = opts.accessor,
        accessor = _opts$accessor === void 0 ? null : _opts$accessor,
        _opts$bufferLayout = opts.bufferLayout,
        bufferLayout = _opts$bufferLayout === void 0 ? null : _opts$bufferLayout;
    var _opts$defaultValue = opts.defaultValue,
        defaultValue = _opts$defaultValue === void 0 ? [0, 0, 0, 0] : _opts$defaultValue;
    defaultValue = Array.isArray(defaultValue) ? defaultValue : [defaultValue];
    Object.assign(_this.userData, DEFAULT_STATE, opts, {
      transition: transition,
      noAlloc: noAlloc,
      update: update,
      accessor: accessor,
      defaultValue: defaultValue,
      bufferLayout: bufferLayout
    });
    Object.seal(_this.userData); // Check all fields and generate helpful error messages

    _this._validateAttributeUpdaters();

    return _this;
  }

  _createClass(LayerAttribute, [{
    key: "needsUpdate",
    value: function needsUpdate() {
      return this.userData.needsUpdate;
    }
  }, {
    key: "needsRedraw",
    value: function needsRedraw() {
      var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          _ref$clearChangedFlag = _ref.clearChangedFlags,
          clearChangedFlags = _ref$clearChangedFlag === void 0 ? false : _ref$clearChangedFlag;

      var needsRedraw = this.userData.needsRedraw;
      this.userData.needsRedraw = this.userData.needsRedraw && !clearChangedFlags;
      return needsRedraw;
    }
  }, {
    key: "getInstanceCount",
    value: function getInstanceCount() {
      return this.value !== null ? this.value.length / this.size : 0;
    }
  }, {
    key: "getUpdateTriggers",
    value: function getUpdateTriggers() {
      var accessor = this.userData.accessor; // Backards compatibility: allow attribute name to be used as update trigger key

      return [this.id].concat(accessor || []);
    }
  }, {
    key: "getAccessor",
    value: function getAccessor() {
      return this.userData.accessor;
    }
  }, {
    key: "supportsTransition",
    value: function supportsTransition() {
      return this.userData.transition;
    } // Resolve transition settings object if transition is enabled, otherwise `null`

  }, {
    key: "getTransitionSetting",
    value: function getTransitionSetting(opts) {
      var _this$userData = this.userData,
          transition = _this$userData.transition,
          accessor = _this$userData.accessor;

      if (!transition) {
        return null;
      }

      var settings = Array.isArray(accessor) ? opts[accessor.find(function (a) {
        return opts[a];
      })] : opts[accessor]; // Shorthand: use duration instead of parameter object

      if (Number.isFinite(settings)) {
        settings = {
          duration: settings
        };
      }

      if (settings && settings.duration > 0) {
        return Object.assign({}, transition, settings);
      }

      return null;
    } // Checks that typed arrays for attributes are big enough
    // sets alloc flag if not
    // @return {Boolean} whether any updates are needed

  }, {
    key: "setNeedsUpdate",
    value: function setNeedsUpdate() {
      var reason = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.id;
      this.userData.needsUpdate = this.userData.needsUpdate || reason;
    }
  }, {
    key: "setNeedsRedraw",
    value: function setNeedsRedraw() {
      var reason = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.id;
      this.userData.needsRedraw = this.userData.needsRedraw || reason;
    }
  }, {
    key: "allocate",
    value: function allocate(numInstances) {
      var state = this.userData;

      if (state.isExternalBuffer || state.noAlloc) {
        // Data is provided through a Buffer object.
        return false;
      } // Do we need to reallocate the attribute's typed array?


      var instanceCount = this.getInstanceCount();
      var needsAlloc = instanceCount === 0 || instanceCount < numInstances;

      if (needsAlloc && (state.update || state.accessor)) {
        (0, _assert.default)(Number.isFinite(numInstances)); // Allocate at least one element to ensure a valid buffer

        var allocCount = Math.max(numInstances, 1);
        var ArrayType = glArrayFromType(this.type || _constants.default.FLOAT);
        this.constant = false;
        this.value = new ArrayType(this.size * allocCount);
        state.needsUpdate = true;
        state.allocedInstances = allocCount;
        return true;
      }

      return false;
    }
  }, {
    key: "updateBuffer",
    value: function updateBuffer(_ref2) {
      var numInstances = _ref2.numInstances,
          data = _ref2.data,
          props = _ref2.props,
          context = _ref2.context;

      if (!this.needsUpdate()) {
        return false;
      }

      var state = this.userData;
      var update = state.update,
          accessor = state.accessor;
      var updated = true;

      if (update) {
        // Custom updater - typically for non-instanced layers
        update.call(context, this, {
          data: data,
          props: props,
          numInstances: numInstances
        });
        this.update({
          value: this.value,
          constant: this.constant
        });

        this._checkAttributeArray();
      } else if (accessor) {
        // Standard updater
        this._updateBufferViaStandardAccessor(data, props);

        this._checkAttributeArray();
      } else {
        updated = false;
      }

      state.needsUpdate = false;
      state.needsRedraw = true;
      return updated;
    } // Use generic value
    // Returns true if successful

  }, {
    key: "setGenericValue",
    value: function setGenericValue(value) {
      var state = this.userData;

      if (value === undefined || typeof value === 'function') {
        // ignore if this attribute has no accessor
        // ignore if accessor is function, will be used in updateBuffer
        state.isExternalBuffer = false;
        return false;
      }

      value = this._normalizeValue(value);
      var hasChanged = !this.constant || !this._areValuesEqual(value, this.value);

      if (hasChanged) {
        this.update({
          constant: true,
          value: value
        });
      }

      state.needsRedraw = state.needsUpdate || hasChanged;
      state.needsUpdate = false;
      state.isExternalBuffer = true;
      return true;
    } // Use external buffer
    // Returns true if successful

  }, {
    key: "setExternalBuffer",
    value: function setExternalBuffer(buffer, numInstances) {
      var state = this.userData;

      if (buffer) {
        state.isExternalBuffer = true;
        state.needsUpdate = false;

        if (buffer instanceof _luma.Buffer) {
          if (this.externalBuffer !== buffer) {
            this.update({
              constant: false,
              buffer: buffer
            });
            state.needsRedraw = true;
          }
        } else if (this.value !== buffer) {
          if (!ArrayBuffer.isView(buffer)) {
            throw new Error('Attribute prop must be typed array');
          }

          if (state.auto && buffer.length <= numInstances * this.size) {
            throw new Error('Attribute prop array must match length and size');
          }

          var ArrayType = glArrayFromType(this.type || _constants.default.FLOAT);

          if (buffer instanceof ArrayType) {
            this.update({
              constant: false,
              value: buffer
            });
          } else {
            _log.default.warn("Attribute prop ".concat(this.id, " is casted to ").concat(ArrayType.name))(); // Cast to proper type


            this.update({
              constant: false,
              value: new ArrayType(buffer)
            });
          } // Save original typed array


          this.value = buffer;
          state.needsRedraw = true;
        }

        return true;
      }

      state.isExternalBuffer = false;
      return false;
    } // PRIVATE HELPER METHODS

    /* check user supplied values and apply fallback */

  }, {
    key: "_normalizeValue",
    value: function _normalizeValue(value) {
      var out = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
      var start = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
      var defaultValue = this.userData.defaultValue;

      if (!Array.isArray(value) && !ArrayBuffer.isView(value)) {
        out[start] = Number.isFinite(value) ? value : defaultValue[0];
        return out;
      }
      /* eslint-disable no-fallthrough, default-case */


      switch (this.size) {
        case 4:
          out[start + 3] = Number.isFinite(value[3]) ? value[3] : defaultValue[3];

        case 3:
          out[start + 2] = Number.isFinite(value[2]) ? value[2] : defaultValue[2];

        case 2:
          out[start + 1] = Number.isFinite(value[1]) ? value[1] : defaultValue[1];

        case 1:
          out[start + 0] = Number.isFinite(value[0]) ? value[0] : defaultValue[0];
      }

      return out;
    }
  }, {
    key: "_areValuesEqual",
    value: function _areValuesEqual(value1, value2) {
      var size = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.size;

      for (var i = 0; i < size; i++) {
        if (value1[i] !== value2[i]) {
          return false;
        }
      }

      return true;
    }
  }, {
    key: "_updateBufferViaStandardAccessor",
    value: function _updateBufferViaStandardAccessor(data, props) {
      var state = this.userData;
      var accessor = state.accessor;
      var value = this.value,
          size = this.size;
      var accessorFunc = props[accessor];
      (0, _assert.default)(typeof accessorFunc === 'function', "accessor \"".concat(accessor, "\" is not a function"));
      var i = 0;
      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = data[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var object = _step.value;
          var objectValue = accessorFunc(object);

          this._normalizeValue(objectValue, value, i);

          i += size;
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return != null) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }

      this.update({
        value: value
      });
    } // Validate deck.gl level fields

  }, {
    key: "_validateAttributeUpdaters",
    value: function _validateAttributeUpdaters() {
      var state = this.userData; // Check that either 'accessor' or 'update' is a valid function

      var hasUpdater = state.noAlloc || typeof state.update === 'function' || typeof state.accessor === 'string';

      if (!hasUpdater) {
        throw new Error("Attribute ".concat(this.id, " missing update or accessor"));
      }
    }
  }, {
    key: "_checkAttributeArray",
    value: function _checkAttributeArray() {
      var value = this.value;

      if (value && value.length >= 4) {
        var valid = Number.isFinite(value[0]) && Number.isFinite(value[1]) && Number.isFinite(value[2]) && Number.isFinite(value[3]);

        if (!valid) {
          throw new Error("Illegal attribute generated for ".concat(this.id));
        }
      }
    }
  }, {
    key: "bufferLayout",
    get: function get() {
      return this.userData.bufferLayout;
    },
    set: function set(layout) {
      this.userData.bufferLayout = layout;
    }
  }]);

  return LayerAttribute;
}(_luma._Attribute);
/* eslint-disable complexity */


exports.default = LayerAttribute;

function glArrayFromType(glType) {
  var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
      _ref3$clamped = _ref3.clamped,
      clamped = _ref3$clamped === void 0 ? true : _ref3$clamped; // Sorted in some order of likelihood to reduce amount of comparisons


  switch (glType) {
    case _constants.default.FLOAT:
      return Float32Array;

    case _constants.default.UNSIGNED_SHORT:
    case _constants.default.UNSIGNED_SHORT_5_6_5:
    case _constants.default.UNSIGNED_SHORT_4_4_4_4:
    case _constants.default.UNSIGNED_SHORT_5_5_5_1:
      return Uint16Array;

    case _constants.default.UNSIGNED_INT:
      return Uint32Array;

    case _constants.default.UNSIGNED_BYTE:
      return clamped ? Uint8ClampedArray : Uint8Array;

    case _constants.default.BYTE:
      return Int8Array;

    case _constants.default.SHORT:
      return Int16Array;

    case _constants.default.INT:
      return Int32Array;

    default:
      throw new Error('Failed to deduce type from array');
  }
}
/* eslint-enable complexity */
},{"../utils/assert":"sRS1","luma.gl/constants":"lMsC","luma.gl":"GAQa","../utils/log":"q39U"}],"y2C9":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.padArray = padArray;

// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.

/*
 * Helper function for padArray
 */
function padArrayChunk(_ref) {
  var source = _ref.source,
      target = _ref.target,
      _ref$start = _ref.start,
      start = _ref$start === void 0 ? 0 : _ref$start,
      end = _ref.end,
      getData = _ref.getData;
  end = end || target.length;
  var sourceLength = source.length;
  var targetLength = end - start;

  if (sourceLength > targetLength) {
    target.set(source.subarray(0, targetLength), start);
    return;
  }

  target.set(source, start);

  if (!getData) {
    return;
  } // source is not large enough to fill target space, call `getData` to get filler data


  var i = sourceLength;

  while (i < targetLength) {
    var datum = getData(i, source);

    for (var j = 0; j < datum.length; j++) {
      target[start + i] = datum[j];
      i++;
    }
  }
}
/*
 * The padArray function stretches a source array to the size of a target array.
   The arrays can have internal structures (like the attributes of PathLayer and
   SolidPolygonLayer), defined by the optional sourceLayout and targetLayout parameters.
   If the target array is larger, the getData callback is used to fill in the blanks.
 * @params {TypedArray} source - original data
 * @params {TypedArray} target - output data
 * @params {Number} size - length per datum
 * @params {Function} getData - callback to get new data when source is short
 * @params {Array<Number>} [sourceLayout] - subdivision of the original data in [chunkSize0, chunkSize1, ...]
 * @params {Array<Number>} [targetLayout] - subdivision of the output data in [chunkSize0, chunkSize1, ...]
 */


function padArray(_ref2) {
  var source = _ref2.source,
      target = _ref2.target,
      size = _ref2.size,
      getData = _ref2.getData,
      sourceLayout = _ref2.sourceLayout,
      targetLayout = _ref2.targetLayout;

  if (!Array.isArray(targetLayout)) {
    // Flat arrays
    padArrayChunk({
      source: source,
      target: target,
      getData: getData
    });
    return target;
  } // Arrays have internal structure


  var sourceIndex = 0;
  var targetIndex = 0;

  var getChunkData = getData && function (i, chunk) {
    return getData(i + targetIndex, chunk);
  };

  var n = Math.min(sourceLayout.length, targetLayout.length);

  for (var i = 0; i < n; i++) {
    var sourceChunkLength = sourceLayout[i] * size;
    var targetChunkLength = targetLayout[i] * size;
    padArrayChunk({
      source: source.subarray(sourceIndex, sourceIndex + sourceChunkLength),
      target: target,
      start: targetIndex,
      end: targetIndex + targetChunkLength,
      getData: getChunkData
    });
    sourceIndex += sourceChunkLength;
    targetIndex += targetChunkLength;
  }

  if (targetIndex < target.length) {
    padArrayChunk({
      source: [],
      target: target,
      start: targetIndex,
      getData: getChunkData
    });
  }

  return target;
}
},{}],"BYWI":[function(require,module,exports) {

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getShaders = getShaders;
exports.getBuffers = getBuffers;
exports.padBuffer = padBuffer;

var _luma = require("luma.gl");

var _arrayUtils = require("../utils/array-utils");

var ATTRIBUTE_MAPPING = {
  1: 'float',
  2: 'vec2',
  3: 'vec3',
  4: 'vec4'
};

function getShaders(transitions) {
  // Build shaders
  var varyings = [];
  var attributeDeclarations = [];
  var uniformsDeclarations = [];
  var varyingDeclarations = [];
  var calculations = [];

  for (var attributeName in transitions) {
    var transition = transitions[attributeName];
    var attributeType = ATTRIBUTE_MAPPING[transition.attribute.size];

    if (attributeType) {
      transition.bufferIndex = varyings.length;
      varyings.push(attributeName);
      attributeDeclarations.push("attribute ".concat(attributeType, " ").concat(attributeName, "From;"));
      attributeDeclarations.push("attribute ".concat(attributeType, " ").concat(attributeName, "To;"));
      uniformsDeclarations.push("uniform float ".concat(attributeName, "Time;"));
      varyingDeclarations.push("varying ".concat(attributeType, " ").concat(attributeName, ";"));
      calculations.push("".concat(attributeName, " = mix(").concat(attributeName, "From, ").concat(attributeName, "To,\n        ").concat(attributeName, "Time);"));
    }
  }

  var vs = "\n#define SHADER_NAME feedback-vertex-shader\n".concat(attributeDeclarations.join('\n'), "\n").concat(uniformsDeclarations.join('\n'), "\n").concat(varyingDeclarations.join('\n'), "\n\nvoid main(void) {\n  ").concat(calculations.join('\n'), "\n  gl_Position = vec4(0.0);\n}\n");
  var fs = "#define SHADER_NAME feedback-fragment-shader\n\nprecision highp float;\n\n".concat(varyingDeclarations.join('\n'), "\n\nvoid main(void) {\n  gl_FragColor = vec4(0.0);\n}\n");
  return {
    vs: vs,
    fs: fs,
    varyings: varyings
  };
}

function getBuffers(transitions) {
  var sourceBuffers = {};
  var feedbackBuffers = {};

  for (var attributeName in transitions) {
    var _transitions$attribut = transitions[attributeName],
        fromState = _transitions$attribut.fromState,
        toState = _transitions$attribut.toState,
        buffer = _transitions$attribut.buffer;
    sourceBuffers["".concat(attributeName, "From")] = fromState;
    sourceBuffers["".concat(attributeName, "To")] = toState;
    feedbackBuffers["".concat(attributeName)] = buffer;
  }

  return {
    sourceBuffers: sourceBuffers,
    feedbackBuffers: feedbackBuffers
  };
}

function padBuffer(_ref) {
  var fromState = _ref.fromState,
      toState = _ref.toState,
      fromLength = _ref.fromLength,
      toLength = _ref.toLength,
      fromBufferLayout = _ref.fromBufferLayout,
      toBufferLayout = _ref.toBufferLayout,
      _ref$getData = _ref.getData,
      getData = _ref$getData === void 0 ? function (x) {
    return x;
  } : _ref$getData;
  var hasBufferLayout = fromBufferLayout && toBufferLayout; // check if buffer needs to be padded

  if (!hasBufferLayout && fromLength >= toLength || !(fromState instanceof _luma.Buffer)) {
    return;
  }

  var data = new Float32Array(toLength);
  var fromData = fromState.getData({});
  var value = toState.value,
      buffer = toState.buffer,
      size = toState.size,
      constant = toState.constant;
  var toData = value || buffer.getData({});
  var getMissingData = constant ? function (i, chunk) {
    return getData(value, chunk);
  } : function (i, chunk) {
    return getData(toData.subarray(i, i + size), chunk);
  };
  (0, _arrayUtils.padArray)({
    source: fromData,
    target: data,
    sourceLayout: fromBufferLayout,
    targetLayout: toBufferLayout,
    size: toState.size,
    getData: getMissingData
  });
  fromState.setData({
    data: data
  });
}
},{"luma.gl":"GAQa","../utils/array-utils":"y2C9"}],"yhd8":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.TRANSITION_STATE = void 0;

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

var TRANSITION_STATE = {
  NONE: 'none',
  PENDING: 'pending',
  IN_PROGRESS: 'in_progress',
  ENDED: 'ended'
};
exports.TRANSITION_STATE = TRANSITION_STATE;

function noop() {}

var Transition =
/*#__PURE__*/
function () {
  /**
   * @params props {object} - properties of the transition.
   *
   * @params props.duration {number} - total time to complete the transition
   * @params props.easing {func} - easing function
   * @params props.onStart {func} - callback when transition starts
   * @params props.onUpdate {func} - callback when transition updates
   * @params props.onInterrupt {func} - callback when transition is interrupted
   * @params props.onEnd {func} - callback when transition ends
   *
   * Any additional properties are also saved on the instance but have no effect.
   */
  function Transition(props) {
    _classCallCheck(this, Transition);

    this._startTime = null;
    this._state = TRANSITION_STATE.NONE; // Defaults

    this.duration = 1;

    this.easing = function (t) {
      return t;
    };

    this.onStart = noop;
    this.onUpdate = noop;
    this.onInterrupt = noop;
    this.onEnd = noop;
    Object.assign(this, props);
  }
  /* Public API */


  _createClass(Transition, [{
    key: "start",

    /**
     * (re)start this transition.
     * @params props {object} - optional overriding props. see constructor
     */
    value: function start(props) {
      if (this.inProgress) {
        this.onInterrupt(this);
      }

      Object.assign(this, props);

      this._setState(TRANSITION_STATE.PENDING);
    }
    /**
     * cancel this transition if it is in progress.
     */

  }, {
    key: "cancel",
    value: function cancel() {
      if (this.inProgress) {
        this.onInterrupt(this);

        this._setState(TRANSITION_STATE.NONE);
      }
    }
    /**
     * update this transition.
     * @params currentTime {number} - timestamp of the update. should be in the same unit as `duration`.
     */

  }, {
    key: "update",
    value: function update(currentTime) {
      if (this.state === TRANSITION_STATE.PENDING) {
        this._startTime = currentTime;

        this._setState(TRANSITION_STATE.IN_PROGRESS);
      }

      if (this.state === TRANSITION_STATE.IN_PROGRESS) {
        var shouldEnd = false;
        var time = (currentTime - this._startTime) / this.duration;

        if (time >= 1) {
          time = 1;
          shouldEnd = true;
        }

        this.time = this.easing(time);
        this.onUpdate(this);

        if (shouldEnd) {
          this._setState(TRANSITION_STATE.ENDED);
        }

        return true;
      }

      return false;
    }
    /* Private API */

  }, {
    key: "_setState",
    value: function _setState(newState) {
      if (this._state === newState) {
        return;
      }

      this._state = newState;

      switch (newState) {
        case TRANSITION_STATE.PENDING:
          this.onStart(this);
          break;

        case TRANSITION_STATE.ENDED:
          this.onEnd(this);
          break;

        default:
      }
    }
  }, {
    key: "state",
    get: function get() {
      return this._state;
    }
  }, {
    key: "inProgress",
    get: function get() {
      return this._state === TRANSITION_STATE.PENDING || this._state === TRANSITION_STATE.IN_PROGRESS;
    }
  }]);

  return Transition;
}();

exports.default = Transition;
},{}],"SmHT":[function(require,module,exports) {

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _constants = _interopRequireDefault(require("luma.gl/constants"));

var _luma = require("luma.gl");

var _attributeTransitionUtils = require("./attribute-transition-utils");

var _attribute = _interopRequireDefault(require("./attribute"));

var _transition = _interopRequireDefault(require("../transitions/transition"));

var _log = _interopRequireDefault(require("../utils/log"));

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

var noop = function noop() {};

var DEFAULT_TRANSITION_SETTINGS = {
  duration: 0,
  easing: function easing(t) {
    return t;
  },
  onStart: noop,
  onEnd: noop,
  onInterrupt: noop
};

var AttributeTransitionManager =
/*#__PURE__*/
function () {
  function AttributeTransitionManager(gl, _ref) {
    var id = _ref.id;

    _classCallCheck(this, AttributeTransitionManager);

    this.id = id;
    this.gl = gl;
    this.attributeTransitions = {};
    this.needsRedraw = false;
    this.transform = null;
    this.numInstances = 0;

    if (_luma.Transform.isSupported(gl)) {
      this.isSupported = true;
    } else if (gl) {
      // This class may be instantiated without a WebGL context (e.g. web worker)
      _log.default.warn('WebGL2 not supported by this browser. Transition animation is disabled.')();
    }
  }

  _createClass(AttributeTransitionManager, [{
    key: "finalize",
    value: function finalize() {
      if (this.transform) {
        this.transform.delete();
      }

      for (var attributeName in this.attributeTransitions) {
        this._removeTransition(attributeName);
      }
    }
    /* Public methods */
    // Called when attribute manager updates
    // Check the latest attributes for updates.

  }, {
    key: "update",
    value: function update(_ref2) {
      var attributes = _ref2.attributes,
          _ref2$transitions = _ref2.transitions,
          transitions = _ref2$transitions === void 0 ? {} : _ref2$transitions,
          numInstances = _ref2.numInstances;
      this.opts = transitions; // Transform class will crash if elementCount is 0

      this.numInstances = numInstances || 1;

      if (!this.isSupported) {
        return;
      }

      var attributeTransitions = this.attributeTransitions;
      var changedTransitions = {};

      for (var attributeName in attributes) {
        var hasChanged = this._updateAttribute(attributeName, attributes[attributeName]);

        if (hasChanged) {
          changedTransitions[attributeName] = attributeTransitions[attributeName];
        }
      }

      for (var _attributeName in attributeTransitions) {
        var attribute = attributes[_attributeName];

        if (!attribute || !attribute.supportsTransition()) {
          // Animated attribute has been removed
          this._removeTransition(_attributeName);
        }
      }

      if (!this.transform) {
        this._createModel();
      } else if (this.transform) {
        var _getBuffers = (0, _attributeTransitionUtils.getBuffers)(changedTransitions),
            sourceBuffers = _getBuffers.sourceBuffers,
            feedbackBuffers = _getBuffers.feedbackBuffers;

        this.transform.update({
          elementCount: this.numInstances,
          sourceBuffers: sourceBuffers,
          feedbackBuffers: feedbackBuffers
        });
      }
    } // Returns `true` if attribute is transition-enabled

  }, {
    key: "hasAttribute",
    value: function hasAttribute(attributeName) {
      return attributeName in this.attributeTransitions;
    } // Get all the animated attributes

  }, {
    key: "getAttributes",
    value: function getAttributes() {
      var animatedAttributes = {};

      for (var attributeName in this.attributeTransitions) {
        var transition = this.attributeTransitions[attributeName];

        if (transition.buffer) {
          animatedAttributes[attributeName] = transition.attributeInTransition;
        }
      }

      return animatedAttributes;
    }
    /* eslint-disable max-statements */
    // Called every render cycle, run transform feedback
    // Returns `true` if anything changes

  }, {
    key: "setCurrentTime",
    value: function setCurrentTime(currentTime) {
      if (!this.transform || this.numInstances === 0) {
        return false;
      }

      var uniforms = {};
      var needsRedraw = this.needsRedraw;
      this.needsRedraw = false;

      for (var attributeName in this.attributeTransitions) {
        var transition = this.attributeTransitions[attributeName];
        var updated = transition.update(currentTime);

        if (updated) {
          uniforms["".concat(attributeName, "Time")] = transition.time;
          needsRedraw = true;
        }
      }

      if (needsRedraw) {
        this.transform.run({
          uniforms: uniforms
        });
      }

      return needsRedraw;
    }
    /* eslint-enable max-statements */

    /* Private methods */

  }, {
    key: "_createTransition",
    value: function _createTransition(attributeName, attribute) {
      var transition = this.attributeTransitions[attributeName];

      if (!transition) {
        transition = new _transition.default({
          name: attributeName,
          attribute: attribute,
          attributeInTransition: new _attribute.default(this.gl, attribute),
          bufferLayout: attribute.bufferLayout
        });
        this.attributeTransitions[attributeName] = transition;

        this._invalidateModel();

        return transition;
      }

      return null;
    }
  }, {
    key: "_removeTransition",
    value: function _removeTransition(attributeName) {
      var transition = this.attributeTransitions[attributeName];

      if (transition) {
        if (transition.buffer) {
          transition.buffer.delete();
        }

        if (transition._swapBuffer) {
          transition._swapBuffer.delete();
        }

        delete this.attributeTransitions[attributeName];

        this._invalidateModel();
      }
    } // Check an attributes for updates
    // Returns a transition object if a new transition is triggered.

  }, {
    key: "_updateAttribute",
    value: function _updateAttribute(attributeName, attribute) {
      var settings = attribute.getTransitionSetting(this.opts);

      if (settings) {
        var hasChanged;
        var transition = this.attributeTransitions[attributeName];

        if (transition) {
          hasChanged = attribute.needsRedraw();
        } else {
          // New animated attributes have been added
          transition = this._createTransition(attributeName, attribute);
          hasChanged = true;
        }

        if (hasChanged) {
          this._triggerTransition(transition, settings);

          return true;
        }
      }

      return false;
    } // Invalidates the current model

  }, {
    key: "_invalidateModel",
    value: function _invalidateModel() {
      if (this.transform) {
        this.transform.delete();
        this.transform = null;
      }
    } // Create a model for the transform feedback

  }, {
    key: "_createModel",
    value: function _createModel() {
      if (Object.keys(this.attributeTransitions).length === 0) {
        // no transitions
        return;
      }

      this.transform = new _luma.Transform(this.gl, Object.assign({
        elementCount: this.numInstances
      }, (0, _attributeTransitionUtils.getBuffers)(this.attributeTransitions), (0, _attributeTransitionUtils.getShaders)(this.attributeTransitions)));
    } // get current values of an attribute, clipped/padded to the size of the new buffer

  }, {
    key: "_getNextTransitionStates",
    value: function _getNextTransitionStates(transition, settings) {
      var attribute = transition.attribute;
      var size = attribute.size;
      var toState;

      if (attribute.constant) {
        toState = {
          constant: true,
          value: attribute.value,
          size: size
        };
      } else {
        toState = {
          constant: false,
          buffer: attribute.getBuffer(),
          size: size,
          // attribute's `value` does not match the content of external buffer,
          // will need to call buffer.getData if needed
          value: attribute.externalBuffer ? null : attribute.value
        };
      }

      var fromState = transition.buffer || toState;
      var toLength = this.numInstances * size;
      var fromLength = fromState instanceof _luma.Buffer && fromState.getElementCount() || toLength; // Alternate between two buffers when new transitions start.
      // Last destination buffer is used as an attribute (from state),
      // And the other buffer is now the destination buffer.

      var buffer = transition._swapBuffer;
      transition._swapBuffer = transition.buffer;

      if (!buffer) {
        buffer = new _luma.Buffer(this.gl, {
          data: new Float32Array(toLength),
          usage: _constants.default.DYNAMIC_COPY
        });
      } else if (buffer.getElementCount() < toLength) {
        // Pad buffers to be the same length
        buffer.setData({
          data: new Float32Array(toLength)
        });
      }

      transition.attributeInTransition.update({
        buffer: buffer
      });
      (0, _attributeTransitionUtils.padBuffer)({
        fromState: fromState,
        toState: toState,
        fromLength: fromLength,
        toLength: toLength,
        fromBufferLayout: transition.bufferLayout,
        toBufferLayout: attribute.bufferLayout,
        getData: settings.enter
      });
      transition.bufferLayout = attribute.bufferLayout;
      return {
        fromState: fromState,
        toState: toState,
        buffer: buffer
      };
    } // Start a new transition using the current settings
    // Updates transition state and from/to buffer

  }, {
    key: "_triggerTransition",
    value: function _triggerTransition(transition, settings) {
      // Check if settings is valid
      (0, _assert.default)(settings && settings.duration > 0);
      this.needsRedraw = true;
      var transitionSettings = Object.assign({}, DEFAULT_TRANSITION_SETTINGS, settings); // Attribute descriptor to transition from

      transition.start(Object.assign({}, this._getNextTransitionStates(transition, settings), transitionSettings));
    }
  }]);

  return AttributeTransitionManager;
}();

exports.default = AttributeTransitionManager;
},{"luma.gl/constants":"lMsC","luma.gl":"GAQa","./attribute-transition-utils":"BYWI","./attribute":"JblB","../transitions/transition":"yhd8","../utils/log":"q39U","../utils/assert":"sRS1"}],"Vv1w":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _attribute = _interopRequireDefault(require("./attribute"));

var _log = _interopRequireDefault(require("../utils/log"));

var _attributeTransitionManager = _interopRequireDefault(require("./attribute-transition-manager"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.

/* eslint-disable guard-for-in */


var LOG_START_END_PRIORITY = 2;
var LOG_DETAIL_PRIORITY = 3;

function noop() {} // Default loggers


var logFunctions = {
  savedMessages: null,
  timeStart: null,
  onLog: function onLog(_ref) {
    var level = _ref.level,
        message = _ref.message;

    _log.default.log(level, message)();
  },
  onUpdateStart: function onUpdateStart(_ref2) {
    var level = _ref2.level,
        numInstances = _ref2.numInstances;
    logFunctions.savedMessages = [];
    logFunctions.timeStart = new Date();
  },
  onUpdate: function onUpdate(_ref3) {
    var level = _ref3.level,
        message = _ref3.message;

    if (logFunctions.savedMessages) {
      logFunctions.savedMessages.push(message);
    }
  },
  onUpdateEnd: function onUpdateEnd(_ref4) {
    var level = _ref4.level,
        id = _ref4.id,
        numInstances = _ref4.numInstances;
    var timeMs = Math.round(new Date() - logFunctions.timeStart);
    var time = "".concat(timeMs, "ms");

    _log.default.group(level, "Updated attributes for ".concat(numInstances, " instances in ").concat(id, " in ").concat(time), {
      collapsed: true
    })();

    var _iteratorNormalCompletion = true;
    var _didIteratorError = false;
    var _iteratorError = undefined;

    try {
      for (var _iterator = logFunctions.savedMessages[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
        var message = _step.value;

        _log.default.log(level, message)();
      }
    } catch (err) {
      _didIteratorError = true;
      _iteratorError = err;
    } finally {
      try {
        if (!_iteratorNormalCompletion && _iterator.return != null) {
          _iterator.return();
        }
      } finally {
        if (_didIteratorError) {
          throw _iteratorError;
        }
      }
    }

    _log.default.groupEnd(level, "Updated attributes for ".concat(numInstances, " instances in ").concat(id, " in ").concat(time))();

    logFunctions.savedMessages = null;
  }
};

var AttributeManager =
/*#__PURE__*/
function () {
  _createClass(AttributeManager, null, [{
    key: "setDefaultLogFunctions",

    /**
     * Sets log functions to help trace or time attribute updates.
     * Default logging uses deck logger.
     *
     * `onLog` is called for each attribute.
     *
     * To enable detailed control of timming and e.g. hierarchical logging,
     * hooks are also provided for update start and end.
     *
     * @param {Object} [opts]
     * @param {String} [onLog=] - called to print
     * @param {String} [onUpdateStart=] - called before update() starts
     * @param {String} [onUpdateEnd=] - called after update() ends
     */
    value: function setDefaultLogFunctions() {
      var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          onLog = _ref5.onLog,
          onUpdateStart = _ref5.onUpdateStart,
          onUpdate = _ref5.onUpdate,
          onUpdateEnd = _ref5.onUpdateEnd;

      if (onLog !== undefined) {
        logFunctions.onLog = onLog || noop;
      }

      if (onUpdateStart !== undefined) {
        logFunctions.onUpdateStart = onUpdateStart || noop;
      }

      if (onUpdate !== undefined) {
        logFunctions.onUpdate = onUpdate || noop;
      }

      if (onUpdateEnd !== undefined) {
        logFunctions.onUpdateEnd = onUpdateEnd || noop;
      }
    }
    /**
     * @classdesc
     * Automated attribute generation and management. Suitable when a set of
     * vertex shader attributes are generated by iteration over a data array,
     * and updates to these attributes are needed either when the data itself
     * changes, or when other data relevant to the calculations change.
     *
     * - First the application registers descriptions of its dynamic vertex
     *   attributes using AttributeManager.add().
     * - Then, when any change that affects attributes is detected by the
     *   application, the app will call AttributeManager.invalidate().
     * - Finally before it renders, it calls AttributeManager.update() to
     *   ensure that attributes are automatically rebuilt if anything has been
     *   invalidated.
     *
     * The application provided update functions describe how attributes
     * should be updated from a data array and are expected to traverse
     * that data array (or iterable) and fill in the attribute's typed array.
     *
     * Note that the attribute manager intentionally does not do advanced
     * change detection, but instead makes it easy to build such detection
     * by offering the ability to "invalidate" each attribute separately.
     */

  }]);

  function AttributeManager(gl) {
    var _ref6 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
        _ref6$id = _ref6.id,
        id = _ref6$id === void 0 ? 'attribute-manager' : _ref6$id,
        stats = _ref6.stats;

    _classCallCheck(this, AttributeManager);

    this.id = id;
    this.gl = gl;
    this.attributes = {};
    this.updateTriggers = {};
    this.accessors = {};
    this.needsRedraw = true;
    this.userData = {};
    this.stats = stats;
    this.attributeTransitionManager = new _attributeTransitionManager.default(gl, {
      id: "".concat(id, "-transitions")
    }); // For debugging sanity, prevent uninitialized members

    Object.seal(this);
  }

  _createClass(AttributeManager, [{
    key: "finalize",
    value: function finalize() {
      for (var attributeName in this.attributes) {
        this.attributes[attributeName].delete();
      }

      this.attributeTransitionManager.finalize();
    } // Returns the redraw flag, optionally clearing it.
    // Redraw flag will be set if any attributes attributes changed since
    // flag was last cleared.
    //
    // @param {String} [clearRedrawFlags=false] - whether to clear the flag
    // @return {false|String} - reason a redraw is needed.

  }, {
    key: "getNeedsRedraw",
    value: function getNeedsRedraw() {
      var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          _ref7$clearRedrawFlag = _ref7.clearRedrawFlags,
          clearRedrawFlags = _ref7$clearRedrawFlag === void 0 ? false : _ref7$clearRedrawFlag;

      var redraw = this.needsRedraw;
      this.needsRedraw = this.needsRedraw && !clearRedrawFlags;
      return redraw && this.id;
    } // Sets the redraw flag.
    // @param {Boolean} redraw=true
    // @return {AttributeManager} - for chaining

  }, {
    key: "setNeedsRedraw",
    value: function setNeedsRedraw() {
      var redraw = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
      this.needsRedraw = true;
      return this;
    } // Adds attributes

  }, {
    key: "add",
    value: function add(attributes, updaters) {
      this._add(attributes, updaters);
    } // Adds attributes

  }, {
    key: "addInstanced",
    value: function addInstanced(attributes, updaters) {
      this._add(attributes, updaters, {
        instanced: 1
      });
    }
    /**
     * Removes attributes
     * Takes an array of attribute names and delete them from
     * the attribute map if they exists
     *
     * @example
     * attributeManager.remove(['position']);
     *
     * @param {Object} attributeNameArray - attribute name array (see above)
     */

  }, {
    key: "remove",
    value: function remove(attributeNameArray) {
      for (var i = 0; i < attributeNameArray.length; i++) {
        var name = attributeNameArray[i];

        if (this.attributes[name] !== undefined) {
          this.attributes[name].delete();
          delete this.attributes[name];
        }
      }
    } // Marks an attribute for update

  }, {
    key: "invalidate",
    value: function invalidate(triggerName) {
      var invalidatedAttributes = this._invalidateTrigger(triggerName); // For performance tuning


      logFunctions.onLog({
        level: LOG_DETAIL_PRIORITY,
        message: "invalidated attributes ".concat(invalidatedAttributes, " (").concat(triggerName, ") for ").concat(this.id)
      });
    }
  }, {
    key: "invalidateAll",
    value: function invalidateAll() {
      for (var attributeName in this.attributes) {
        this.attributes[attributeName].setNeedsUpdate();
      } // For performance tuning


      logFunctions.onLog({
        level: LOG_DETAIL_PRIORITY,
        message: "invalidated all attributes for ".concat(this.id)
      });
    } // Ensure all attribute buffers are updated from props or data.

  }, {
    key: "update",
    value: function update() {
      var _ref8 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          data = _ref8.data,
          numInstances = _ref8.numInstances,
          transitions = _ref8.transitions,
          _ref8$props = _ref8.props,
          props = _ref8$props === void 0 ? {} : _ref8$props,
          _ref8$buffers = _ref8.buffers,
          buffers = _ref8$buffers === void 0 ? {} : _ref8$buffers,
          _ref8$context = _ref8.context,
          context = _ref8$context === void 0 ? {} : _ref8$context; // keep track of whether some attributes are updated


      var updated = false;
      logFunctions.onUpdateStart({
        level: LOG_START_END_PRIORITY,
        id: this.id,
        numInstances: numInstances
      });

      if (this.stats) {
        this.stats.timeStart('attribute updates', this.id);
      }

      for (var attributeName in this.attributes) {
        var attribute = this.attributes[attributeName];

        if (attribute.setExternalBuffer(buffers[attributeName], this.numInstances)) {// Attribute is using external buffer from the props
        } else if (attribute.setGenericValue(props[attribute.getAccessor()])) {// Attribute is using generic value from the props
        } else if (attribute.needsUpdate()) {
          updated = true;

          this._updateAttribute({
            attribute: attribute,
            numInstances: numInstances,
            data: data,
            props: props,
            context: context
          });
        }

        this.needsRedraw |= attribute.needsRedraw();
      }

      if (updated) {
        // Only initiate alloc/update (and logging) if actually needed
        if (this.stats) {
          this.stats.timeEnd('attribute updates', this.id);
        }

        logFunctions.onUpdateEnd({
          level: LOG_START_END_PRIORITY,
          id: this.id,
          numInstances: numInstances
        });
      }

      this.attributeTransitionManager.update({
        attributes: this.attributes,
        numInstances: numInstances,
        transitions: transitions
      });
    } // Update attribute transition to the current timestamp
    // Returns `true` if any transition is in progress

  }, {
    key: "updateTransition",
    value: function updateTransition() {
      var attributeTransitionManager = this.attributeTransitionManager;
      var transitionUpdated = attributeTransitionManager.setCurrentTime(Date.now());
      this.needsRedraw = this.needsRedraw || transitionUpdated;
      return transitionUpdated;
    }
    /**
     * Returns all attribute descriptors
     * Note: Format matches luma.gl Model/Program.setAttributes()
     * @return {Object} attributes - descriptors
     */

  }, {
    key: "getAttributes",
    value: function getAttributes() {
      return this.attributes;
    }
    /**
     * Returns changed attribute descriptors
     * This indicates which WebGLBuggers need to be updated
     * @return {Object} attributes - descriptors
     */

  }, {
    key: "getChangedAttributes",
    value: function getChangedAttributes(_ref9) {
      var _ref9$clearChangedFla = _ref9.clearChangedFlags,
          clearChangedFlags = _ref9$clearChangedFla === void 0 ? false : _ref9$clearChangedFla;
      var attributes = this.attributes,
          attributeTransitionManager = this.attributeTransitionManager;
      var changedAttributes = Object.assign({}, attributeTransitionManager.getAttributes());

      for (var attributeName in attributes) {
        var attribute = attributes[attributeName];

        if (attribute.needsRedraw({
          clearChangedFlags: true
        })) {
          // Only return non-transition attributes
          if (!attributeTransitionManager.hasAttribute(attributeName)) {
            changedAttributes[attributeName] = attribute;
          }
        }
      }

      return changedAttributes;
    } // PROTECTED METHODS - Only to be used by collaborating classes, not by apps
    // Returns object containing all accessors as keys, with non-null values
    // @return {Object} - accessors object

  }, {
    key: "getAccessors",
    value: function getAccessors() {
      return this.updateTriggers;
    } // PRIVATE METHODS
    // Used to register an attribute

  }, {
    key: "_add",
    value: function _add(attributes, updaters) {
      var extraProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

      if (updaters) {
        _log.default.warn('AttributeManager.add({updaters}) - updater map no longer supported')();
      }

      var newAttributes = {};

      for (var attributeName in attributes) {
        var attribute = attributes[attributeName]; // Initialize the attribute descriptor, with WebGL and metadata fields

        newAttributes[attributeName] = new _attribute.default(this.gl, Object.assign({}, attribute, {
          id: attributeName,
          // Luma fields
          constant: attribute.constant || false,
          isIndexed: attribute.isIndexed || attribute.elements,
          size: attribute.elements && 1 || attribute.size,
          value: attribute.value || null,
          instanced: attribute.instanced || extraProps.instanced
        }));
      }

      Object.assign(this.attributes, newAttributes);

      this._mapUpdateTriggersToAttributes();
    }
    /* eslint-enable max-statements */
    // build updateTrigger name to attribute name mapping

  }, {
    key: "_mapUpdateTriggersToAttributes",
    value: function _mapUpdateTriggersToAttributes() {
      var _this = this;

      var triggers = {};

      var _loop = function _loop(attributeName) {
        var attribute = _this.attributes[attributeName];
        attribute.getUpdateTriggers().forEach(function (triggerName) {
          if (!triggers[triggerName]) {
            triggers[triggerName] = [];
          }

          triggers[triggerName].push(attributeName);
        });
      };

      for (var attributeName in this.attributes) {
        _loop(attributeName);
      }

      this.updateTriggers = triggers;
    }
  }, {
    key: "_invalidateTrigger",
    value: function _invalidateTrigger(triggerName) {
      var attributes = this.attributes,
          updateTriggers = this.updateTriggers;
      var invalidatedAttributes = updateTriggers[triggerName];

      if (invalidatedAttributes) {
        invalidatedAttributes.forEach(function (name) {
          var attribute = attributes[name];

          if (attribute) {
            attribute.setNeedsUpdate();
          }
        });
      } else {
        var message = "invalidating non-existent trigger ".concat(triggerName, " for ").concat(this.id, "\n");
        message += "Valid triggers: ".concat(Object.keys(attributes).join(', '));

        _log.default.warn(message, invalidatedAttributes)();
      }

      return invalidatedAttributes;
    }
  }, {
    key: "_updateAttribute",
    value: function _updateAttribute(_ref10) {
      var attribute = _ref10.attribute,
          numInstances = _ref10.numInstances,
          data = _ref10.data,
          props = _ref10.props,
          context = _ref10.context;

      if (attribute.allocate(numInstances)) {
        logFunctions.onUpdate({
          level: LOG_DETAIL_PRIORITY,
          message: "".concat(attribute.id, " allocated ").concat(numInstances),
          id: this.id
        });
      } // Calls update on any buffers that need update


      var timeStart = Date.now();
      var updated = attribute.updateBuffer({
        numInstances: numInstances,
        data: data,
        props: props,
        context: context
      });

      if (updated) {
        this.needsRedraw = true;
        var timeMs = Math.round(Date.now() - timeStart);
        logFunctions.onUpdate({
          level: LOG_DETAIL_PRIORITY,
          message: "".concat(attribute.id, " updated ").concat(numInstances, " in ").concat(timeMs, "ms")
        });
      }
    }
  }]);

  return AttributeManager;
}();

exports.default = AttributeManager;
},{"./attribute":"JblB","../utils/log":"q39U","./attribute-transition-manager":"SmHT"}],"JOyY":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.removeLayerInSeer = exports.updateLayerInSeer = exports.initLayerInSeer = exports.seerInitListener = exports.layerEditListener = exports.applyPropOverrides = exports.setPropOverrides = void 0;

var _seer = _interopRequireDefault(require("seer"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _toConsumableArray(arr) {
  return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
}

function _nonIterableSpread() {
  throw new TypeError("Invalid attempt to spread non-iterable instance");
}

function _iterableToArray(iter) {
  if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}

function _arrayWithoutHoles(arr) {
  if (Array.isArray(arr)) {
    for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
      arr2[i] = arr[i];
    }

    return arr2;
  }
}

/**
 * Recursively set a nested property of an object given a properties array and a value
 */
var recursiveSet = function recursiveSet(obj, path, value) {
  if (!obj) {
    return;
  }

  if (path.length > 1) {
    recursiveSet(obj[path[0]], path.slice(1), value);
  } else {
    obj[path[0]] = value;
  }
};

var overrides = new Map();
/**
 * Create an override on the specify layer, indexed by a valuePath array.
 * Do nothing in case Seer as not been initialized to prevent any preformance drawback.
 */

var setPropOverrides = function setPropOverrides(id, valuePath, value) {
  if (!_seer.default.isReady()) {
    return;
  }

  if (!overrides.has(id)) {
    overrides.set(id, new Map());
  }

  var props = overrides.get(id);
  props.set(valuePath, value);
};
/**
 * Get the props overrides of a specific layer if Seer as been initialized
 * Invalidates the data to be sure new ones are always picked up.
 */


exports.setPropOverrides = setPropOverrides;

var applyPropOverrides = function applyPropOverrides(props) {
  if (!_seer.default.isReady() || !props.id) {
    return;
  }

  var overs = overrides.get(props.id);

  if (!overs) {
    return;
  }

  overs.forEach(function (value, valuePath) {
    recursiveSet(props, valuePath, value); // Invalidate data array if we have a data override

    if (valuePath[0] === 'data') {
      props.data = _toConsumableArray(props.data);
    }
  });
};
/**
 * Listen for deck.gl edit events
 */


exports.applyPropOverrides = applyPropOverrides;

var layerEditListener = function layerEditListener(cb) {
  if (!_seer.default.isReady()) {
    return;
  }

  _seer.default.listenFor('deck.gl', cb);
};
/**
 * Listen for seer init events to resend data
 */


exports.layerEditListener = layerEditListener;

var seerInitListener = function seerInitListener(cb) {
  if (!_seer.default.isReady()) {
    return;
  }

  _seer.default.listenFor('init', cb);
};

exports.seerInitListener = seerInitListener;

var initLayerInSeer = function initLayerInSeer(layer) {
  if (!_seer.default.isReady() || !layer) {
    return;
  }

  var badges = [layer.constructor.layerName];

  _seer.default.listItem('deck.gl', layer.id, {
    badges: badges,
    // TODO: Seer currently only handles single model layers
    links: layer.state && layer.state.model ? ["luma.gl:".concat(layer.state.model.id)] : undefined,
    parent: layer.parent ? layer.parent.id : undefined
  });
};
/**
 * Log layer's properties to Seer
 */


exports.initLayerInSeer = initLayerInSeer;

var updateLayerInSeer = function updateLayerInSeer(layer) {
  if (!_seer.default.isReady() || _seer.default.throttle("deck.gl:".concat(layer.id), 1e3)) {
    return;
  }

  var data = logPayload(layer);

  _seer.default.multiUpdate('deck.gl', layer.id, data);
};
/**
 * On finalize of a specify layer, remove it from seer
 */


exports.updateLayerInSeer = updateLayerInSeer;

var removeLayerInSeer = function removeLayerInSeer(id) {
  if (!_seer.default.isReady() || !id) {
    return;
  }

  _seer.default.deleteItem('deck.gl', id);
};

exports.removeLayerInSeer = removeLayerInSeer;

function logPayload(layer) {
  var data = [{
    path: 'objects.props',
    data: layer.props
  }];
  var badges = [layer.constructor.layerName];

  if (layer.state) {
    if (layer.getAttributeManager()) {
      var attrs = layer.getAttributeManager().getAttributes();
      data.push({
        path: 'objects.attributes',
        data: attrs
      });
      badges.push(layer.getAttributeManager().stats.getTimeString());
    } // TODO: Seer currently only handles single model layers


    if (layer.state.model) {
      layer.state.model.setProps({
        timerQueryEnabled: true
      });
      var lastFrameTime = layer.state.model.stats.lastFrameTime;

      if (lastFrameTime) {
        badges.push("".concat((lastFrameTime * 1000).toFixed(0), "\u03BCs"));
      }
    }
  }

  data.push({
    path: 'badges',
    data: badges
  });
  return data;
}
},{"seer":"Kyly"}],"UMax":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.validateProps = validateProps;
exports.diffProps = diffProps;
exports.compareProps = compareProps;

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function validateProps(props) {
  var propTypes = getPropTypes(props);

  for (var propName in propTypes) {
    var propType = propTypes[propName];
    var validate = propType.validate;

    if (validate && !validate(props[propName], propType)) {
      throw new Error("Invalid prop ".concat(propName, ": ").concat(props[propName]));
    }
  }
} // Returns an object with "change flags", either false or strings indicating reason for change


function diffProps(props, oldProps) {
  // First check if any props have changed (ignore props that will be examined separately)
  var propsChangedReason = compareProps({
    newProps: props,
    oldProps: oldProps,
    propTypes: getPropTypes(props),
    ignoreProps: {
      data: null,
      updateTriggers: null
    }
  }); // Now check if any data related props have changed

  var dataChangedReason = diffDataProps(props, oldProps); // Check update triggers to determine if any attributes need regeneration
  // Note - if data has changed, all attributes will need regeneration, so skip this step

  var updateTriggersChangedReason = false;

  if (!dataChangedReason) {
    updateTriggersChangedReason = diffUpdateTriggers(props, oldProps);
  }

  return {
    dataChanged: dataChangedReason,
    propsChanged: propsChangedReason,
    updateTriggersChanged: updateTriggersChangedReason
  };
}
/**
 * Performs equality by iterating through keys on an object and returning false
 * when any key has values which are not strictly equal between the arguments.
 * @param {Object} opt.oldProps - object with old key/value pairs
 * @param {Object} opt.newProps - object with new key/value pairs
 * @param {Object} opt.ignoreProps={} - object, keys that should not be compared
 * @returns {null|String} - null when values of all keys are strictly equal.
 *   if unequal, returns a string explaining what changed.
 */

/* eslint-disable max-statements, max-depth, complexity */


function compareProps() {
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
      newProps = _ref.newProps,
      oldProps = _ref.oldProps,
      _ref$ignoreProps = _ref.ignoreProps,
      ignoreProps = _ref$ignoreProps === void 0 ? {} : _ref$ignoreProps,
      _ref$propTypes = _ref.propTypes,
      propTypes = _ref$propTypes === void 0 ? {} : _ref$propTypes,
      _ref$triggerName = _ref.triggerName,
      triggerName = _ref$triggerName === void 0 ? 'props' : _ref$triggerName;

  (0, _assert.default)(oldProps !== undefined && newProps !== undefined, 'compareProps args'); // shallow equality => deep equality

  if (oldProps === newProps) {
    return null;
  } // TODO - do we need these checks? Should never happen...


  if (_typeof(newProps) !== 'object' || newProps === null) {
    return "".concat(triggerName, " changed shallowly");
  }

  if (_typeof(oldProps) !== 'object' || oldProps === null) {
    return "".concat(triggerName, " changed shallowly");
  } // Test if new props different from old props


  for (var key in oldProps) {
    if (!(key in ignoreProps)) {
      if (!(key in newProps)) {
        return "".concat(triggerName, ".").concat(key, " dropped");
      }

      var newProp = newProps[key];
      var oldProp = oldProps[key];
      var propType = propTypes[key]; // If prop type has an equal function, invoke it

      var equal = propType && propType.equal;

      if (equal && !equal(newProp, oldProp, propType)) {
        return "".concat(triggerName, ".").concat(key, " changed deeply");
      }

      if (!equal) {
        // If object has an equals function, invoke it
        equal = newProp && oldProp && newProp.equals;

        if (equal && !equal.call(newProp, oldProp)) {
          return "".concat(triggerName, ".").concat(key, " changed deeply");
        }
      }

      if (!equal && oldProp !== newProp) {
        return "".concat(triggerName, ".").concat(key, " changed shallowly");
      }
    }
  } // Test if any new props have been added


  for (var _key in newProps) {
    if (!(_key in ignoreProps)) {
      if (!(_key in oldProps)) {
        return "".concat(triggerName, ".").concat(_key, " added: undefined -> ").concat(newProps[_key]);
      }
    }
  }

  return null;
}
/* eslint-enable max-statements, max-depth, complexity */
// HELPERS
// The comparison of the data prop requires special handling
// the dataComparator should be used if supplied


function diffDataProps(props, oldProps) {
  if (oldProps === null) {
    return 'oldProps is null, initial diff';
  } // Support optional app defined comparison of data


  var dataComparator = props.dataComparator;

  if (dataComparator) {
    if (!dataComparator(props.data, oldProps.data)) {
      return 'Data comparator detected a change';
    } // Otherwise, do a shallow equal on props

  } else if (props.data !== oldProps.data) {
    return 'A new data container was supplied';
  }

  return null;
} // Checks if any update triggers have changed
// also calls callback to invalidate attributes accordingly.


function diffUpdateTriggers(props, oldProps) {
  if (oldProps === null) {
    return 'oldProps is null, initial diff';
  } // If the 'all' updateTrigger fires, ignore testing others


  if ('all' in props.updateTriggers) {
    var diffReason = diffUpdateTrigger(props, oldProps, 'all');

    if (diffReason) {
      return {
        all: true
      };
    }
  }

  var triggerChanged = {};
  var reason = false; // If the 'all' updateTrigger didn't fire, need to check all others

  for (var triggerName in props.updateTriggers) {
    if (triggerName !== 'all') {
      var _diffReason = diffUpdateTrigger(props, oldProps, triggerName);

      if (_diffReason) {
        triggerChanged[triggerName] = true;
        reason = triggerChanged;
      }
    }
  }

  return reason;
}

function diffUpdateTrigger(props, oldProps, triggerName) {
  var newTriggers = props.updateTriggers[triggerName];
  newTriggers = newTriggers === undefined || newTriggers === null ? {} : newTriggers;
  var oldTriggers = oldProps.updateTriggers[triggerName];
  oldTriggers = oldTriggers === undefined || oldTriggers === null ? {} : oldTriggers;
  var diffReason = compareProps({
    oldProps: oldTriggers,
    newProps: newTriggers,
    triggerName: triggerName
  });
  return diffReason;
}

function getPropTypes(props) {
  var layer = props._component;
  var LayerType = layer && layer.constructor;
  return LayerType ? LayerType._propTypes : {};
}
},{"../utils/assert":"sRS1"}],"W4L2":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.count = count;

function _typeof(obj) {
  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);
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.


var ERR_NOT_OBJECT = 'count(): argument not an object';
var ERR_NOT_CONTAINER = 'count(): argument not a container';
/**
 * Deduces numer of elements in a JavaScript container.
 * - Auto-deduction for ES6 containers that define a count() method
 * - Auto-deduction for ES6 containers that define a size member
 * - Auto-deduction for Classic Arrays via the built-in length attribute
 * - Also handles objects, although note that this an O(N) operation
 */

function count(container) {
  if (!isObject(container)) {
    throw new Error(ERR_NOT_OBJECT);
  } // Check if ES6 collection "count" function is available


  if (typeof container.count === 'function') {
    return container.count();
  } // Check if ES6 collection "size" attribute is set


  if (Number.isFinite(container.size)) {
    return container.size;
  } // Check if array length attribute is set
  // Note: checking this last since some ES6 collections (Immutable.js)
  // emit profuse warnings when trying to access `length` attribute


  if (Number.isFinite(container.length)) {
    return container.length;
  } // Note that getting the count of an object is O(N)


  if (isPlainObject(container)) {
    return Object.keys(container).length;
  }

  throw new Error(ERR_NOT_CONTAINER);
}
/**
 * Checks if argument is a plain object (not a class or array etc)
 * @param {*} value - JavaScript value to be tested
 * @return {Boolean} - true if argument is a plain JavaScript object
 */


function isPlainObject(value) {
  return value !== null && _typeof(value) === 'object' && value.constructor === Object;
}
/**
 * Checks if argument is an indexable object (not a primitive value, nor null)
 * @param {*} value - JavaScript value to be tested
 * @return {Boolean} - true if argument is a JavaScript object
 */


function isObject(value) {
  return value !== null && _typeof(value) === 'object';
}
},{}],"mLtW":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.LIFECYCLE = void 0;
var LIFECYCLE = {
  NO_STATE: 'Awaiting state',
  MATCHED: 'Matched. State transferred from previous layer',
  INITIALIZED: 'Initialized',
  AWAITING_GC: 'Discarded. Awaiting garbage collection',
  AWAITING_FINALIZATION: 'No longer matched. Awaiting garbage collection',
  FINALIZED: 'Finalized! Awaiting garbage collection'
};
exports.LIFECYCLE = LIFECYCLE;
},{}],"jwNP":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.parsePropTypes = parsePropTypes;

function _typeof(obj) {
  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);
}

function _slicedToArray(arr, i) {
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
}

function _nonIterableRest() {
  throw new TypeError("Invalid attempt to destructure non-iterable instance");
}

function _iterableToArrayLimit(arr, i) {
  var _arr = [];
  var _n = true;
  var _d = false;
  var _e = undefined;

  try {
    for (var _i = arr[Symbol.iterator](), _s; !(_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;
}

function _arrayWithHoles(arr) {
  if (Array.isArray(arr)) return arr;
}

var TYPE_DEFINITIONS = {
  boolean: {
    validate: function validate(value, propType) {
      return true;
    },
    equal: function equal(value1, value2, propType) {
      return Boolean(value1) === Boolean(value2);
    }
  },
  number: {
    validate: function validate(value, propType) {
      return Number.isFinite(value) && (!('max' in propType) || value <= propType.max) && (!('min' in propType) || value >= propType.min);
    }
  },
  color: {
    validate: function validate(value, propType) {
      return isArray(value) && (value.length === 3 || value.length === 4);
    },
    equal: function equal(value1, value2, propType) {
      return arrayEqual(value1, value2);
    }
  },
  accessor: {
    validate: function validate(value, propType) {
      var valueType = getTypeOf(value);
      return valueType === 'function' || valueType === getTypeOf(propType.value);
    },
    equal: function equal(value1, value2, propType) {
      if (typeof value2 === 'function') {
        return true;
      }

      return arrayEqual(value1, value2);
    }
  },
  array: {
    validate: function validate(value, propType) {
      return propType.optional && !value || isArray(value);
    },
    equal: function equal(value1, value2, propType) {
      return propType.compare ? arrayEqual(value1, value2) : value1 === value2;
    }
  },
  function: {
    validate: function validate(value, propType) {
      return propType.optional && !value || typeof value === 'function';
    },
    equal: function equal(value1, value2, propType) {
      return !propType.compare || value1 === value2;
    }
  }
};

function arrayEqual(array1, array2) {
  if (array1 === array2) {
    return true;
  }

  if (!isArray(array1) || !isArray(array2)) {
    return false;
  }

  var len = array1.length;

  if (len !== array2.length) {
    return false;
  }

  for (var i = 0; i < len; i++) {
    if (array1[i] !== array2[i]) {
      return false;
    }
  }

  return true;
}

function parsePropTypes(propDefs) {
  var propTypes = {};
  var defaultProps = {};
  var deprecatedProps = {};

  var _arr = Object.entries(propDefs);

  for (var _i = 0; _i < _arr.length; _i++) {
    var _arr$_i = _slicedToArray(_arr[_i], 2),
        propName = _arr$_i[0],
        propDef = _arr$_i[1];

    if (propDef && propDef.deprecatedFor) {
      deprecatedProps[propName] = Array.isArray(propDef.deprecatedFor) ? propDef.deprecatedFor : [propDef.deprecatedFor];
    } else {
      var propType = parsePropType(propName, propDef);
      propTypes[propName] = propType;
      defaultProps[propName] = propType.value;
    }
  }

  return {
    propTypes: propTypes,
    defaultProps: defaultProps,
    deprecatedProps: deprecatedProps
  };
} // Parses one property definition entry. Either contains:
// * a valid prop type object ({type, ...})
// * or just a default value, in which case type and name inference is used


function parsePropType(name, propDef) {
  switch (getTypeOf(propDef)) {
    case 'object':
      return normalizePropDefinition(name, propDef);

    case 'array':
      return normalizePropDefinition(name, {
        type: 'array',
        value: propDef,
        compare: false
      });

    case 'boolean':
      return normalizePropDefinition(name, {
        type: 'boolean',
        value: propDef
      });

    case 'number':
      return normalizePropDefinition(name, {
        type: 'number',
        value: propDef
      });

    case 'function':
      return normalizePropDefinition(name, {
        type: 'function',
        value: propDef,
        compare: true
      });
    // return guessFunctionType(name, propDef);

    default:
      return {
        name: name,
        type: 'unknown',
        value: propDef
      };
  }
}

function normalizePropDefinition(name, propDef) {
  if (!('type' in propDef)) {
    if (!('value' in propDef)) {
      // If no type and value this object is likely the value
      return {
        name: name,
        type: 'object',
        value: propDef
      };
    }

    return Object.assign({
      name: name,
      type: getTypeOf(propDef.value)
    }, propDef);
  }

  return Object.assign({
    name: name
  }, TYPE_DEFINITIONS[propDef.type], propDef);
}

function isArray(value) {
  return Array.isArray(value) || ArrayBuffer.isView(value);
} // improved version of javascript typeof that can distinguish arrays and null values


function getTypeOf(value) {
  if (isArray(value)) {
    return 'array';
  }

  if (value === null) {
    return 'null';
  }

  return _typeof(value);
}
},{}],"I1A5":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.createProps = createProps;

var _seerIntegration = require("../lib/seer-integration");

var _log = _interopRequireDefault(require("../utils/log"));

var _propTypes = require("./prop-types");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Create a property object
function createProps() {
  var component = this; // eslint-disable-line
  // Get default prop object (a prototype chain for now)

  var propTypeDefs = getPropsPrototypeAndTypes(component.constructor);
  var propsPrototype = propTypeDefs.defaultProps; // Create a new prop object with default props object in prototype chain

  var propsInstance = Object.create(propsPrototype, {
    // Props need a back pointer to the owning component
    _component: {
      enumerable: false,
      value: component
    },
    // The supplied (original) values for those async props that are set to url strings or Promises.
    // In this case, the actual (i.e. resolved) values are looked up from component.internalState
    _asyncPropOriginalValues: {
      enumerable: false,
      value: {}
    },
    // Note: the actual (resolved) values for props that are NOT set to urls or Promises.
    // in this case the values are served directly from this map
    _asyncPropResolvedValues: {
      enumerable: false,
      value: {}
    }
  }); // "Copy" all sync props

  for (var i = 0; i < arguments.length; ++i) {
    Object.assign(propsInstance, arguments[i]);
  }

  var layerName = component.constructor.layerName;
  var deprecatedProps = propTypeDefs.deprecatedProps;
  checkDeprecatedProps(layerName, propsInstance, deprecatedProps);
  checkDeprecatedProps(layerName, propsInstance.updateTriggers, deprecatedProps);
  checkDeprecatedProps(layerName, propsInstance.transitions, deprecatedProps); // SEER: Apply any overrides from the seer debug extension if it is active

  (0, _seerIntegration.applyPropOverrides)(propsInstance); // Props must be immutable

  Object.freeze(propsInstance);
  return propsInstance;
}
/* eslint-disable max-depth */


function checkDeprecatedProps(layerName, propsInstance, deprecatedProps) {
  if (!propsInstance) {
    return;
  }

  for (var name in deprecatedProps) {
    if (hasOwnProperty(propsInstance, name)) {
      var nameStr = "".concat(layerName || 'Layer', ": ").concat(name);
      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = deprecatedProps[name][Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var newPropName = _step.value;

          if (!hasOwnProperty(propsInstance, newPropName)) {
            propsInstance[newPropName] = propsInstance[name];
          }
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return != null) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }

      _log.default.deprecated(nameStr, deprecatedProps[name].join('/'))();
    }
  }
}
/* eslint-enable max-depth */
// Return precalculated defaultProps and propType objects if available
// build them if needed


function getPropsPrototypeAndTypes(componentClass) {
  var props = getOwnProperty(componentClass, '_mergedDefaultProps');

  if (props) {
    return {
      defaultProps: props,
      propTypes: getOwnProperty(componentClass, '_propTypes'),
      deprecatedProps: getOwnProperty(componentClass, '_deprecatedProps')
    };
  }

  return createPropsPrototypeAndTypes(componentClass);
} // Build defaultProps and propType objects by walking component prototype chain


function createPropsPrototypeAndTypes(componentClass) {
  var parent = componentClass.prototype;

  if (!parent) {
    return {
      defaultProps: {}
    };
  }

  var parentClass = Object.getPrototypeOf(componentClass);
  var parentPropDefs = parent && getPropsPrototypeAndTypes(parentClass) || null; // Parse propTypes from Component.defaultProps

  var componentDefaultProps = getOwnProperty(componentClass, 'defaultProps') || {};
  var componentPropDefs = (0, _propTypes.parsePropTypes)(componentDefaultProps); // Create a merged type object

  var propTypes = Object.assign({}, parentPropDefs && parentPropDefs.propTypes, componentPropDefs.propTypes); // Create any necessary property descriptors and create the default prop object
  // Assign merged default props

  var defaultProps = createPropsPrototype(componentPropDefs.defaultProps, parentPropDefs && parentPropDefs.defaultProps, propTypes, componentClass); // Create a map for prop whose default value is a callback

  var deprecatedProps = Object.assign({}, parentPropDefs && parentPropDefs.deprecatedProps, componentPropDefs.deprecatedProps); // Store the precalculated props

  componentClass._mergedDefaultProps = defaultProps;
  componentClass._propTypes = propTypes;
  componentClass._deprecatedProps = deprecatedProps;
  return {
    propTypes: propTypes,
    defaultProps: defaultProps,
    deprecatedProps: deprecatedProps
  };
} // Builds a pre-merged default props object that component props can inherit from


function createPropsPrototype(props, parentProps, propTypes, componentClass) {
  var defaultProps = Object.create(null);
  Object.assign(defaultProps, parentProps, props); // Avoid freezing `id` prop

  var id = getComponentName(componentClass);
  delete props.id; // Add getters/setters for async prop properties

  Object.defineProperties(defaultProps, {
    // `id` is treated specially because layer might need to override it
    id: {
      configurable: false,
      writable: true,
      value: id
    }
  }); // Add getters/setters for async prop properties

  addAsyncPropsToPropPrototype(defaultProps, propTypes);
  return defaultProps;
} // Create descriptors for overridable props


function addAsyncPropsToPropPrototype(defaultProps, propTypes) {
  var defaultValues = {};
  var descriptors = {
    // Default "resolved" values for async props, returned if value not yet resolved/set.
    _asyncPropDefaultValues: {
      enumerable: false,
      value: defaultValues
    },
    // Shadowed object, just to make sure "early indexing" into the instance does not fail
    _asyncPropOriginalValues: {
      enumerable: false,
      value: {}
    }
  }; // Move async props into shadow values

  for (var propName in propTypes) {
    var propType = propTypes[propName];
    var name = propType.name,
        value = propType.value; // Note: async is ES7 keyword, can't destructure

    if (propType.async) {
      defaultValues[name] = value;
      descriptors[name] = getDescriptorForAsyncProp(name, value);
    }
  }

  Object.defineProperties(defaultProps, descriptors);
} // Helper: Configures getter and setter for one async prop


function getDescriptorForAsyncProp(name) {
  return {
    configurable: false,
    enumerable: true,
    // Save the provided value for async props in a special map
    set: function set(newValue) {
      if (typeof newValue === 'string' || newValue instanceof Promise) {
        this._asyncPropOriginalValues[name] = newValue;
      } else {
        this._asyncPropResolvedValues[name] = newValue;
      }
    },
    // Only the component's state knows the true value of async prop
    get: function get() {
      if (this._asyncPropResolvedValues) {
        // Prop value isn't async, so just return it
        if (name in this._asyncPropResolvedValues) {
          var value = this._asyncPropResolvedValues[name]; // Special handling - components expect null `data` prop expects to be replaced with `[]`

          if (name === 'data') {
            return value || this._asyncPropDefaultValues[name];
          }

          return value;
        }

        if (name in this._asyncPropOriginalValues) {
          // It's an async prop value: look into component state
          var state = this._component && this._component.internalState;

          if (state && state.hasAsyncProp(name)) {
            return state.getAsyncProp(name);
          }
        }
      } // the prop is not supplied, or
      // component not yet initialized/matched, return the component's default value for the prop


      return this._asyncPropDefaultValues[name];
    }
  };
} // HELPER METHODS


function hasOwnProperty(object, prop) {
  return Object.prototype.hasOwnProperty.call(object, prop);
} // Constructors have their super class constructors as prototypes


function getOwnProperty(object, prop) {
  return hasOwnProperty(object, prop) && object[prop];
}

function getComponentName(componentClass) {
  var componentName = getOwnProperty(componentClass, 'layerName') || getOwnProperty(componentClass, 'componentName');

  if (!componentName) {
    _log.default.once(0, "".concat(componentClass.name, ".componentName not specified"))();
  }

  return componentName || componentClass.name;
}
},{"../lib/seer-integration":"JOyY","../utils/log":"q39U","./prop-types":"jwNP"}],"O0D4":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _log = _interopRequireDefault(require("../utils/log"));

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.


var EMPTY_PROPS = Object.freeze({});

var ComponentState =
/*#__PURE__*/
function () {
  function ComponentState() {
    var component = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;

    _classCallCheck(this, ComponentState);

    this.component = component;
    this.asyncProps = {}; // Prop values that the layer sees

    this.onAsyncPropUpdated = function () {};

    this.oldProps = EMPTY_PROPS; // Last props before update

    this.oldAsyncProps = null; // Last props before update, with async values copied.
  }

  _createClass(ComponentState, [{
    key: "getOldProps",
    value: function getOldProps() {
      return this.oldAsyncProps || this.oldProps;
    }
  }, {
    key: "resetOldProps",
    value: function resetOldProps() {
      this.oldAsyncProps = null;
      this.oldProps = this.component.props;
    } // Whenever async props are changing, we need to make a copy of oldProps
    // otherwise the prop rewriting will affect the value both in props and oldProps.
    // While the copy is relatively expensive, this only happens on load completion.

  }, {
    key: "freezeAsyncOldProps",
    value: function freezeAsyncOldProps() {
      if (!this.oldAsyncProps) {
        // Make sure oldProps is set
        this.oldProps = this.oldProps || this.component.props; // Deep copy props (Object.assign only handles shallow props)
        // TODO - Alternatively, just reconfigure the async prop descriptors to fixed values?

        this.oldAsyncProps = {};

        for (var propName in this.oldProps) {
          this.oldAsyncProps[propName] = this.oldProps[propName];
        }
      }
    } // ASYNC PROP HANDLING
    //
    // Checks if a prop is overridden

  }, {
    key: "hasAsyncProp",
    value: function hasAsyncProp(propName) {
      return propName in this.asyncProps;
    } // Returns value of an overriden prop

  }, {
    key: "getAsyncProp",
    value: function getAsyncProp(propName) {
      var asyncProp = this.asyncProps[propName];
      return asyncProp && asyncProp.resolvedValue;
    }
  }, {
    key: "isAsyncPropLoading",
    value: function isAsyncPropLoading(propName) {
      var asyncProp = this.asyncProps[propName];
      return Boolean(asyncProp && asyncProp.pendingLoadCount > 0 && asyncProp.pendingLoadCount !== asyncProp.resolvedLoadCount);
    } // Updates all async/overridden props (when new props come in)
    // Checks if urls have changed, starts loading, or removes override

  }, {
    key: "setAsyncProps",
    value: function setAsyncProps(props) {
      // NOTE: prop param and default values are only support for testing
      var resolvedValues = props._asyncPropResolvedValues || {};
      var originalValues = props._asyncPropOriginalValues || props;
      var defaultValues = props._asyncPropDefaultValues || {}; // TODO - use async props from the layer's prop types

      for (var propName in resolvedValues) {
        var value = resolvedValues[propName];

        this._createAsyncPropData(propName, value, defaultValues[propName]);

        this._updateAsyncProp(propName, value);
      }

      for (var _propName in originalValues) {
        var _value = originalValues[_propName]; // Makes sure a record exists for this prop

        this._createAsyncPropData(_propName, _value, defaultValues[_propName]);

        this._updateAsyncProp(_propName, _value);
      }
    } // Intercept strings (URLs) and Promises and activates loading and prop rewriting

  }, {
    key: "_updateAsyncProp",
    value: function _updateAsyncProp(propName, value) {
      if (!this._didAsyncInputValueChange(propName, value)) {
        return;
      } // interpret value string as url and start a new load tracked by a promise


      if (typeof value === 'string') {
        var fetch = this.layer.props.fetch;
        var url = value;
        value = fetch(url);
      } // interprets promise and track the "loading"


      if (value instanceof Promise) {
        this._watchPromise(propName, value);

        return;
      } // else, normal, non-async value. Just store value for now


      this._setPropValue(propName, value);
    } // Checks if an input value actually changed (to avoid reloading/rewatching promises/urls)

  }, {
    key: "_didAsyncInputValueChange",
    value: function _didAsyncInputValueChange(propName, value) {
      var asyncProp = this.asyncProps[propName];

      if (value === asyncProp.lastValue) {
        return false;
      }

      asyncProp.lastValue = value;
      return true;
    } // Set normal, non-async value

  }, {
    key: "_setPropValue",
    value: function _setPropValue(propName, value) {
      var asyncProp = this.asyncProps[propName];
      asyncProp.value = value;
      asyncProp.resolvedValue = value;
      asyncProp.pendingLoadCount++;
      asyncProp.resolvedLoadCount = asyncProp.pendingLoadCount;
    } // Set a just resolved async value, calling onAsyncPropUpdates if value changes asynchronously

  }, {
    key: "_setAsyncPropValue",
    value: function _setAsyncPropValue(propName, value, loadCount) {
      // Only update if loadCount is larger or equal to resolvedLoadCount
      // otherwise a more recent load has already completed
      var asyncProp = this.asyncProps[propName];

      if (asyncProp && loadCount >= asyncProp.resolvedLoadCount) {
        (0, _assert.default)(value !== undefined); // A chance to copy old props before updating

        this.freezeAsyncOldProps();
        value = this._postProcessValue(propName, value);
        asyncProp.resolvedValue = value;
        asyncProp.resolvedLoadCount = loadCount; // Call callback to inform listener

        this.onAsyncPropUpdated(propName, value);
      }
    } // Tracks a promise, sets the prop when loaded, handles load count

  }, {
    key: "_watchPromise",
    value: function _watchPromise(propName, promise) {
      var _this = this;

      var asyncProp = this.asyncProps[propName];
      asyncProp.pendingLoadCount++;
      var loadCount = asyncProp.pendingLoadCount;
      promise.then(function (data) {
        return _this._setAsyncPropValue(propName, data, loadCount);
      }).catch(function (error) {
        return _log.default.error(error)();
      });
    } // Give the app a chance to post process the loaded data

  }, {
    key: "_postProcessValue",
    value: function _postProcessValue(propName, value) {
      var _ref = this.component ? this.component.props : {},
          dataTransform = _ref.dataTransform;

      if (propName === 'data' && dataTransform) {
        value = dataTransform(value);
      }

      return value;
    } // Creating an asyncProp record if needed

  }, {
    key: "_createAsyncPropData",
    value: function _createAsyncPropData(propName, value, defaultValue) {
      var asyncProp = this.asyncProps[propName];

      if (!asyncProp) {
        // assert(defaultValue !== undefined);
        this.asyncProps[propName] = {
          lastValue: null,
          // Supplied prop value (can be url/promise, not visible to layer)
          resolvedValue: defaultValue,
          // Resolved prop value (valid data, can be "shown" to layer)
          pendingLoadCount: 0,
          // How many loads have been issued
          resolvedLoadCount: 0 // Latest resolved load, (earlier loads will be ignored)

        };
      }
    }
  }]);

  return ComponentState;
}();

exports.default = ComponentState;
},{"../utils/log":"q39U","../utils/assert":"sRS1"}],"aCay":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _constants = require("../lifecycle/constants");

var _createProps = require("../lifecycle/create-props");

var _componentState = _interopRequireDefault(require("./component-state"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

var defaultProps = {};
var counter = 0;

var Component =
/*#__PURE__*/
function () {
  function Component()
  /* ...propObjects */
  {
    _classCallCheck(this, Component); // Merge supplied props with default props and freeze them.

    /* eslint-disable prefer-spread */


    this.props = _createProps.createProps.apply(this, arguments);
    /* eslint-enable prefer-spread */
    // Define all members before layer is sealed

    this.id = this.props.id; // The layer's id, used for matching with layers from last render cycle

    this.count = counter++; // Keep track of how many layer instances you are generating

    this.lifecycle = _constants.LIFECYCLE.NO_STATE; // Helps track and debug the life cycle of the layers

    this.parent = null; // reference to the composite layer parent that rendered this layer

    this.context = null; // Will reference layer manager's context, contains state shared by layers

    this.state = null; // Will be set to the shared layer state object during layer matching

    this.internalState = null; // Seal the layer

    Object.seal(this);
  } // clone this layer with modified props


  _createClass(Component, [{
    key: "clone",
    value: function clone(newProps) {
      var props = this.props; // Async props cannot be copied with Object.assign, copy them separately

      var asyncProps = {}; // See async props definition in create-props.js

      for (var key in props._asyncPropDefaultValues) {
        if (key in props._asyncPropResolvedValues) {
          asyncProps[key] = props._asyncPropResolvedValues[key];
        } else if (key in props._asyncPropOriginalValues) {
          asyncProps[key] = props._asyncPropOriginalValues[key];
        }
      } // Some custom layer implementation may not support multiple arguments in the constructor


      return new this.constructor(Object.assign({}, props, asyncProps, newProps));
    }
  }, {
    key: "_initState",
    // PROTECTED METHODS, override in subclass
    value: function _initState() {
      this.internalState = new _componentState.default({});
    }
  }, {
    key: "stats",
    get: function get() {
      return this.internalState.stats;
    }
  }]);

  return Component;
}();

exports.default = Component;
Component.defaultProps = defaultProps;
},{"../lifecycle/constants":"mLtW","../lifecycle/create-props":"I1A5","./component-state":"O0D4"}],"bkBd":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _componentState = _interopRequireDefault(require("../lifecycle/component-state"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
}

var LayerState =
/*#__PURE__*/
function (_ComponentState) {
  _inherits(LayerState, _ComponentState);

  function LayerState(_ref) {
    var _this;

    var attributeManager = _ref.attributeManager,
        layer = _ref.layer;

    _classCallCheck(this, LayerState);

    _this = _possibleConstructorReturn(this, _getPrototypeOf(LayerState).call(this, layer));
    _this.attributeManager = attributeManager;
    _this.model = null;
    _this.needsRedraw = true;
    _this.subLayers = null; // reference to sublayers rendered in a previous cycle

    return _this;
  }

  _createClass(LayerState, [{
    key: "layer",
    get: function get() {
      return this.component;
    },
    set: function set(layer) {
      this.component = layer;
    }
  }]);

  return LayerState;
}(_componentState.default);

exports.default = LayerState;
},{"../lifecycle/component-state":"O0D4"}],"qSjy":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _constants = require("./constants");

var _attributeManager = _interopRequireDefault(require("./attribute-manager"));

var _seerIntegration = require("./seer-integration");

var _props = require("../lifecycle/props");

var _count = require("../utils/count");

var _log = _interopRequireDefault(require("../utils/log"));

var _constants2 = _interopRequireDefault(require("luma.gl/constants"));

var _luma = require("luma.gl");

var _assert = _interopRequireDefault(require("../utils/assert"));

var _projectFunctions = require("../shaderlib/project/project-functions");

var _component = _interopRequireDefault(require("../lifecycle/component"));

var _layerState = _interopRequireDefault(require("./layer-state"));

var _viewportMercatorProject = require("viewport-mercator-project");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _slicedToArray(arr, i) {
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
}

function _nonIterableRest() {
  throw new TypeError("Invalid attempt to destructure non-iterable instance");
}

function _iterableToArrayLimit(arr, i) {
  var _arr = [];
  var _n = true;
  var _d = false;
  var _e = undefined;

  try {
    for (var _i = arr[Symbol.iterator](), _s; !(_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;
}

function _arrayWithHoles(arr) {
  if (Array.isArray(arr)) return arr;
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.

/* eslint-disable react/no-direct-mutation-state */

/* global fetch */

/* global window */


var LOG_PRIORITY_UPDATE = 1;
var EMPTY_ARRAY = Object.freeze([]);
var pickingColorCache = new Uint8ClampedArray(0);
var defaultProps = {
  // data: Special handling for null, see below
  data: {
    type: 'data',
    value: EMPTY_ARRAY,
    async: true
  },
  dataComparator: null,
  dataTransform: {
    type: 'function',
    value: function value(data) {
      return data;
    },
    compare: false
  },
  fetch: {
    type: 'function',
    value: function value(url) {
      return fetch(url).then(function (response) {
        return response.json();
      });
    },
    compare: false
  },
  updateTriggers: {},
  // Update triggers: a core change detection mechanism in deck.gl
  numInstances: undefined,
  visible: true,
  pickable: false,
  opacity: {
    type: 'number',
    min: 0,
    max: 1,
    value: 0.8
  },
  onHover: {
    type: 'function',
    value: null,
    compare: false,
    optional: true
  },
  onClick: {
    type: 'function',
    value: null,
    compare: false,
    optional: true
  },
  onDragStart: {
    type: 'function',
    value: null,
    compare: false,
    optional: true
  },
  onDrag: {
    type: 'function',
    value: null,
    compare: false,
    optional: true
  },
  onDragEnd: {
    type: 'function',
    value: null,
    compare: false,
    optional: true
  },
  coordinateSystem: _constants.COORDINATE_SYSTEM.LNGLAT,
  coordinateOrigin: {
    type: 'array',
    value: [0, 0, 0],
    compare: true
  },
  modelMatrix: {
    type: 'array',
    value: null,
    compare: true,
    optional: true
  },
  wrapLongitude: false,
  parameters: {},
  uniforms: {},
  framebuffer: null,
  animation: null,
  // Passed prop animation functions to evaluate props
  // Offset depth based on layer index to avoid z-fighting.
  // Negative values pull layer towards the camera
  // https://www.opengl.org/archives/resources/faq/technical/polygonoffset.htm
  getPolygonOffset: {
    type: 'function',
    value: function value(_ref) {
      var layerIndex = _ref.layerIndex;
      return [0, -layerIndex * 100];
    },
    compare: false
  },
  // Selection/Highlighting
  highlightedObjectIndex: null,
  autoHighlight: false,
  highlightColor: {
    type: 'color',
    value: [0, 0, 128, 128]
  }
};

var Layer =
/*#__PURE__*/
function (_Component) {
  _inherits(Layer, _Component);

  function Layer() {
    _classCallCheck(this, Layer);

    return _possibleConstructorReturn(this, _getPrototypeOf(Layer).apply(this, arguments));
  }

  _createClass(Layer, [{
    key: "toString",
    value: function toString() {
      var className = this.constructor.layerName || this.constructor.name;
      return "".concat(className, "({id: '").concat(this.props.id, "'})");
    } // Public API
    // Updates selected state members and marks the object for redraw

  }, {
    key: "setState",
    value: function setState(updateObject) {
      this.setChangeFlags({
        stateChanged: true
      });
      Object.assign(this.state, updateObject);
      this.setNeedsRedraw();
    } // Sets the redraw flag for this layer, will trigger a redraw next animation frame

  }, {
    key: "setNeedsRedraw",
    value: function setNeedsRedraw() {
      var redraw = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;

      if (this.internalState) {
        this.internalState.needsRedraw = redraw;
      }
    } // This layer needs a deep update
    // TODO - Need to align with existing needsUpdate before uncommenting
    // For now async props will call layerManager directly

  }, {
    key: "setLayerNeedsUpdate",
    value: function setLayerNeedsUpdate() {
      this.context.layerManager.setNeedsUpdate(String(this));
    } // Checks state of attributes and model

  }, {
    key: "getNeedsRedraw",
    value: function getNeedsRedraw() {
      var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          _ref2$clearRedrawFlag = _ref2.clearRedrawFlags,
          clearRedrawFlags = _ref2$clearRedrawFlag === void 0 ? false : _ref2$clearRedrawFlag;

      return this._getNeedsRedraw(clearRedrawFlags);
    } // Checks if layer attributes needs updating

  }, {
    key: "needsUpdate",
    value: function needsUpdate() {
      // Call subclass lifecycle method
      return this.shouldUpdateState(this._getUpdateParams()); // End lifecycle method
    } // Returns true if the layer is pickable and visible.

  }, {
    key: "isPickable",
    value: function isPickable() {
      return this.props.pickable && this.props.visible;
    } // Return an array of models used by this layer, can be overriden by layer subclass

  }, {
    key: "getModels",
    value: function getModels() {
      return this.state && (this.state.models || (this.state.model ? [this.state.model] : []));
    } // TODO - Gradually phase out, does not support multi model layers

  }, {
    key: "getSingleModel",
    value: function getSingleModel() {
      return this.state && this.state.model;
    }
  }, {
    key: "getAttributeManager",
    value: function getAttributeManager() {
      return this.internalState && this.internalState.attributeManager;
    } // Returns the most recent layer that matched to this state
    // (When reacting to an async event, this layer may no longer be the latest)

  }, {
    key: "getCurrentLayer",
    value: function getCurrentLayer() {
      return this.internalState && this.internalState.layer;
    } // Use iteration (the only required capability on data) to get first element
    // deprecated since we are effectively only supporting Arrays

  }, {
    key: "getFirstObject",
    value: function getFirstObject() {
      var data = this.props.data;
      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = data[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var object = _step.value;
          return object;
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return != null) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }

      return null;
    } // PROJECTION METHODS
    // Projects a point with current map state (lat, lon, zoom, pitch, bearing)
    // From the current layer's coordinate system to screen

  }, {
    key: "project",
    value: function project(xyz) {
      var viewport = this.context.viewport;
      var worldPosition = (0, _projectFunctions.getWorldPosition)(xyz, {
        viewport: viewport,
        modelMatrix: this.props.modelMatrix,
        coordinateOrigin: this.props.coordinateOrigin,
        coordinateSystem: this.props.coordinateSystem
      });

      var _worldToPixels = (0, _viewportMercatorProject.worldToPixels)(worldPosition, viewport.pixelProjectionMatrix),
          _worldToPixels2 = _slicedToArray(_worldToPixels, 3),
          x = _worldToPixels2[0],
          y = _worldToPixels2[1],
          z = _worldToPixels2[2];

      return xyz.length === 2 ? [x, y] : [x, y, z];
    } // Note: this does not reverse `project`.
    // Always unprojects to the viewport's coordinate system

  }, {
    key: "unproject",
    value: function unproject(xy) {
      var viewport = this.context.viewport;
      (0, _assert.default)(Array.isArray(xy));
      return viewport.unproject(xy);
    }
  }, {
    key: "projectPosition",
    value: function projectPosition(xyz) {
      (0, _assert.default)(Array.isArray(xyz));
      return (0, _projectFunctions.projectPosition)(xyz, {
        viewport: this.context.viewport,
        modelMatrix: this.props.modelMatrix,
        coordinateOrigin: this.props.coordinateOrigin,
        coordinateSystem: this.props.coordinateSystem
      });
    } // DEPRECATE: This does not handle offset modes

  }, {
    key: "projectFlat",
    value: function projectFlat(lngLat) {
      _log.default.deprecated('layer.projectFlat', 'layer.projectPosition')();

      var viewport = this.context.viewport;
      (0, _assert.default)(Array.isArray(lngLat));
      return viewport.projectFlat(lngLat);
    } // DEPRECATE: This is not meaningful in offset modes

  }, {
    key: "unprojectFlat",
    value: function unprojectFlat(xy) {
      _log.default.deprecated('layer.unprojectFlat')();

      var viewport = this.context.viewport;
      (0, _assert.default)(Array.isArray(xy));
      return viewport.unprojectFlat(xy);
    }
  }, {
    key: "use64bitProjection",
    value: function use64bitProjection() {
      if (this.props.fp64) {
        if (this.props.coordinateSystem === _constants.COORDINATE_SYSTEM.LNGLAT_DEPRECATED) {
          return true;
        }

        _log.default.once(0, "Legacy 64-bit mode only works with coordinateSystem set to\n        COORDINATE_SYSTEM.LNGLAT_DEPRECATED. Rendering in 32-bit mode instead")();
      }

      return false;
    }
  }, {
    key: "use64bitPositions",
    value: function use64bitPositions() {
      return this.props.fp64 || this.props.coordinateSystem === _constants.COORDINATE_SYSTEM.LNGLAT;
    } // TODO - needs to refer to context for devicePixels setting

  }, {
    key: "screenToDevicePixels",
    value: function screenToDevicePixels(screenPixels) {
      _log.default.deprecated('screenToDevicePixels', 'DeckGL prop useDevicePixels for conversion')();

      var devicePixelRatio = typeof window !== 'undefined' ? window.devicePixelRatio : 1;
      return screenPixels * devicePixelRatio;
    } // Event handling

  }, {
    key: "onHover",
    value: function onHover(info) {
      if (this.props.onHover) {
        return this.props.onHover(info, this.context.pickingEvent);
      }

      return false;
    }
  }, {
    key: "onClick",
    value: function onClick(info) {
      if (this.props.onClick) {
        return this.props.onClick(info, this.context.pickingEvent);
      }

      return false;
    } // Returns the picking color that doesn't match any subfeature
    // Use if some graphics do not belong to any pickable subfeature
    // @return {Array} - a black color

  }, {
    key: "nullPickingColor",
    value: function nullPickingColor() {
      return [0, 0, 0];
    } // Returns the picking color that doesn't match any subfeature
    // Use if some graphics do not belong to any pickable subfeature

  }, {
    key: "encodePickingColor",
    value: function encodePickingColor(i) {
      var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
      (0, _assert.default)(i < 16777215, 'index out of picking color range');
      target[0] = i + 1 & 255;
      target[1] = i + 1 >> 8 & 255;
      target[2] = i + 1 >> 8 >> 8 & 255;
      return target;
    } // Returns the index corresponding to a picking color that doesn't match any subfeature
    // @param {Uint8Array} color - color array to be decoded
    // @return {Array} - the decoded picking color

  }, {
    key: "decodePickingColor",
    value: function decodePickingColor(color) {
      (0, _assert.default)(color instanceof Uint8Array);

      var _color = _slicedToArray(color, 3),
          i1 = _color[0],
          i2 = _color[1],
          i3 = _color[2]; // 1 was added to seperate from no selection


      var index = i1 + i2 * 256 + i3 * 65536 - 1;
      return index;
    } // //////////////////////////////////////////////////
    // LIFECYCLE METHODS, overridden by the layer subclasses
    // Called once to set up the initial state
    // App can create WebGL resources

  }, {
    key: "initializeState",
    value: function initializeState() {
      throw new Error("Layer ".concat(this, " has not defined initializeState"));
    } // Let's layer control if updateState should be called

  }, {
    key: "shouldUpdateState",
    value: function shouldUpdateState(_ref3) {
      var oldProps = _ref3.oldProps,
          props = _ref3.props,
          context = _ref3.context,
          changeFlags = _ref3.changeFlags;
      return changeFlags.propsOrDataChanged;
    } // Default implementation, all attributes will be invalidated and updated
    // when data changes

  }, {
    key: "updateState",
    value: function updateState(_ref4) {
      var oldProps = _ref4.oldProps,
          props = _ref4.props,
          context = _ref4.context,
          changeFlags = _ref4.changeFlags;
      var attributeManager = this.getAttributeManager();

      if (changeFlags.dataChanged && attributeManager) {
        attributeManager.invalidateAll();
      }
    } // Called once when layer is no longer matched and state will be discarded
    // App can destroy WebGL resources here

  }, {
    key: "finalizeState",
    value: function finalizeState() {
      var _iteratorNormalCompletion2 = true;
      var _didIteratorError2 = false;
      var _iteratorError2 = undefined;

      try {
        for (var _iterator2 = this.getModels()[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
          var model = _step2.value;
          model.delete();
        }
      } catch (err) {
        _didIteratorError2 = true;
        _iteratorError2 = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
            _iterator2.return();
          }
        } finally {
          if (_didIteratorError2) {
            throw _iteratorError2;
          }
        }
      }

      var attributeManager = this.getAttributeManager();

      if (attributeManager) {
        attributeManager.finalize();
      }
    } // If state has a model, draw it with supplied uniforms

  }, {
    key: "draw",
    value: function draw(opts) {
      var _iteratorNormalCompletion3 = true;
      var _didIteratorError3 = false;
      var _iteratorError3 = undefined;

      try {
        for (var _iterator3 = this.getModels()[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
          var model = _step3.value;
          model.draw(opts);
        }
      } catch (err) {
        _didIteratorError3 = true;
        _iteratorError3 = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
            _iterator3.return();
          }
        } finally {
          if (_didIteratorError3) {
            throw _iteratorError3;
          }
        }
      }
    } // called to populate the info object that is passed to the event handler
    // @return null to cancel event

  }, {
    key: "getPickingInfo",
    value: function getPickingInfo(_ref5) {
      var info = _ref5.info,
          mode = _ref5.mode;
      var index = info.index;

      if (index >= 0) {
        // If props.data is an indexable array, get the object
        if (Array.isArray(this.props.data)) {
          info.object = this.props.data[index];
        }
      }

      return info;
    } // END LIFECYCLE METHODS
    // //////////////////////////////////////////////////
    // INTERNAL METHODS
    // Default implementation of attribute invalidation, can be redefined

  }, {
    key: "invalidateAttribute",
    value: function invalidateAttribute() {
      var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'all';
      var diffReason = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
      var attributeManager = this.getAttributeManager();

      if (!attributeManager) {
        return;
      }

      if (name === 'all') {
        _log.default.log(LOG_PRIORITY_UPDATE, "updateTriggers invalidating all attributes: ".concat(diffReason))();

        attributeManager.invalidateAll();
      } else {
        _log.default.log(LOG_PRIORITY_UPDATE, "updateTriggers invalidating attribute ".concat(name, ": ").concat(diffReason))();

        attributeManager.invalidate(name);
      }
    } // Calls attribute manager to update any WebGL attributes

  }, {
    key: "updateAttributes",
    value: function updateAttributes(props) {
      var attributeManager = this.getAttributeManager();

      if (!attributeManager) {
        return;
      } // Figure out data length


      var numInstances = this.getNumInstances(props);
      attributeManager.update({
        data: props.data,
        numInstances: numInstances,
        props: props,
        transitions: props.transitions,
        buffers: props,
        context: this,
        // Don't worry about non-attribute props
        ignoreUnknownAttributes: true
      });
      var model = this.getSingleModel();

      if (model) {
        var changedAttributes = attributeManager.getChangedAttributes({
          clearChangedFlags: true
        });
        model.setAttributes(changedAttributes);
      }
    } // Update attribute transition

  }, {
    key: "updateTransition",
    value: function updateTransition() {
      var attributeManager = this.getAttributeManager();

      if (attributeManager) {
        attributeManager.updateTransition();
      }
    }
  }, {
    key: "calculateInstancePickingColors",
    value: function calculateInstancePickingColors(attribute, _ref6) {
      var numInstances = _ref6.numInstances;
      var value = attribute.value,
          size = attribute.size;

      if (value[0] === 1) {
        // This can happen when data has changed, but the attribute value typed array
        // has sufficient size and does not need to be re-allocated.
        // This attribute is already populated, we do not have to recalculate it
        return;
      } // calculateInstancePickingColors always generates the same sequence.
      // pickingColorCache saves the largest generated sequence for reuse


      var cacheSize = pickingColorCache.length / size;

      if (cacheSize < numInstances) {
        // If the attribute is larger than the cache, resize the cache and populate the missing chunk
        var newPickingColorCache = new Uint8ClampedArray(numInstances * size);
        newPickingColorCache.set(pickingColorCache);
        var pickingColor = [];

        for (var i = cacheSize; i < numInstances; i++) {
          this.encodePickingColor(i, pickingColor);
          newPickingColorCache[i * size + 0] = pickingColor[0];
          newPickingColorCache[i * size + 1] = pickingColor[1];
          newPickingColorCache[i * size + 2] = pickingColor[2];
        }

        pickingColorCache = newPickingColorCache;
      } // Copy the last calculated picking color sequence into the attribute


      value.set(numInstances < cacheSize ? pickingColorCache.subarray(0, numInstances * size) : pickingColorCache);
    } // Sets the specified instanced picking color to null picking color. Used for multi picking.

  }, {
    key: "_clearInstancePickingColor",
    value: function _clearInstancePickingColor(color) {
      var instancePickingColors = this.getAttributeManager().attributes.instancePickingColors;
      var value = instancePickingColors.value,
          size = instancePickingColors.size;
      var i = this.decodePickingColor(color);
      value[i * size + 0] = 0;
      value[i * size + 1] = 0;
      value[i * size + 2] = 0; // TODO: Optimize this to use sub-buffer update!

      instancePickingColors.update({
        value: value
      });
    } // Sets all occurrences of the specified picking color to null picking color. Used for multi picking.

  }, {
    key: "_clearPickingColor",
    value: function _clearPickingColor(color) {
      var pickingColors = this.getAttributeManager().attributes.pickingColors;
      var value = pickingColors.value;

      for (var i = 0; i < value.length; i += 3) {
        if (value[i + 0] === color[0] && value[i + 1] === color[1] && value[i + 2] === color[2]) {
          value[i + 0] = 0;
          value[i + 1] = 0;
          value[i + 2] = 0;
        }
      } // TODO: Optimize this to use sub-buffer update!


      pickingColors.update({
        value: value
      });
    } // This method figures out if we use instance colors or not
    // and calls _clearInstancePickingColor or _clearPickingColor

  }, {
    key: "clearPickingColor",
    value: function clearPickingColor(color) {
      if (this.getAttributeManager().attributes.pickingColors) {
        this._clearPickingColor(color);
      } else {
        this._clearInstancePickingColor(color);
      }
    }
  }, {
    key: "copyPickingColors",
    value: function copyPickingColors() {
      var _this$getAttributeMan = this.getAttributeManager().attributes,
          pickingColors = _this$getAttributeMan.pickingColors,
          instancePickingColors = _this$getAttributeMan.instancePickingColors;
      var colors = pickingColors || instancePickingColors;
      return new Uint8ClampedArray(colors.value);
    }
  }, {
    key: "restorePickingColors",
    value: function restorePickingColors(value) {
      var _this$getAttributeMan2 = this.getAttributeManager().attributes,
          pickingColors = _this$getAttributeMan2.pickingColors,
          instancePickingColors = _this$getAttributeMan2.instancePickingColors;
      var colors = pickingColors || instancePickingColors;
      colors.update({
        value: value
      });
    } // Deduces numer of instances. Intention is to support:
    // - Explicit setting of numInstances
    // - Auto-deduction for ES6 containers that define a size member
    // - Auto-deduction for Classic Arrays via the built-in length attribute
    // - Auto-deduction via arrays

  }, {
    key: "getNumInstances",
    value: function getNumInstances(props) {
      props = props || this.props; // First Check if app has provided an explicit value

      if (props.numInstances !== undefined) {
        return props.numInstances;
      } // Second check if the layer has set its own value


      if (this.state && this.state.numInstances !== undefined) {
        return this.state.numInstances;
      } // Use container library to get a count for any ES6 container or object


      var data = this.props.data;
      return (0, _count.count)(data);
    } // LAYER MANAGER API
    // Should only be called by the deck.gl LayerManager class
    // Called by layer manager when a new layer is found

    /* eslint-disable max-statements */

  }, {
    key: "_initialize",
    value: function _initialize() {
      this._initState(); // Call subclass lifecycle methods


      this.initializeState(this.context); // End subclass lifecycle methods
      // TODO deprecated, for backwards compatibility with older layers
      // in case layer resets state

      this.state.attributeManager = this.getAttributeManager(); // initializeState callback tends to clear state

      this.setChangeFlags({
        dataChanged: true,
        propsChanged: true,
        viewportChanged: true
      });

      this._updateState();

      var model = this.getSingleModel();

      if (model) {
        model.id = this.props.id;
        model.program.id = "".concat(this.props.id, "-program");
        model.geometry.id = "".concat(this.props.id, "-geometry");
      }
    } // Called by layer manager
    // if this layer is new (not matched with an existing layer) oldProps will be empty object

  }, {
    key: "_update",
    value: function _update() {
      // Call subclass lifecycle method
      var stateNeedsUpdate = this.needsUpdate(); // End lifecycle method

      if (stateNeedsUpdate) {
        this._updateState();
      }
    }
    /* eslint-enable max-statements */
    // Common code for _initialize and _update

  }, {
    key: "_updateState",
    value: function _updateState() {
      var updateParams = this._getUpdateParams(); // Safely call subclass lifecycle methods


      if (this.context.gl) {
        this.updateState(updateParams);
      } else {
        try {
          this.updateState(updateParams);
        } catch (error) {// ignore error if gl context is missing
        }
      } // End subclass lifecycle methods


      if (this.isComposite) {
        // Render or update previously rendered sublayers
        this._renderLayers(updateParams);
      } else {
        this.setNeedsRedraw(); // Add any subclass attributes

        this.updateAttributes(this.props);

        this._updateBaseUniforms(); // Note: Automatic instance count update only works for single layers


        if (this.state.model) {
          this.state.model.setInstanceCount(this.getNumInstances());
        }
      }

      this.clearChangeFlags();
      this.internalState.resetOldProps();
    } // Called by manager when layer is about to be disposed
    // Note: not guaranteed to be called on application shutdown

  }, {
    key: "_finalize",
    value: function _finalize() {
      (0, _assert.default)(this.internalState && this.state); // Call subclass lifecycle method

      this.finalizeState(this.context); // End lifecycle method

      (0, _seerIntegration.removeLayerInSeer)(this.id);
    } // Calculates uniforms

  }, {
    key: "drawLayer",
    value: function drawLayer(_ref7) {
      var _this = this;

      var _ref7$moduleParameter = _ref7.moduleParameters,
          moduleParameters = _ref7$moduleParameter === void 0 ? null : _ref7$moduleParameter,
          _ref7$uniforms = _ref7.uniforms,
          uniforms = _ref7$uniforms === void 0 ? {} : _ref7$uniforms,
          _ref7$parameters = _ref7.parameters,
          parameters = _ref7$parameters === void 0 ? {} : _ref7$parameters;

      if (!uniforms.picking_uActive) {
        this.updateTransition();
      } // TODO/ib - hack move to luma Model.draw


      if (moduleParameters) {
        this.setModuleParameters(moduleParameters);
      } // Hack/ib - define a public luma function


      var animationProps = this.context.animationProps;

      if (animationProps) {
        var _iteratorNormalCompletion4 = true;
        var _didIteratorError4 = false;
        var _iteratorError4 = undefined;

        try {
          for (var _iterator4 = this.getModels()[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
            var model = _step4.value;

            model._setAnimationProps(animationProps);
          }
        } catch (err) {
          _didIteratorError4 = true;
          _iteratorError4 = err;
        } finally {
          try {
            if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
              _iterator4.return();
            }
          } finally {
            if (_didIteratorError4) {
              throw _iteratorError4;
            }
          }
        }
      } // Apply polygon offset to avoid z-fighting
      // TODO - move to draw-layers


      var getPolygonOffset = this.props.getPolygonOffset;
      var offsets = getPolygonOffset && getPolygonOffset(uniforms) || [0, 0];
      parameters.polygonOffset = offsets; // Call subclass lifecycle method

      (0, _luma.withParameters)(this.context.gl, parameters, function () {
        _this.draw({
          moduleParameters: moduleParameters,
          uniforms: uniforms,
          parameters: parameters,
          context: _this.context
        });
      }); // End lifecycle method
    } // {uniforms = {}, ...opts}

  }, {
    key: "pickLayer",
    value: function pickLayer(opts) {
      // Call subclass lifecycle method
      return this.getPickingInfo(opts); // End lifecycle method
    } // Helper methods

  }, {
    key: "getChangeFlags",
    value: function getChangeFlags() {
      return this.internalState.changeFlags;
    } // Dirty some change flags, will be handled by updateLayer

    /* eslint-disable complexity */

  }, {
    key: "setChangeFlags",
    value: function setChangeFlags(flags) {
      var _this2 = this;

      this.internalState.changeFlags = this.internalState.changeFlags || {};
      var changeFlags = this.internalState.changeFlags; // Update primary flags

      if (flags.dataChanged && !changeFlags.dataChanged) {
        changeFlags.dataChanged = flags.dataChanged;

        _log.default.log(LOG_PRIORITY_UPDATE + 1, function () {
          return "dataChanged: ".concat(flags.dataChanged, " in ").concat(_this2.id);
        })();
      }

      if (flags.updateTriggersChanged && !changeFlags.updateTriggersChanged) {
        changeFlags.updateTriggersChanged = changeFlags.updateTriggersChanged && flags.updateTriggersChanged ? Object.assign({}, flags.updateTriggersChanged, changeFlags.updateTriggersChanged) : flags.updateTriggersChanged || changeFlags.updateTriggersChanged;

        _log.default.log(LOG_PRIORITY_UPDATE + 1, function () {
          return 'updateTriggersChanged: ' + "".concat(Object.keys(flags.updateTriggersChanged).join(', '), " in ").concat(_this2.id);
        })();
      }

      if (flags.propsChanged && !changeFlags.propsChanged) {
        changeFlags.propsChanged = flags.propsChanged;

        _log.default.log(LOG_PRIORITY_UPDATE + 1, function () {
          return "propsChanged: ".concat(flags.propsChanged, " in ").concat(_this2.id);
        })();
      }

      if (flags.viewportChanged && !changeFlags.viewportChanged) {
        changeFlags.viewportChanged = flags.viewportChanged;

        _log.default.log(LOG_PRIORITY_UPDATE + 2, function () {
          return "viewportChanged: ".concat(flags.viewportChanged, " in ").concat(_this2.id);
        })();
      }

      if (flags.stateChanged && !changeFlags.stateChanged) {
        changeFlags.stateChanged = flags.stateChanged;

        _log.default.log(LOG_PRIORITY_UPDATE + 1, function () {
          return "stateChanged: ".concat(flags.stateChanged, " in ").concat(_this2.id);
        })();
      } // Update composite flags


      var propsOrDataChanged = flags.dataChanged || flags.updateTriggersChanged || flags.propsChanged;
      changeFlags.propsOrDataChanged = changeFlags.propsOrDataChanged || propsOrDataChanged;
      changeFlags.somethingChanged = changeFlags.somethingChanged || propsOrDataChanged || flags.viewportChanged || flags.stateChanged;
    }
    /* eslint-enable complexity */
    // Clear all changeFlags, typically after an update

  }, {
    key: "clearChangeFlags",
    value: function clearChangeFlags() {
      this.internalState.changeFlags = {
        // Primary changeFlags, can be strings stating reason for change
        dataChanged: false,
        propsChanged: false,
        updateTriggersChanged: false,
        viewportChanged: false,
        stateChanged: false,
        // Derived changeFlags
        propsOrDataChanged: false,
        somethingChanged: false
      };
    }
  }, {
    key: "printChangeFlags",
    value: function printChangeFlags() {
      var flags = this.internalState.changeFlags;
      return "".concat(flags.dataChanged ? 'data ' : '').concat(flags.propsChanged ? 'props ' : '').concat(flags.updateTriggersChanged ? 'triggers ' : '').concat(flags.viewportChanged ? 'viewport' : '');
    } // Compares the layers props with old props from a matched older layer
    // and extracts change flags that describe what has change so that state
    // can be update correctly with minimal effort

  }, {
    key: "diffProps",
    value: function diffProps(newProps, oldProps) {
      var changeFlags = (0, _props.diffProps)(newProps, oldProps); // iterate over changedTriggers

      if (changeFlags.updateTriggersChanged) {
        for (var key in changeFlags.updateTriggersChanged) {
          if (changeFlags.updateTriggersChanged[key]) {
            this._activeUpdateTrigger(key);
          }
        }
      }

      return this.setChangeFlags(changeFlags);
    } // Called by layer manager to validate props (in development)

  }, {
    key: "validateProps",
    value: function validateProps() {
      (0, _props.validateProps)(this.props);
    }
  }, {
    key: "setModuleParameters",
    value: function setModuleParameters(moduleParameters) {
      var _iteratorNormalCompletion5 = true;
      var _didIteratorError5 = false;
      var _iteratorError5 = undefined;

      try {
        for (var _iterator5 = this.getModels()[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
          var model = _step5.value;
          model.updateModuleSettings(moduleParameters);
        }
      } catch (err) {
        _didIteratorError5 = true;
        _iteratorError5 = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
            _iterator5.return();
          }
        } finally {
          if (_didIteratorError5) {
            throw _iteratorError5;
          }
        }
      }
    } // PRIVATE METHODS

  }, {
    key: "_getUpdateParams",
    value: function _getUpdateParams() {
      return {
        props: this.props,
        oldProps: this.internalState.getOldProps(),
        context: this.context,
        changeFlags: this.internalState.changeFlags
      };
    } // Checks state of attributes and model

  }, {
    key: "_getNeedsRedraw",
    value: function _getNeedsRedraw(clearRedrawFlags) {
      // this method may be called by the render loop as soon a the layer
      // has been created, so guard against uninitialized state
      if (!this.internalState) {
        return false;
      }

      var redraw = false;
      redraw = redraw || this.internalState.needsRedraw && this.id;
      this.internalState.needsRedraw = this.internalState.needsRedraw && !clearRedrawFlags; // TODO - is attribute manager needed? - Model should be enough.

      var attributeManager = this.getAttributeManager();
      var attributeManagerNeedsRedraw = attributeManager && attributeManager.getNeedsRedraw({
        clearRedrawFlags: clearRedrawFlags
      });
      redraw = redraw || attributeManagerNeedsRedraw;
      return redraw;
    } // Create new attribute manager

  }, {
    key: "_getAttributeManager",
    value: function _getAttributeManager() {
      return new _attributeManager.default(this.context.gl, {
        id: this.props.id,
        stats: this.context.stats
      });
    }
  }, {
    key: "_initState",
    value: function _initState() {
      (0, _assert.default)(!this.internalState && !this.state);

      var attributeManager = this._getAttributeManager();

      if (attributeManager) {
        // All instanced layers get instancePickingColors attribute by default
        // Their shaders can use it to render a picking scene
        // TODO - this slightly slows down non instanced layers
        attributeManager.addInstanced({
          instancePickingColors: {
            type: _constants2.default.UNSIGNED_BYTE,
            size: 3,
            update: this.calculateInstancePickingColors
          }
        });
      }

      this.internalState = new _layerState.default({
        attributeManager: attributeManager,
        layer: this
      });
      this.state = {}; // TODO deprecated, for backwards compatibility with older layers

      this.state.attributeManager = attributeManager;
      this.internalState.onAsyncPropUpdated = this._onAsyncPropUpdated.bind(this); // Ensure any async props are updated

      this.internalState.setAsyncProps(this.props);
    } // Called by layer manager to transfer state from an old layer

  }, {
    key: "_transferState",
    value: function _transferState(oldLayer) {
      var state = oldLayer.state,
          internalState = oldLayer.internalState;
      (0, _assert.default)(state && internalState);

      if (this === oldLayer) {
        return;
      } // Move internalState


      this.internalState = internalState;
      this.internalState.component = this; // Move state

      this.state = state; // Deprecated: layer references on `state`

      state.layer = this; // We keep the state ref on old layers to support async actions
      // oldLayer.state = null;
      // Ensure any async props are updated

      this.internalState.setAsyncProps(this.props); // Update model layer reference

      var _iteratorNormalCompletion6 = true;
      var _didIteratorError6 = false;
      var _iteratorError6 = undefined;

      try {
        for (var _iterator6 = this.getModels()[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
          var model = _step6.value;
          model.userData.layer = this;
        }
      } catch (err) {
        _didIteratorError6 = true;
        _iteratorError6 = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
            _iterator6.return();
          }
        } finally {
          if (_didIteratorError6) {
            throw _iteratorError6;
          }
        }
      }

      this.diffProps(this.props, this.internalState.getOldProps());
    }
  }, {
    key: "_onAsyncPropUpdated",
    value: function _onAsyncPropUpdated() {
      this.diffProps(this.props, this.internalState.getOldProps());
      this.setLayerNeedsUpdate();
    } // Operate on each changed triggers, will be called when an updateTrigger changes

  }, {
    key: "_activeUpdateTrigger",
    value: function _activeUpdateTrigger(propName) {
      this.invalidateAttribute(propName);
    }
  }, {
    key: "_updateBaseUniforms",
    value: function _updateBaseUniforms() {
      var _this3 = this;

      var uniforms = {
        // apply gamma to opacity to make it visually "linear"
        opacity: typeof this.props.opacity === 'function' ? function (animationProps) {
          return Math.pow(_this3.props.opacity(animationProps), 1 / 2.2);
        } : Math.pow(this.props.opacity, 1 / 2.2)
      };
      var _iteratorNormalCompletion7 = true;
      var _didIteratorError7 = false;
      var _iteratorError7 = undefined;

      try {
        for (var _iterator7 = this.getModels()[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
          var model = _step7.value;
          model.setUniforms(uniforms);
        }
      } catch (err) {
        _didIteratorError7 = true;
        _iteratorError7 = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion7 && _iterator7.return != null) {
            _iterator7.return();
          }
        } finally {
          if (_didIteratorError7) {
            throw _iteratorError7;
          }
        }
      }
    } // DEPRECATED METHODS
    // Updates selected state members and marks the object for redraw

  }, {
    key: "setUniforms",
    value: function setUniforms(uniformMap) {
      var _iteratorNormalCompletion8 = true;
      var _didIteratorError8 = false;
      var _iteratorError8 = undefined;

      try {
        for (var _iterator8 = this.getModels()[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {
          var model = _step8.value;
          model.setUniforms(uniformMap);
        } // TODO - set needsRedraw on the model(s)?

      } catch (err) {
        _didIteratorError8 = true;
        _iteratorError8 = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion8 && _iterator8.return != null) {
            _iterator8.return();
          }
        } finally {
          if (_didIteratorError8) {
            throw _iteratorError8;
          }
        }
      }

      this.setNeedsRedraw();

      _log.default.deprecated('layer.setUniforms', 'model.setUniforms')();
    }
  }, {
    key: "is64bitEnabled",
    value: function is64bitEnabled() {
      _log.default.deprecated('is64bitEnabled', 'use64bitProjection')();

      return this.use64bitProjection();
    }
  }]);

  return Layer;
}(_component.default);

exports.default = Layer;
Layer.layerName = 'Layer';
Layer.defaultProps = defaultProps;
},{"./constants":"GfMx","./attribute-manager":"Vv1w","./seer-integration":"JOyY","../lifecycle/props":"UMax","../utils/count":"W4L2","../utils/log":"q39U","luma.gl/constants":"lMsC","luma.gl":"GAQa","../utils/assert":"sRS1","../shaderlib/project/project-functions":"YebI","../lifecycle/component":"aCay","./layer-state":"bkBd","viewport-mercator-project":"K6fX"}],"rXeY":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.drawLayers = drawLayers;
exports.drawPickingBuffer = drawPickingBuffer;
exports.getPixelRatio = void 0;

var _constants = _interopRequireDefault(require("luma.gl/constants"));

var _luma = require("luma.gl");

var _log = _interopRequireDefault(require("../utils/log"));

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.

/* global window */
var LOG_PRIORITY_DRAW = 2;
var renderCount = 0; // TODO - Exported for pick-layers.js - Move to util?

var getPixelRatio = function getPixelRatio(_ref) {
  var useDevicePixels = _ref.useDevicePixels;
  (0, _assert.default)(typeof useDevicePixels === 'boolean', 'Invalid useDevicePixels');
  return useDevicePixels && typeof window !== 'undefined' ? window.devicePixelRatio : 1;
}; // Convert viewport top-left CSS coordinates to bottom up WebGL coordinates


exports.getPixelRatio = getPixelRatio;

var getGLViewport = function getGLViewport(gl, _ref2) {
  var viewport = _ref2.viewport,
      pixelRatio = _ref2.pixelRatio; // TODO - dummy default for node
  // Fallback to width/height when clientWidth/clientHeight are 0 or undefined.

  var height = gl.canvas ? gl.canvas.clientHeight || gl.canvas.height : 100; // Convert viewport top-left CSS coordinates to bottom up WebGL coordinates

  var dimensions = viewport;
  return [dimensions.x * pixelRatio, (height - dimensions.y - dimensions.height) * pixelRatio, dimensions.width * pixelRatio, dimensions.height * pixelRatio];
}; // Helper functions


function clearCanvas(gl, _ref3) {
  var useDevicePixels = _ref3.useDevicePixels; // const pixelRatio = getPixelRatio({useDevicePixels});

  var width = gl.drawingBufferWidth;
  var height = gl.drawingBufferHeight; // clear depth and color buffers, restoring transparency

  (0, _luma.withParameters)(gl, {
    viewport: [0, 0, width, height]
  }, function () {
    gl.clear(_constants.default.COLOR_BUFFER_BIT | _constants.default.DEPTH_BUFFER_BIT);
  });
} // Draw a list of layers in a list of viewports


function drawLayers(gl, _ref4) {
  var layers = _ref4.layers,
      viewports = _ref4.viewports,
      views = _ref4.views,
      onViewportActive = _ref4.onViewportActive,
      useDevicePixels = _ref4.useDevicePixels,
      _ref4$drawPickingColo = _ref4.drawPickingColors,
      drawPickingColors = _ref4$drawPickingColo === void 0 ? false : _ref4$drawPickingColo,
      _ref4$deviceRect = _ref4.deviceRect,
      deviceRect = _ref4$deviceRect === void 0 ? null : _ref4$deviceRect,
      _ref4$parameters = _ref4.parameters,
      parameters = _ref4$parameters === void 0 ? {} : _ref4$parameters,
      _ref4$layerFilter = _ref4.layerFilter,
      layerFilter = _ref4$layerFilter === void 0 ? null : _ref4$layerFilter,
      _ref4$pass = _ref4.pass,
      pass = _ref4$pass === void 0 ? 'draw' : _ref4$pass,
      _ref4$redrawReason = _ref4.redrawReason,
      redrawReason = _ref4$redrawReason === void 0 ? '' : _ref4$redrawReason,
      stats = _ref4.stats,
      customRender = _ref4.customRender;

  if (!customRender) {
    clearCanvas(gl, {
      useDevicePixels: useDevicePixels
    });
  } // effectManager.preDraw();


  viewports.forEach(function (viewportOrDescriptor, i) {
    var viewport = getViewportFromDescriptor(viewportOrDescriptor);
    var view = views && views[viewport.id]; // Update context to point to this viewport

    onViewportActive(viewport); // render this viewport

    drawLayersInViewport(gl, {
      layers: layers,
      viewport: viewport,
      view: view,
      useDevicePixels: useDevicePixels,
      drawPickingColors: drawPickingColors,
      deviceRect: deviceRect,
      parameters: parameters,
      layerFilter: layerFilter,
      pass: pass,
      redrawReason: redrawReason,
      stats: stats
    });
  }); // effectManager.draw();
} // Draws list of layers and viewports into the picking buffer
// Note: does not sample the buffer, that has to be done by the caller


function drawPickingBuffer(gl, _ref5) {
  var layers = _ref5.layers,
      viewports = _ref5.viewports,
      onViewportActive = _ref5.onViewportActive,
      useDevicePixels = _ref5.useDevicePixels,
      pickingFBO = _ref5.pickingFBO,
      _ref5$deviceRect = _ref5.deviceRect,
      x = _ref5$deviceRect.x,
      y = _ref5$deviceRect.y,
      width = _ref5$deviceRect.width,
      height = _ref5$deviceRect.height,
      _ref5$layerFilter = _ref5.layerFilter,
      layerFilter = _ref5$layerFilter === void 0 ? null : _ref5$layerFilter,
      _ref5$redrawReason = _ref5.redrawReason,
      redrawReason = _ref5$redrawReason === void 0 ? '' : _ref5$redrawReason; // Make sure we clear scissor test and fbo bindings in case of exceptions
  // We are only interested in one pixel, no need to render anything else
  // Note that the callback here is called synchronously.
  // Set blend mode for picking
  // always overwrite existing pixel with [r,g,b,layerIndex]

  return (0, _luma.withParameters)(gl, {
    framebuffer: pickingFBO,
    scissorTest: true,
    scissor: [x, y, width, height],
    clearColor: [0, 0, 0, 0]
  }, function () {
    drawLayers(gl, {
      layers: layers,
      viewports: viewports,
      onViewportActive: onViewportActive,
      useDevicePixels: useDevicePixels,
      drawPickingColors: true,
      layerFilter: layerFilter,
      pass: 'picking',
      redrawReason: redrawReason,
      parameters: {
        blend: true,
        blendFunc: [gl.ONE, gl.ZERO, gl.CONSTANT_ALPHA, gl.ZERO],
        blendEquation: gl.FUNC_ADD,
        blendColor: [0, 0, 0, 0]
      }
    });
  });
} // Draws a list of layers in one viewport
// TODO - when picking we could completely skip rendering viewports that dont
// intersect with the picking rect


function drawLayersInViewport(gl, _ref6) {
  var layers = _ref6.layers,
      viewport = _ref6.viewport,
      view = _ref6.view,
      useDevicePixels = _ref6.useDevicePixels,
      _ref6$drawPickingColo = _ref6.drawPickingColors,
      drawPickingColors = _ref6$drawPickingColo === void 0 ? false : _ref6$drawPickingColo,
      _ref6$deviceRect = _ref6.deviceRect,
      deviceRect = _ref6$deviceRect === void 0 ? null : _ref6$deviceRect,
      _ref6$parameters = _ref6.parameters,
      parameters = _ref6$parameters === void 0 ? {} : _ref6$parameters,
      layerFilter = _ref6.layerFilter,
      _ref6$pass = _ref6.pass,
      pass = _ref6$pass === void 0 ? 'draw' : _ref6$pass,
      _ref6$redrawReason = _ref6.redrawReason,
      redrawReason = _ref6$redrawReason === void 0 ? '' : _ref6$redrawReason,
      stats = _ref6.stats;
  var pixelRatio = getPixelRatio({
    useDevicePixels: useDevicePixels
  });
  var glViewport = getGLViewport(gl, {
    viewport: viewport,
    pixelRatio: pixelRatio
  });

  if (view && view.props.clear) {
    var clearOpts = view.props.clear === true ? {
      color: true,
      depth: true
    } : view.props.clear;
    (0, _luma.withParameters)(gl, {
      scissorTest: true,
      scissor: glViewport
    }, function () {
      return (0, _luma.clear)(gl, clearOpts);
    });
  } // render layers in normal colors


  var renderStats = {
    totalCount: layers.length,
    visibleCount: 0,
    compositeCount: 0,
    pickableCount: 0
  }; // const {x, y, width, height} = deviceRect || [];

  (0, _luma.setParameters)(gl, parameters || {}); // render layers in normal colors

  layers.forEach(function (layer, layerIndex) {
    // Check if we should draw layer
    var shouldDrawLayer = !layer.isComposite && layer.props.visible;

    if (drawPickingColors) {
      shouldDrawLayer = shouldDrawLayer && layer.props.pickable;
    }

    if (shouldDrawLayer && layerFilter) {
      shouldDrawLayer = layerFilter({
        layer: layer,
        viewport: viewport,
        isPicking: drawPickingColors
      });
    } // Calculate stats


    if (shouldDrawLayer && layer.props.pickable) {
      renderStats.pickableCount++;
    }

    if (layer.isComposite) {
      renderStats.compositeCount++;
    } // Draw the layer


    if (shouldDrawLayer) {
      renderStats.visibleCount++;
      drawLayerInViewport({
        gl: gl,
        layer: layer,
        layerIndex: layerIndex,
        drawPickingColors: drawPickingColors,
        pixelRatio: pixelRatio,
        glViewport: glViewport,
        parameters: parameters
      });
    }
  });
  renderCount++;
  logRenderStats({
    renderStats: renderStats,
    pass: pass,
    redrawReason: redrawReason,
    stats: stats
  });
}

function drawLayerInViewport(_ref7) {
  var gl = _ref7.gl,
      layer = _ref7.layer,
      layerIndex = _ref7.layerIndex,
      drawPickingColors = _ref7.drawPickingColors,
      pixelRatio = _ref7.pixelRatio,
      glViewport = _ref7.glViewport,
      parameters = _ref7.parameters;
  var moduleParameters = Object.assign(Object.create(layer.props), {
    viewport: layer.context.viewport,
    pickingActive: drawPickingColors ? 1 : 0,
    devicePixelRatio: pixelRatio
  });
  var uniforms = Object.assign({}, layer.context.uniforms, {
    layerIndex: layerIndex
  }); // All parameter resolving is done here instead of the layer
  // Blend parameters must not be overriden

  var layerParameters = Object.assign({}, layer.props.parameters || {}, parameters);
  Object.assign(layerParameters, {
    viewport: glViewport
  });

  if (drawPickingColors) {
    Object.assign(layerParameters, {
      blendColor: [0, 0, 0, (layerIndex + 1) / 255]
    });
  } else {
    Object.assign(moduleParameters, getObjectHighlightParameters(layer));
  }

  layer.drawLayer({
    moduleParameters: moduleParameters,
    uniforms: uniforms,
    parameters: layerParameters
  });
}

function logRenderStats(_ref8) {
  var renderStats = _ref8.renderStats,
      pass = _ref8.pass,
      redrawReason = _ref8.redrawReason,
      stats = _ref8.stats;

  if (_log.default.priority >= LOG_PRIORITY_DRAW) {
    var totalCount = renderStats.totalCount,
        visibleCount = renderStats.visibleCount,
        compositeCount = renderStats.compositeCount,
        pickableCount = renderStats.pickableCount;
    var primitiveCount = totalCount - compositeCount;
    var hiddenCount = primitiveCount - visibleCount;
    var message = '';
    message += "RENDER #".concat(renderCount, " ").concat(visibleCount, " (of ").concat(totalCount, " layers) to ").concat(pass, " because ").concat(redrawReason, " ");

    if (_log.default.priority > LOG_PRIORITY_DRAW) {
      message += "(".concat(hiddenCount, " hidden, ").concat(compositeCount, " composite ").concat(pickableCount, " pickable)");
    }

    _log.default.log(LOG_PRIORITY_DRAW, message)();

    if (stats) {
      stats.increment('redraw layers', visibleCount);
    }
  }
} // Get a viewport from a viewport descriptor (which can be a plain viewport)


function getViewportFromDescriptor(viewportOrDescriptor) {
  return viewportOrDescriptor.viewport ? viewportOrDescriptor.viewport : viewportOrDescriptor;
}
/**
 * Returns the picking color of currenlty selected object of the given 'layer'.
 * @return {Array} - the picking color or null if layers selected object is invalid.
 */


function getObjectHighlightParameters(layer) {
  // TODO - inefficient to update settings every render?
  // TODO: Add warning if 'highlightedObjectIndex' is > numberOfInstances of the model.
  var _layer$props = layer.props,
      highlightedObjectIndex = _layer$props.highlightedObjectIndex,
      highlightColor = _layer$props.highlightColor;
  var parameters = {
    pickingHighlightColor: [highlightColor[0], highlightColor[1], highlightColor[2], highlightColor[3] || 255]
  }; // Update picking module settings if highlightedObjectIndex is set.
  // This will overwrite any settings from auto highlighting.

  if (Number.isInteger(highlightedObjectIndex)) {
    parameters.pickingSelectedColor = highlightedObjectIndex >= 0 ? layer.encodePickingColor(highlightedObjectIndex) : null;
  }

  return parameters;
}
},{"luma.gl/constants":"lMsC","luma.gl":"GAQa","../utils/log":"q39U","../utils/assert":"sRS1"}],"thuH":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.pickObject = pickObject;
exports.pickVisibleObjects = pickVisibleObjects;
exports.getClosestFromPickingBuffer = getClosestFromPickingBuffer;

var _drawLayers = require("./draw-layers");

var _log = _interopRequireDefault(require("../utils/log"));

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var NO_PICKED_OBJECT = {
  pickedColor: null,
  pickedLayer: null,
  pickedObjectIndex: -1
};
/* eslint-disable max-depth, max-statements */
// Pick the closest object at the given (x,y) coordinate

function pickObject(gl, _ref) {
  var layers = _ref.layers,
      viewports = _ref.viewports,
      x = _ref.x,
      y = _ref.y,
      radius = _ref.radius,
      layerFilter = _ref.layerFilter,
      _ref$depth = _ref.depth,
      depth = _ref$depth === void 0 ? 1 : _ref$depth,
      mode = _ref.mode,
      onViewportActive = _ref.onViewportActive,
      pickingFBO = _ref.pickingFBO,
      lastPickedInfo = _ref.lastPickedInfo,
      useDevicePixels = _ref.useDevicePixels; // Convert from canvas top-left to WebGL bottom-left coordinates
  // And compensate for pixelRatio

  var pixelRatio = (0, _drawLayers.getPixelRatio)({
    useDevicePixels: useDevicePixels
  });
  var deviceX = Math.round(x * pixelRatio);
  var deviceY = Math.round(gl.canvas.height - y * pixelRatio);
  var deviceRadius = Math.round(radius * pixelRatio);
  var deviceRect = getPickingRect({
    deviceX: deviceX,
    deviceY: deviceY,
    deviceRadius: deviceRadius,
    deviceWidth: pickingFBO.width,
    deviceHeight: pickingFBO.height
  });
  var result = [];
  var affectedLayers = {};

  for (var i = 0; i < depth; i++) {
    var pickedColors = deviceRect && drawAndSamplePickingBuffer(gl, {
      layers: layers,
      viewports: viewports,
      onViewportActive: onViewportActive,
      useDevicePixels: useDevicePixels,
      pickingFBO: pickingFBO,
      deviceRect: deviceRect,
      layerFilter: layerFilter,
      redrawReason: mode
    });
    var pickInfo = pickedColors && getClosestFromPickingBuffer(gl, {
      pickedColors: pickedColors,
      layers: layers,
      deviceX: deviceX,
      deviceY: deviceY,
      deviceRadius: deviceRadius,
      deviceRect: deviceRect
    }) || NO_PICKED_OBJECT; // Only exclude if we need to run picking again.
    // We need to run picking again if an object is detected AND
    // we have not exhausted the requested depth.

    if (pickInfo.pickedColor && i + 1 < depth) {
      var layerId = pickInfo.pickedColor[3] - 1;

      if (!affectedLayers[layerId]) {
        // backup original colors
        affectedLayers[layerId] = layers[layerId].copyPickingColors();
      }

      layers[layerId].clearPickingColor(pickInfo.pickedColor);
    } // This logic needs to run even if no object is picked.


    var processedPickInfos = processPickInfo({
      pickInfo: pickInfo,
      lastPickedInfo: lastPickedInfo,
      mode: mode,
      layers: layers,
      viewports: viewports,
      x: x,
      y: y,
      deviceX: deviceX,
      deviceY: deviceY,
      pixelRatio: pixelRatio
    });

    if (processedPickInfos) {
      processedPickInfos.forEach(function (info) {
        return result.push(info);
      });
    } // If no object is picked stop.


    if (!pickInfo.pickedColor) {
      break;
    }
  } // reset only affected buffers


  Object.keys(affectedLayers).forEach(function (layerId) {
    return layers[layerId].restorePickingColors(affectedLayers[layerId]);
  });
  return result;
} // Pick all objects within the given bounding box


function pickVisibleObjects(gl, _ref2) {
  var layers = _ref2.layers,
      viewports = _ref2.viewports,
      x = _ref2.x,
      y = _ref2.y,
      width = _ref2.width,
      height = _ref2.height,
      mode = _ref2.mode,
      layerFilter = _ref2.layerFilter,
      onViewportActive = _ref2.onViewportActive,
      pickingFBO = _ref2.pickingFBO,
      useDevicePixels = _ref2.useDevicePixels; // Convert from canvas top-left to WebGL bottom-left coordinates
  // And compensate for pixelRatio

  var pixelRatio = (0, _drawLayers.getPixelRatio)({
    useDevicePixels: useDevicePixels
  });
  var deviceLeft = Math.round(x * pixelRatio);
  var deviceBottom = Math.round(gl.canvas.height - y * pixelRatio);
  var deviceRight = Math.round((x + width) * pixelRatio);
  var deviceTop = Math.round(gl.canvas.height - (y + height) * pixelRatio);
  var deviceRect = {
    x: deviceLeft,
    y: deviceTop,
    width: deviceRight - deviceLeft,
    height: deviceBottom - deviceTop
  };
  var pickedColors = drawAndSamplePickingBuffer(gl, {
    layers: layers,
    viewports: viewports,
    onViewportActive: onViewportActive,
    pickingFBO: pickingFBO,
    useDevicePixels: useDevicePixels,
    deviceRect: deviceRect,
    layerFilter: layerFilter,
    redrawReason: mode
  });
  var pickInfos = getUniquesFromPickingBuffer(gl, {
    pickedColors: pickedColors,
    layers: layers
  }); // Only return unique infos, identified by info.object

  var uniqueInfos = new Map();
  pickInfos.forEach(function (pickInfo) {
    var info = {
      color: pickInfo.pickedColor,
      layer: null,
      index: pickInfo.pickedObjectIndex,
      picked: true,
      x: x,
      y: y,
      width: width,
      height: height,
      pixelRatio: pixelRatio
    };
    info = getLayerPickingInfo({
      layer: pickInfo.pickedLayer,
      info: info,
      mode: mode
    });

    if (!uniqueInfos.has(info.object)) {
      uniqueInfos.set(info.object, info);
    }
  });
  return Array.from(uniqueInfos.values());
} // HELPER METHODS
// returns pickedColor or null if no pickable layers found.


function drawAndSamplePickingBuffer(gl, _ref3) {
  var layers = _ref3.layers,
      viewports = _ref3.viewports,
      onViewportActive = _ref3.onViewportActive,
      useDevicePixels = _ref3.useDevicePixels,
      pickingFBO = _ref3.pickingFBO,
      deviceRect = _ref3.deviceRect,
      layerFilter = _ref3.layerFilter,
      redrawReason = _ref3.redrawReason;
  (0, _assert.default)(deviceRect);
  (0, _assert.default)(Number.isFinite(deviceRect.width) && deviceRect.width > 0, '`width` must be > 0');
  (0, _assert.default)(Number.isFinite(deviceRect.height) && deviceRect.height > 0, '`height` must be > 0');
  var pickableLayers = layers.filter(function (layer) {
    return layer.isPickable();
  });

  if (pickableLayers.length < 1) {
    return null;
  }

  (0, _drawLayers.drawPickingBuffer)(gl, {
    layers: layers,
    viewports: viewports,
    onViewportActive: onViewportActive,
    useDevicePixels: useDevicePixels,
    pickingFBO: pickingFBO,
    deviceRect: deviceRect,
    layerFilter: layerFilter,
    redrawReason: redrawReason
  }); // Read from an already rendered picking buffer
  // Returns an Uint8ClampedArray of picked pixels

  var x = deviceRect.x,
      y = deviceRect.y,
      width = deviceRect.width,
      height = deviceRect.height;
  var pickedColors = new Uint8Array(width * height * 4);
  pickingFBO.readPixels({
    x: x,
    y: y,
    width: width,
    height: height,
    pixelArray: pickedColors
  });
  return pickedColors;
} // Indentifies which viewport, if any corresponds to x and y
// Returns first viewport if no match
// TODO - need to determine which viewport we are in
// TODO - document concept of "primary viewport" that matches all coords?
// TODO - static method on Viewport class?


function getViewportFromCoordinates(_ref4) {
  var viewports = _ref4.viewports;
  var viewport = viewports[0];
  return viewport;
} // Calculate a picking rect centered on deviceX and deviceY and clipped to device
// Returns null if pixel is outside of device


function getPickingRect(_ref5) {
  var deviceX = _ref5.deviceX,
      deviceY = _ref5.deviceY,
      deviceRadius = _ref5.deviceRadius,
      deviceWidth = _ref5.deviceWidth,
      deviceHeight = _ref5.deviceHeight;
  var valid = deviceX >= 0 && deviceY >= 0 && deviceX < deviceWidth && deviceY < deviceHeight; // x, y out of bounds.

  if (!valid) {
    return null;
  } // Create a box of size `radius * 2 + 1` centered at [deviceX, deviceY]


  var x = Math.max(0, deviceX - deviceRadius);
  var y = Math.max(0, deviceY - deviceRadius);
  var width = Math.min(deviceWidth, deviceX + deviceRadius) - x + 1;
  var height = Math.min(deviceHeight, deviceY + deviceRadius) - y + 1;
  return {
    x: x,
    y: y,
    width: width,
    height: height
  };
} // TODO - break this monster function into 3+ parts


function processPickInfo(_ref6) {
  var pickInfo = _ref6.pickInfo,
      lastPickedInfo = _ref6.lastPickedInfo,
      mode = _ref6.mode,
      layers = _ref6.layers,
      viewports = _ref6.viewports,
      x = _ref6.x,
      y = _ref6.y,
      deviceX = _ref6.deviceX,
      deviceY = _ref6.deviceY,
      pixelRatio = _ref6.pixelRatio;
  var pickedColor = pickInfo.pickedColor,
      pickedLayer = pickInfo.pickedLayer,
      pickedObjectIndex = pickInfo.pickedObjectIndex;
  var affectedLayers = pickedLayer ? [pickedLayer] : [];

  if (mode === 'hover') {
    // only invoke onHover events if picked object has changed
    var lastPickedObjectIndex = lastPickedInfo.index;
    var lastPickedLayerId = lastPickedInfo.layerId;
    var pickedLayerId = pickedLayer && pickedLayer.props.id; // proceed only if picked object changed

    if (pickedLayerId !== lastPickedLayerId || pickedObjectIndex !== lastPickedObjectIndex) {
      if (pickedLayerId !== lastPickedLayerId) {
        // We cannot store a ref to lastPickedLayer in the context because
        // the state of an outdated layer is no longer valid
        // and the props may have changed
        var lastPickedLayer = layers.find(function (layer) {
          return layer.props.id === lastPickedLayerId;
        });

        if (lastPickedLayer) {
          // Let leave event fire before enter event
          affectedLayers.unshift(lastPickedLayer);
        }
      } // Update layer manager context


      lastPickedInfo.layerId = pickedLayerId;
      lastPickedInfo.index = pickedObjectIndex;
      lastPickedInfo.info = null;
    }
  }

  var viewport = getViewportFromCoordinates({
    viewports: viewports
  }); // TODO - add coords

  var coordinate = viewport && viewport.unproject([x, y]);
  var baseInfo = {
    color: null,
    layer: null,
    index: -1,
    picked: false,
    x: x,
    y: y,
    pixel: [x, y],
    coordinate: coordinate,
    // TODO remove the lngLat prop after compatibility check
    lngLat: coordinate,
    devicePixel: [deviceX, deviceY],
    pixelRatio: pixelRatio
  }; // Use a Map to store all picking infos.
  // The following two forEach loops are the result of
  // https://github.com/uber/deck.gl/issues/443
  // Please be very careful when changing this pattern

  var infos = new Map();
  affectedLayers.forEach(function (layer) {
    var info = Object.assign({}, baseInfo);

    if (layer === pickedLayer) {
      info.color = pickedColor;
      info.index = pickedObjectIndex;
      info.picked = true;
    }

    info = getLayerPickingInfo({
      layer: layer,
      info: info,
      mode: mode
    });

    if (layer === pickedLayer && mode === 'hover') {
      lastPickedInfo.info = info;
    }

    if (mode === 'hover') {
      var pickingSelectedColor = layer.props.autoHighlight && pickedLayer === layer ? pickedColor : null;
      layer.setModuleParameters({
        pickingSelectedColor: pickingSelectedColor
      }); // TODO this needsRedraw logic should be fixed in layer

      layer.setNeedsRedraw();
    } // This guarantees that there will be only one copy of info for
    // one composite layer


    if (info) {
      infos.set(info.layer.id, info);
    }
  });
  var unhandledPickInfos = callLayerPickingCallbacks(infos, mode);
  return unhandledPickInfos;
} // Per-layer event handlers (e.g. onClick, onHover) are provided by the
// user and out of deck.gl's control. It's very much possible that
// the user calls React lifecycle methods in these function, such as
// ReactComponent.setState(). React lifecycle methods sometimes induce
// a re-render and re-generation of props of deck.gl and its layers,
// which invalidates all layers currently passed to this very function.
// Therefore, per-layer event handlers must be invoked at the end
// of the picking operation. NO operation that relies on the states of current
// layers should be called after this code.


function callLayerPickingCallbacks(infos, mode) {
  var unhandledPickInfos = [];
  infos.forEach(function (info) {
    var handled = false;

    switch (mode) {
      case 'click':
        handled = info.layer.onClick(info);
        break;

      case 'hover':
        handled = info.layer.onHover(info);
        break;

      case 'query':
        break;

      default:
        throw new Error('unknown pick type');
    }

    if (!handled) {
      unhandledPickInfos.push(info);
    }
  });
  return unhandledPickInfos;
}
/**
 * Pick at a specified pixel with a tolerance radius
 * Returns the closest object to the pixel in shape `{pickedColor, pickedLayer, pickedObjectIndex}`
 */


function getClosestFromPickingBuffer(gl, _ref7) {
  var pickedColors = _ref7.pickedColors,
      layers = _ref7.layers,
      deviceX = _ref7.deviceX,
      deviceY = _ref7.deviceY,
      deviceRadius = _ref7.deviceRadius,
      deviceRect = _ref7.deviceRect;
  (0, _assert.default)(pickedColors); // Traverse all pixels in picking results and find the one closest to the supplied
  // [deviceX, deviceY]

  var x = deviceRect.x,
      y = deviceRect.y,
      width = deviceRect.width,
      height = deviceRect.height;
  var minSquareDistanceToCenter = deviceRadius * deviceRadius;
  var closestPixelIndex = -1;
  var i = 0;

  for (var row = 0; row < height; row++) {
    var dy = row + y - deviceY;
    var dy2 = dy * dy;

    if (dy2 > minSquareDistanceToCenter) {
      // skip this row
      i += 4 * width;
    } else {
      for (var col = 0; col < width; col++) {
        // Decode picked layer from color
        var pickedLayerIndex = pickedColors[i + 3] - 1;

        if (pickedLayerIndex >= 0) {
          var dx = col + x - deviceX;
          var d2 = dx * dx + dy2;

          if (d2 <= minSquareDistanceToCenter) {
            minSquareDistanceToCenter = d2;
            closestPixelIndex = i;
          }
        }

        i += 4;
      }
    }
  }

  if (closestPixelIndex >= 0) {
    // Decode picked object index from color
    var _pickedLayerIndex = pickedColors[closestPixelIndex + 3] - 1;

    var pickedColor = pickedColors.slice(closestPixelIndex, closestPixelIndex + 4);
    var pickedLayer = layers[_pickedLayerIndex];

    if (pickedLayer) {
      var pickedObjectIndex = pickedLayer.decodePickingColor(pickedColor);
      return {
        pickedColor: pickedColor,
        pickedLayer: pickedLayer,
        pickedObjectIndex: pickedObjectIndex
      };
    }

    _log.default.error('Picked non-existent layer. Is picking buffer corrupt?')();
  }

  return NO_PICKED_OBJECT;
}
/* eslint-enable max-depth, max-statements */

/**
 * Examines a picking buffer for unique colors
 * Returns array of unique objects in shape `{x, y, pickedColor, pickedLayer, pickedObjectIndex}`
 */


function getUniquesFromPickingBuffer(gl, _ref8) {
  var pickedColors = _ref8.pickedColors,
      layers = _ref8.layers;
  var uniqueColors = new Map(); // Traverse all pixels in picking results and get unique colors

  if (pickedColors) {
    for (var i = 0; i < pickedColors.length; i += 4) {
      // Decode picked layer from color
      var pickedLayerIndex = pickedColors[i + 3] - 1;

      if (pickedLayerIndex >= 0) {
        var pickedColor = pickedColors.slice(i, i + 4);
        var colorKey = pickedColor.join(','); // eslint-disable-next-line

        if (!uniqueColors.has(colorKey)) {
          var pickedLayer = layers[pickedLayerIndex]; // eslint-disable-next-line

          if (pickedLayer) {
            uniqueColors.set(colorKey, {
              pickedColor: pickedColor,
              pickedLayer: pickedLayer,
              pickedObjectIndex: pickedLayer.decodePickingColor(pickedColor)
            });
          } else {
            _log.default.error('Picked non-existent layer. Is picking buffer corrupt?')();
          }
        }
      }
    }
  }

  return Array.from(uniqueColors.values());
} // Walk up the layer composite chain to populate the info object


function getLayerPickingInfo(_ref9) {
  var layer = _ref9.layer,
      info = _ref9.info,
      mode = _ref9.mode;

  while (layer && info) {
    // For a composite layer, sourceLayer will point to the sublayer
    // where the event originates from.
    // It provides additional context for the composite layer's
    // getPickingInfo() method to populate the info object
    var sourceLayer = info.layer || layer;
    info.layer = layer; // layer.pickLayer() function requires a non-null ```layer.state```
    // object to funtion properly. So the layer refereced here
    // must be the "current" layer, not an "out-dated" / "invalidated" layer

    info = layer.pickLayer({
      info: info,
      mode: mode,
      sourceLayer: sourceLayer
    });
    layer = layer.parent;
  }

  return info;
}
},{"./draw-layers":"rXeY","../utils/log":"q39U","../utils/assert":"sRS1"}],"uWrz":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.flatten = flatten;
exports.countVertices = countVertices;
exports.flattenVertices = flattenVertices;
exports.fillArray = fillArray;

// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.

/**
 * Flattens a nested array into a single level array,
 * or a single value into an array with one value
 * @example flatten([[1, [2]], [3], 4]) => [1, 2, 3, 4]
 * @example flatten(1) => [1]
 * @param {Array} array The array to flatten.
 * @param {Function} filter= - Optional predicate called on each `value` to
 *   determine if it should be included (pushed onto) the resulting array.
 * @param {Function} map= - Optional transform applied to each array elements.
 * @param {Array} result=[] - Optional array to push value into
 * @return {Array} Returns the new flattened array (new array or `result` if provided)
 */
function flatten(array) {
  var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
      _ref$filter = _ref.filter,
      filter = _ref$filter === void 0 ? function () {
    return true;
  } : _ref$filter,
      _ref$map = _ref.map,
      map = _ref$map === void 0 ? function (x) {
    return x;
  } : _ref$map,
      _ref$result = _ref.result,
      result = _ref$result === void 0 ? [] : _ref$result; // Wrap single object in array


  if (!Array.isArray(array)) {
    return filter(array) ? [map(array)] : [];
  } // Deep flatten and filter the array


  return flattenArray(array, filter, map, result);
} // Deep flattens an array. Helper to `flatten`, see its parameters


function flattenArray(array, filter, map, result) {
  var index = -1;

  while (++index < array.length) {
    var value = array[index];

    if (Array.isArray(value)) {
      flattenArray(value, filter, map, result);
    } else if (filter(value)) {
      result.push(map(value));
    }
  }

  return result;
}

function countVertices(nestedArray) {
  var count = 0;
  var index = -1;

  while (++index < nestedArray.length) {
    var value = nestedArray[index];

    if (Array.isArray(value) || ArrayBuffer.isView(value)) {
      count += countVertices(value);
    } else {
      count++;
    }
  }

  return count;
} // Flattens nested array of vertices, padding third coordinate as needed


function flattenVertices(nestedArray) {
  var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
      _ref2$result = _ref2.result,
      result = _ref2$result === void 0 ? [] : _ref2$result,
      _ref2$dimensions = _ref2.dimensions,
      dimensions = _ref2$dimensions === void 0 ? 3 : _ref2$dimensions;

  var index = -1;
  var vertexLength = 0;

  while (++index < nestedArray.length) {
    var value = nestedArray[index];

    if (Array.isArray(value) || ArrayBuffer.isView(value)) {
      flattenVertices(value, {
        result: result,
        dimensions: dimensions
      });
    } else {
      // eslint-disable-next-line
      if (vertexLength < dimensions) {
        result.push(value);
        vertexLength++;
      }
    }
  } // Add a third coordinate if needed


  if (vertexLength > 0 && vertexLength < dimensions) {
    result.push(0);
  }

  return result;
} // Uses copyWithin to significantly speed up typed array value filling


function fillArray(_ref3) {
  var target = _ref3.target,
      source = _ref3.source,
      _ref3$start = _ref3.start,
      start = _ref3$start === void 0 ? 0 : _ref3$start,
      _ref3$count = _ref3.count,
      count = _ref3$count === void 0 ? 1 : _ref3$count;
  var length = source.length;
  var total = count * length;
  var copied = 0;

  for (var i = start; copied < length; copied++) {
    target[i++] = source[copied];
  }

  while (copied < total) {
    // If we have copied less than half, copy everything we got
    // else copy remaining in one operation
    if (copied < total - copied) {
      target.copyWithin(start + copied, start, start + copied);
      copied *= 2;
    } else {
      target.copyWithin(start + copied, start, start + total - copied);
      copied = total;
    }
  }

  return target;
} // Flattens nested array of vertices, padding third coordinate as needed

/*
export function flattenTypedVertices(nestedArray, {
  result = [],
  Type = Float32Array,
  start = 0,
  dimensions = 3
} = {}) {
  let index = -1;
  let vertexLength = 0;
  while (++index < nestedArray.length) {
    const value = nestedArray[index];
    if (Array.isArray(value) || ArrayBuffer.isView(value)) {
      start = flattenTypedVertices(value, {result, start, dimensions});
    } else {
      if (vertexLength < dimensions) { // eslint-disable-line
        result[start++] = value;
        vertexLength++;
      }
    }
  }
  // Add a third coordinate if needed
  if (vertexLength > 0 && vertexLength < dimensions) {
    result[start++] = 0;
  }
  return start;
}
*/
},{}],"Pq0P":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.transformVector = transformVector;
exports.createMat4 = createMat4;
exports.extractCameraVectors = extractCameraVectors;
exports.mod = mod;

var vec4 = _interopRequireWildcard(require("gl-matrix/vec4"));

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Extensions to math.gl library. Intended to be folded back.
function transformVector(matrix, vector) {
  // Handle non-invertible matrix
  if (!matrix) {
    return null;
  }

  var result = vec4.transformMat4([0, 0, 0, 0], vector, matrix);
  var scale = 1 / result[3];
  vec4.multiply(result, result, [scale, scale, scale, scale]);
  return result;
} // Helper, avoids low-precision 32 bit matrices from gl-matrix mat4.create()


function createMat4() {
  return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
} // Extract camera vectors (move to math library?)


function extractCameraVectors(_ref) {
  var viewMatrix = _ref.viewMatrix,
      viewMatrixInverse = _ref.viewMatrixInverse; // Read the translation from the inverse view matrix

  return {
    eye: [viewMatrixInverse[12], viewMatrixInverse[13], viewMatrixInverse[14]],
    direction: [viewMatrix[2], viewMatrix[6], viewMatrix[10]],
    up: [viewMatrix[1], viewMatrix[5], viewMatrix[9]]
  };
}

function mod(value, divisor) {
  (0, _assert.default)(Number.isFinite(value) && Number.isFinite(divisor));
  var modulus = value % divisor;
  return modulus < 0 ? divisor + modulus : modulus;
}
},{"gl-matrix/vec4":"i3i1","../utils/assert":"sRS1"}],"RXGn":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _log = _interopRequireDefault(require("../utils/log"));

var _mathUtils = require("../utils/math-utils");

var _math = require("math.gl");

var mat4 = _interopRequireWildcard(require("gl-matrix/mat4"));

var _viewportMercatorProject = require("viewport-mercator-project");

var _assert = _interopRequireDefault(require("../utils/assert"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _slicedToArray(arr, i) {
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
}

function _nonIterableRest() {
  throw new TypeError("Invalid attempt to destructure non-iterable instance");
}

function _iterableToArrayLimit(arr, i) {
  var _arr = [];
  var _n = true;
  var _d = false;
  var _e = undefined;

  try {
    for (var _i = arr[Symbol.iterator](), _s; !(_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;
}

function _arrayWithHoles(arr) {
  if (Array.isArray(arr)) return arr;
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.


var DEGREES_TO_RADIANS = Math.PI / 180;
var IDENTITY = (0, _mathUtils.createMat4)();
var ZERO_VECTOR = [0, 0, 0];
var DEFAULT_DISTANCE_SCALES = {
  pixelsPerMeter: [1, 1, 1],
  metersPerPixel: [1, 1, 1],
  pixelsPerDegree: [1, 1, 1],
  degreesPerPixel: [1, 1, 1]
};
var DEFAULT_ZOOM = 0;
var ERR_ARGUMENT = 'Illegal argument to Viewport';

var Viewport =
/*#__PURE__*/
function () {
  /**
   * @classdesc
   * Manages coordinate system transformations for deck.gl.
   *
   * Note: The Viewport is immutable in the sense that it only has accessors.
   * A new viewport instance should be created if any parameters have changed.
   */
  function Viewport() {
    var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

    _classCallCheck(this, Viewport);

    var _opts$id = opts.id,
        id = _opts$id === void 0 ? null : _opts$id,
        _opts$x = opts.x,
        x = _opts$x === void 0 ? 0 : _opts$x,
        _opts$y = opts.y,
        y = _opts$y === void 0 ? 0 : _opts$y,
        _opts$width = opts.width,
        width = _opts$width === void 0 ? 1 : _opts$width,
        _opts$height = opts.height,
        height = _opts$height === void 0 ? 1 : _opts$height;
    this.id = id || this.constructor.displayName || 'viewport';
    this.x = x;
    this.y = y; // Silently allow apps to send in w,h = 0,0

    this.width = width || 1;
    this.height = height || 1;

    this._initViewMatrix(opts);

    this._initProjectionMatrix(opts);

    this._initPixelMatrices(); // Bind methods for easy access


    this.equals = this.equals.bind(this);
    this.project = this.project.bind(this);
    this.unproject = this.unproject.bind(this);
    this.projectPosition = this.projectPosition.bind(this);
    this.unprojectPosition = this.unprojectPosition.bind(this);
    this.projectFlat = this.projectFlat.bind(this);
    this.unprojectFlat = this.unprojectFlat.bind(this);
    this.getMatrices = this.getMatrices.bind(this);
  } // Two viewports are equal if width and height are identical, and if
  // their view and projection matrices are (approximately) equal.


  _createClass(Viewport, [{
    key: "equals",
    value: function equals(viewport) {
      if (!(viewport instanceof Viewport)) {
        return false;
      }

      return viewport.width === this.width && viewport.height === this.height && (0, _math.equals)(viewport.projectionMatrix, this.projectionMatrix) && (0, _math.equals)(viewport.viewMatrix, this.viewMatrix); // TODO - check distance scales?
    }
    /**
     * Projects xyz (possibly latitude and longitude) to pixel coordinates in window
     * using viewport projection parameters
     * - [longitude, latitude] to [x, y]
     * - [longitude, latitude, Z] => [x, y, z]
     * Note: By default, returns top-left coordinates for canvas/SVG type render
     *
     * @param {Array} lngLatZ - [lng, lat] or [lng, lat, Z]
     * @param {Object} opts - options
     * @param {Object} opts.topLeft=true - Whether projected coords are top left
     * @return {Array} - [x, y] or [x, y, z] in top left coords
     */

  }, {
    key: "project",
    value: function project(xyz) {
      var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
          _ref$topLeft = _ref.topLeft,
          topLeft = _ref$topLeft === void 0 ? true : _ref$topLeft;

      var worldPosition = this.projectPosition(xyz);
      var coord = (0, _viewportMercatorProject.worldToPixels)(worldPosition, this.pixelProjectionMatrix);

      var _coord = _slicedToArray(coord, 2),
          x = _coord[0],
          y = _coord[1];

      var y2 = topLeft ? y : this.height - y;
      return xyz.length === 2 ? [x, y2] : [x, y2, coord[2]];
    }
    /**
     * Unproject pixel coordinates on screen onto world coordinates,
     * (possibly [lon, lat]) on map.
     * - [x, y] => [lng, lat]
     * - [x, y, z] => [lng, lat, Z]
     * @param {Array} xyz -
     * @param {Object} opts - options
     * @param {Object} opts.topLeft=true - Whether origin is top left
     * @return {Array|null} - [lng, lat, Z] or [X, Y, Z]
     */

  }, {
    key: "unproject",
    value: function unproject(xyz) {
      var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
          _ref2$topLeft = _ref2.topLeft,
          topLeft = _ref2$topLeft === void 0 ? true : _ref2$topLeft,
          targetZ = _ref2.targetZ;

      var _xyz = _slicedToArray(xyz, 3),
          x = _xyz[0],
          y = _xyz[1],
          z = _xyz[2];

      var y2 = topLeft ? y : this.height - y;
      var targetZWorld = targetZ && targetZ * this.distanceScales.pixelsPerMeter[2];
      var coord = (0, _viewportMercatorProject.pixelsToWorld)([x, y2, z], this.pixelUnprojectionMatrix, targetZWorld);

      var _this$unprojectPositi = this.unprojectPosition(coord),
          _this$unprojectPositi2 = _slicedToArray(_this$unprojectPositi, 3),
          X = _this$unprojectPositi2[0],
          Y = _this$unprojectPositi2[1],
          Z = _this$unprojectPositi2[2];

      if (Number.isFinite(z)) {
        return [X, Y, Z];
      }

      return Number.isFinite(targetZ) ? [X, Y, targetZ] : [X, Y];
    } // NON_LINEAR PROJECTION HOOKS
    // Used for web meractor projection

  }, {
    key: "projectPosition",
    value: function projectPosition(xyz) {
      var _this$projectFlat = this.projectFlat(xyz),
          _this$projectFlat2 = _slicedToArray(_this$projectFlat, 2),
          X = _this$projectFlat2[0],
          Y = _this$projectFlat2[1];

      var Z = (xyz[2] || 0) * this.distanceScales.pixelsPerMeter[2];
      return [X, Y, Z];
    }
  }, {
    key: "unprojectPosition",
    value: function unprojectPosition(xyz) {
      var _this$unprojectFlat = this.unprojectFlat(xyz),
          _this$unprojectFlat2 = _slicedToArray(_this$unprojectFlat, 2),
          X = _this$unprojectFlat2[0],
          Y = _this$unprojectFlat2[1];

      var Z = (xyz[2] || 0) * this.distanceScales.metersPerPixel[2];
      return [X, Y, Z];
    }
    /**
     * Project [lng,lat] on sphere onto [x,y] on 512*512 Mercator Zoom 0 tile.
     * Performs the nonlinear part of the web mercator projection.
     * Remaining projection is done with 4x4 matrices which also handles
     * perspective.
     * @param {Array} lngLat - [lng, lat] coordinates
     *   Specifies a point on the sphere to project onto the map.
     * @return {Array} [x,y] coordinates.
     */

  }, {
    key: "projectFlat",
    value: function projectFlat(xyz) {
      var scale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.scale;

      if (this.isGeospatial) {
        return (0, _viewportMercatorProject.lngLatToWorld)(xyz, scale);
      }

      return xyz;
    }
    /**
     * Unproject world point [x,y] on map onto {lat, lon} on sphere
     * @param {object|Vector} xy - object with {x,y} members
     *  representing point on projected map plane
     * @return {GeoCoordinates} - object with {lat,lon} of point on sphere.
     *   Has toArray method if you need a GeoJSON Array.
     *   Per cartographic tradition, lat and lon are specified as degrees.
     */

  }, {
    key: "unprojectFlat",
    value: function unprojectFlat(xyz) {
      var scale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.scale;

      if (this.isGeospatial) {
        return (0, _viewportMercatorProject.worldToLngLat)(xyz, scale);
      }

      return xyz;
    }
  }, {
    key: "getDistanceScales",
    value: function getDistanceScales() {
      var coordinateOrigin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;

      if (coordinateOrigin) {
        return (0, _viewportMercatorProject.getDistanceScales)({
          longitude: coordinateOrigin[0],
          latitude: coordinateOrigin[1],
          scale: this.scale,
          highPrecision: true
        });
      }

      return this.distanceScales;
    }
  }, {
    key: "getMatrices",
    value: function getMatrices() {
      var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          _ref3$modelMatrix = _ref3.modelMatrix,
          modelMatrix = _ref3$modelMatrix === void 0 ? null : _ref3$modelMatrix;

      var modelViewProjectionMatrix = this.viewProjectionMatrix;
      var pixelProjectionMatrix = this.pixelProjectionMatrix;
      var pixelUnprojectionMatrix = this.pixelUnprojectionMatrix;

      if (modelMatrix) {
        modelViewProjectionMatrix = mat4.multiply([], this.viewProjectionMatrix, modelMatrix);
        pixelProjectionMatrix = mat4.multiply([], this.pixelProjectionMatrix, modelMatrix);
        pixelUnprojectionMatrix = mat4.invert([], pixelProjectionMatrix);
      }

      var matrices = Object.assign({
        modelViewProjectionMatrix: modelViewProjectionMatrix,
        viewProjectionMatrix: this.viewProjectionMatrix,
        viewMatrix: this.viewMatrix,
        projectionMatrix: this.projectionMatrix,
        // project/unproject between pixels and world
        pixelProjectionMatrix: pixelProjectionMatrix,
        pixelUnprojectionMatrix: pixelUnprojectionMatrix,
        width: this.width,
        height: this.height,
        scale: this.scale
      });
      return matrices;
    }
  }, {
    key: "containsPixel",
    value: function containsPixel(_ref4) {
      var x = _ref4.x,
          y = _ref4.y,
          _ref4$width = _ref4.width,
          width = _ref4$width === void 0 ? 1 : _ref4$width,
          _ref4$height = _ref4.height,
          height = _ref4$height === void 0 ? 1 : _ref4$height;
      return x < this.x + this.width && this.x < x + width && y < this.y + this.height && this.y < y + height;
    } // EXPERIMENTAL METHODS

  }, {
    key: "getCameraPosition",
    value: function getCameraPosition() {
      return this.cameraPosition;
    }
  }, {
    key: "getCameraDirection",
    value: function getCameraDirection() {
      return this.cameraDirection;
    }
  }, {
    key: "getCameraUp",
    value: function getCameraUp() {
      return this.cameraUp;
    } // INTERNAL METHODS
    // TODO - these are duplicating WebMercator methods

  }, {
    key: "_addMetersToLngLat",
    value: function _addMetersToLngLat(lngLatZ, xyz) {
      var _lngLatZ = _slicedToArray(lngLatZ, 3),
          lng = _lngLatZ[0],
          lat = _lngLatZ[1],
          _lngLatZ$ = _lngLatZ[2],
          Z = _lngLatZ$ === void 0 ? 0 : _lngLatZ$;

      var _this$_metersToLngLat = this._metersToLngLatDelta(xyz),
          _this$_metersToLngLat2 = _slicedToArray(_this$_metersToLngLat, 3),
          deltaLng = _this$_metersToLngLat2[0],
          deltaLat = _this$_metersToLngLat2[1],
          _this$_metersToLngLat3 = _this$_metersToLngLat2[2],
          deltaZ = _this$_metersToLngLat3 === void 0 ? 0 : _this$_metersToLngLat3;

      return lngLatZ.length === 2 ? [lng + deltaLng, lat + deltaLat] : [lng + deltaLng, lat + deltaLat, Z + deltaZ];
    }
  }, {
    key: "_metersToLngLatDelta",
    value: function _metersToLngLatDelta(xyz) {
      var _xyz2 = _slicedToArray(xyz, 3),
          x = _xyz2[0],
          y = _xyz2[1],
          _xyz2$ = _xyz2[2],
          z = _xyz2$ === void 0 ? 0 : _xyz2$;

      (0, _assert.default)(Number.isFinite(x) && Number.isFinite(y) && Number.isFinite(z), ERR_ARGUMENT);
      var _this$distanceScales = this.distanceScales,
          pixelsPerMeter = _this$distanceScales.pixelsPerMeter,
          degreesPerPixel = _this$distanceScales.degreesPerPixel;
      var deltaLng = x * pixelsPerMeter[0] * degreesPerPixel[0];
      var deltaLat = y * pixelsPerMeter[1] * degreesPerPixel[1];
      return xyz.length === 2 ? [deltaLng, deltaLat] : [deltaLng, deltaLat, z];
    }
  }, {
    key: "_createProjectionMatrix",
    value: function _createProjectionMatrix(_ref5) {
      var orthographic = _ref5.orthographic,
          fovyRadians = _ref5.fovyRadians,
          aspect = _ref5.aspect,
          focalDistance = _ref5.focalDistance,
          near = _ref5.near,
          far = _ref5.far;
      (0, _assert.default)(Number.isFinite(fovyRadians));
      return orthographic ? new _math.Matrix4().orthographic({
        fovy: fovyRadians,
        aspect: aspect,
        focalDistance: focalDistance,
        near: near,
        far: far
      }) : new _math.Matrix4().perspective({
        fovy: fovyRadians,
        aspect: aspect,
        near: near,
        far: far
      });
    }
    /* eslint-disable complexity, max-statements */

  }, {
    key: "_initViewMatrix",
    value: function _initViewMatrix(opts) {
      var _opts$viewMatrix = opts.viewMatrix,
          viewMatrix = _opts$viewMatrix === void 0 ? IDENTITY : _opts$viewMatrix,
          _opts$longitude = opts.longitude,
          longitude = _opts$longitude === void 0 ? null : _opts$longitude,
          _opts$latitude = opts.latitude,
          latitude = _opts$latitude === void 0 ? null : _opts$latitude,
          _opts$zoom = opts.zoom,
          zoom = _opts$zoom === void 0 ? null : _opts$zoom,
          _opts$position = opts.position,
          position = _opts$position === void 0 ? null : _opts$position,
          _opts$modelMatrix = opts.modelMatrix,
          modelMatrix = _opts$modelMatrix === void 0 ? null : _opts$modelMatrix,
          _opts$focalDistance = opts.focalDistance,
          focalDistance = _opts$focalDistance === void 0 ? 1 : _opts$focalDistance,
          _opts$distanceScales = opts.distanceScales,
          distanceScales = _opts$distanceScales === void 0 ? null : _opts$distanceScales; // Check if we have a geospatial anchor

      this.isGeospatial = Number.isFinite(latitude) && Number.isFinite(longitude);
      this.zoom = zoom;

      if (!Number.isFinite(this.zoom)) {
        this.zoom = this.isGeospatial ? (0, _viewportMercatorProject.getMeterZoom)({
          latitude: latitude
        }) + Math.log2(focalDistance) : DEFAULT_ZOOM;
      }

      this.scale = Math.pow(2, this.zoom); // Calculate distance scales if lng/lat/zoom are provided

      this.distanceScales = this.isGeospatial ? (0, _viewportMercatorProject.getDistanceScales)({
        latitude: latitude,
        longitude: longitude,
        scale: this.scale
      }) : distanceScales || DEFAULT_DISTANCE_SCALES;
      this.focalDistance = focalDistance;
      this.distanceScales.metersPerPixel = new _math.Vector3(this.distanceScales.metersPerPixel);
      this.distanceScales.pixelsPerMeter = new _math.Vector3(this.distanceScales.pixelsPerMeter);
      this.position = ZERO_VECTOR;
      this.meterOffset = ZERO_VECTOR;

      if (position) {
        // Apply model matrix if supplied
        this.position = position;
        this.modelMatrix = modelMatrix;
        this.meterOffset = modelMatrix ? modelMatrix.transformVector(position) : position;
      }

      if (this.isGeospatial) {
        // Determine camera center
        this.longitude = longitude;
        this.latitude = latitude;
        this.center = this._getCenterInWorld({
          longitude: longitude,
          latitude: latitude
        }); // Flip Y to match the orientation of the Mercator plane

        this.viewMatrixUncentered = mat4.scale([], viewMatrix, [1, -1, 1]); // Make a centered version of the matrix for projection modes without an offset

        this.viewMatrix = new _math.Matrix4() // Apply the uncentered view matrix
        .multiplyRight(this.viewMatrixUncentered) // And center it
        .translate(new _math.Vector3(this.center || ZERO_VECTOR).negate());
      } else {
        this.center = position;
        this.viewMatrixUncentered = viewMatrix;
        this.viewMatrix = viewMatrix;
      }
    }
    /* eslint-enable complexity, max-statements */

  }, {
    key: "_getCenterInWorld",
    value: function _getCenterInWorld(_ref6) {
      var longitude = _ref6.longitude,
          latitude = _ref6.latitude;
      var meterOffset = this.meterOffset,
          scale = this.scale,
          distanceScales = this.distanceScales; // Make a centered version of the matrix for projection modes without an offset

      var center2d = this.projectFlat([longitude, latitude], scale);
      var center = new _math.Vector3(center2d[0], center2d[1], 0);

      if (meterOffset) {
        var pixelPosition = new _math.Vector3(meterOffset) // Convert to pixels in current zoom
        .scale(distanceScales.pixelsPerMeter);
        center.add(pixelPosition);
      }

      return center;
    }
  }, {
    key: "_initProjectionMatrix",
    value: function _initProjectionMatrix(opts) {
      var _opts$projectionMatri = opts.projectionMatrix,
          projectionMatrix = _opts$projectionMatri === void 0 ? null : _opts$projectionMatri,
          _opts$orthographic = opts.orthographic,
          orthographic = _opts$orthographic === void 0 ? false : _opts$orthographic,
          fovyRadians = opts.fovyRadians,
          fovyDegrees = opts.fovyDegrees,
          fovy = opts.fovy,
          _opts$near = opts.near,
          near = _opts$near === void 0 ? 0.1 : _opts$near,
          _opts$far = opts.far,
          far = _opts$far === void 0 ? 1000 : _opts$far,
          _opts$focalDistance2 = opts.focalDistance,
          focalDistance = _opts$focalDistance2 === void 0 ? 1 : _opts$focalDistance2,
          orthographicFocalDistance = opts.orthographicFocalDistance;
      var radians = fovyRadians || (fovyDegrees || fovy || 75) * DEGREES_TO_RADIANS;
      this.projectionMatrix = projectionMatrix || this._createProjectionMatrix({
        orthographic: orthographic,
        fovyRadians: radians,
        aspect: this.width / this.height,
        focalDistance: orthographicFocalDistance || focalDistance,
        near: near,
        far: far
      });
    }
  }, {
    key: "_initPixelMatrices",
    value: function _initPixelMatrices() {
      // Note: As usual, matrix operations should be applied in "reverse" order
      // since vectors will be multiplied in from the right during transformation
      var vpm = (0, _mathUtils.createMat4)();
      mat4.multiply(vpm, vpm, this.projectionMatrix);
      mat4.multiply(vpm, vpm, this.viewMatrix);
      this.viewProjectionMatrix = vpm; // console.log('VPM', this.viewMatrix, this.projectionMatrix, this.viewProjectionMatrix);
      // Calculate inverse view matrix

      this.viewMatrixInverse = mat4.invert([], this.viewMatrix) || this.viewMatrix; // Decompose camera directions

      var _extractCameraVectors = (0, _mathUtils.extractCameraVectors)({
        viewMatrix: this.viewMatrix,
        viewMatrixInverse: this.viewMatrixInverse
      }),
          eye = _extractCameraVectors.eye,
          direction = _extractCameraVectors.direction,
          up = _extractCameraVectors.up;

      this.cameraPosition = eye;
      this.cameraDirection = direction;
      this.cameraUp = up; // console.log(this.cameraPosition, this.cameraDirection, this.cameraUp);

      /*
       * Builds matrices that converts preprojected lngLats to screen pixels
       * and vice versa.
       * Note: Currently returns bottom-left coordinates!
       * Note: Starts with the GL projection matrix and adds steps to the
       *       scale and translate that matrix onto the window.
       * Note: WebGL controls clip space to screen projection with gl.viewport
       *       and does not need this step.
       */
      // matrix for conversion from world location to screen (pixel) coordinates

      var viewportMatrix = (0, _mathUtils.createMat4)(); // matrix from NDC to viewport.

      var pixelProjectionMatrix = (0, _mathUtils.createMat4)(); // matrix from world space to viewport.

      mat4.scale(viewportMatrix, viewportMatrix, [this.width / 2, -this.height / 2, 1]);
      mat4.translate(viewportMatrix, viewportMatrix, [1, -1, 0]);
      mat4.multiply(pixelProjectionMatrix, viewportMatrix, this.viewProjectionMatrix);
      this.pixelProjectionMatrix = pixelProjectionMatrix;
      this.viewportMatrix = viewportMatrix;
      this.pixelUnprojectionMatrix = mat4.invert((0, _mathUtils.createMat4)(), this.pixelProjectionMatrix);

      if (!this.pixelUnprojectionMatrix) {
        _log.default.warn('Pixel project matrix not invertible')(); // throw new Error('Pixel project matrix not invertible');

      }
    }
  }]);

  return Viewport;
}();

exports.default = Viewport;
Viewport.displayName = 'Viewport';
},{"../utils/log":"q39U","../utils/math-utils":"Pq0P","math.gl":"dl2t","gl-matrix/mat4":"Nd3D","viewport-mercator-project":"K6fX","../utils/assert":"sRS1"}],"jqu2":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _assert = _interopRequireDefault(require("../utils/assert"));

var _luma = require("luma.gl");

var _seer = _interopRequireDefault(require("seer"));

var _layer = _interopRequireDefault(require("./layer"));

var _drawLayers2 = require("./draw-layers");

var _pickLayers = require("./pick-layers");

var _constants = require("../lifecycle/constants");

var _log = _interopRequireDefault(require("../utils/log"));

var _flatten = require("../utils/flatten");

var _probe = require("probe.gl");

var _viewport = _interopRequireDefault(require("../viewports/viewport"));

var _seerIntegration = require("./seer-integration");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _toConsumableArray(arr) {
  return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
}

function _nonIterableSpread() {
  throw new TypeError("Invalid attempt to spread non-iterable instance");
}

function _iterableToArray(iter) {
  if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}

function _arrayWithoutHoles(arr) {
  if (Array.isArray(arr)) {
    for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
      arr2[i] = arr[i];
    }

    return arr2;
  }
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.


var LOG_PRIORITY_LIFECYCLE = 2;
var LOG_PRIORITY_LIFECYCLE_MINOR = 4; // CONTEXT IS EXPOSED TO LAYERS

var INITIAL_CONTEXT = Object.seal({
  layerManager: null,
  gl: null,
  // Settings
  useDevicePixels: true,
  // Exposed in case custom layers need to adjust sizes
  // General resources
  stats: null,
  // for tracking lifecycle performance
  // GL Resources
  shaderCache: null,
  pickingFBO: null,
  // Screen-size framebuffer that layers can reuse
  // State
  pickingEvent: null,
  lastPickedInfo: null,
  animationProps: null,
  userData: {} // Place for any custom app `context`

});

var layerName = function layerName(layer) {
  return layer instanceof _layer.default ? "".concat(layer) : !layer ? 'null' : 'invalid';
};

var LayerManager =
/*#__PURE__*/
function () {
  // eslint-disable-next-line
  function LayerManager(gl) {
    var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
        stats = _ref.stats,
        _ref$viewport = _ref.viewport,
        viewport = _ref$viewport === void 0 ? null : _ref$viewport;

    _classCallCheck(this, LayerManager); // Currently deck.gl expects the DeckGL.layers array to be different
    // whenever React rerenders. If the same layers array is used, the
    // LayerManager's diffing algorithm will generate a fatal error and
    // break the rendering.
    // `this.lastRenderedLayers` stores the UNFILTERED layers sent
    // down to LayerManager, so that `layers` reference can be compared.
    // If it's the same across two React render calls, the diffing logic
    // will be skipped.


    this.lastRenderedLayers = [];
    this.layers = [];
    this.context = Object.assign({}, INITIAL_CONTEXT, {
      layerManager: this,
      gl: gl,
      // Enabling luma.gl Program caching using private API (_cachePrograms)
      shaderCache: gl && new _luma._ShaderCache({
        gl: gl,
        _cachePrograms: true
      }),
      stats: stats || new _probe.Stats({
        id: 'deck.gl'
      }),
      lastPickedInfo: {
        // For callback tracking and autohighlight
        index: -1,
        layerId: null,
        info: null
      },
      // Make sure context.viewport is not empty on the first layer initialization
      viewport: viewport || new _viewport.default({
        id: 'DEFAULT-INITIAL-VIEWPORT'
      }) // Current viewport, exposed to layers for project* function

    });
    this.layerFilter = null;
    this.drawPickingColors = false;
    this._needsRedraw = 'Initial render';
    this._needsUpdate = false;
    this._debug = false;
    this._activateViewport = this._activateViewport.bind(this); // Seer integration

    this._initSeer = this._initSeer.bind(this);
    this._editSeer = this._editSeer.bind(this);
    Object.seal(this);
    (0, _seerIntegration.seerInitListener)(this._initSeer);
    (0, _seerIntegration.layerEditListener)(this._editSeer);
  } // Method to call when the layer manager is not needed anymore.
  // Currently used in the <DeckGL> componentWillUnmount lifecycle to unbind Seer listeners.


  _createClass(LayerManager, [{
    key: "finalize",
    value: function finalize() {
      _seer.default.removeListener(this._initSeer);

      _seer.default.removeListener(this._editSeer);
    } // Check if a redraw is needed

  }, {
    key: "needsRedraw",
    value: function needsRedraw() {
      var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          _ref2$clearRedrawFlag = _ref2.clearRedrawFlags,
          clearRedrawFlags = _ref2$clearRedrawFlag === void 0 ? true : _ref2$clearRedrawFlag;

      return this._checkIfNeedsRedraw(clearRedrawFlags);
    } // Check if a deep update of all layers is needed

  }, {
    key: "needsUpdate",
    value: function needsUpdate() {
      return this._needsUpdate;
    } // Layers will be redrawn (in next animation frame)

  }, {
    key: "setNeedsRedraw",
    value: function setNeedsRedraw(reason) {
      this._needsRedraw = this._needsRedraw || reason;
    } // Layers will be updated deeply (in next animation frame)
    // Potentially regenerating attributes and sub layers

  }, {
    key: "setNeedsUpdate",
    value: function setNeedsUpdate(reason) {
      this._needsUpdate = this._needsUpdate || reason;
    } // Gets an (optionally) filtered list of layers

  }, {
    key: "getLayers",
    value: function getLayers() {
      var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          _ref3$layerIds = _ref3.layerIds,
          layerIds = _ref3$layerIds === void 0 ? null : _ref3$layerIds; // Filtering by layerId compares beginning of strings, so that sublayers will be included
      // Dependes on the convention of adding suffixes to the parent's layer name


      return layerIds ? this.layers.filter(function (layer) {
        return layerIds.find(function (layerId) {
          return layer.id.indexOf(layerId) === 0;
        });
      }) : this.layers;
    }
    /**
     * Set props needed for layer rendering and picking.
     * Parameters are to be passed as a single object, with the following values:
     * @param {Boolean} useDevicePixels
     */

    /* eslint-disable complexity, max-statements */

  }, {
    key: "setProps",
    value: function setProps(props) {
      if ('debug' in props) {
        this._debug = props.debug;
      } // A way for apps to add data to context that can be accessed in layers


      if ('userData' in props) {
        this.context.userData = props.userData;
      }

      if ('useDevicePixels' in props) {
        this.context.useDevicePixels = props.useDevicePixels;
      } // TODO - For now we set layers before viewports to preserve changeFlags


      if ('layers' in props) {
        this.setLayers(props.layers);
      }

      if ('layerFilter' in props) {
        if (this.layerFilter !== props.layerFilter) {
          this.layerFilter = props.layerFilter;
          this.setNeedsRedraw('layerFilter changed');
        }
      }

      if ('drawPickingColors' in props) {
        if (props.drawPickingColors !== this.drawPickingColors) {
          this.drawPickingColors = props.drawPickingColors;
          this.setNeedsRedraw('drawPickingColors changed');
        }
      }
    }
    /* eslint-enable complexity, max-statements */
    // Supply a new layer list, initiating sublayer generation and layer matching

  }, {
    key: "setLayers",
    value: function setLayers(newLayers) {
      // TODO - something is generating state updates that cause rerender of the same
      if (newLayers === this.lastRenderedLayers) {
        _log.default.log(3, 'Ignoring layer update due to layer array not changed')();

        return this;
      }

      this.lastRenderedLayers = newLayers;
      newLayers = (0, _flatten.flatten)(newLayers, {
        filter: Boolean
      });
      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = newLayers[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var layer = _step.value;
          layer.context = this.context;
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return != null) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }

      var _this$_updateLayers = this._updateLayers({
        oldLayers: this.layers,
        newLayers: newLayers
      }),
          error = _this$_updateLayers.error,
          generatedLayers = _this$_updateLayers.generatedLayers;

      this.layers = generatedLayers; // Throw first error found, if any

      if (error) {
        throw error;
      }

      return this;
    } // Update layers from last cycle if `setNeedsUpdate()` has been called

  }, {
    key: "updateLayers",
    value: function updateLayers() {
      // NOTE: For now, even if only some layer has changed, we update all layers
      // to ensure that layer id maps etc remain consistent even if different
      // sublayers are rendered
      var reason = this.needsUpdate();

      if (reason) {
        this.setNeedsRedraw("updating layers: ".concat(reason)); // HACK - Call with a copy of lastRenderedLayers to trigger a full update

        this.setLayers(_toConsumableArray(this.lastRenderedLayers));
      }
    } //
    // METHODS FOR LAYERS
    //
    // Draw all layers in all views

  }, {
    key: "drawLayers",
    value: function drawLayers(_ref4) {
      var _ref4$pass = _ref4.pass,
          pass = _ref4$pass === void 0 ? 'render to screen' : _ref4$pass,
          viewports = _ref4.viewports,
          views = _ref4.views,
          _ref4$redrawReason = _ref4.redrawReason,
          redrawReason = _ref4$redrawReason === void 0 ? 'unknown reason' : _ref4$redrawReason,
          _ref4$customRender = _ref4.customRender,
          customRender = _ref4$customRender === void 0 ? false : _ref4$customRender;
      var drawPickingColors = this.drawPickingColors;
      var _this$context = this.context,
          gl = _this$context.gl,
          useDevicePixels = _this$context.useDevicePixels; // render this viewport

      (0, _drawLayers2.drawLayers)(gl, {
        layers: this.layers,
        viewports: viewports,
        views: views,
        onViewportActive: this._activateViewport,
        useDevicePixels: useDevicePixels,
        drawPickingColors: drawPickingColors,
        pass: pass,
        layerFilter: this.layerFilter,
        redrawReason: redrawReason,
        customRender: customRender
      });
    } // Returns a new picking info object by assuming the last picked object is still picked

  }, {
    key: "getLastPickedObject",
    value: function getLastPickedObject(_ref5) {
      var x = _ref5.x,
          y = _ref5.y,
          viewports = _ref5.viewports;
      var lastPickedInfo = this.context.lastPickedInfo.info;
      var lastPickedLayerId = lastPickedInfo && lastPickedInfo.layer && lastPickedInfo.layer.id;
      var layer = lastPickedLayerId ? this.layers.find(function (l) {
        return l.id === lastPickedLayerId;
      }) : null;
      var coordinate = viewports[0] && viewports[0].unproject([x, y]);
      var info = {
        x: x,
        y: y,
        coordinate: coordinate,
        // TODO remove the lngLat prop after compatibility check
        lngLat: coordinate,
        layer: layer
      };

      if (layer) {
        return Object.assign({}, lastPickedInfo, info);
      }

      return Object.assign(info, {
        color: null,
        object: null,
        index: -1
      });
    } // Pick the closest info at given coordinate

  }, {
    key: "pickObject",
    value: function pickObject(_ref6) {
      var x = _ref6.x,
          y = _ref6.y,
          mode = _ref6.mode,
          _ref6$radius = _ref6.radius,
          radius = _ref6$radius === void 0 ? 0 : _ref6$radius,
          layerIds = _ref6.layerIds,
          viewports = _ref6.viewports,
          _ref6$depth = _ref6.depth,
          depth = _ref6$depth === void 0 ? 1 : _ref6$depth,
          _ref6$event = _ref6.event,
          event = _ref6$event === void 0 ? null : _ref6$event;
      var _this$context2 = this.context,
          gl = _this$context2.gl,
          useDevicePixels = _this$context2.useDevicePixels; // Allow layers to access the event

      this.context.pickingEvent = event;
      var layers = this.getLayers({
        layerIds: layerIds
      });
      var result = (0, _pickLayers.pickObject)(gl, {
        // User params
        x: x,
        y: y,
        radius: radius,
        layers: layers,
        mode: mode,
        layerFilter: this.layerFilter,
        depth: depth,
        // Injected params
        viewports: viewports,
        onViewportActive: this._activateViewport,
        pickingFBO: this._getPickingBuffer(),
        lastPickedInfo: this.context.lastPickedInfo,
        useDevicePixels: useDevicePixels
      }); // Clear the current event

      this.context.pickingEvent = null;
      return result;
    } // Get all unique infos within a bounding box

  }, {
    key: "pickObjects",
    value: function pickObjects(_ref7) {
      var x = _ref7.x,
          y = _ref7.y,
          width = _ref7.width,
          height = _ref7.height,
          layerIds = _ref7.layerIds,
          viewports = _ref7.viewports;
      var _this$context3 = this.context,
          gl = _this$context3.gl,
          useDevicePixels = _this$context3.useDevicePixels;
      var layers = this.getLayers({
        layerIds: layerIds
      });
      return (0, _pickLayers.pickVisibleObjects)(gl, {
        x: x,
        y: y,
        width: width,
        height: height,
        layers: layers,
        layerFilter: this.layerFilter,
        mode: 'pickObjects',
        viewports: viewports,
        onViewportActive: this._activateViewport,
        pickingFBO: this._getPickingBuffer(),
        useDevicePixels: useDevicePixels
      });
    } //
    // PRIVATE METHODS
    //

  }, {
    key: "_checkIfNeedsRedraw",
    value: function _checkIfNeedsRedraw(clearRedrawFlags) {
      var redraw = this._needsRedraw;

      if (clearRedrawFlags) {
        this._needsRedraw = false;
      } // This layers list doesn't include sublayers, relying on composite layers


      var _iteratorNormalCompletion2 = true;
      var _didIteratorError2 = false;
      var _iteratorError2 = undefined;

      try {
        for (var _iterator2 = this.layers[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
          var layer = _step2.value; // Call every layer to clear their flags

          var layerNeedsRedraw = layer.getNeedsRedraw({
            clearRedrawFlags: clearRedrawFlags
          });
          redraw = redraw || layerNeedsRedraw;
        }
      } catch (err) {
        _didIteratorError2 = true;
        _iteratorError2 = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
            _iterator2.return();
          }
        } finally {
          if (_didIteratorError2) {
            throw _iteratorError2;
          }
        }
      }

      return redraw;
    } // Make a viewport "current" in layer context, updating viewportChanged flags

  }, {
    key: "_activateViewport",
    value: function _activateViewport(viewport) {
      var oldViewport = this.context.viewport;
      var viewportChanged = !oldViewport || !viewport.equals(oldViewport);

      if (viewportChanged) {
        _log.default.log(4, 'Viewport changed', viewport)();

        this.context.viewport = viewport; // Update layers states
        // Let screen space layers update their state based on viewport

        var _iteratorNormalCompletion3 = true;
        var _didIteratorError3 = false;
        var _iteratorError3 = undefined;

        try {
          for (var _iterator3 = this.layers[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
            var layer = _step3.value;
            layer.setChangeFlags({
              viewportChanged: 'Viewport changed'
            });

            this._updateLayer(layer);
          }
        } catch (err) {
          _didIteratorError3 = true;
          _iteratorError3 = err;
        } finally {
          try {
            if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
              _iterator3.return();
            }
          } finally {
            if (_didIteratorError3) {
              throw _iteratorError3;
            }
          }
        }
      }

      (0, _assert.default)(this.context.viewport, 'LayerManager: viewport not set');
      return this;
    }
  }, {
    key: "_getPickingBuffer",
    value: function _getPickingBuffer() {
      var gl = this.context.gl; // Create a frame buffer if not already available

      this.context.pickingFBO = this.context.pickingFBO || new _luma.Framebuffer(gl); // Resize it to current canvas size (this is a noop if size hasn't changed)

      this.context.pickingFBO.resize({
        width: gl.canvas.width,
        height: gl.canvas.height
      });
      return this.context.pickingFBO;
    } // Match all layers, checking for caught errors
    // To avoid having an exception in one layer disrupt other layers
    // TODO - mark layers with exceptions as bad and remove from rendering cycle?

  }, {
    key: "_updateLayers",
    value: function _updateLayers(_ref8) {
      var oldLayers = _ref8.oldLayers,
          newLayers = _ref8.newLayers; // Create old layer map

      var oldLayerMap = {};
      var _iteratorNormalCompletion4 = true;
      var _didIteratorError4 = false;
      var _iteratorError4 = undefined;

      try {
        for (var _iterator4 = oldLayers[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
          var oldLayer = _step4.value;

          if (oldLayerMap[oldLayer.id]) {
            _log.default.warn("Multiple old layers with same id ".concat(layerName(oldLayer)))();
          } else {
            oldLayerMap[oldLayer.id] = oldLayer;
          }
        } // Allocate array for generated layers

      } catch (err) {
        _didIteratorError4 = true;
        _iteratorError4 = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
            _iterator4.return();
          }
        } finally {
          if (_didIteratorError4) {
            throw _iteratorError4;
          }
        }
      }

      var generatedLayers = []; // Match sublayers

      var error = this._updateSublayersRecursively({
        newLayers: newLayers,
        oldLayerMap: oldLayerMap,
        generatedLayers: generatedLayers
      }); // Finalize unmatched layers


      var error2 = this._finalizeOldLayers(oldLayerMap);

      this._needsUpdate = false;
      var firstError = error || error2;
      return {
        error: firstError,
        generatedLayers: generatedLayers
      };
    } // Note: adds generated layers to `generatedLayers` array parameter

  }, {
    key: "_updateSublayersRecursively",
    value: function _updateSublayersRecursively(_ref9) {
      var newLayers = _ref9.newLayers,
          oldLayerMap = _ref9.oldLayerMap,
          generatedLayers = _ref9.generatedLayers;
      var error = null;
      var _iteratorNormalCompletion5 = true;
      var _didIteratorError5 = false;
      var _iteratorError5 = undefined;

      try {
        for (var _iterator5 = newLayers[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
          var newLayer = _step5.value;
          newLayer.context = this.context; // Given a new coming layer, find its matching old layer (if any)

          var oldLayer = oldLayerMap[newLayer.id];

          if (oldLayer === null) {
            // null, rather than undefined, means this id was originally there
            _log.default.warn("Multiple new layers with same id ".concat(layerName(newLayer)))();
          } // Remove the old layer from candidates, as it has been matched with this layer


          oldLayerMap[newLayer.id] = null;
          var sublayers = null; // We must not generate exceptions until after layer matching is complete

          try {
            if (this._debug && oldLayer !== newLayer) {
              newLayer.validateProps();
            }

            if (!oldLayer) {
              this._initializeLayer(newLayer);

              (0, _seerIntegration.initLayerInSeer)(newLayer); // Initializes layer in seer chrome extension (if connected)
            } else {
              this._transferLayerState(oldLayer, newLayer);

              this._updateLayer(newLayer);

              (0, _seerIntegration.updateLayerInSeer)(newLayer); // Updates layer in seer chrome extension (if connected)
            }

            generatedLayers.push(newLayer); // Call layer lifecycle method: render sublayers

            sublayers = newLayer.isComposite && newLayer.getSubLayers(); // End layer lifecycle method: render sublayers
          } catch (err) {
            _log.default.warn("error during matching of ".concat(layerName(newLayer)), err)();

            error = error || err; // Record first exception
          }

          if (sublayers) {
            this._updateSublayersRecursively({
              newLayers: sublayers,
              oldLayerMap: oldLayerMap,
              generatedLayers: generatedLayers
            });
          }
        }
      } catch (err) {
        _didIteratorError5 = true;
        _iteratorError5 = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
            _iterator5.return();
          }
        } finally {
          if (_didIteratorError5) {
            throw _iteratorError5;
          }
        }
      }

      return error;
    } // Finalize any old layers that were not matched

  }, {
    key: "_finalizeOldLayers",
    value: function _finalizeOldLayers(oldLayerMap) {
      var error = null;

      for (var layerId in oldLayerMap) {
        var layer = oldLayerMap[layerId];

        if (layer) {
          error = error || this._finalizeLayer(layer);
        }
      }

      return error;
    } // EXCEPTION SAFE LAYER ACCESS
    // Initializes a single layer, calling layer methods

  }, {
    key: "_initializeLayer",
    value: function _initializeLayer(layer) {
      _log.default.log(LOG_PRIORITY_LIFECYCLE, "initializing ".concat(layerName(layer)))();

      var error = null;

      try {
        layer._initialize();

        layer.lifecycle = _constants.LIFECYCLE.INITIALIZED;
      } catch (err) {
        _log.default.warn("error while initializing ".concat(layerName(layer), "\n"), err)();

        error = error || err; // TODO - what should the lifecycle state be here? LIFECYCLE.INITIALIZATION_FAILED?
      } // Set back pointer (used in picking)


      layer.internalState.layer = layer; // Save layer on model for picking purposes
      // store on model.userData rather than directly on model

      var _iteratorNormalCompletion6 = true;
      var _didIteratorError6 = false;
      var _iteratorError6 = undefined;

      try {
        for (var _iterator6 = layer.getModels()[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
          var model = _step6.value;
          model.userData.layer = layer;
        }
      } catch (err) {
        _didIteratorError6 = true;
        _iteratorError6 = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
            _iterator6.return();
          }
        } finally {
          if (_didIteratorError6) {
            throw _iteratorError6;
          }
        }
      }

      return error;
    }
  }, {
    key: "_transferLayerState",
    value: function _transferLayerState(oldLayer, newLayer) {
      newLayer._transferState(oldLayer);

      newLayer.lifecycle = _constants.LIFECYCLE.MATCHED;

      if (newLayer !== oldLayer) {
        _log.default.log(LOG_PRIORITY_LIFECYCLE_MINOR, "matched ".concat(layerName(newLayer)), oldLayer, '->', newLayer)();

        oldLayer.lifecycle = _constants.LIFECYCLE.AWAITING_GC;
      } else {
        _log.default.log(LOG_PRIORITY_LIFECYCLE_MINOR, "Matching layer is unchanged ".concat(newLayer.id))();
      }
    } // Updates a single layer, cleaning all flags

  }, {
    key: "_updateLayer",
    value: function _updateLayer(layer) {
      _log.default.log(LOG_PRIORITY_LIFECYCLE_MINOR, "updating ".concat(layer, " because: ").concat(layer.printChangeFlags()))();

      var error = null;

      try {
        layer._update();
      } catch (err) {
        _log.default.warn("error during update of ".concat(layerName(layer)), err)(); // Save first error


        error = err;
      }

      return error;
    } // Finalizes a single layer

  }, {
    key: "_finalizeLayer",
    value: function _finalizeLayer(layer) {
      (0, _assert.default)(layer.lifecycle !== _constants.LIFECYCLE.AWAITING_FINALIZATION);
      layer.lifecycle = _constants.LIFECYCLE.AWAITING_FINALIZATION;
      var error = null;
      this.setNeedsRedraw("finalized ".concat(layerName(layer)));

      try {
        layer._finalize();
      } catch (err) {
        _log.default.warn("error during finalization of ".concat(layerName(layer)), err)();

        error = err;
      }

      layer.lifecycle = _constants.LIFECYCLE.FINALIZED;

      _log.default.log(LOG_PRIORITY_LIFECYCLE, "finalizing ".concat(layerName(layer)))();

      return error;
    } // SEER INTEGRATION

    /**
     * Called upon Seer initialization, manually sends layers data.
     */

  }, {
    key: "_initSeer",
    value: function _initSeer() {
      this.layers.forEach(function (layer) {
        (0, _seerIntegration.initLayerInSeer)(layer);
        (0, _seerIntegration.updateLayerInSeer)(layer);
      });
    }
    /**
     * On Seer property edition, set override and update layers.
     */

  }, {
    key: "_editSeer",
    value: function _editSeer(payload) {
      if (payload.type !== 'edit' || payload.valuePath[0] !== 'props') {
        return;
      }

      (0, _seerIntegration.setPropOverrides)(payload.itemKey, payload.valuePath.slice(1), payload.value);
      var newLayers = this.layers.map(function (layer) {
        return new layer.constructor(layer.props);
      });
      this.updateLayers({
        newLayers: newLayers
      });
    }
  }]);

  return LayerManager;
}();

exports.default = LayerManager;
},{"../utils/assert":"sRS1","luma.gl":"GAQa","seer":"Kyly","./layer":"qSjy","./draw-layers":"rXeY","./pick-layers":"thuH","../lifecycle/constants":"mLtW","../utils/log":"q39U","../utils/flatten":"uWrz","probe.gl":"aapK","../viewports/viewport":"RXGn","./seer-integration":"JOyY"}],"rjtR":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.deepEqual = deepEqual;

// Compare two objects, partial deep equal
function deepEqual(a, b) {
  if (a === b) {
    return true;
  } // TODO - implement deep equal on view descriptors


  return Object.keys(a).every(function (key) {
    if (Array.isArray(a[key]) && Array.isArray(b[key])) {
      return deepEqual(a[key], b[key]);
    }

    return a[key] === b[key];
  });
}
},{}],"A1zt":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.parsePosition = parsePosition;
exports.getPosition = getPosition;

function _typeof(obj) {
  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);
}

var PERCENT_OR_PIXELS_REGEX = /([0-9]+\.?[0-9]*)(%|px)/; // Takes a number or a string of formats `50%`, `33.3%` or `200px`

function parsePosition(value) {
  switch (_typeof(value)) {
    case 'number':
      return {
        position: value,
        relative: false
      };

    case 'string':
      var match = value.match(PERCENT_OR_PIXELS_REGEX);

      if (match && match.length >= 3) {
        var relative = match[2] === '%';
        var position = parseFloat(match[1]);
        return {
          position: relative ? position / 100 : position,
          relative: relative
        };
      }

    // fallthrough

    default:
      // eslint-disable-line
      throw new Error("Could not parse position string ".concat(value));
  }
}

function getPosition(position, extent) {
  return position.relative ? Math.round(position.position * extent) : position.position;
}
},{}],"K8TO":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _viewport = _interopRequireDefault(require("../viewports/viewport"));

var _positions = require("../utils/positions");

var _deepEqual = require("../utils/deep-equal");

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

var View =
/*#__PURE__*/
function () {
  function View() {
    var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

    _classCallCheck(this, View);

    var _props$id = props.id,
        id = _props$id === void 0 ? null : _props$id,
        _props$x = props.x,
        x = _props$x === void 0 ? 0 : _props$x,
        _props$y = props.y,
        y = _props$y === void 0 ? 0 : _props$y,
        _props$width = props.width,
        width = _props$width === void 0 ? '100%' : _props$width,
        _props$height = props.height,
        height = _props$height === void 0 ? '100%' : _props$height,
        _props$projectionMatr = props.projectionMatrix,
        projectionMatrix = _props$projectionMatr === void 0 ? null : _props$projectionMatr,
        _props$fovy = props.fovy,
        fovy = _props$fovy === void 0 ? 75 : _props$fovy,
        _props$near = props.near,
        near = _props$near === void 0 ? 0.1 : _props$near,
        _props$far = props.far,
        far = _props$far === void 0 ? 1000 : _props$far,
        _props$modelMatrix = props.modelMatrix,
        modelMatrix = _props$modelMatrix === void 0 ? null : _props$modelMatrix,
        _props$viewportInstan = props.viewportInstance,
        viewportInstance = _props$viewportInstan === void 0 ? null : _props$viewportInstan,
        _props$type = props.type,
        type = _props$type === void 0 ? _viewport.default : _props$type;
    (0, _assert.default)(!viewportInstance || viewportInstance instanceof _viewport.default);
    this.viewportInstance = viewportInstance; // Id

    this.id = id || this.constructor.displayName || 'view';
    this.type = type;
    this.props = Object.assign({}, props, {
      projectionMatrix: projectionMatrix,
      fovy: fovy,
      near: near,
      far: far,
      modelMatrix: modelMatrix
    }); // Extents

    this._parseDimensions({
      x: x,
      y: y,
      width: width,
      height: height
    }); // Bind methods for easy access


    this.equals = this.equals.bind(this);
    Object.seal(this);
  }

  _createClass(View, [{
    key: "equals",
    value: function equals(view) {
      if (this === view) {
        return true;
      } // if `viewportInstance` is set, it is the only prop that is used
      // Delegate to `Viewport.equals`


      if (this.viewportInstance) {
        return view.viewportInstance && this.viewportInstance.equals(view.viewportInstance);
      }

      var viewChanged = (0, _deepEqual.deepEqual)(this.props, view.props);
      return viewChanged;
    } // Build a `Viewport` from a view descriptor
    // TODO - add support for autosizing viewports using width and height

  }, {
    key: "makeViewport",
    value: function makeViewport(_ref) {
      var width = _ref.width,
          height = _ref.height,
          viewState = _ref.viewState;

      if (this.viewportInstance) {
        return this.viewportInstance;
      }

      viewState = this.filterViewState(viewState); // Resolve relative viewport dimensions

      var viewportDimensions = this.getDimensions({
        width: width,
        height: height
      });
      var props = Object.assign({
        viewState: viewState
      }, viewState, this.props, viewportDimensions);
      return this._getViewport(props);
    }
  }, {
    key: "getViewStateId",
    value: function getViewStateId() {
      switch (_typeof(this.props.viewState)) {
        case 'string':
          // if View.viewState is a string, return it
          return this.props.viewState;

        case 'object':
          // If it is an object, return its id component
          return this.props.viewState && this.props.viewState.id;

        default:
          return this.id;
      }
    } // Allows view to override (or completely define) viewState

  }, {
    key: "filterViewState",
    value: function filterViewState(viewState) {
      if (this.props.viewState && _typeof(this.props.viewState) === 'object') {
        // If we have specified an id, then intent is to override,
        // If not, completely specify the view state
        if (!this.props.viewState.id) {
          return this.props.viewState;
        } // Merge in all props from View's viewState, except id


        var newViewState = Object.assign({}, viewState);

        for (var key in this.props.viewState) {
          if (key !== 'id') {
            newViewState[key] = this.props.viewState[key];
          }
        }

        return newViewState;
      }

      return viewState;
    } // Resolve relative viewport dimensions into actual dimensions (y='50%', width=800 => y=400)

  }, {
    key: "getDimensions",
    value: function getDimensions(_ref2) {
      var width = _ref2.width,
          height = _ref2.height;
      return {
        x: (0, _positions.getPosition)(this._x, width),
        y: (0, _positions.getPosition)(this._y, height),
        width: (0, _positions.getPosition)(this._width, width),
        height: (0, _positions.getPosition)(this._height, height)
      };
    } // Used by sub classes to resolve controller props

  }, {
    key: "_getControllerProps",
    value: function _getControllerProps(defaultOpts) {
      var opts = this.props.controller;

      if (!opts) {
        return null;
      }

      if (opts === true) {
        return defaultOpts;
      }

      if (typeof opts === 'function') {
        opts = {
          type: opts
        };
      }

      return Object.assign({}, defaultOpts, opts);
    } // Overridable method

  }, {
    key: "_getViewport",
    value: function _getViewport(props) {
      // Get the type of the viewport
      var ViewportType = this.type;
      return new ViewportType(props);
    } // Parse relative viewport dimension descriptors (e.g {y: '50%', height: '50%'})

  }, {
    key: "_parseDimensions",
    value: function _parseDimensions(_ref3) {
      var x = _ref3.x,
          y = _ref3.y,
          width = _ref3.width,
          height = _ref3.height;
      this._x = (0, _positions.parsePosition)(x);
      this._y = (0, _positions.parsePosition)(y);
      this._width = (0, _positions.parsePosition)(width);
      this._height = (0, _positions.parsePosition)(height);
    }
  }]);

  return View;
}();

exports.default = View;
},{"../viewports/viewport":"RXGn","../utils/positions":"A1zt","../utils/deep-equal":"rjtR","../utils/assert":"sRS1"}],"SRCU":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _assert = _interopRequireDefault(require("../utils/assert"));

var _deepEqual = require("../utils/deep-equal");

var _view = _interopRequireDefault(require("../views/view"));

var _viewport = _interopRequireDefault(require("../viewports/viewport"));

var _log = _interopRequireDefault(require("../utils/log"));

var _flatten = require("../utils/flatten");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.


var ViewManager =
/*#__PURE__*/
function () {
  function ViewManager() {
    var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

    _classCallCheck(this, ViewManager); // List of view descriptors, gets re-evaluated when width/height changes


    this.views = [];
    this.width = 100;
    this.height = 100;
    this.viewState = {};
    this.controllers = {};
    this._viewports = []; // Generated viewports

    this._viewportMap = {};
    this._isUpdating = false;
    this._needsRedraw = 'Initial render';
    this._needsUpdate = true;
    this._eventManager = props.eventManager;
    this._eventCallbacks = {
      onViewStateChange: props.onViewStateChange,
      onInteractiveStateChange: props.onInteractiveStateChange
    };
    Object.seal(this); // Init with default map viewport

    this.setProps(props);
  }

  _createClass(ViewManager, [{
    key: "finalize",
    value: function finalize() {
      for (var key in this.controllers) {
        if (this.controllers[key]) {
          this.controllers[key].finalize();
        }
      }

      this.controllers = {};
    } // Check if a redraw is needed

  }, {
    key: "needsRedraw",
    value: function needsRedraw() {
      var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          _ref$clearRedrawFlags = _ref.clearRedrawFlags,
          clearRedrawFlags = _ref$clearRedrawFlags === void 0 ? true : _ref$clearRedrawFlags;

      var redraw = this._needsRedraw;

      if (clearRedrawFlags) {
        this._needsRedraw = false;
      }

      return redraw;
    } // Layers will be redrawn (in next animation frame)

  }, {
    key: "setNeedsRedraw",
    value: function setNeedsRedraw(reason) {
      this._needsRedraw = this._needsRedraw || reason;
    } // Layers will be updated deeply (in next animation frame)
    // Potentially regenerating attributes and sub layers

  }, {
    key: "setNeedsUpdate",
    value: function setNeedsUpdate(reason) {
      this._needsUpdate = this._needsUpdate || reason;
      this._needsRedraw = this._needsRedraw || reason;
    }
    /** Get a set of viewports for a given width and height
     * TODO - Intention is for deck.gl to autodeduce width and height and drop the need for props
     * @param rect (object, optional) - filter the viewports
     *   + not provided - return all viewports
     *   + {x, y} - only return viewports that contain this pixel
     *   + {x, y, width, height} - only return viewports that overlap with this rectangle
     */

  }, {
    key: "getViewports",
    value: function getViewports(rect) {
      if (rect) {
        return this._viewports.filter(function (viewport) {
          return viewport.containsPixel(rect);
        });
      }

      return this._viewports;
    }
  }, {
    key: "getViews",
    value: function getViews() {
      var viewMap = {};
      this.views.forEach(function (view) {
        viewMap[view.id] = view;
      });
      return viewMap;
    } // Resolves a viewId string to a View, if already a View returns it.

  }, {
    key: "getView",
    value: function getView(viewOrViewId) {
      return typeof viewOrViewId === 'string' ? this.views.find(function (view) {
        return view.id === viewOrViewId;
      }) : viewOrViewId;
    } // Returns the viewState for a specific viewId. Matches the viewState by
    // 1. view.viewStateId
    // 2. view.id
    // 3. root viewState
    // then applies the view's filter if any

  }, {
    key: "getViewState",
    value: function getViewState(viewId) {
      var view = this.getView(viewId); // Backward compatibility: view state for single view

      var viewState = view && this.viewState[view.getViewStateId()] || this.viewState;
      return view ? view.filterViewState(viewState) : viewState;
    }
  }, {
    key: "getViewport",
    value: function getViewport(viewId) {
      return this._viewportMap[viewId];
    }
    /**
     * Projects xyz (possibly latitude and longitude) to pixel coordinates in window
     * using viewport projection parameters
     * - [longitude, latitude] to [x, y]
     * - [longitude, latitude, Z] => [x, y, z]
     * Note: By default, returns top-left coordinates for canvas/SVG type render
     *
     * @param {Array} lngLatZ - [lng, lat] or [lng, lat, Z]
     * @param {Object} opts - options
     * @param {Object} opts.topLeft=true - Whether projected coords are top left
     * @return {Array} - [x, y] or [x, y, z] in top left coords
     */

  }, {
    key: "project",
    value: function project(xyz) {
      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
        topLeft: true
      };
      var viewports = this.getViewports();

      for (var i = viewports.length - 1; i >= 0; --i) {
        var viewport = viewports[i];

        if (viewport.contains(xyz, opts)) {
          return viewport.project(xyz, opts);
        }
      }

      return null;
    }
    /**
     * Unproject pixel coordinates on screen onto world coordinates,
     * (possibly [lon, lat]) on map.
     * - [x, y] => [lng, lat]
     * - [x, y, z] => [lng, lat, Z]
     * @param {Array} xyz -
     * @param {Object} opts - options
     * @param {Object} opts.topLeft=true - Whether origin is top left
     * @return {Array|null} - [lng, lat, Z] or [X, Y, Z]
     */

  }, {
    key: "unproject",
    value: function unproject(xyz, opts) {
      var viewports = this.getViewports();

      for (var i = viewports.length - 1; i >= 0; --i) {
        var viewport = viewports[i];

        if (viewport.containsPixel(xyz, opts)) {
          return viewport.unproject(xyz);
        }
      }

      return null;
    }
  }, {
    key: "setProps",
    value: function setProps(props) {
      if ('views' in props) {
        this._setViews(props.views);
      } // TODO - support multiple view states


      if ('viewState' in props) {
        this._setViewState(props.viewState);
      }

      if ('width' in props || 'height' in props) {
        this._setSize(props.width, props.height);
      } // Important: avoid invoking _update() inside itself
      // Nested updates result in unexpected side effects inside _rebuildViewports()
      // when using auto control in pure-js


      if (!this._isUpdating) {
        this._update();
      }
    }
  }, {
    key: "_update",
    value: function _update() {
      this._isUpdating = true; // Only rebuild viewports if the update flag is set

      if (this._needsUpdate) {
        this._needsUpdate = false;

        this._rebuildViewports();
      } // If viewport transition(s) are triggered during viewports update, controller(s)
      // will immediately call `onViewStateChange` which calls `viewManager.setProps` again.


      if (this._needsUpdate) {
        this._needsUpdate = false;

        this._rebuildViewports();
      }

      this._isUpdating = false;
    }
  }, {
    key: "_setSize",
    value: function _setSize(width, height) {
      (0, _assert.default)(Number.isFinite(width) && Number.isFinite(height));

      if (width !== this.width || height !== this.height) {
        this.width = width;
        this.height = height;
        this.setNeedsUpdate('Size changed');
      }
    } // Update the view descriptor list and set change flag if needed
    // Does not actually rebuild the `Viewport`s until `getViewports` is called

  }, {
    key: "_setViews",
    value: function _setViews(views) {
      // DEPRECATED: Ensure any "naked" Viewports are wrapped in View instances
      views = (0, _flatten.flatten)(views, {
        filter: Boolean
      }).map(function (view) {
        return view instanceof _viewport.default ? new _view.default({
          viewportInstance: view
        }) : view;
      });

      var viewsChanged = this._diffViews(views, this.views);

      if (viewsChanged) {
        this.setNeedsUpdate('views changed');
      }

      this.views = views;
    }
  }, {
    key: "_setViewState",
    value: function _setViewState(viewState) {
      if (viewState) {
        var viewStateChanged = !(0, _deepEqual.deepEqual)(viewState, this.viewState);

        if (viewStateChanged) {
          this.setNeedsUpdate('viewState changed');
        }

        this.viewState = viewState;
      } else {
        _log.default.warn('setting null viewState')();
      }
    } //
    // PRIVATE METHODS
    //

  }, {
    key: "_onViewStateChange",
    value: function _onViewStateChange(viewId, event) {
      event.viewId = viewId;

      this._eventCallbacks.onViewStateChange(event);
    }
  }, {
    key: "_createController",
    value: function _createController(props) {
      var Controller = props.type;
      var controller = new Controller(Object.assign({
        eventManager: this._eventManager,
        // Set an internal callback that calls the prop callback if provided
        onViewStateChange: this._onViewStateChange.bind(this, props.id),
        onStateChange: this._eventCallbacks.onInteractiveStateChange
      }, props));
      return controller;
    }
  }, {
    key: "_updateController",
    value: function _updateController(view, viewState, viewport, controller) {
      if (view.controller) {
        var controllerProps = Object.assign({}, view.controller, viewState, {
          id: view.id,
          x: viewport.x,
          y: viewport.y,
          width: viewport.width,
          height: viewport.height
        }); // TODO - check if view / controller type has changed, and replace the controller

        if (controller) {
          controller.setProps(controllerProps);
        } else {
          controller = this._createController(controllerProps);
        }

        return controller;
      }

      return null;
    } // Rebuilds viewports from descriptors towards a certain window size

  }, {
    key: "_rebuildViewports",
    value: function _rebuildViewports() {
      var _this = this;

      var width = this.width,
          height = this.height,
          views = this.views;
      var oldControllers = this.controllers;
      this.controllers = {};
      this._viewports = views.map(function (view) {
        var viewState = _this.getViewState(view);

        var viewport = view.makeViewport({
          width: width,
          height: height,
          viewState: viewState
        }); // Update the controller

        _this.controllers[view.id] = _this._updateController(view, viewState, viewport, oldControllers[view.id]);
        return viewport;
      }); // Remove unused controllers

      for (var id in oldControllers) {
        if (oldControllers[id] && !this.controllers[id]) {
          oldControllers[id].finalize();
        }
      }

      this._buildViewportMap();
    }
  }, {
    key: "_buildViewportMap",
    value: function _buildViewportMap() {
      var _this2 = this; // Build a view id to view index


      this._viewportMap = {};

      this._viewports.forEach(function (viewport) {
        if (viewport.id) {
          // TODO - issue warning if multiple viewports use same id
          _this2._viewportMap[viewport.id] = _this2._viewportMap[viewport.id] || viewport;
        }
      });
    } // Check if viewport array has changed, returns true if any change
    // Note that descriptors can be the same

  }, {
    key: "_diffViews",
    value: function _diffViews(newViews, oldViews) {
      if (newViews.length !== oldViews.length) {
        return true;
      }

      return newViews.some(function (_, i) {
        return !newViews[i].equals(oldViews[i]);
      });
    }
  }]);

  return ViewManager;
}();

exports.default = ViewManager;
},{"../utils/assert":"sRS1","../utils/deep-equal":"rjtR","../views/view":"K8TO","../viewports/viewport":"RXGn","../utils/log":"q39U","../utils/flatten":"uWrz"}],"uuqX":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _viewport = _interopRequireDefault(require("./viewport"));

var _viewportMercatorProject = require("viewport-mercator-project");

var vec2 = _interopRequireWildcard(require("gl-matrix/vec2"));

var _assert = _interopRequireDefault(require("../utils/assert"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _slicedToArray(arr, i) {
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
}

function _nonIterableRest() {
  throw new TypeError("Invalid attempt to destructure non-iterable instance");
}

function _iterableToArrayLimit(arr, i) {
  var _arr = [];
  var _n = true;
  var _d = false;
  var _e = undefined;

  try {
    for (var _i = arr[Symbol.iterator](), _s; !(_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;
}

function _arrayWithHoles(arr) {
  if (Array.isArray(arr)) return arr;
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
// View and Projection Matrix calculations for mapbox-js style
// map view properties


var ERR_ARGUMENT = 'Illegal argument to WebMercatorViewport';

var WebMercatorViewport =
/*#__PURE__*/
function (_Viewport) {
  _inherits(WebMercatorViewport, _Viewport);
  /**
   * @classdesc
   * Creates view/projection matrices from mercator params
   * Note: The Viewport is immutable in the sense that it only has accessors.
   * A new viewport instance should be created if any parameters have changed.
   */

  /* eslint-disable complexity, max-statements */


  function WebMercatorViewport() {
    var _this;

    var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

    _classCallCheck(this, WebMercatorViewport);

    var _opts$latitude = opts.latitude,
        latitude = _opts$latitude === void 0 ? 0 : _opts$latitude,
        _opts$longitude = opts.longitude,
        longitude = _opts$longitude === void 0 ? 0 : _opts$longitude,
        _opts$zoom = opts.zoom,
        zoom = _opts$zoom === void 0 ? 11 : _opts$zoom,
        _opts$pitch = opts.pitch,
        pitch = _opts$pitch === void 0 ? 0 : _opts$pitch,
        _opts$bearing = opts.bearing,
        bearing = _opts$bearing === void 0 ? 0 : _opts$bearing,
        _opts$nearZMultiplier = opts.nearZMultiplier,
        nearZMultiplier = _opts$nearZMultiplier === void 0 ? 0.1 : _opts$nearZMultiplier,
        _opts$farZMultiplier = opts.farZMultiplier,
        farZMultiplier = _opts$farZMultiplier === void 0 ? 10 : _opts$farZMultiplier,
        _opts$orthographic = opts.orthographic,
        orthographic = _opts$orthographic === void 0 ? false : _opts$orthographic;
    var width = opts.width,
        height = opts.height,
        _opts$altitude = opts.altitude,
        altitude = _opts$altitude === void 0 ? 1.5 : _opts$altitude; // Silently allow apps to send in 0,0 to facilitate isomorphic render etc

    width = width || 1;
    height = height || 1; // Altitude - prevent division by 0
    // TODO - just throw an Error instead?

    altitude = Math.max(0.75, altitude);

    var _getProjectionParamet = (0, _viewportMercatorProject.getProjectionParameters)({
      width: width,
      height: height,
      pitch: pitch,
      altitude: altitude,
      nearZMultiplier: nearZMultiplier,
      farZMultiplier: farZMultiplier
    }),
        fov = _getProjectionParamet.fov,
        aspect = _getProjectionParamet.aspect,
        focalDistance = _getProjectionParamet.focalDistance,
        near = _getProjectionParamet.near,
        far = _getProjectionParamet.far; // The uncentered matrix allows us two move the center addition to the
    // shader (cheap) which gives a coordinate system that has its center in
    // the layer's center position. This makes rotations and other modelMatrx
    // transforms much more useful.


    var viewMatrixUncentered = (0, _viewportMercatorProject.getViewMatrix)({
      height: height,
      pitch: pitch,
      bearing: bearing,
      altitude: altitude
    }); // TODO / hack - prevent vertical offsets if not FirstPersonViewport

    var position = opts.position && [opts.position[0], opts.position[1], 0];
    var viewportOpts = Object.assign({}, opts, {
      // x, y,
      width: width,
      height: height,
      // view matrix
      viewMatrix: viewMatrixUncentered,
      longitude: longitude,
      latitude: latitude,
      zoom: zoom,
      position: position,
      // projection matrix parameters
      orthographic: orthographic,
      fovyRadians: fov,
      aspect: aspect,
      // TODO Viewport is already carefully set up to "focus" on ground, so can't use focal distance
      orthographicFocalDistance: focalDistance,
      near: near,
      far: far
    });
    _this = _possibleConstructorReturn(this, _getPrototypeOf(WebMercatorViewport).call(this, viewportOpts)); // Save parameters

    _this.latitude = latitude;
    _this.longitude = longitude;
    _this.zoom = zoom;
    _this.pitch = pitch;
    _this.bearing = bearing;
    _this.altitude = altitude;
    _this.orthographic = orthographic; // Bind methods

    _this.metersToLngLatDelta = _this.metersToLngLatDelta.bind(_assertThisInitialized(_assertThisInitialized(_this)));
    _this.lngLatDeltaToMeters = _this.lngLatDeltaToMeters.bind(_assertThisInitialized(_assertThisInitialized(_this)));
    _this.addMetersToLngLat = _this.addMetersToLngLat.bind(_assertThisInitialized(_assertThisInitialized(_this)));
    Object.freeze(_assertThisInitialized(_assertThisInitialized(_this)));
    return _this;
  }
  /* eslint-enable complexity, max-statements */

  /**
   * Converts a meter offset to a lnglat offset
   *
   * Note: Uses simple linear approximation around the viewport center
   * Error increases with size of offset (roughly 1% per 100km)
   *
   * @param {[Number,Number]|[Number,Number,Number]) xyz - array of meter deltas
   * @return {[Number,Number]|[Number,Number,Number]) - array of [lng,lat,z] deltas
   */


  _createClass(WebMercatorViewport, [{
    key: "metersToLngLatDelta",
    value: function metersToLngLatDelta(xyz) {
      var _xyz = _slicedToArray(xyz, 3),
          x = _xyz[0],
          y = _xyz[1],
          _xyz$ = _xyz[2],
          z = _xyz$ === void 0 ? 0 : _xyz$;

      (0, _assert.default)(Number.isFinite(x) && Number.isFinite(y) && Number.isFinite(z), ERR_ARGUMENT);
      var _this$distanceScales = this.distanceScales,
          pixelsPerMeter = _this$distanceScales.pixelsPerMeter,
          degreesPerPixel = _this$distanceScales.degreesPerPixel;
      var deltaLng = x * pixelsPerMeter[0] * degreesPerPixel[0];
      var deltaLat = y * pixelsPerMeter[1] * degreesPerPixel[1];
      return xyz.length === 2 ? [deltaLng, deltaLat] : [deltaLng, deltaLat, z];
    }
    /**
     * Converts a lnglat offset to a meter offset
     *
     * Note: Uses simple linear approximation around the viewport center
     * Error increases with size of offset (roughly 1% per 100km)
     *
     * @param {[Number,Number]|[Number,Number,Number]) deltaLngLatZ - array of [lng,lat,z] deltas
     * @return {[Number,Number]|[Number,Number,Number]) - array of meter deltas
     */

  }, {
    key: "lngLatDeltaToMeters",
    value: function lngLatDeltaToMeters(deltaLngLatZ) {
      var _deltaLngLatZ = _slicedToArray(deltaLngLatZ, 3),
          deltaLng = _deltaLngLatZ[0],
          deltaLat = _deltaLngLatZ[1],
          _deltaLngLatZ$ = _deltaLngLatZ[2],
          deltaZ = _deltaLngLatZ$ === void 0 ? 0 : _deltaLngLatZ$;

      (0, _assert.default)(Number.isFinite(deltaLng) && Number.isFinite(deltaLat) && Number.isFinite(deltaZ), ERR_ARGUMENT);
      var _this$distanceScales2 = this.distanceScales,
          pixelsPerDegree = _this$distanceScales2.pixelsPerDegree,
          metersPerPixel = _this$distanceScales2.metersPerPixel;
      var deltaX = deltaLng * pixelsPerDegree[0] * metersPerPixel[0];
      var deltaY = deltaLat * pixelsPerDegree[1] * metersPerPixel[1];
      return deltaLngLatZ.length === 2 ? [deltaX, deltaY] : [deltaX, deltaY, deltaZ];
    }
    /**
     * Add a meter delta to a base lnglat coordinate, returning a new lnglat array
     *
     * Note: Uses simple linear approximation around the viewport center
     * Error increases with size of offset (roughly 1% per 100km)
     *
     * @param {[Number,Number]|[Number,Number,Number]) lngLatZ - base coordinate
     * @param {[Number,Number]|[Number,Number,Number]) xyz - array of meter deltas
     * @return {[Number,Number]|[Number,Number,Number]) array of [lng,lat,z] deltas
     */

  }, {
    key: "addMetersToLngLat",
    value: function addMetersToLngLat(lngLatZ, xyz) {
      return (0, _viewportMercatorProject.addMetersToLngLat)(lngLatZ, xyz);
    }
    /**
     * Get the map center that place a given [lng, lat] coordinate at screen
     * point [x, y]
     *
     * @param {Array} lngLat - [lng,lat] coordinates
     *   Specifies a point on the sphere.
     * @param {Array} pos - [x,y] coordinates
     *   Specifies a point on the screen.
     * @return {Array} [lng,lat] new map center.
     */

  }, {
    key: "getMapCenterByLngLatPosition",
    value: function getMapCenterByLngLatPosition(_ref) {
      var lngLat = _ref.lngLat,
          pos = _ref.pos;
      var fromLocation = (0, _viewportMercatorProject.pixelsToWorld)(pos, this.pixelUnprojectionMatrix);
      var toLocation = this.projectFlat(lngLat);
      var translate = vec2.add([], toLocation, vec2.negate([], fromLocation));
      var newCenter = vec2.add([], this.center, translate);
      return this.unprojectFlat(newCenter);
    } // Legacy method name

  }, {
    key: "getLocationAtPoint",
    value: function getLocationAtPoint(_ref2) {
      var lngLat = _ref2.lngLat,
          pos = _ref2.pos;
      return this.getMapCenterByLngLatPosition({
        lngLat: lngLat,
        pos: pos
      });
    }
    /**
     * Returns a new viewport that fit around the given rectangle.
     * Only supports non-perspective mode.
     * @param {Array} bounds - [[lon, lat], [lon, lat]]
     * @param {Number} [options.padding] - The amount of padding in pixels to add to the given bounds.
     * @param {Array} [options.offset] - The center of the given bounds relative to the map's center,
     *    [x, y] measured in pixels.
     * @returns {WebMercatorViewport}
     */

  }, {
    key: "fitBounds",
    value: function fitBounds(bounds) {
      var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      var width = this.width,
          height = this.height;

      var _fitBounds2 = (0, _viewportMercatorProject.fitBounds)(Object.assign({
        width: width,
        height: height,
        bounds: bounds
      }, options)),
          longitude = _fitBounds2.longitude,
          latitude = _fitBounds2.latitude,
          zoom = _fitBounds2.zoom;

      return new WebMercatorViewport({
        width: width,
        height: height,
        longitude: longitude,
        latitude: latitude,
        zoom: zoom
      });
    }
  }]);

  return WebMercatorViewport;
}(_viewport.default);

exports.default = WebMercatorViewport;
WebMercatorViewport.displayName = 'WebMercatorViewport';
},{"./viewport":"RXGn","viewport-mercator-project":"K6fX","gl-matrix/vec2":"iP3z","../utils/assert":"sRS1"}],"zzBl":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _math = require("math.gl");

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

var TransitionInterpolator =
/*#__PURE__*/
function () {
  /**
   * @param opts {array|object}
   * @param opts.compare {array} - prop names used in equality check
   * @param opts.extract {array} - prop names needed for interpolation
   * @param opts.required {array} - prop names that must be supplied
   * alternatively, supply one list of prop names as `opts` if all of the above are the same.
   */
  function TransitionInterpolator() {
    var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

    _classCallCheck(this, TransitionInterpolator);

    if (Array.isArray(opts)) {
      opts = {
        compare: opts,
        extract: opts,
        required: opts
      };
    }

    var _opts = opts,
        compare = _opts.compare,
        extract = _opts.extract,
        required = _opts.required;
    this._propsToCompare = compare;
    this._propsToExtract = extract;
    this._requiredProps = required;
  }
  /**
   * Checks if two sets of props need transition in between
   * @param currentProps {object} - a list of viewport props
   * @param nextProps {object} - a list of viewport props
   * @returns {bool} - true if two props are equivalent
   */


  _createClass(TransitionInterpolator, [{
    key: "arePropsEqual",
    value: function arePropsEqual(currentProps, nextProps) {
      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = (this._propsToCompare || Object.keys(nextProps))[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var key = _step.value;

          if (!(0, _math.equals)(currentProps[key], nextProps[key])) {
            return false;
          }
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return != null) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }

      return true;
    }
    /**
     * Called before transition starts to validate/pre-process start and end props
     * @param startProps {object} - a list of starting viewport props
     * @param endProps {object} - a list of target viewport props
     * @returns {Object} {start, end} - start and end props to be passed
     *   to `interpolateProps`
     */

  }, {
    key: "initializeProps",
    value: function initializeProps(startProps, endProps) {
      var result;

      if (this._propsToExtract) {
        var startViewStateProps = {};
        var endViewStateProps = {};
        var _iteratorNormalCompletion2 = true;
        var _didIteratorError2 = false;
        var _iteratorError2 = undefined;

        try {
          for (var _iterator2 = this._propsToExtract[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
            var key = _step2.value;
            startViewStateProps[key] = startProps[key];
            endViewStateProps[key] = endProps[key];
          }
        } catch (err) {
          _didIteratorError2 = true;
          _iteratorError2 = err;
        } finally {
          try {
            if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
              _iterator2.return();
            }
          } finally {
            if (_didIteratorError2) {
              throw _iteratorError2;
            }
          }
        }

        result = {
          start: startViewStateProps,
          end: endViewStateProps
        };
      } else {
        result = {
          start: startProps,
          end: endProps
        };
      }

      this._checkRequiredProps(result.start);

      this._checkRequiredProps(result.end);

      return result;
    }
    /**
     * Returns viewport props in transition
     * @param startProps {object} - a list of starting viewport props
     * @param endProps {object} - a list of target viewport props
     * @param t {number} - a time factor between [0, 1]
     * @returns {object} - a list of interpolated viewport props
     */

  }, {
    key: "interpolateProps",
    value: function interpolateProps(startProps, endProps, t) {
      (0, _assert.default)(false, 'interpolateProps is not implemented');
    }
  }, {
    key: "_checkRequiredProps",
    value: function _checkRequiredProps(props) {
      if (!this._requiredProps) {
        return;
      }

      this._requiredProps.forEach(function (propName) {
        var value = props[propName];
        (0, _assert.default)(Number.isFinite(value) || Array.isArray(value), "".concat(propName, " is required for transition"));
      });
    }
  }]);

  return TransitionInterpolator;
}();

exports.default = TransitionInterpolator;
},{"math.gl":"dl2t","../utils/assert":"sRS1"}],"wq52":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _transitionInterpolator = _interopRequireDefault(require("./transition-interpolator"));

var _math = require("math.gl");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
}

var VIEWPORT_TRANSITION_PROPS = ['longitude', 'latitude', 'zoom', 'bearing', 'pitch'];
/**
 * Performs linear interpolation of two view states.
 */

var LinearInterpolator =
/*#__PURE__*/
function (_TransitionInterpolat) {
  _inherits(LinearInterpolator, _TransitionInterpolat);
  /**
   * @param {Array} transitionProps - list of props to apply linear transition to.
   */


  function LinearInterpolator() {
    var transitionProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : VIEWPORT_TRANSITION_PROPS;

    _classCallCheck(this, LinearInterpolator);

    return _possibleConstructorReturn(this, _getPrototypeOf(LinearInterpolator).call(this, transitionProps));
  }

  _createClass(LinearInterpolator, [{
    key: "interpolateProps",
    value: function interpolateProps(startProps, endProps, t) {
      var viewport = {};

      for (var key in endProps) {
        viewport[key] = (0, _math.lerp)(startProps[key], endProps[key], t);
      }

      return viewport;
    }
  }]);

  return LinearInterpolator;
}(_transitionInterpolator.default);

exports.default = LinearInterpolator;
},{"./transition-interpolator":"zzBl","math.gl":"dl2t"}],"bUf5":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.TRANSITION_EVENTS = void 0;

var _linearInterpolator = _interopRequireDefault(require("../transitions/linear-interpolator"));

var _transition = _interopRequireDefault(require("../transitions/transition"));

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}
/* global requestAnimationFrame, cancelAnimationFrame */


var noop = function noop() {};

var TRANSITION_EVENTS = {
  BREAK: 1,
  SNAP_TO_END: 2,
  IGNORE: 3
};
exports.TRANSITION_EVENTS = TRANSITION_EVENTS;
var DEFAULT_PROPS = {
  transitionDuration: 0,
  transitionEasing: function transitionEasing(t) {
    return t;
  },
  transitionInterpolator: new _linearInterpolator.default(),
  transitionInterruption: TRANSITION_EVENTS.BREAK,
  onTransitionStart: noop,
  onTransitionInterrupt: noop,
  onTransitionEnd: noop
};

var TransitionManager =
/*#__PURE__*/
function () {
  function TransitionManager(ControllerState) {
    var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

    _classCallCheck(this, TransitionManager);

    (0, _assert.default)(ControllerState);
    this.ControllerState = ControllerState;
    this.props = Object.assign({}, DEFAULT_PROPS, props);
    this.animation = null;
    this.propsInTransition = null;
    this.transition = new _transition.default();
    this.onViewStateChange = props.onViewStateChange;
    this._onTransitionFrame = this._onTransitionFrame.bind(this);
    this._onTransitionUpdate = this._onTransitionUpdate.bind(this);
  }

  _createClass(TransitionManager, [{
    key: "finalize",
    value: function finalize() {
      cancelAnimationFrame(this.animation);
    } // Returns current transitioned viewport.

  }, {
    key: "getViewportInTransition",
    value: function getViewportInTransition() {
      return this.propsInTransition;
    } // Process the vewiport change, either ignore or trigger a new transition.
    // Return true if a new transition is triggered, false otherwise.

  }, {
    key: "processViewStateChange",
    value: function processViewStateChange(nextProps) {
      var transitionTriggered = false;
      var currentProps = this.props; // Set this.props here as '_triggerTransition' calls '_updateViewport' that uses this.props.

      nextProps = Object.assign({}, DEFAULT_PROPS, nextProps);
      this.props = nextProps; // NOTE: Be cautious re-ordering statements in this function.

      if (this._shouldIgnoreViewportChange(currentProps, nextProps)) {
        return transitionTriggered;
      }

      if (this._isTransitionEnabled(nextProps)) {
        var startProps = Object.assign({}, currentProps, this.transition.interruption === TRANSITION_EVENTS.SNAP_TO_END ? this.transition.endProps : this.propsInTransition || currentProps);

        this._triggerTransition(startProps, nextProps);

        transitionTriggered = true;
      } else {
        this.transition.cancel();
      }

      return transitionTriggered;
    } // Helper methods

  }, {
    key: "_isTransitionEnabled",
    value: function _isTransitionEnabled(props) {
      return props.transitionDuration > 0 && props.transitionInterpolator;
    }
  }, {
    key: "_isUpdateDueToCurrentTransition",
    value: function _isUpdateDueToCurrentTransition(props) {
      if (this.transition.inProgress) {
        return this.transition.interpolator.arePropsEqual(props, this.propsInTransition);
      }

      return false;
    }
  }, {
    key: "_shouldIgnoreViewportChange",
    value: function _shouldIgnoreViewportChange(currentProps, nextProps) {
      if (this.transition.inProgress) {
        // Ignore update if it is requested to be ignored
        return this.transition.interruption === TRANSITION_EVENTS.IGNORE || // Ignore update if it is due to current active transition.
        this._isUpdateDueToCurrentTransition(nextProps);
      } else if (this._isTransitionEnabled(nextProps)) {
        // Ignore if none of the viewport props changed.
        return nextProps.transitionInterpolator.arePropsEqual(currentProps, nextProps);
      }

      return true;
    }
  }, {
    key: "_triggerTransition",
    value: function _triggerTransition(startProps, endProps) {
      (0, _assert.default)(this._isTransitionEnabled(endProps), 'Transition is not enabled');
      cancelAnimationFrame(this.animation);
      var startViewstate = new this.ControllerState(startProps);
      var endViewStateProps = new this.ControllerState(endProps).shortestPathFrom(startViewstate);
      var initialProps = endProps.transitionInterpolator.initializeProps(startProps, endViewStateProps);
      this.propsInTransition = {};
      this.transition.start({
        duration: endProps.transitionDuration,
        easing: endProps.transitionEasing,
        interpolator: endProps.transitionInterpolator,
        interruption: endProps.transitionInterruption,
        startProps: initialProps.start,
        endProps: initialProps.end,
        onStart: endProps.onTransitionStart,
        onUpdate: this._onTransitionUpdate,
        onInterrupt: this._onTransitionEnd(endProps.onTransitionInterrupt),
        onEnd: this._onTransitionEnd(endProps.onTransitionEnd)
      });

      this._onTransitionFrame();
    }
  }, {
    key: "_onTransitionFrame",
    value: function _onTransitionFrame() {
      // _updateViewport() may cancel the animation
      this.animation = requestAnimationFrame(this._onTransitionFrame);
      this.transition.update(Date.now());
    }
  }, {
    key: "_onTransitionEnd",
    value: function _onTransitionEnd(callback) {
      var _this = this;

      return function (transition) {
        cancelAnimationFrame(_this.animation);
        _this.propsInTransition = null;
        callback(transition);
      };
    }
  }, {
    key: "_onTransitionUpdate",
    value: function _onTransitionUpdate(transition) {
      // NOTE: Be cautious re-ordering statements in this function.
      var interpolator = transition.interpolator,
          startProps = transition.startProps,
          endProps = transition.endProps,
          time = transition.time;
      var viewport = interpolator.interpolateProps(startProps, endProps, time); // This gurantees all props (e.g. bearing, longitude) are normalized
      // So when viewports are compared they are in same range.

      this.propsInTransition = new this.ControllerState(Object.assign({}, this.props, viewport)).getViewportProps();

      if (this.onViewStateChange) {
        this.onViewStateChange({
          viewState: this.propsInTransition,
          interactionState: {
            inTransition: true
          }
        });
      }
    }
  }]);

  return TransitionManager;
}();

exports.default = TransitionManager;
TransitionManager.defaultProps = DEFAULT_PROPS;
},{"../transitions/linear-interpolator":"wq52","../transitions/transition":"yhd8","../utils/assert":"sRS1"}],"Gii9":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _transitionManager = _interopRequireDefault(require("./transition-manager"));

var _log = _interopRequireDefault(require("../utils/log"));

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _slicedToArray(arr, i) {
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
}

function _nonIterableRest() {
  throw new TypeError("Invalid attempt to destructure non-iterable instance");
}

function _iterableToArrayLimit(arr, i) {
  var _arr = [];
  var _n = true;
  var _d = false;
  var _e = undefined;

  try {
    for (var _i = arr[Symbol.iterator](), _s; !(_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;
}

function _arrayWithHoles(arr) {
  if (Array.isArray(arr)) return arr;
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
} // Copyright (c) 2015 Uber Technologies, Inc.
// 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.


var NO_TRANSITION_PROPS = {
  transitionDuration: 0
}; // EVENT HANDLING PARAMETERS

var PITCH_MOUSE_THRESHOLD = 5;
var PITCH_ACCEL = 1.2;
var ZOOM_ACCEL = 0.01;
var EVENT_TYPES = {
  WHEEL: ['wheel'],
  PAN: ['panstart', 'panmove', 'panend'],
  PINCH: ['pinchstart', 'pinchmove', 'pinchend'],
  DOUBLE_TAP: ['doubletap'],
  KEYBOARD: ['keydown']
};

var Controller =
/*#__PURE__*/
function () {
  function Controller(ControllerState) {
    var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

    _classCallCheck(this, Controller);

    (0, _assert.default)(ControllerState);
    this.ControllerState = ControllerState;
    this.controllerState = null;
    this.controllerStateProps = null;
    this.eventManager = null;
    this.transitionManager = new _transitionManager.default(ControllerState, options);
    this._events = null;
    this._state = {
      isDragging: false
    };
    this.events = [];
    this.onViewStateChange = null;
    this.onStateChange = null;
    this.invertPan = false;
    this.handleEvent = this.handleEvent.bind(this);
    this.setProps(options);
  }

  _createClass(Controller, [{
    key: "finalize",
    value: function finalize() {
      for (var eventName in this._events) {
        if (this._events[eventName]) {
          this.eventManager.off(eventName, this.handleEvent);
        }
      }

      this.transitionManager.finalize();
    }
    /**
     * Callback for events
     * @param {hammer.Event} event
     */

  }, {
    key: "handleEvent",
    value: function handleEvent(event) {
      var ControllerState = this.ControllerState;
      this.controllerState = new ControllerState(Object.assign({}, this.controllerStateProps, this._state));

      switch (event.type) {
        case 'panstart':
          return this._onPanStart(event);

        case 'panmove':
          return this._onPan(event);

        case 'panend':
          return this._onPanEnd(event);

        case 'pinchstart':
          return this._onPinchStart(event);

        case 'pinchmove':
          return this._onPinch(event);

        case 'pinchend':
          return this._onPinchEnd(event);

        case 'doubletap':
          return this._onDoubleTap(event);

        case 'wheel':
          return this._onWheel(event);

        case 'keydown':
          return this._onKeyDown(event);

        default:
          return false;
      }
    }
    /* Event utils */
    // Event object: http://hammerjs.github.io/api/#event-object

  }, {
    key: "getCenter",
    value: function getCenter(event) {
      var _this$controllerState = this.controllerStateProps,
          x = _this$controllerState.x,
          y = _this$controllerState.y;
      var offsetCenter = event.offsetCenter;
      return [offsetCenter.x - x, offsetCenter.y - y];
    }
  }, {
    key: "isPointInBounds",
    value: function isPointInBounds(pos) {
      var _this$controllerState2 = this.controllerStateProps,
          width = _this$controllerState2.width,
          height = _this$controllerState2.height;
      return pos[0] >= 0 && pos[0] <= width && pos[1] >= 0 && pos[1] <= height;
    }
  }, {
    key: "isFunctionKeyPressed",
    value: function isFunctionKeyPressed(event) {
      var srcEvent = event.srcEvent;
      return Boolean(srcEvent.metaKey || srcEvent.altKey || srcEvent.ctrlKey || srcEvent.shiftKey);
    }
  }, {
    key: "isDragging",
    value: function isDragging() {
      return this._state.isDragging;
    }
    /**
     * Extract interactivity options
     */

    /* eslint-disable complexity, max-statements */

  }, {
    key: "setProps",
    value: function setProps(props) {
      if ('onViewportChange' in props) {
        _log.default.removed('onViewportChange')();
      }

      if ('onViewStateChange' in props) {
        this.onViewStateChange = props.onViewStateChange;
      }

      if ('onStateChange' in props) {
        this.onStateChange = props.onStateChange;
      }

      this.controllerStateProps = props;

      if ('eventManager' in props && this.eventManager !== props.eventManager) {
        // EventManager has changed
        this.eventManager = props.eventManager;
        this._events = {};
        this.toggleEvents(this.events, true);
      }

      this.transitionManager.processViewStateChange(this.controllerStateProps); // TODO - make sure these are not reset on every setProps

      var _props$scrollZoom = props.scrollZoom,
          scrollZoom = _props$scrollZoom === void 0 ? true : _props$scrollZoom,
          _props$dragPan = props.dragPan,
          dragPan = _props$dragPan === void 0 ? true : _props$dragPan,
          _props$dragRotate = props.dragRotate,
          dragRotate = _props$dragRotate === void 0 ? true : _props$dragRotate,
          _props$doubleClickZoo = props.doubleClickZoom,
          doubleClickZoom = _props$doubleClickZoo === void 0 ? true : _props$doubleClickZoo,
          _props$touchZoom = props.touchZoom,
          touchZoom = _props$touchZoom === void 0 ? true : _props$touchZoom,
          _props$touchRotate = props.touchRotate,
          touchRotate = _props$touchRotate === void 0 ? false : _props$touchRotate,
          _props$keyboard = props.keyboard,
          keyboard = _props$keyboard === void 0 ? true : _props$keyboard; // Register/unregister events

      var isInteractive = Boolean(this.onViewStateChange);
      this.toggleEvents(EVENT_TYPES.WHEEL, isInteractive && scrollZoom);
      this.toggleEvents(EVENT_TYPES.PAN, isInteractive && (dragPan || dragRotate));
      this.toggleEvents(EVENT_TYPES.PINCH, isInteractive && (touchZoom || touchRotate));
      this.toggleEvents(EVENT_TYPES.DOUBLE_TAP, isInteractive && doubleClickZoom);
      this.toggleEvents(EVENT_TYPES.KEYBOARD, isInteractive && keyboard); // Interaction toggles

      this.scrollZoom = scrollZoom;
      this.dragPan = dragPan;
      this.dragRotate = dragRotate;
      this.doubleClickZoom = doubleClickZoom;
      this.touchZoom = touchZoom;
      this.touchRotate = touchRotate;
      this.keyboard = keyboard;
    }
    /* eslint-enable complexity, max-statements */

  }, {
    key: "toggleEvents",
    value: function toggleEvents(eventNames, enabled) {
      var _this = this;

      if (this.eventManager) {
        eventNames.forEach(function (eventName) {
          if (_this._events[eventName] !== enabled) {
            _this._events[eventName] = enabled;

            if (enabled) {
              _this.eventManager.on(eventName, _this.handleEvent);
            } else {
              _this.eventManager.off(eventName, _this.handleEvent);
            }
          }
        });
      }
    } // DEPRECATED

  }, {
    key: "setOptions",
    value: function setOptions(props) {
      return this.setProps(props);
    } // Private Methods

    /* Callback util */
    // formats map state and invokes callback function

  }, {
    key: "updateViewport",
    value: function updateViewport(newControllerState) {
      var extraProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      var interactionState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
      var viewState = Object.assign({}, newControllerState.getViewportProps(), extraProps); // TODO - to restore diffing, we need to include interactionState

      var changed = this.controllerState !== newControllerState; // const oldViewState = this.controllerState.getViewportProps();
      // const changed = Object.keys(viewState).some(key => oldViewState[key] !== viewState[key]);

      if (changed) {
        var oldViewState = this.controllerState ? this.controllerState.getViewportProps() : null;

        if (this.onViewStateChange) {
          this.onViewStateChange({
            viewState: viewState,
            interactionState: interactionState,
            oldViewState: oldViewState
          });
        }
      }

      Object.assign(this._state, Object.assign({}, newControllerState.getInteractiveState(), interactionState));

      if (this.onStateChange) {
        this.onStateChange(this._state);
      } // this.setState(Object.assign({}, newControllerState.getInteractiveState(), extraState));

    }
    /* Event handlers */
    // Default handler for the `panstart` event.

  }, {
    key: "_onPanStart",
    value: function _onPanStart(event) {
      var pos = this.getCenter(event);

      if (!this.isPointInBounds(pos)) {
        return false;
      }

      var newControllerState = this.controllerState.panStart({
        pos: pos
      }).rotateStart({
        pos: pos
      });
      return this.updateViewport(newControllerState, NO_TRANSITION_PROPS, {
        isDragging: true
      });
    } // Default handler for the `panmove` event.

  }, {
    key: "_onPan",
    value: function _onPan(event) {
      var alternateMode = this.isFunctionKeyPressed(event) || event.rightButton;
      alternateMode = this.invertPan ? !alternateMode : alternateMode;
      return alternateMode ? this._onPanMove(event) : this._onPanRotate(event);
    } // Default handler for the `panend` event.

  }, {
    key: "_onPanEnd",
    value: function _onPanEnd(event) {
      var newControllerState = this.controllerState.panEnd().rotateEnd();
      return this.updateViewport(newControllerState, null, {
        isDragging: false
      });
    } // Default handler for panning to move.
    // Called by `_onPan` when panning without function key pressed.

  }, {
    key: "_onPanMove",
    value: function _onPanMove(event) {
      if (!this.dragPan) {
        return false;
      }

      var pos = this.getCenter(event);

      if (!this.isDragging()) {
        return false;
      }

      var newControllerState = this.controllerState.pan({
        pos: pos
      });
      return this.updateViewport(newControllerState, NO_TRANSITION_PROPS, {
        isDragging: true
      });
    } // Default handler for panning to rotate.
    // Called by `_onPan` when panning with function key pressed.

  }, {
    key: "_onPanRotate",
    value: function _onPanRotate(event) {
      if (!this.dragRotate) {
        return false;
      }

      return this._onPanRotateStandard(event);
    } // Normal pan to rotate

  }, {
    key: "_onPanRotateStandard",
    value: function _onPanRotateStandard(event) {
      var deltaX = event.deltaX,
          deltaY = event.deltaY;

      var _this$controllerState3 = this.controllerState.getViewportProps(),
          width = _this$controllerState3.width,
          height = _this$controllerState3.height;

      var deltaScaleX = deltaX / width;
      var deltaScaleY = deltaY / height;
      var newControllerState = this.controllerState.rotate({
        deltaScaleX: deltaScaleX,
        deltaScaleY: deltaScaleY
      });
      return this.updateViewport(newControllerState, NO_TRANSITION_PROPS, {
        isDragging: true
      });
    }
  }, {
    key: "_onPanRotateMap",
    value: function _onPanRotateMap(event) {
      var deltaX = event.deltaX,
          deltaY = event.deltaY;

      var _this$getCenter = this.getCenter(event),
          _this$getCenter2 = _slicedToArray(_this$getCenter, 2),
          centerY = _this$getCenter2[1];

      var startY = centerY - deltaY;

      var _this$controllerState4 = this.controllerState.getViewportProps(),
          width = _this$controllerState4.width,
          height = _this$controllerState4.height;

      var deltaScaleX = deltaX / width;
      var deltaScaleY = 0;

      if (deltaY > 0) {
        if (Math.abs(height - startY) > PITCH_MOUSE_THRESHOLD) {
          // Move from 0 to -1 as we drag upwards
          deltaScaleY = deltaY / (startY - height) * PITCH_ACCEL;
        }
      } else if (deltaY < 0) {
        if (startY > PITCH_MOUSE_THRESHOLD) {
          // Move from 0 to 1 as we drag upwards
          deltaScaleY = 1 - centerY / startY;
        }
      }

      deltaScaleY = Math.min(1, Math.max(-1, deltaScaleY));
      var newControllerState = this.controllerState.rotate({
        deltaScaleX: deltaScaleX,
        deltaScaleY: deltaScaleY
      });
      return this.updateViewport(newControllerState, NO_TRANSITION_PROPS, {
        isDragging: true
      });
    } // Default handler for the `wheel` event.

  }, {
    key: "_onWheel",
    value: function _onWheel(event) {
      if (!this.scrollZoom) {
        return false;
      }

      event.preventDefault();
      var pos = this.getCenter(event);

      if (!this.isPointInBounds(pos)) {
        return false;
      }

      var delta = event.delta; // Map wheel delta to relative scale

      var scale = 2 / (1 + Math.exp(-Math.abs(delta * ZOOM_ACCEL)));

      if (delta < 0 && scale !== 0) {
        scale = 1 / scale;
      }

      var newControllerState = this.controllerState.zoom({
        pos: pos,
        scale: scale
      });
      return this.updateViewport(newControllerState, NO_TRANSITION_PROPS);
    } // Default handler for the `pinchstart` event.

  }, {
    key: "_onPinchStart",
    value: function _onPinchStart(event) {
      var pos = this.getCenter(event);

      if (!this.isPointInBounds(pos)) {
        return false;
      }

      var newControllerState = this.controllerState.zoomStart({
        pos: pos
      }).rotateStart({
        pos: pos
      }); // hack - hammer's `rotation` field doesn't seem to produce the correct angle

      this._state.startPinchRotation = event.rotation;
      return this.updateViewport(newControllerState, NO_TRANSITION_PROPS, {
        isDragging: true
      });
    } // Default handler for the `pinch` event.

  }, {
    key: "_onPinch",
    value: function _onPinch(event) {
      if (!this.touchZoom && !this.touchRotate) {
        return false;
      }

      var newControllerState = this.controllerState;

      if (this.touchZoom) {
        var scale = event.scale;
        var pos = this.getCenter(event);
        newControllerState = newControllerState.zoom({
          pos: pos,
          scale: scale
        });
      }

      if (this.touchRotate) {
        var rotation = event.rotation;
        var startPinchRotation = this._state.startPinchRotation;
        newControllerState = newControllerState.rotate({
          deltaScaleX: -(rotation - startPinchRotation) / 180
        });
      }

      return this.updateViewport(newControllerState, NO_TRANSITION_PROPS, {
        isDragging: true
      });
    } // Default handler for the `pinchend` event.

  }, {
    key: "_onPinchEnd",
    value: function _onPinchEnd(event) {
      var newControllerState = this.controllerState.zoomEnd().rotateEnd();
      this._state.startPinchRotation = 0;
      return this.updateViewport(newControllerState, null, {
        isDragging: false
      });
    } // Default handler for the `doubletap` event.

  }, {
    key: "_onDoubleTap",
    value: function _onDoubleTap(event) {
      if (!this.doubleClickZoom) {
        return false;
      }

      var pos = this.getCenter(event);

      if (!this.isPointInBounds(pos)) {
        return false;
      }

      var isZoomOut = this.isFunctionKeyPressed(event);
      var newControllerState = this.controllerState.zoom({
        pos: pos,
        scale: isZoomOut ? 0.5 : 2
      });
      return this.updateViewport(newControllerState, this._getTransitionProps());
    }
    /* eslint-disable complexity */
    // Default handler for the `keydown` event

  }, {
    key: "_onKeyDown",
    value: function _onKeyDown(event) {
      if (!this.keyboard) {
        return false;
      }

      var funcKey = this.isFunctionKeyPressed(event);
      var controllerState = this.controllerState;
      var newControllerState;

      switch (event.srcEvent.keyCode) {
        case 189:
          // -
          newControllerState = funcKey ? controllerState.zoomOut().zoomOut() : controllerState.zoomOut();
          break;

        case 187:
          // +
          newControllerState = funcKey ? controllerState.zoomIn().zoomIn() : controllerState.zoomIn();
          break;

        case 37:
          // left
          newControllerState = funcKey ? controllerState.rotateLeft() : controllerState.moveLeft();
          break;

        case 39:
          // right
          newControllerState = funcKey ? controllerState.rotateRight() : controllerState.moveRight();
          break;

        case 38:
          // up
          newControllerState = funcKey ? controllerState.rotateUp() : controllerState.moveUp();
          break;

        case 40:
          // down
          newControllerState = funcKey ? controllerState.rotateDown() : controllerState.moveDown();
          break;

        default:
          return false;
      }

      return this.updateViewport(newControllerState, this._getTransitionProps());
    }
    /* eslint-enable complexity */

  }, {
    key: "_getTransitionProps",
    value: function _getTransitionProps() {
      // Transitions on double-tap and key-down are only supported by MapController
      return NO_TRANSITION_PROPS;
    }
  }]);

  return Controller;
}();

exports.default = Controller;
},{"./transition-manager":"bUf5","../utils/log":"q39U","../utils/assert":"sRS1"}],"YDzL":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _math = require("math.gl");

var _assert = _interopRequireDefault(require("../utils/assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

var defaultState = {
  position: [0, 0, 0],
  lookAt: [0, 0, 0],
  up: [0, 0, 1],
  rotationX: 0,
  rotationY: 0,
  fov: 50,
  near: 1,
  far: 100
};
/* Helpers */

var ViewState =
/*#__PURE__*/
function () {
  function ViewState(opts) {
    _classCallCheck(this, ViewState);

    var width = opts.width,
        height = opts.height,
        _opts$position = opts.position,
        position = _opts$position === void 0 ? defaultState.position : _opts$position;
    (0, _assert.default)(Number.isFinite(width), '`width` must be supplied');
    (0, _assert.default)(Number.isFinite(height), '`height` must be supplied');
    this._viewportProps = this._applyConstraints(Object.assign({}, opts, {
      position: new _math.Vector3(position)
    }));
  }

  _createClass(ViewState, [{
    key: "getViewportProps",
    value: function getViewportProps() {
      return this._viewportProps;
    }
  }, {
    key: "getDirection",
    value: function getDirection() {
      var spherical = new _math._SphericalCoordinates({
        bearing: this._viewportProps.bearing,
        pitch: this._viewportProps.pitch
      });
      var direction = spherical.toVector3().normalize();
      return direction;
    }
  }, {
    key: "getDirectionFromBearing",
    value: function getDirectionFromBearing(bearing) {
      var spherical = new _math._SphericalCoordinates({
        bearing: bearing,
        pitch: 90
      });
      var direction = spherical.toVector3().normalize();
      return direction;
    }
  }, {
    key: "shortestPathFrom",
    value: function shortestPathFrom(viewState) {
      return this._viewportProps;
    } // Redefined by subclass
    // Apply any constraints (mathematical or defined by _viewportProps) to map state

  }, {
    key: "_applyConstraints",
    value: function _applyConstraints(props) {
      return props;
    }
  }]);

  return ViewState;
}();

exports.default = ViewState;
},{"math.gl":"dl2t","../utils/assert":"sRS1"}],"TKv4":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.testExports = exports.default = exports.MAPBOX_LIMITS = void 0;

var _math = require("math.gl");

var _controller = _interopRequireDefault(require("./controller"));

var _viewState = _interopRequireDefault(require("./view-state"));

var _viewportMercatorProject = _interopRequireWildcard(require("viewport-mercator-project"));

var _assert = _interopRequireDefault(require("../utils/assert"));

var _linearInterpolator = _interopRequireDefault(require("../transitions/linear-interpolator"));

var _transitionManager = require("./transition-manager");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _slicedToArray(arr, i) {
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
}

function _nonIterableRest() {
  throw new TypeError("Invalid attempt to destructure non-iterable instance");
}

function _iterableToArrayLimit(arr, i) {
  var _arr = [];
  var _n = true;
  var _d = false;
  var _e = undefined;

  try {
    for (var _i = arr[Symbol.iterator](), _s; !(_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;
}

function _arrayWithHoles(arr) {
  if (Array.isArray(arr)) return arr;
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
}

var LINEAR_TRANSITION_PROPS = {
  transitionDuration: 300,
  transitionEasing: function transitionEasing(t) {
    return t;
  },
  transitionInterpolator: new _linearInterpolator.default(),
  transitionInterruption: _transitionManager.TRANSITION_EVENTS.BREAK
}; // MAPBOX LIMITS

var MAPBOX_LIMITS = {
  minZoom: 0,
  maxZoom: 20,
  minPitch: 0,
  maxPitch: 60
};
exports.MAPBOX_LIMITS = MAPBOX_LIMITS;
var DEFAULT_STATE = {
  pitch: 0,
  bearing: 0,
  altitude: 1.5
};
/* Utils */

var MapState =
/*#__PURE__*/
function (_ViewState) {
  _inherits(MapState, _ViewState);

  function MapState() {
    var _this;

    var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
        width = _ref.width,
        height = _ref.height,
        latitude = _ref.latitude,
        longitude = _ref.longitude,
        zoom = _ref.zoom,
        _ref$bearing = _ref.bearing,
        bearing = _ref$bearing === void 0 ? DEFAULT_STATE.bearing : _ref$bearing,
        _ref$pitch = _ref.pitch,
        pitch = _ref$pitch === void 0 ? DEFAULT_STATE.pitch : _ref$pitch,
        _ref$altitude = _ref.altitude,
        altitude = _ref$altitude === void 0 ? DEFAULT_STATE.altitude : _ref$altitude,
        _ref$maxZoom = _ref.maxZoom,
        maxZoom = _ref$maxZoom === void 0 ? MAPBOX_LIMITS.maxZoom : _ref$maxZoom,
        _ref$minZoom = _ref.minZoom,
        minZoom = _ref$minZoom === void 0 ? MAPBOX_LIMITS.minZoom : _ref$minZoom,
        _ref$maxPitch = _ref.maxPitch,
        maxPitch = _ref$maxPitch === void 0 ? MAPBOX_LIMITS.maxPitch : _ref$maxPitch,
        _ref$minPitch = _ref.minPitch,
        minPitch = _ref$minPitch === void 0 ? MAPBOX_LIMITS.minPitch : _ref$minPitch,
        startPanLngLat = _ref.startPanLngLat,
        startZoomLngLat = _ref.startZoomLngLat,
        startBearing = _ref.startBearing,
        startPitch = _ref.startPitch,
        startZoom = _ref.startZoom;

    _classCallCheck(this, MapState);

    (0, _assert.default)(Number.isFinite(longitude), '`longitude` must be supplied');
    (0, _assert.default)(Number.isFinite(latitude), '`latitude` must be supplied');
    (0, _assert.default)(Number.isFinite(zoom), '`zoom` must be supplied');
    _this = _possibleConstructorReturn(this, _getPrototypeOf(MapState).call(this, {
      width: width,
      height: height,
      latitude: latitude,
      longitude: longitude,
      zoom: zoom,
      bearing: bearing,
      pitch: pitch,
      altitude: altitude,
      maxZoom: maxZoom,
      minZoom: minZoom,
      maxPitch: maxPitch,
      minPitch: minPitch
    }));
    _this._interactiveState = {
      startPanLngLat: startPanLngLat,
      startZoomLngLat: startZoomLngLat,
      startBearing: startBearing,
      startPitch: startPitch,
      startZoom: startZoom
    };
    return _this;
  }
  /* Public API */


  _createClass(MapState, [{
    key: "getViewportProps",
    value: function getViewportProps() {
      return this._viewportProps;
    }
  }, {
    key: "getInteractiveState",
    value: function getInteractiveState() {
      return this._interactiveState;
    }
    /**
     * Start panning
     * @param {[Number, Number]} pos - position on screen where the pointer grabs
     */

  }, {
    key: "panStart",
    value: function panStart(_ref2) {
      var pos = _ref2.pos;
      return this._getUpdatedState({
        startPanLngLat: this._unproject(pos)
      });
    }
    /**
     * Pan
     * @param {[Number, Number]} pos - position on screen where the pointer is
     * @param {[Number, Number], optional} startPos - where the pointer grabbed at
     *   the start of the operation. Must be supplied of `panStart()` was not called
     */

  }, {
    key: "pan",
    value: function pan(_ref3) {
      var pos = _ref3.pos,
          startPos = _ref3.startPos;

      var startPanLngLat = this._interactiveState.startPanLngLat || this._unproject(startPos);

      if (!startPanLngLat) {
        return this;
      }

      var _this$_calculateNewLn = this._calculateNewLngLat({
        startPanLngLat: startPanLngLat,
        pos: pos
      }),
          _this$_calculateNewLn2 = _slicedToArray(_this$_calculateNewLn, 2),
          longitude = _this$_calculateNewLn2[0],
          latitude = _this$_calculateNewLn2[1];

      return this._getUpdatedState({
        longitude: longitude,
        latitude: latitude
      });
    }
    /**
     * End panning
     * Must call if `panStart()` was called
     */

  }, {
    key: "panEnd",
    value: function panEnd() {
      return this._getUpdatedState({
        startPanLngLat: null
      });
    }
    /**
     * Start rotating
     * @param {[Number, Number]} pos - position on screen where the center is
     */

  }, {
    key: "rotateStart",
    value: function rotateStart(_ref4) {
      var pos = _ref4.pos;
      return this._getUpdatedState({
        startBearing: this._viewportProps.bearing,
        startPitch: this._viewportProps.pitch
      });
    }
    /**
     * Rotate
     * @param {Number} deltaScaleX - a number between [-1, 1] specifying the
     *   change to bearing.
     * @param {Number} deltaScaleY - a number between [-1, 1] specifying the
     *   change to pitch. -1 sets to minPitch and 1 sets to maxPitch.
     */

  }, {
    key: "rotate",
    value: function rotate(_ref5) {
      var _ref5$deltaScaleX = _ref5.deltaScaleX,
          deltaScaleX = _ref5$deltaScaleX === void 0 ? 0 : _ref5$deltaScaleX,
          _ref5$deltaScaleY = _ref5.deltaScaleY,
          deltaScaleY = _ref5$deltaScaleY === void 0 ? 0 : _ref5$deltaScaleY;
      var _this$_interactiveSta = this._interactiveState,
          startBearing = _this$_interactiveSta.startBearing,
          startPitch = _this$_interactiveSta.startPitch;

      if (!Number.isFinite(startBearing) || !Number.isFinite(startPitch)) {
        return this;
      }

      var _this$_calculateNewPi = this._calculateNewPitchAndBearing({
        deltaScaleX: deltaScaleX,
        deltaScaleY: deltaScaleY,
        startBearing: startBearing,
        startPitch: startPitch
      }),
          pitch = _this$_calculateNewPi.pitch,
          bearing = _this$_calculateNewPi.bearing;

      return this._getUpdatedState({
        bearing: bearing,
        pitch: pitch
      });
    }
    /**
     * End rotating
     * Must call if `rotateStart()` was called
     */

  }, {
    key: "rotateEnd",
    value: function rotateEnd() {
      return this._getUpdatedState({
        startBearing: null,
        startPitch: null
      });
    }
    /**
     * Start zooming
     * @param {[Number, Number]} pos - position on screen where the center is
     */

  }, {
    key: "zoomStart",
    value: function zoomStart(_ref6) {
      var pos = _ref6.pos;
      return this._getUpdatedState({
        startZoomLngLat: this._unproject(pos),
        startZoom: this._viewportProps.zoom
      });
    }
    /**
     * Zoom
     * @param {[Number, Number]} pos - position on screen where the current center is
     * @param {[Number, Number]} startPos - the center position at
     *   the start of the operation. Must be supplied of `zoomStart()` was not called
     * @param {Number} scale - a number between [0, 1] specifying the accumulated
     *   relative scale.
     */

  }, {
    key: "zoom",
    value: function zoom(_ref7) {
      var pos = _ref7.pos,
          startPos = _ref7.startPos,
          scale = _ref7.scale;
      (0, _assert.default)(scale > 0, '`scale` must be a positive number'); // Make sure we zoom around the current mouse position rather than map center

      var _this$_interactiveSta2 = this._interactiveState,
          startZoom = _this$_interactiveSta2.startZoom,
          startZoomLngLat = _this$_interactiveSta2.startZoomLngLat;

      if (!Number.isFinite(startZoom)) {
        // We have two modes of zoom:
        // scroll zoom that are discrete events (transform from the current zoom level),
        // and pinch zoom that are continuous events (transform from the zoom level when
        // pinch started).
        // If startZoom state is defined, then use the startZoom state;
        // otherwise assume discrete zooming
        startZoom = this._viewportProps.zoom;
        startZoomLngLat = this._unproject(startPos) || this._unproject(pos);
      } // take the start lnglat and put it where the mouse is down.


      (0, _assert.default)(startZoomLngLat, '`startZoomLngLat` prop is required ' + 'for zoom behavior to calculate where to position the map.');

      var zoom = this._calculateNewZoom({
        scale: scale,
        startZoom: startZoom
      });

      var zoomedViewport = new _viewportMercatorProject.default(Object.assign({}, this._viewportProps, {
        zoom: zoom
      }));

      var _zoomedViewport$getLo = zoomedViewport.getLocationAtPoint({
        lngLat: startZoomLngLat,
        pos: pos
      }),
          _zoomedViewport$getLo2 = _slicedToArray(_zoomedViewport$getLo, 2),
          longitude = _zoomedViewport$getLo2[0],
          latitude = _zoomedViewport$getLo2[1];

      return this._getUpdatedState({
        zoom: zoom,
        longitude: longitude,
        latitude: latitude
      });
    }
    /**
     * End zooming
     * Must call if `zoomStart()` was called
     */

  }, {
    key: "zoomEnd",
    value: function zoomEnd() {
      return this._getUpdatedState({
        startZoomLngLat: null,
        startZoom: null
      });
    }
  }, {
    key: "zoomIn",
    value: function zoomIn() {
      return this._zoomFromCenter(2);
    }
  }, {
    key: "zoomOut",
    value: function zoomOut() {
      return this._zoomFromCenter(0.5);
    }
  }, {
    key: "moveLeft",
    value: function moveLeft() {
      return this._panFromCenter([100, 0]);
    }
  }, {
    key: "moveRight",
    value: function moveRight() {
      return this._panFromCenter([-100, 0]);
    }
  }, {
    key: "moveUp",
    value: function moveUp() {
      return this._panFromCenter([0, 100]);
    }
  }, {
    key: "moveDown",
    value: function moveDown() {
      return this._panFromCenter([0, -100]);
    }
  }, {
    key: "rotateLeft",
    value: function rotateLeft() {
      return this._getUpdatedState({
        bearing: this._viewportProps.bearing - 15
      });
    }
  }, {
    key: "rotateRight",
    value: function rotateRight() {
      return this._getUpdatedState({
        bearing: this._viewportProps.bearing + 15
      });
    }
  }, {
    key: "rotateUp",
    value: function rotateUp() {
      return this._getUpdatedState({
        pitch: this._viewportProps.pitch + 10
      });
    }
  }, {
    key: "rotateDown",
    value: function rotateDown() {
      return this._getUpdatedState({
        pitch: this._viewportProps.pitch - 10
      });
    }
  }, {
    key: "shortestPathFrom",
    value: function shortestPathFrom(viewState) {
      // const endViewStateProps = new this.ControllerState(endProps).shortestPathFrom(startViewstate);
      var fromProps = viewState.getViewportProps();
      var props = Object.assign({}, this._viewportProps);
      var bearing = props.bearing,
          longitude = props.longitude;

      if (Math.abs(bearing - fromProps.bearing) > 180) {
        props.bearing = bearing < 0 ? bearing + 360 : bearing - 360;
      }

      if (Math.abs(longitude - fromProps.longitude) > 180) {
        props.longitude = longitude < 0 ? longitude + 360 : longitude - 360;
      }

      return props;
    }
    /* Private methods */

  }, {
    key: "_zoomFromCenter",
    value: function _zoomFromCenter(scale) {
      var _this$_viewportProps = this._viewportProps,
          width = _this$_viewportProps.width,
          height = _this$_viewportProps.height;
      return this.zoom({
        pos: [width / 2, height / 2],
        scale: scale
      });
    }
  }, {
    key: "_panFromCenter",
    value: function _panFromCenter(offset) {
      var _this$_viewportProps2 = this._viewportProps,
          width = _this$_viewportProps2.width,
          height = _this$_viewportProps2.height;
      return this.pan({
        startPos: [width / 2, height / 2],
        pos: [width / 2 + offset[0], height / 2 + offset[1]]
      });
    }
  }, {
    key: "_getUpdatedState",
    value: function _getUpdatedState(newProps) {
      // Update _viewportProps
      return new MapState(Object.assign({}, this._viewportProps, this._interactiveState, newProps));
    } // Apply any constraints (mathematical or defined by _viewportProps) to map state

  }, {
    key: "_applyConstraints",
    value: function _applyConstraints(props) {
      // Ensure zoom is within specified range
      var maxZoom = props.maxZoom,
          minZoom = props.minZoom,
          zoom = props.zoom;
      props.zoom = (0, _math.clamp)(zoom, minZoom, maxZoom); // Ensure pitch is within specified range

      var maxPitch = props.maxPitch,
          minPitch = props.minPitch,
          pitch = props.pitch;
      props.pitch = (0, _math.clamp)(pitch, minPitch, maxPitch);
      Object.assign(props, (0, _viewportMercatorProject.normalizeViewportProps)(props));
      return props;
    }
  }, {
    key: "_unproject",
    value: function _unproject(pos) {
      var viewport = new _viewportMercatorProject.default(this._viewportProps);
      return pos && viewport.unproject(pos);
    } // Calculate a new lnglat based on pixel dragging position

  }, {
    key: "_calculateNewLngLat",
    value: function _calculateNewLngLat(_ref8) {
      var startPanLngLat = _ref8.startPanLngLat,
          pos = _ref8.pos;
      var viewport = new _viewportMercatorProject.default(this._viewportProps);
      return viewport.getMapCenterByLngLatPosition({
        lngLat: startPanLngLat,
        pos: pos
      });
    } // Calculates new zoom

  }, {
    key: "_calculateNewZoom",
    value: function _calculateNewZoom(_ref9) {
      var scale = _ref9.scale,
          startZoom = _ref9.startZoom;
      var _this$_viewportProps3 = this._viewportProps,
          maxZoom = _this$_viewportProps3.maxZoom,
          minZoom = _this$_viewportProps3.minZoom;
      var zoom = startZoom + Math.log2(scale);
      return (0, _math.clamp)(zoom, minZoom, maxZoom);
    } // Calculates a new pitch and bearing from a position (coming from an event)

  }, {
    key: "_calculateNewPitchAndBearing",
    value: function _calculateNewPitchAndBearing(_ref10) {
      var deltaScaleX = _ref10.deltaScaleX,
          deltaScaleY = _ref10.deltaScaleY,
          startBearing = _ref10.startBearing,
          startPitch = _ref10.startPitch; // clamp deltaScaleY to [-1, 1] so that rotation is constrained between minPitch and maxPitch.
      // deltaScaleX does not need to be clamped as bearing does not have constraints.

      deltaScaleY = (0, _math.clamp)(deltaScaleY, -1, 1);
      var _this$_viewportProps4 = this._viewportProps,
          minPitch = _this$_viewportProps4.minPitch,
          maxPitch = _this$_viewportProps4.maxPitch;
      var bearing = startBearing + 180 * deltaScaleX;
      var pitch = startPitch;

      if (deltaScaleY > 0) {
        // Gradually increase pitch
        pitch = startPitch + deltaScaleY * (maxPitch - startPitch);
      } else if (deltaScaleY < 0) {
        // Gradually decrease pitch
        pitch = startPitch - deltaScaleY * (minPitch - startPitch);
      }

      return {
        pitch: pitch,
        bearing: bearing
      };
    }
  }]);

  return MapState;
}(_viewState.default);

var MapController =
/*#__PURE__*/
function (_Controller) {
  _inherits(MapController, _Controller);

  function MapController(props) {
    var _this2;

    _classCallCheck(this, MapController);

    _this2 = _possibleConstructorReturn(this, _getPrototypeOf(MapController).call(this, MapState, props));
    _this2.invertPan = true;
    return _this2;
  }

  _createClass(MapController, [{
    key: "_getTransitionProps",
    value: function _getTransitionProps() {
      // Enables Transitions on double-tap and key-down events.
      return LINEAR_TRANSITION_PROPS;
    }
  }, {
    key: "_onPanRotate",
    value: function _onPanRotate(event) {
      if (!this.dragRotate) {
        return false;
      }

      return this._onPanRotateMap(event);
    }
  }]);

  return MapController;
}(_controller.default);

exports.default = MapController;
var testExports = {
  MapState: MapState
};
exports.testExports = testExports;
},{"math.gl":"dl2t","./controller":"Gii9","./view-state":"YDzL","viewport-mercator-project":"K6fX","../utils/assert":"sRS1","../transitions/linear-interpolator":"wq52","./transition-manager":"bUf5"}],"mzbM":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _view = _interopRequireDefault(require("./view"));

var _webMercatorViewport = _interopRequireDefault(require("../viewports/web-mercator-viewport"));

var _mapController = _interopRequireDefault(require("../controllers/map-controller"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
}

var MapView =
/*#__PURE__*/
function (_View) {
  _inherits(MapView, _View);

  function MapView(props) {
    _classCallCheck(this, MapView);

    return _possibleConstructorReturn(this, _getPrototypeOf(MapView).call(this, Object.assign({}, props, {
      type: _webMercatorViewport.default
    })));
  }

  _createClass(MapView, [{
    key: "controller",
    get: function get() {
      return this._getControllerProps({
        type: _mapController.default
      });
    }
  }]);

  return MapView;
}(_view.default);

exports.default = MapView;
MapView.displayName = 'MapView';
},{"./view":"K8TO","../viewports/web-mercator-viewport":"uuqX","../controllers/map-controller":"TKv4"}],"V03Y":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.

/* eslint-disable no-try-catch */


var EffectManager =
/*#__PURE__*/
function () {
  function EffectManager(_ref) {
    var gl = _ref.gl,
        layerManager = _ref.layerManager;

    _classCallCheck(this, EffectManager);

    this.gl = gl;
    this.layerManager = layerManager;
    this._effects = [];
  }
  /**
   * Adds an effect to be managed.  That effect's initialize function will
   * be called, and the effect's preDraw and draw callbacks will be
   * called at the appropriate times in the render loop
   * @param {Effect} effect - the effect to be added
   */


  _createClass(EffectManager, [{
    key: "addEffect",
    value: function addEffect(effect) {
      this._effects.push(effect);

      this._sortEffects();

      effect.initialize({
        gl: this.gl,
        layerManager: this.layerManager
      });
    }
    /**
     * Removes an effect that is already being managed.  That effect's
     * finalize function will be called, and its callbacks will no longer
     * be envoked in the render loop
     * @param {Effect} effect - the effect to be removed
     * @return {bool} - True if the effect was already being managed, and
     * thus successfully removed; false otherwise
     */

  }, {
    key: "removeEffect",
    value: function removeEffect(effect) {
      var i = this._effects.indexOf(effect);

      if (i >= 0) {
        effect.finalize({
          gl: this.gl,
          layerManager: this.layerManager
        });

        this._effects.splice(i, 1);

        return true;
      }

      return false;
    }
    /**
     * Envoke the preDraw callback of all managed events, in order of
     * decreasing priority
     */

  }, {
    key: "preDraw",
    value: function preDraw() {
      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = this._effects[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var effect = _step.value;

          if (effect.needsRedraw) {
            effect.preDraw({
              gl: this.gl,
              layerManager: this.layerManager
            });
          }
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return != null) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }
    }
    /**
     * Envoke the draw callback of all managed events, in order of
     * decreasing priority
     */

  }, {
    key: "draw",
    value: function draw() {
      var _iteratorNormalCompletion2 = true;
      var _didIteratorError2 = false;
      var _iteratorError2 = undefined;

      try {
        for (var _iterator2 = this._effects[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
          var effect = _step2.value;

          if (effect.needsRedraw) {
            effect.draw({
              gl: this.gl,
              layerManager: this.layerManager
            });
          }
        }
      } catch (err) {
        _didIteratorError2 = true;
        _iteratorError2 = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
            _iterator2.return();
          }
        } finally {
          if (_didIteratorError2) {
            throw _iteratorError2;
          }
        }
      }
    }
  }, {
    key: "_sortEffects",
    value: function _sortEffects() {
      this._effects.sort(function (a, b) {
        if (a.priority > b.priority) {
          return -1;
        } else if (a.priority < b.priority) {
          return 1;
        }

        return a.count - b.count;
      });
    }
  }]);

  return EffectManager;
}();

exports.default = EffectManager;
},{}],"GHnM":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.


var counter = 0;

var Effect =
/*#__PURE__*/
function () {
  function Effect() {
    _classCallCheck(this, Effect);

    this.id = 'effect';
    this.count = counter++;
    this.visible = true;
    this.priority = 0;
    this.needsRedraw = false;
  }
  /**
   * subclasses should override to set up any resources needed
   */


  _createClass(Effect, [{
    key: "initialize",
    value: function initialize(_ref) {
      var gl = _ref.gl,
          layerManager = _ref.layerManager;
    }
    /**
     * and subclasses should free those resources here
     */

  }, {
    key: "finalize",
    value: function finalize(_ref2) {
      var gl = _ref2.gl,
          layerManager = _ref2.layerManager;
    }
    /**
     * override for a callback immediately before drawing each frame
     */

  }, {
    key: "preDraw",
    value: function preDraw(_ref3) {
      var gl = _ref3.gl,
          layerManager = _ref3.layerManager;
    }
    /**
     * override for a callback immediately after drawing a frame's layers
     */

  }, {
    key: "draw",
    value: function draw(_ref4) {
      var gl = _ref4.gl,
          layerManager = _ref4.layerManager;
    }
  }, {
    key: "setNeedsRedraw",
    value: function setNeedsRedraw() {
      var redraw = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
      this.needsRedraw = redraw;
    }
  }]);

  return Effect;
}();

exports.default = Effect;
},{}],"dowO":[function(require,module,exports) {
var define;
/*! Hammer.JS - v2.0.7 - 2016-04-22
 * http://hammerjs.github.io/
 *
 * Copyright (c) 2016 Jorik Tangelder;
 * Licensed under the MIT license */
(function (window, document, exportName, undefined) {
  'use strict';

  var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];
  var TEST_ELEMENT = document.createElement('div');
  var TYPE_FUNCTION = 'function';
  var round = Math.round;
  var abs = Math.abs;
  var now = Date.now;
  /**
   * set a timeout with a given scope
   * @param {Function} fn
   * @param {Number} timeout
   * @param {Object} context
   * @returns {number}
   */

  function setTimeoutContext(fn, timeout, context) {
    return setTimeout(bindFn(fn, context), timeout);
  }
  /**
   * if the argument is an array, we want to execute the fn on each entry
   * if it aint an array we don't want to do a thing.
   * this is used by all the methods that accept a single and array argument.
   * @param {*|Array} arg
   * @param {String} fn
   * @param {Object} [context]
   * @returns {Boolean}
   */


  function invokeArrayArg(arg, fn, context) {
    if (Array.isArray(arg)) {
      each(arg, context[fn], context);
      return true;
    }

    return false;
  }
  /**
   * walk objects and arrays
   * @param {Object} obj
   * @param {Function} iterator
   * @param {Object} context
   */


  function each(obj, iterator, context) {
    var i;

    if (!obj) {
      return;
    }

    if (obj.forEach) {
      obj.forEach(iterator, context);
    } else if (obj.length !== undefined) {
      i = 0;

      while (i < obj.length) {
        iterator.call(context, obj[i], i, obj);
        i++;
      }
    } else {
      for (i in obj) {
        obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);
      }
    }
  }
  /**
   * wrap a method with a deprecation warning and stack trace
   * @param {Function} method
   * @param {String} name
   * @param {String} message
   * @returns {Function} A new function wrapping the supplied method.
   */


  function deprecate(method, name, message) {
    var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\n' + message + ' AT \n';
    return function () {
      var e = new Error('get-stack-trace');
      var stack = e && e.stack ? e.stack.replace(/^[^\(]+?[\n$]/gm, '').replace(/^\s+at\s+/gm, '').replace(/^Object.<anonymous>\s*\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';
      var log = window.console && (window.console.warn || window.console.log);

      if (log) {
        log.call(window.console, deprecationMessage, stack);
      }

      return method.apply(this, arguments);
    };
  }
  /**
   * extend object.
   * means that properties in dest will be overwritten by the ones in src.
   * @param {Object} target
   * @param {...Object} objects_to_assign
   * @returns {Object} target
   */


  var assign;

  if (typeof Object.assign !== 'function') {
    assign = function assign(target) {
      if (target === undefined || target === null) {
        throw new TypeError('Cannot convert undefined or null to object');
      }

      var output = Object(target);

      for (var index = 1; index < arguments.length; index++) {
        var source = arguments[index];

        if (source !== undefined && source !== null) {
          for (var nextKey in source) {
            if (source.hasOwnProperty(nextKey)) {
              output[nextKey] = source[nextKey];
            }
          }
        }
      }

      return output;
    };
  } else {
    assign = Object.assign;
  }
  /**
   * extend object.
   * means that properties in dest will be overwritten by the ones in src.
   * @param {Object} dest
   * @param {Object} src
   * @param {Boolean} [merge=false]
   * @returns {Object} dest
   */


  var extend = deprecate(function extend(dest, src, merge) {
    var keys = Object.keys(src);
    var i = 0;

    while (i < keys.length) {
      if (!merge || merge && dest[keys[i]] === undefined) {
        dest[keys[i]] = src[keys[i]];
      }

      i++;
    }

    return dest;
  }, 'extend', 'Use `assign`.');
  /**
   * merge the values from src in the dest.
   * means that properties that exist in dest will not be overwritten by src
   * @param {Object} dest
   * @param {Object} src
   * @returns {Object} dest
   */

  var merge = deprecate(function merge(dest, src) {
    return extend(dest, src, true);
  }, 'merge', 'Use `assign`.');
  /**
   * simple class inheritance
   * @param {Function} child
   * @param {Function} base
   * @param {Object} [properties]
   */

  function inherit(child, base, properties) {
    var baseP = base.prototype,
        childP;
    childP = child.prototype = Object.create(baseP);
    childP.constructor = child;
    childP._super = baseP;

    if (properties) {
      assign(childP, properties);
    }
  }
  /**
   * simple function bind
   * @param {Function} fn
   * @param {Object} context
   * @returns {Function}
   */


  function bindFn(fn, context) {
    return function boundFn() {
      return fn.apply(context, arguments);
    };
  }
  /**
   * let a boolean value also be a function that must return a boolean
   * this first item in args will be used as the context
   * @param {Boolean|Function} val
   * @param {Array} [args]
   * @returns {Boolean}
   */


  function boolOrFn(val, args) {
    if (typeof val == TYPE_FUNCTION) {
      return val.apply(args ? args[0] || undefined : undefined, args);
    }

    return val;
  }
  /**
   * use the val2 when val1 is undefined
   * @param {*} val1
   * @param {*} val2
   * @returns {*}
   */


  function ifUndefined(val1, val2) {
    return val1 === undefined ? val2 : val1;
  }
  /**
   * addEventListener with multiple events at once
   * @param {EventTarget} target
   * @param {String} types
   * @param {Function} handler
   */


  function addEventListeners(target, types, handler) {
    each(splitStr(types), function (type) {
      target.addEventListener(type, handler, false);
    });
  }
  /**
   * removeEventListener with multiple events at once
   * @param {EventTarget} target
   * @param {String} types
   * @param {Function} handler
   */


  function removeEventListeners(target, types, handler) {
    each(splitStr(types), function (type) {
      target.removeEventListener(type, handler, false);
    });
  }
  /**
   * find if a node is in the given parent
   * @method hasParent
   * @param {HTMLElement} node
   * @param {HTMLElement} parent
   * @return {Boolean} found
   */


  function hasParent(node, parent) {
    while (node) {
      if (node == parent) {
        return true;
      }

      node = node.parentNode;
    }

    return false;
  }
  /**
   * small indexOf wrapper
   * @param {String} str
   * @param {String} find
   * @returns {Boolean} found
   */


  function inStr(str, find) {
    return str.indexOf(find) > -1;
  }
  /**
   * split string on whitespace
   * @param {String} str
   * @returns {Array} words
   */


  function splitStr(str) {
    return str.trim().split(/\s+/g);
  }
  /**
   * find if a array contains the object using indexOf or a simple polyFill
   * @param {Array} src
   * @param {String} find
   * @param {String} [findByKey]
   * @return {Boolean|Number} false when not found, or the index
   */


  function inArray(src, find, findByKey) {
    if (src.indexOf && !findByKey) {
      return src.indexOf(find);
    } else {
      var i = 0;

      while (i < src.length) {
        if (findByKey && src[i][findByKey] == find || !findByKey && src[i] === find) {
          return i;
        }

        i++;
      }

      return -1;
    }
  }
  /**
   * convert array-like objects to real arrays
   * @param {Object} obj
   * @returns {Array}
   */


  function toArray(obj) {
    return Array.prototype.slice.call(obj, 0);
  }
  /**
   * unique array with objects based on a key (like 'id') or just by the array's value
   * @param {Array} src [{id:1},{id:2},{id:1}]
   * @param {String} [key]
   * @param {Boolean} [sort=False]
   * @returns {Array} [{id:1},{id:2}]
   */


  function uniqueArray(src, key, sort) {
    var results = [];
    var values = [];
    var i = 0;

    while (i < src.length) {
      var val = key ? src[i][key] : src[i];

      if (inArray(values, val) < 0) {
        results.push(src[i]);
      }

      values[i] = val;
      i++;
    }

    if (sort) {
      if (!key) {
        results = results.sort();
      } else {
        results = results.sort(function sortUniqueArray(a, b) {
          return a[key] > b[key];
        });
      }
    }

    return results;
  }
  /**
   * get the prefixed property
   * @param {Object} obj
   * @param {String} property
   * @returns {String|Undefined} prefixed
   */


  function prefixed(obj, property) {
    var prefix, prop;
    var camelProp = property[0].toUpperCase() + property.slice(1);
    var i = 0;

    while (i < VENDOR_PREFIXES.length) {
      prefix = VENDOR_PREFIXES[i];
      prop = prefix ? prefix + camelProp : property;

      if (prop in obj) {
        return prop;
      }

      i++;
    }

    return undefined;
  }
  /**
   * get a unique id
   * @returns {number} uniqueId
   */


  var _uniqueId = 1;

  function uniqueId() {
    return _uniqueId++;
  }
  /**
   * get the window object of an element
   * @param {HTMLElement} element
   * @returns {DocumentView|Window}
   */


  function getWindowForElement(element) {
    var doc = element.ownerDocument || element;
    return doc.defaultView || doc.parentWindow || window;
  }

  var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;
  var SUPPORT_TOUCH = 'ontouchstart' in window;
  var SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined;
  var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);
  var INPUT_TYPE_TOUCH = 'touch';
  var INPUT_TYPE_PEN = 'pen';
  var INPUT_TYPE_MOUSE = 'mouse';
  var INPUT_TYPE_KINECT = 'kinect';
  var COMPUTE_INTERVAL = 25;
  var INPUT_START = 1;
  var INPUT_MOVE = 2;
  var INPUT_END = 4;
  var INPUT_CANCEL = 8;
  var DIRECTION_NONE = 1;
  var DIRECTION_LEFT = 2;
  var DIRECTION_RIGHT = 4;
  var DIRECTION_UP = 8;
  var DIRECTION_DOWN = 16;
  var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;
  var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;
  var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;
  var PROPS_XY = ['x', 'y'];
  var PROPS_CLIENT_XY = ['clientX', 'clientY'];
  /**
   * create new input type manager
   * @param {Manager} manager
   * @param {Function} callback
   * @returns {Input}
   * @constructor
   */

  function Input(manager, callback) {
    var self = this;
    this.manager = manager;
    this.callback = callback;
    this.element = manager.element;
    this.target = manager.options.inputTarget; // smaller wrapper around the handler, for the scope and the enabled state of the manager,
    // so when disabled the input events are completely bypassed.

    this.domHandler = function (ev) {
      if (boolOrFn(manager.options.enable, [manager])) {
        self.handler(ev);
      }
    };

    this.init();
  }

  Input.prototype = {
    /**
     * should handle the inputEvent data and trigger the callback
     * @virtual
     */
    handler: function () {},

    /**
     * bind the events
     */
    init: function () {
      this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);
      this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);
      this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
    },

    /**
     * unbind the events
     */
    destroy: function () {
      this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);
      this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);
      this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
    }
  };
  /**
   * create new input type manager
   * called by the Manager constructor
   * @param {Hammer} manager
   * @returns {Input}
   */

  function createInputInstance(manager) {
    var Type;
    var inputClass = manager.options.inputClass;

    if (inputClass) {
      Type = inputClass;
    } else if (SUPPORT_POINTER_EVENTS) {
      Type = PointerEventInput;
    } else if (SUPPORT_ONLY_TOUCH) {
      Type = TouchInput;
    } else if (!SUPPORT_TOUCH) {
      Type = MouseInput;
    } else {
      Type = TouchMouseInput;
    }

    return new Type(manager, inputHandler);
  }
  /**
   * handle input events
   * @param {Manager} manager
   * @param {String} eventType
   * @param {Object} input
   */


  function inputHandler(manager, eventType, input) {
    var pointersLen = input.pointers.length;
    var changedPointersLen = input.changedPointers.length;
    var isFirst = eventType & INPUT_START && pointersLen - changedPointersLen === 0;
    var isFinal = eventType & (INPUT_END | INPUT_CANCEL) && pointersLen - changedPointersLen === 0;
    input.isFirst = !!isFirst;
    input.isFinal = !!isFinal;

    if (isFirst) {
      manager.session = {};
    } // source event is the normalized value of the domEvents
    // like 'touchstart, mouseup, pointerdown'


    input.eventType = eventType; // compute scale, rotation etc

    computeInputData(manager, input); // emit secret event

    manager.emit('hammer.input', input);
    manager.recognize(input);
    manager.session.prevInput = input;
  }
  /**
   * extend the data with some usable properties like scale, rotate, velocity etc
   * @param {Object} manager
   * @param {Object} input
   */


  function computeInputData(manager, input) {
    var session = manager.session;
    var pointers = input.pointers;
    var pointersLength = pointers.length; // store the first input to calculate the distance and direction

    if (!session.firstInput) {
      session.firstInput = simpleCloneInputData(input);
    } // to compute scale and rotation we need to store the multiple touches


    if (pointersLength > 1 && !session.firstMultiple) {
      session.firstMultiple = simpleCloneInputData(input);
    } else if (pointersLength === 1) {
      session.firstMultiple = false;
    }

    var firstInput = session.firstInput;
    var firstMultiple = session.firstMultiple;
    var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;
    var center = input.center = getCenter(pointers);
    input.timeStamp = now();
    input.deltaTime = input.timeStamp - firstInput.timeStamp;
    input.angle = getAngle(offsetCenter, center);
    input.distance = getDistance(offsetCenter, center);
    computeDeltaXY(session, input);
    input.offsetDirection = getDirection(input.deltaX, input.deltaY);
    var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);
    input.overallVelocityX = overallVelocity.x;
    input.overallVelocityY = overallVelocity.y;
    input.overallVelocity = abs(overallVelocity.x) > abs(overallVelocity.y) ? overallVelocity.x : overallVelocity.y;
    input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;
    input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;
    input.maxPointers = !session.prevInput ? input.pointers.length : input.pointers.length > session.prevInput.maxPointers ? input.pointers.length : session.prevInput.maxPointers;
    computeIntervalInputData(session, input); // find the correct target

    var target = manager.element;

    if (hasParent(input.srcEvent.target, target)) {
      target = input.srcEvent.target;
    }

    input.target = target;
  }

  function computeDeltaXY(session, input) {
    var center = input.center;
    var offset = session.offsetDelta || {};
    var prevDelta = session.prevDelta || {};
    var prevInput = session.prevInput || {};

    if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {
      prevDelta = session.prevDelta = {
        x: prevInput.deltaX || 0,
        y: prevInput.deltaY || 0
      };
      offset = session.offsetDelta = {
        x: center.x,
        y: center.y
      };
    }

    input.deltaX = prevDelta.x + (center.x - offset.x);
    input.deltaY = prevDelta.y + (center.y - offset.y);
  }
  /**
   * velocity is calculated every x ms
   * @param {Object} session
   * @param {Object} input
   */


  function computeIntervalInputData(session, input) {
    var last = session.lastInterval || input,
        deltaTime = input.timeStamp - last.timeStamp,
        velocity,
        velocityX,
        velocityY,
        direction;

    if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {
      var deltaX = input.deltaX - last.deltaX;
      var deltaY = input.deltaY - last.deltaY;
      var v = getVelocity(deltaTime, deltaX, deltaY);
      velocityX = v.x;
      velocityY = v.y;
      velocity = abs(v.x) > abs(v.y) ? v.x : v.y;
      direction = getDirection(deltaX, deltaY);
      session.lastInterval = input;
    } else {
      // use latest velocity info if it doesn't overtake a minimum period
      velocity = last.velocity;
      velocityX = last.velocityX;
      velocityY = last.velocityY;
      direction = last.direction;
    }

    input.velocity = velocity;
    input.velocityX = velocityX;
    input.velocityY = velocityY;
    input.direction = direction;
  }
  /**
   * create a simple clone from the input used for storage of firstInput and firstMultiple
   * @param {Object} input
   * @returns {Object} clonedInputData
   */


  function simpleCloneInputData(input) {
    // make a simple copy of the pointers because we will get a reference if we don't
    // we only need clientXY for the calculations
    var pointers = [];
    var i = 0;

    while (i < input.pointers.length) {
      pointers[i] = {
        clientX: round(input.pointers[i].clientX),
        clientY: round(input.pointers[i].clientY)
      };
      i++;
    }

    return {
      timeStamp: now(),
      pointers: pointers,
      center: getCenter(pointers),
      deltaX: input.deltaX,
      deltaY: input.deltaY
    };
  }
  /**
   * get the center of all the pointers
   * @param {Array} pointers
   * @return {Object} center contains `x` and `y` properties
   */


  function getCenter(pointers) {
    var pointersLength = pointers.length; // no need to loop when only one touch

    if (pointersLength === 1) {
      return {
        x: round(pointers[0].clientX),
        y: round(pointers[0].clientY)
      };
    }

    var x = 0,
        y = 0,
        i = 0;

    while (i < pointersLength) {
      x += pointers[i].clientX;
      y += pointers[i].clientY;
      i++;
    }

    return {
      x: round(x / pointersLength),
      y: round(y / pointersLength)
    };
  }
  /**
   * calculate the velocity between two points. unit is in px per ms.
   * @param {Number} deltaTime
   * @param {Number} x
   * @param {Number} y
   * @return {Object} velocity `x` and `y`
   */


  function getVelocity(deltaTime, x, y) {
    return {
      x: x / deltaTime || 0,
      y: y / deltaTime || 0
    };
  }
  /**
   * get the direction between two points
   * @param {Number} x
   * @param {Number} y
   * @return {Number} direction
   */


  function getDirection(x, y) {
    if (x === y) {
      return DIRECTION_NONE;
    }

    if (abs(x) >= abs(y)) {
      return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
    }

    return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;
  }
  /**
   * calculate the absolute distance between two points
   * @param {Object} p1 {x, y}
   * @param {Object} p2 {x, y}
   * @param {Array} [props] containing x and y keys
   * @return {Number} distance
   */


  function getDistance(p1, p2, props) {
    if (!props) {
      props = PROPS_XY;
    }

    var x = p2[props[0]] - p1[props[0]],
        y = p2[props[1]] - p1[props[1]];
    return Math.sqrt(x * x + y * y);
  }
  /**
   * calculate the angle between two coordinates
   * @param {Object} p1
   * @param {Object} p2
   * @param {Array} [props] containing x and y keys
   * @return {Number} angle
   */


  function getAngle(p1, p2, props) {
    if (!props) {
      props = PROPS_XY;
    }

    var x = p2[props[0]] - p1[props[0]],
        y = p2[props[1]] - p1[props[1]];
    return Math.atan2(y, x) * 180 / Math.PI;
  }
  /**
   * calculate the rotation degrees between two pointersets
   * @param {Array} start array of pointers
   * @param {Array} end array of pointers
   * @return {Number} rotation
   */


  function getRotation(start, end) {
    return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);
  }
  /**
   * calculate the scale factor between two pointersets
   * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out
   * @param {Array} start array of pointers
   * @param {Array} end array of pointers
   * @return {Number} scale
   */


  function getScale(start, end) {
    return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);
  }

  var MOUSE_INPUT_MAP = {
    mousedown: INPUT_START,
    mousemove: INPUT_MOVE,
    mouseup: INPUT_END
  };
  var MOUSE_ELEMENT_EVENTS = 'mousedown';
  var MOUSE_WINDOW_EVENTS = 'mousemove mouseup';
  /**
   * Mouse events input
   * @constructor
   * @extends Input
   */

  function MouseInput() {
    this.evEl = MOUSE_ELEMENT_EVENTS;
    this.evWin = MOUSE_WINDOW_EVENTS;
    this.pressed = false; // mousedown state

    Input.apply(this, arguments);
  }

  inherit(MouseInput, Input, {
    /**
     * handle mouse events
     * @param {Object} ev
     */
    handler: function MEhandler(ev) {
      var eventType = MOUSE_INPUT_MAP[ev.type]; // on start we want to have the left mouse button down

      if (eventType & INPUT_START && ev.button === 0) {
        this.pressed = true;
      }

      if (eventType & INPUT_MOVE && ev.which !== 1) {
        eventType = INPUT_END;
      } // mouse must be down


      if (!this.pressed) {
        return;
      }

      if (eventType & INPUT_END) {
        this.pressed = false;
      }

      this.callback(this.manager, eventType, {
        pointers: [ev],
        changedPointers: [ev],
        pointerType: INPUT_TYPE_MOUSE,
        srcEvent: ev
      });
    }
  });
  var POINTER_INPUT_MAP = {
    pointerdown: INPUT_START,
    pointermove: INPUT_MOVE,
    pointerup: INPUT_END,
    pointercancel: INPUT_CANCEL,
    pointerout: INPUT_CANCEL
  }; // in IE10 the pointer types is defined as an enum

  var IE10_POINTER_TYPE_ENUM = {
    2: INPUT_TYPE_TOUCH,
    3: INPUT_TYPE_PEN,
    4: INPUT_TYPE_MOUSE,
    5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816

  };
  var POINTER_ELEMENT_EVENTS = 'pointerdown';
  var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel'; // IE10 has prefixed support, and case-sensitive

  if (window.MSPointerEvent && !window.PointerEvent) {
    POINTER_ELEMENT_EVENTS = 'MSPointerDown';
    POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';
  }
  /**
   * Pointer events input
   * @constructor
   * @extends Input
   */


  function PointerEventInput() {
    this.evEl = POINTER_ELEMENT_EVENTS;
    this.evWin = POINTER_WINDOW_EVENTS;
    Input.apply(this, arguments);
    this.store = this.manager.session.pointerEvents = [];
  }

  inherit(PointerEventInput, Input, {
    /**
     * handle mouse events
     * @param {Object} ev
     */
    handler: function PEhandler(ev) {
      var store = this.store;
      var removePointer = false;
      var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');
      var eventType = POINTER_INPUT_MAP[eventTypeNormalized];
      var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;
      var isTouch = pointerType == INPUT_TYPE_TOUCH; // get index of the event in the store

      var storeIndex = inArray(store, ev.pointerId, 'pointerId'); // start and mouse must be down

      if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {
        if (storeIndex < 0) {
          store.push(ev);
          storeIndex = store.length - 1;
        }
      } else if (eventType & (INPUT_END | INPUT_CANCEL)) {
        removePointer = true;
      } // it not found, so the pointer hasn't been down (so it's probably a hover)


      if (storeIndex < 0) {
        return;
      } // update the event in the store


      store[storeIndex] = ev;
      this.callback(this.manager, eventType, {
        pointers: store,
        changedPointers: [ev],
        pointerType: pointerType,
        srcEvent: ev
      });

      if (removePointer) {
        // remove from the store
        store.splice(storeIndex, 1);
      }
    }
  });
  var SINGLE_TOUCH_INPUT_MAP = {
    touchstart: INPUT_START,
    touchmove: INPUT_MOVE,
    touchend: INPUT_END,
    touchcancel: INPUT_CANCEL
  };
  var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';
  var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';
  /**
   * Touch events input
   * @constructor
   * @extends Input
   */

  function SingleTouchInput() {
    this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;
    this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;
    this.started = false;
    Input.apply(this, arguments);
  }

  inherit(SingleTouchInput, Input, {
    handler: function TEhandler(ev) {
      var type = SINGLE_TOUCH_INPUT_MAP[ev.type]; // should we handle the touch events?

      if (type === INPUT_START) {
        this.started = true;
      }

      if (!this.started) {
        return;
      }

      var touches = normalizeSingleTouches.call(this, ev, type); // when done, reset the started state

      if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {
        this.started = false;
      }

      this.callback(this.manager, type, {
        pointers: touches[0],
        changedPointers: touches[1],
        pointerType: INPUT_TYPE_TOUCH,
        srcEvent: ev
      });
    }
  });
  /**
   * @this {TouchInput}
   * @param {Object} ev
   * @param {Number} type flag
   * @returns {undefined|Array} [all, changed]
   */

  function normalizeSingleTouches(ev, type) {
    var all = toArray(ev.touches);
    var changed = toArray(ev.changedTouches);

    if (type & (INPUT_END | INPUT_CANCEL)) {
      all = uniqueArray(all.concat(changed), 'identifier', true);
    }

    return [all, changed];
  }

  var TOUCH_INPUT_MAP = {
    touchstart: INPUT_START,
    touchmove: INPUT_MOVE,
    touchend: INPUT_END,
    touchcancel: INPUT_CANCEL
  };
  var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';
  /**
   * Multi-user touch events input
   * @constructor
   * @extends Input
   */

  function TouchInput() {
    this.evTarget = TOUCH_TARGET_EVENTS;
    this.targetIds = {};
    Input.apply(this, arguments);
  }

  inherit(TouchInput, Input, {
    handler: function MTEhandler(ev) {
      var type = TOUCH_INPUT_MAP[ev.type];
      var touches = getTouches.call(this, ev, type);

      if (!touches) {
        return;
      }

      this.callback(this.manager, type, {
        pointers: touches[0],
        changedPointers: touches[1],
        pointerType: INPUT_TYPE_TOUCH,
        srcEvent: ev
      });
    }
  });
  /**
   * @this {TouchInput}
   * @param {Object} ev
   * @param {Number} type flag
   * @returns {undefined|Array} [all, changed]
   */

  function getTouches(ev, type) {
    var allTouches = toArray(ev.touches);
    var targetIds = this.targetIds; // when there is only one touch, the process can be simplified

    if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {
      targetIds[allTouches[0].identifier] = true;
      return [allTouches, allTouches];
    }

    var i,
        targetTouches,
        changedTouches = toArray(ev.changedTouches),
        changedTargetTouches = [],
        target = this.target; // get target touches from touches

    targetTouches = allTouches.filter(function (touch) {
      return hasParent(touch.target, target);
    }); // collect touches

    if (type === INPUT_START) {
      i = 0;

      while (i < targetTouches.length) {
        targetIds[targetTouches[i].identifier] = true;
        i++;
      }
    } // filter changed touches to only contain touches that exist in the collected target ids


    i = 0;

    while (i < changedTouches.length) {
      if (targetIds[changedTouches[i].identifier]) {
        changedTargetTouches.push(changedTouches[i]);
      } // cleanup removed touches


      if (type & (INPUT_END | INPUT_CANCEL)) {
        delete targetIds[changedTouches[i].identifier];
      }

      i++;
    }

    if (!changedTargetTouches.length) {
      return;
    }

    return [// merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'
    uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true), changedTargetTouches];
  }
  /**
   * Combined touch and mouse input
   *
   * Touch has a higher priority then mouse, and while touching no mouse events are allowed.
   * This because touch devices also emit mouse events while doing a touch.
   *
   * @constructor
   * @extends Input
   */


  var DEDUP_TIMEOUT = 2500;
  var DEDUP_DISTANCE = 25;

  function TouchMouseInput() {
    Input.apply(this, arguments);
    var handler = bindFn(this.handler, this);
    this.touch = new TouchInput(this.manager, handler);
    this.mouse = new MouseInput(this.manager, handler);
    this.primaryTouch = null;
    this.lastTouches = [];
  }

  inherit(TouchMouseInput, Input, {
    /**
     * handle mouse and touch events
     * @param {Hammer} manager
     * @param {String} inputEvent
     * @param {Object} inputData
     */
    handler: function TMEhandler(manager, inputEvent, inputData) {
      var isTouch = inputData.pointerType == INPUT_TYPE_TOUCH,
          isMouse = inputData.pointerType == INPUT_TYPE_MOUSE;

      if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) {
        return;
      } // when we're in a touch event, record touches to  de-dupe synthetic mouse event


      if (isTouch) {
        recordTouches.call(this, inputEvent, inputData);
      } else if (isMouse && isSyntheticEvent.call(this, inputData)) {
        return;
      }

      this.callback(manager, inputEvent, inputData);
    },

    /**
     * remove the event listeners
     */
    destroy: function destroy() {
      this.touch.destroy();
      this.mouse.destroy();
    }
  });

  function recordTouches(eventType, eventData) {
    if (eventType & INPUT_START) {
      this.primaryTouch = eventData.changedPointers[0].identifier;
      setLastTouch.call(this, eventData);
    } else if (eventType & (INPUT_END | INPUT_CANCEL)) {
      setLastTouch.call(this, eventData);
    }
  }

  function setLastTouch(eventData) {
    var touch = eventData.changedPointers[0];

    if (touch.identifier === this.primaryTouch) {
      var lastTouch = {
        x: touch.clientX,
        y: touch.clientY
      };
      this.lastTouches.push(lastTouch);
      var lts = this.lastTouches;

      var removeLastTouch = function () {
        var i = lts.indexOf(lastTouch);

        if (i > -1) {
          lts.splice(i, 1);
        }
      };

      setTimeout(removeLastTouch, DEDUP_TIMEOUT);
    }
  }

  function isSyntheticEvent(eventData) {
    var x = eventData.srcEvent.clientX,
        y = eventData.srcEvent.clientY;

    for (var i = 0; i < this.lastTouches.length; i++) {
      var t = this.lastTouches[i];
      var dx = Math.abs(x - t.x),
          dy = Math.abs(y - t.y);

      if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) {
        return true;
      }
    }

    return false;
  }

  var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');
  var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined; // magical touchAction value

  var TOUCH_ACTION_COMPUTE = 'compute';
  var TOUCH_ACTION_AUTO = 'auto';
  var TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented

  var TOUCH_ACTION_NONE = 'none';
  var TOUCH_ACTION_PAN_X = 'pan-x';
  var TOUCH_ACTION_PAN_Y = 'pan-y';
  var TOUCH_ACTION_MAP = getTouchActionProps();
  /**
   * Touch Action
   * sets the touchAction property or uses the js alternative
   * @param {Manager} manager
   * @param {String} value
   * @constructor
   */

  function TouchAction(manager, value) {
    this.manager = manager;
    this.set(value);
  }

  TouchAction.prototype = {
    /**
     * set the touchAction value on the element or enable the polyfill
     * @param {String} value
     */
    set: function (value) {
      // find out the touch-action by the event handlers
      if (value == TOUCH_ACTION_COMPUTE) {
        value = this.compute();
      }

      if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) {
        this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;
      }

      this.actions = value.toLowerCase().trim();
    },

    /**
     * just re-set the touchAction value
     */
    update: function () {
      this.set(this.manager.options.touchAction);
    },

    /**
     * compute the value for the touchAction property based on the recognizer's settings
     * @returns {String} value
     */
    compute: function () {
      var actions = [];
      each(this.manager.recognizers, function (recognizer) {
        if (boolOrFn(recognizer.options.enable, [recognizer])) {
          actions = actions.concat(recognizer.getTouchAction());
        }
      });
      return cleanTouchActions(actions.join(' '));
    },

    /**
     * this method is called on each input cycle and provides the preventing of the browser behavior
     * @param {Object} input
     */
    preventDefaults: function (input) {
      var srcEvent = input.srcEvent;
      var direction = input.offsetDirection; // if the touch action did prevented once this session

      if (this.manager.session.prevented) {
        srcEvent.preventDefault();
        return;
      }

      var actions = this.actions;
      var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE];
      var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y];
      var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X];

      if (hasNone) {
        //do not prevent defaults if this is a tap gesture
        var isTapPointer = input.pointers.length === 1;
        var isTapMovement = input.distance < 2;
        var isTapTouchTime = input.deltaTime < 250;

        if (isTapPointer && isTapMovement && isTapTouchTime) {
          return;
        }
      }

      if (hasPanX && hasPanY) {
        // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent
        return;
      }

      if (hasNone || hasPanY && direction & DIRECTION_HORIZONTAL || hasPanX && direction & DIRECTION_VERTICAL) {
        return this.preventSrc(srcEvent);
      }
    },

    /**
     * call preventDefault to prevent the browser's default behavior (scrolling in most cases)
     * @param {Object} srcEvent
     */
    preventSrc: function (srcEvent) {
      this.manager.session.prevented = true;
      srcEvent.preventDefault();
    }
  };
  /**
   * when the touchActions are collected they are not a valid value, so we need to clean things up. *
   * @param {String} actions
   * @returns {*}
   */

  function cleanTouchActions(actions) {
    // none
    if (inStr(actions, TOUCH_ACTION_NONE)) {
      return TOUCH_ACTION_NONE;
    }

    var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
    var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y); // if both pan-x and pan-y are set (different recognizers
    // for different directions, e.g. horizontal pan but vertical swipe?)
    // we need none (as otherwise with pan-x pan-y combined none of these
    // recognizers will work, since the browser would handle all panning

    if (hasPanX && hasPanY) {
      return TOUCH_ACTION_NONE;
    } // pan-x OR pan-y


    if (hasPanX || hasPanY) {
      return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;
    } // manipulation


    if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {
      return TOUCH_ACTION_MANIPULATION;
    }

    return TOUCH_ACTION_AUTO;
  }

  function getTouchActionProps() {
    if (!NATIVE_TOUCH_ACTION) {
      return false;
    }

    var touchMap = {};
    var cssSupports = window.CSS && window.CSS.supports;
    ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function (val) {
      // If css.supports is not supported but there is native touch-action assume it supports
      // all values. This is the case for IE 10 and 11.
      touchMap[val] = cssSupports ? window.CSS.supports('touch-action', val) : true;
    });
    return touchMap;
  }
  /**
   * Recognizer flow explained; *
   * All recognizers have the initial state of POSSIBLE when a input session starts.
   * The definition of a input session is from the first input until the last input, with all it's movement in it. *
   * Example session for mouse-input: mousedown -> mousemove -> mouseup
   *
   * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed
   * which determines with state it should be.
   *
   * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to
   * POSSIBLE to give it another change on the next cycle.
   *
   *               Possible
   *                  |
   *            +-----+---------------+
   *            |                     |
   *      +-----+-----+               |
   *      |           |               |
   *   Failed      Cancelled          |
   *                          +-------+------+
   *                          |              |
   *                      Recognized       Began
   *                                         |
   *                                      Changed
   *                                         |
   *                                  Ended/Recognized
   */


  var STATE_POSSIBLE = 1;
  var STATE_BEGAN = 2;
  var STATE_CHANGED = 4;
  var STATE_ENDED = 8;
  var STATE_RECOGNIZED = STATE_ENDED;
  var STATE_CANCELLED = 16;
  var STATE_FAILED = 32;
  /**
   * Recognizer
   * Every recognizer needs to extend from this class.
   * @constructor
   * @param {Object} options
   */

  function Recognizer(options) {
    this.options = assign({}, this.defaults, options || {});
    this.id = uniqueId();
    this.manager = null; // default is enable true

    this.options.enable = ifUndefined(this.options.enable, true);
    this.state = STATE_POSSIBLE;
    this.simultaneous = {};
    this.requireFail = [];
  }

  Recognizer.prototype = {
    /**
     * @virtual
     * @type {Object}
     */
    defaults: {},

    /**
     * set options
     * @param {Object} options
     * @return {Recognizer}
     */
    set: function (options) {
      assign(this.options, options); // also update the touchAction, in case something changed about the directions/enabled state

      this.manager && this.manager.touchAction.update();
      return this;
    },

    /**
     * recognize simultaneous with an other recognizer.
     * @param {Recognizer} otherRecognizer
     * @returns {Recognizer} this
     */
    recognizeWith: function (otherRecognizer) {
      if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {
        return this;
      }

      var simultaneous = this.simultaneous;
      otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);

      if (!simultaneous[otherRecognizer.id]) {
        simultaneous[otherRecognizer.id] = otherRecognizer;
        otherRecognizer.recognizeWith(this);
      }

      return this;
    },

    /**
     * drop the simultaneous link. it doesnt remove the link on the other recognizer.
     * @param {Recognizer} otherRecognizer
     * @returns {Recognizer} this
     */
    dropRecognizeWith: function (otherRecognizer) {
      if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {
        return this;
      }

      otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
      delete this.simultaneous[otherRecognizer.id];
      return this;
    },

    /**
     * recognizer can only run when an other is failing
     * @param {Recognizer} otherRecognizer
     * @returns {Recognizer} this
     */
    requireFailure: function (otherRecognizer) {
      if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {
        return this;
      }

      var requireFail = this.requireFail;
      otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);

      if (inArray(requireFail, otherRecognizer) === -1) {
        requireFail.push(otherRecognizer);
        otherRecognizer.requireFailure(this);
      }

      return this;
    },

    /**
     * drop the requireFailure link. it does not remove the link on the other recognizer.
     * @param {Recognizer} otherRecognizer
     * @returns {Recognizer} this
     */
    dropRequireFailure: function (otherRecognizer) {
      if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {
        return this;
      }

      otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
      var index = inArray(this.requireFail, otherRecognizer);

      if (index > -1) {
        this.requireFail.splice(index, 1);
      }

      return this;
    },

    /**
     * has require failures boolean
     * @returns {boolean}
     */
    hasRequireFailures: function () {
      return this.requireFail.length > 0;
    },

    /**
     * if the recognizer can recognize simultaneous with an other recognizer
     * @param {Recognizer} otherRecognizer
     * @returns {Boolean}
     */
    canRecognizeWith: function (otherRecognizer) {
      return !!this.simultaneous[otherRecognizer.id];
    },

    /**
     * You should use `tryEmit` instead of `emit` directly to check
     * that all the needed recognizers has failed before emitting.
     * @param {Object} input
     */
    emit: function (input) {
      var self = this;
      var state = this.state;

      function emit(event) {
        self.manager.emit(event, input);
      } // 'panstart' and 'panmove'


      if (state < STATE_ENDED) {
        emit(self.options.event + stateStr(state));
      }

      emit(self.options.event); // simple 'eventName' events

      if (input.additionalEvent) {
        // additional event(panleft, panright, pinchin, pinchout...)
        emit(input.additionalEvent);
      } // panend and pancancel


      if (state >= STATE_ENDED) {
        emit(self.options.event + stateStr(state));
      }
    },

    /**
     * Check that all the require failure recognizers has failed,
     * if true, it emits a gesture event,
     * otherwise, setup the state to FAILED.
     * @param {Object} input
     */
    tryEmit: function (input) {
      if (this.canEmit()) {
        return this.emit(input);
      } // it's failing anyway


      this.state = STATE_FAILED;
    },

    /**
     * can we emit?
     * @returns {boolean}
     */
    canEmit: function () {
      var i = 0;

      while (i < this.requireFail.length) {
        if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {
          return false;
        }

        i++;
      }

      return true;
    },

    /**
     * update the recognizer
     * @param {Object} inputData
     */
    recognize: function (inputData) {
      // make a new copy of the inputData
      // so we can change the inputData without messing up the other recognizers
      var inputDataClone = assign({}, inputData); // is is enabled and allow recognizing?

      if (!boolOrFn(this.options.enable, [this, inputDataClone])) {
        this.reset();
        this.state = STATE_FAILED;
        return;
      } // reset when we've reached the end


      if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {
        this.state = STATE_POSSIBLE;
      }

      this.state = this.process(inputDataClone); // the recognizer has recognized a gesture
      // so trigger an event

      if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {
        this.tryEmit(inputDataClone);
      }
    },

    /**
     * return the state of the recognizer
     * the actual recognizing happens in this method
     * @virtual
     * @param {Object} inputData
     * @returns {Const} STATE
     */
    process: function (inputData) {},
    // jshint ignore:line

    /**
     * return the preferred touch-action
     * @virtual
     * @returns {Array}
     */
    getTouchAction: function () {},

    /**
     * called when the gesture isn't allowed to recognize
     * like when another is being recognized or it is disabled
     * @virtual
     */
    reset: function () {}
  };
  /**
   * get a usable string, used as event postfix
   * @param {Const} state
   * @returns {String} state
   */

  function stateStr(state) {
    if (state & STATE_CANCELLED) {
      return 'cancel';
    } else if (state & STATE_ENDED) {
      return 'end';
    } else if (state & STATE_CHANGED) {
      return 'move';
    } else if (state & STATE_BEGAN) {
      return 'start';
    }

    return '';
  }
  /**
   * direction cons to string
   * @param {Const} direction
   * @returns {String}
   */


  function directionStr(direction) {
    if (direction == DIRECTION_DOWN) {
      return 'down';
    } else if (direction == DIRECTION_UP) {
      return 'up';
    } else if (direction == DIRECTION_LEFT) {
      return 'left';
    } else if (direction == DIRECTION_RIGHT) {
      return 'right';
    }

    return '';
  }
  /**
   * get a recognizer by name if it is bound to a manager
   * @param {Recognizer|String} otherRecognizer
   * @param {Recognizer} recognizer
   * @returns {Recognizer}
   */


  function getRecognizerByNameIfManager(otherRecognizer, recognizer) {
    var manager = recognizer.manager;

    if (manager) {
      return manager.get(otherRecognizer);
    }

    return otherRecognizer;
  }
  /**
   * This recognizer is just used as a base for the simple attribute recognizers.
   * @constructor
   * @extends Recognizer
   */


  function AttrRecognizer() {
    Recognizer.apply(this, arguments);
  }

  inherit(AttrRecognizer, Recognizer, {
    /**
     * @namespace
     * @memberof AttrRecognizer
     */
    defaults: {
      /**
       * @type {Number}
       * @default 1
       */
      pointers: 1
    },

    /**
     * Used to check if it the recognizer receives valid input, like input.distance > 10.
     * @memberof AttrRecognizer
     * @param {Object} input
     * @returns {Boolean} recognized
     */
    attrTest: function (input) {
      var optionPointers = this.options.pointers;
      return optionPointers === 0 || input.pointers.length === optionPointers;
    },

    /**
     * Process the input and return the state for the recognizer
     * @memberof AttrRecognizer
     * @param {Object} input
     * @returns {*} State
     */
    process: function (input) {
      var state = this.state;
      var eventType = input.eventType;
      var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);
      var isValid = this.attrTest(input); // on cancel input and we've recognized before, return STATE_CANCELLED

      if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {
        return state | STATE_CANCELLED;
      } else if (isRecognized || isValid) {
        if (eventType & INPUT_END) {
          return state | STATE_ENDED;
        } else if (!(state & STATE_BEGAN)) {
          return STATE_BEGAN;
        }

        return state | STATE_CHANGED;
      }

      return STATE_FAILED;
    }
  });
  /**
   * Pan
   * Recognized when the pointer is down and moved in the allowed direction.
   * @constructor
   * @extends AttrRecognizer
   */

  function PanRecognizer() {
    AttrRecognizer.apply(this, arguments);
    this.pX = null;
    this.pY = null;
  }

  inherit(PanRecognizer, AttrRecognizer, {
    /**
     * @namespace
     * @memberof PanRecognizer
     */
    defaults: {
      event: 'pan',
      threshold: 10,
      pointers: 1,
      direction: DIRECTION_ALL
    },
    getTouchAction: function () {
      var direction = this.options.direction;
      var actions = [];

      if (direction & DIRECTION_HORIZONTAL) {
        actions.push(TOUCH_ACTION_PAN_Y);
      }

      if (direction & DIRECTION_VERTICAL) {
        actions.push(TOUCH_ACTION_PAN_X);
      }

      return actions;
    },
    directionTest: function (input) {
      var options = this.options;
      var hasMoved = true;
      var distance = input.distance;
      var direction = input.direction;
      var x = input.deltaX;
      var y = input.deltaY; // lock to axis?

      if (!(direction & options.direction)) {
        if (options.direction & DIRECTION_HORIZONTAL) {
          direction = x === 0 ? DIRECTION_NONE : x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
          hasMoved = x != this.pX;
          distance = Math.abs(input.deltaX);
        } else {
          direction = y === 0 ? DIRECTION_NONE : y < 0 ? DIRECTION_UP : DIRECTION_DOWN;
          hasMoved = y != this.pY;
          distance = Math.abs(input.deltaY);
        }
      }

      input.direction = direction;
      return hasMoved && distance > options.threshold && direction & options.direction;
    },
    attrTest: function (input) {
      return AttrRecognizer.prototype.attrTest.call(this, input) && (this.state & STATE_BEGAN || !(this.state & STATE_BEGAN) && this.directionTest(input));
    },
    emit: function (input) {
      this.pX = input.deltaX;
      this.pY = input.deltaY;
      var direction = directionStr(input.direction);

      if (direction) {
        input.additionalEvent = this.options.event + direction;
      }

      this._super.emit.call(this, input);
    }
  });
  /**
   * Pinch
   * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).
   * @constructor
   * @extends AttrRecognizer
   */

  function PinchRecognizer() {
    AttrRecognizer.apply(this, arguments);
  }

  inherit(PinchRecognizer, AttrRecognizer, {
    /**
     * @namespace
     * @memberof PinchRecognizer
     */
    defaults: {
      event: 'pinch',
      threshold: 0,
      pointers: 2
    },
    getTouchAction: function () {
      return [TOUCH_ACTION_NONE];
    },
    attrTest: function (input) {
      return this._super.attrTest.call(this, input) && (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);
    },
    emit: function (input) {
      if (input.scale !== 1) {
        var inOut = input.scale < 1 ? 'in' : 'out';
        input.additionalEvent = this.options.event + inOut;
      }

      this._super.emit.call(this, input);
    }
  });
  /**
   * Press
   * Recognized when the pointer is down for x ms without any movement.
   * @constructor
   * @extends Recognizer
   */

  function PressRecognizer() {
    Recognizer.apply(this, arguments);
    this._timer = null;
    this._input = null;
  }

  inherit(PressRecognizer, Recognizer, {
    /**
     * @namespace
     * @memberof PressRecognizer
     */
    defaults: {
      event: 'press',
      pointers: 1,
      time: 251,
      // minimal time of the pointer to be pressed
      threshold: 9 // a minimal movement is ok, but keep it low

    },
    getTouchAction: function () {
      return [TOUCH_ACTION_AUTO];
    },
    process: function (input) {
      var options = this.options;
      var validPointers = input.pointers.length === options.pointers;
      var validMovement = input.distance < options.threshold;
      var validTime = input.deltaTime > options.time;
      this._input = input; // we only allow little movement
      // and we've reached an end event, so a tap is possible

      if (!validMovement || !validPointers || input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime) {
        this.reset();
      } else if (input.eventType & INPUT_START) {
        this.reset();
        this._timer = setTimeoutContext(function () {
          this.state = STATE_RECOGNIZED;
          this.tryEmit();
        }, options.time, this);
      } else if (input.eventType & INPUT_END) {
        return STATE_RECOGNIZED;
      }

      return STATE_FAILED;
    },
    reset: function () {
      clearTimeout(this._timer);
    },
    emit: function (input) {
      if (this.state !== STATE_RECOGNIZED) {
        return;
      }

      if (input && input.eventType & INPUT_END) {
        this.manager.emit(this.options.event + 'up', input);
      } else {
        this._input.timeStamp = now();
        this.manager.emit(this.options.event, this._input);
      }
    }
  });
  /**
   * Rotate
   * Recognized when two or more pointer are moving in a circular motion.
   * @constructor
   * @extends AttrRecognizer
   */

  function RotateRecognizer() {
    AttrRecognizer.apply(this, arguments);
  }

  inherit(RotateRecognizer, AttrRecognizer, {
    /**
     * @namespace
     * @memberof RotateRecognizer
     */
    defaults: {
      event: 'rotate',
      threshold: 0,
      pointers: 2
    },
    getTouchAction: function () {
      return [TOUCH_ACTION_NONE];
    },
    attrTest: function (input) {
      return this._super.attrTest.call(this, input) && (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);
    }
  });
  /**
   * Swipe
   * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.
   * @constructor
   * @extends AttrRecognizer
   */

  function SwipeRecognizer() {
    AttrRecognizer.apply(this, arguments);
  }

  inherit(SwipeRecognizer, AttrRecognizer, {
    /**
     * @namespace
     * @memberof SwipeRecognizer
     */
    defaults: {
      event: 'swipe',
      threshold: 10,
      velocity: 0.3,
      direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,
      pointers: 1
    },
    getTouchAction: function () {
      return PanRecognizer.prototype.getTouchAction.call(this);
    },
    attrTest: function (input) {
      var direction = this.options.direction;
      var velocity;

      if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {
        velocity = input.overallVelocity;
      } else if (direction & DIRECTION_HORIZONTAL) {
        velocity = input.overallVelocityX;
      } else if (direction & DIRECTION_VERTICAL) {
        velocity = input.overallVelocityY;
      }

      return this._super.attrTest.call(this, input) && direction & input.offsetDirection && input.distance > this.options.threshold && input.maxPointers == this.options.pointers && abs(velocity) > this.options.velocity && input.eventType & INPUT_END;
    },
    emit: function (input) {
      var direction = directionStr(input.offsetDirection);

      if (direction) {
        this.manager.emit(this.options.event + direction, input);
      }

      this.manager.emit(this.options.event, input);
    }
  });
  /**
   * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur
   * between the given interval and position. The delay option can be used to recognize multi-taps without firing
   * a single tap.
   *
   * The eventData from the emitted event contains the property `tapCount`, which contains the amount of
   * multi-taps being recognized.
   * @constructor
   * @extends Recognizer
   */

  function TapRecognizer() {
    Recognizer.apply(this, arguments); // previous time and center,
    // used for tap counting

    this.pTime = false;
    this.pCenter = false;
    this._timer = null;
    this._input = null;
    this.count = 0;
  }

  inherit(TapRecognizer, Recognizer, {
    /**
     * @namespace
     * @memberof PinchRecognizer
     */
    defaults: {
      event: 'tap',
      pointers: 1,
      taps: 1,
      interval: 300,
      // max time between the multi-tap taps
      time: 250,
      // max time of the pointer to be down (like finger on the screen)
      threshold: 9,
      // a minimal movement is ok, but keep it low
      posThreshold: 10 // a multi-tap can be a bit off the initial position

    },
    getTouchAction: function () {
      return [TOUCH_ACTION_MANIPULATION];
    },
    process: function (input) {
      var options = this.options;
      var validPointers = input.pointers.length === options.pointers;
      var validMovement = input.distance < options.threshold;
      var validTouchTime = input.deltaTime < options.time;
      this.reset();

      if (input.eventType & INPUT_START && this.count === 0) {
        return this.failTimeout();
      } // we only allow little movement
      // and we've reached an end event, so a tap is possible


      if (validMovement && validTouchTime && validPointers) {
        if (input.eventType != INPUT_END) {
          return this.failTimeout();
        }

        var validInterval = this.pTime ? input.timeStamp - this.pTime < options.interval : true;
        var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;
        this.pTime = input.timeStamp;
        this.pCenter = input.center;

        if (!validMultiTap || !validInterval) {
          this.count = 1;
        } else {
          this.count += 1;
        }

        this._input = input; // if tap count matches we have recognized it,
        // else it has began recognizing...

        var tapCount = this.count % options.taps;

        if (tapCount === 0) {
          // no failing requirements, immediately trigger the tap event
          // or wait as long as the multitap interval to trigger
          if (!this.hasRequireFailures()) {
            return STATE_RECOGNIZED;
          } else {
            this._timer = setTimeoutContext(function () {
              this.state = STATE_RECOGNIZED;
              this.tryEmit();
            }, options.interval, this);
            return STATE_BEGAN;
          }
        }
      }

      return STATE_FAILED;
    },
    failTimeout: function () {
      this._timer = setTimeoutContext(function () {
        this.state = STATE_FAILED;
      }, this.options.interval, this);
      return STATE_FAILED;
    },
    reset: function () {
      clearTimeout(this._timer);
    },
    emit: function () {
      if (this.state == STATE_RECOGNIZED) {
        this._input.tapCount = this.count;
        this.manager.emit(this.options.event, this._input);
      }
    }
  });
  /**
   * Simple way to create a manager with a default set of recognizers.
   * @param {HTMLElement} element
   * @param {Object} [options]
   * @constructor
   */

  function Hammer(element, options) {
    options = options || {};
    options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset);
    return new Manager(element, options);
  }
  /**
   * @const {string}
   */


  Hammer.VERSION = '2.0.7';
  /**
   * default settings
   * @namespace
   */

  Hammer.defaults = {
    /**
     * set if DOM events are being triggered.
     * But this is slower and unused by simple implementations, so disabled by default.
     * @type {Boolean}
     * @default false
     */
    domEvents: false,

    /**
     * The value for the touchAction property/fallback.
     * When set to `compute` it will magically set the correct value based on the added recognizers.
     * @type {String}
     * @default compute
     */
    touchAction: TOUCH_ACTION_COMPUTE,

    /**
     * @type {Boolean}
     * @default true
     */
    enable: true,

    /**
     * EXPERIMENTAL FEATURE -- can be removed/changed
     * Change the parent input target element.
     * If Null, then it is being set the to main element.
     * @type {Null|EventTarget}
     * @default null
     */
    inputTarget: null,

    /**
     * force an input class
     * @type {Null|Function}
     * @default null
     */
    inputClass: null,

    /**
     * Default recognizer setup when calling `Hammer()`
     * When creating a new Manager these will be skipped.
     * @type {Array}
     */
    preset: [// RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]
    [RotateRecognizer, {
      enable: false
    }], [PinchRecognizer, {
      enable: false
    }, ['rotate']], [SwipeRecognizer, {
      direction: DIRECTION_HORIZONTAL
    }], [PanRecognizer, {
      direction: DIRECTION_HORIZONTAL
    }, ['swipe']], [TapRecognizer], [TapRecognizer, {
      event: 'doubletap',
      taps: 2
    }, ['tap']], [PressRecognizer]],

    /**
     * Some CSS properties can be used to improve the working of Hammer.
     * Add them to this method and they will be set when creating a new Manager.
     * @namespace
     */
    cssProps: {
      /**
       * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.
       * @type {String}
       * @default 'none'
       */
      userSelect: 'none',

      /**
       * Disable the Windows Phone grippers when pressing an element.
       * @type {String}
       * @default 'none'
       */
      touchSelect: 'none',

      /**
       * Disables the default callout shown when you touch and hold a touch target.
       * On iOS, when you touch and hold a touch target such as a link, Safari displays
       * a callout containing information about the link. This property allows you to disable that callout.
       * @type {String}
       * @default 'none'
       */
      touchCallout: 'none',

      /**
       * Specifies whether zooming is enabled. Used by IE10>
       * @type {String}
       * @default 'none'
       */
      contentZooming: 'none',

      /**
       * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.
       * @type {String}
       * @default 'none'
       */
      userDrag: 'none',

      /**
       * Overrides the highlight color shown when the user taps a link or a JavaScript
       * clickable element in iOS. This property obeys the alpha value, if specified.
       * @type {String}
       * @default 'rgba(0,0,0,0)'
       */
      tapHighlightColor: 'rgba(0,0,0,0)'
    }
  };
  var STOP = 1;
  var FORCED_STOP = 2;
  /**
   * Manager
   * @param {HTMLElement} element
   * @param {Object} [options]
   * @constructor
   */

  function Manager(element, options) {
    this.options = assign({}, Hammer.defaults, options || {});
    this.options.inputTarget = this.options.inputTarget || element;
    this.handlers = {};
    this.session = {};
    this.recognizers = [];
    this.oldCssProps = {};
    this.element = element;
    this.input = createInputInstance(this);
    this.touchAction = new TouchAction(this, this.options.touchAction);
    toggleCssProps(this, true);
    each(this.options.recognizers, function (item) {
      var recognizer = this.add(new item[0](item[1]));
      item[2] && recognizer.recognizeWith(item[2]);
      item[3] && recognizer.requireFailure(item[3]);
    }, this);
  }

  Manager.prototype = {
    /**
     * set options
     * @param {Object} options
     * @returns {Manager}
     */
    set: function (options) {
      assign(this.options, options); // Options that need a little more setup

      if (options.touchAction) {
        this.touchAction.update();
      }

      if (options.inputTarget) {
        // Clean up existing event listeners and reinitialize
        this.input.destroy();
        this.input.target = options.inputTarget;
        this.input.init();
      }

      return this;
    },

    /**
     * stop recognizing for this session.
     * This session will be discarded, when a new [input]start event is fired.
     * When forced, the recognizer cycle is stopped immediately.
     * @param {Boolean} [force]
     */
    stop: function (force) {
      this.session.stopped = force ? FORCED_STOP : STOP;
    },

    /**
     * run the recognizers!
     * called by the inputHandler function on every movement of the pointers (touches)
     * it walks through all the recognizers and tries to detect the gesture that is being made
     * @param {Object} inputData
     */
    recognize: function (inputData) {
      var session = this.session;

      if (session.stopped) {
        return;
      } // run the touch-action polyfill


      this.touchAction.preventDefaults(inputData);
      var recognizer;
      var recognizers = this.recognizers; // this holds the recognizer that is being recognized.
      // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED
      // if no recognizer is detecting a thing, it is set to `null`

      var curRecognizer = session.curRecognizer; // reset when the last recognizer is recognized
      // or when we're in a new session

      if (!curRecognizer || curRecognizer && curRecognizer.state & STATE_RECOGNIZED) {
        curRecognizer = session.curRecognizer = null;
      }

      var i = 0;

      while (i < recognizers.length) {
        recognizer = recognizers[i]; // find out if we are allowed try to recognize the input for this one.
        // 1.   allow if the session is NOT forced stopped (see the .stop() method)
        // 2.   allow if we still haven't recognized a gesture in this session, or the this recognizer is the one
        //      that is being recognized.
        // 3.   allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.
        //      this can be setup with the `recognizeWith()` method on the recognizer.

        if (session.stopped !== FORCED_STOP && ( // 1
        !curRecognizer || recognizer == curRecognizer || // 2
        recognizer.canRecognizeWith(curRecognizer))) {
          // 3
          recognizer.recognize(inputData);
        } else {
          recognizer.reset();
        } // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the
        // current active recognizer. but only if we don't already have an active recognizer


        if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {
          curRecognizer = session.curRecognizer = recognizer;
        }

        i++;
      }
    },

    /**
     * get a recognizer by its event name.
     * @param {Recognizer|String} recognizer
     * @returns {Recognizer|Null}
     */
    get: function (recognizer) {
      if (recognizer instanceof Recognizer) {
        return recognizer;
      }

      var recognizers = this.recognizers;

      for (var i = 0; i < recognizers.length; i++) {
        if (recognizers[i].options.event == recognizer) {
          return recognizers[i];
        }
      }

      return null;
    },

    /**
     * add a recognizer to the manager
     * existing recognizers with the same event name will be removed
     * @param {Recognizer} recognizer
     * @returns {Recognizer|Manager}
     */
    add: function (recognizer) {
      if (invokeArrayArg(recognizer, 'add', this)) {
        return this;
      } // remove existing


      var existing = this.get(recognizer.options.event);

      if (existing) {
        this.remove(existing);
      }

      this.recognizers.push(recognizer);
      recognizer.manager = this;
      this.touchAction.update();
      return recognizer;
    },

    /**
     * remove a recognizer by name or instance
     * @param {Recognizer|String} recognizer
     * @returns {Manager}
     */
    remove: function (recognizer) {
      if (invokeArrayArg(recognizer, 'remove', this)) {
        return this;
      }

      recognizer = this.get(recognizer); // let's make sure this recognizer exists

      if (recognizer) {
        var recognizers = this.recognizers;
        var index = inArray(recognizers, recognizer);

        if (index !== -1) {
          recognizers.splice(index, 1);
          this.touchAction.update();
        }
      }

      return this;
    },

    /**
     * bind event
     * @param {String} events
     * @param {Function} handler
     * @returns {EventEmitter} this
     */
    on: function (events, handler) {
      if (events === undefined) {
        return;
      }

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

      var handlers = this.handlers;
      each(splitStr(events), function (event) {
        handlers[event] = handlers[event] || [];
        handlers[event].push(handler);
      });
      return this;
    },

    /**
     * unbind event, leave emit blank to remove all handlers
     * @param {String} events
     * @param {Function} [handler]
     * @returns {EventEmitter} this
     */
    off: function (events, handler) {
      if (events === undefined) {
        return;
      }

      var handlers = this.handlers;
      each(splitStr(events), function (event) {
        if (!handler) {
          delete handlers[event];
        } else {
          handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);
        }
      });
      return this;
    },

    /**
     * emit event to the listeners
     * @param {String} event
     * @param {Object} data
     */
    emit: function (event, data) {
      // we also want to trigger dom events
      if (this.options.domEvents) {
        triggerDomEvent(event, data);
      } // no handlers, so skip it all


      var handlers = this.handlers[event] && this.handlers[event].slice();

      if (!handlers || !handlers.length) {
        return;
      }

      data.type = event;

      data.preventDefault = function () {
        data.srcEvent.preventDefault();
      };

      var i = 0;

      while (i < handlers.length) {
        handlers[i](data);
        i++;
      }
    },

    /**
     * destroy the manager and unbinds all events
     * it doesn't unbind dom events, that is the user own responsibility
     */
    destroy: function () {
      this.element && toggleCssProps(this, false);
      this.handlers = {};
      this.session = {};
      this.input.destroy();
      this.element = null;
    }
  };
  /**
   * add/remove the css properties as defined in manager.options.cssProps
   * @param {Manager} manager
   * @param {Boolean} add
   */

  function toggleCssProps(manager, add) {
    var element = manager.element;

    if (!element.style) {
      return;
    }

    var prop;
    each(manager.options.cssProps, function (value, name) {
      prop = prefixed(element.style, name);

      if (add) {
        manager.oldCssProps[prop] = element.style[prop];
        element.style[prop] = value;
      } else {
        element.style[prop] = manager.oldCssProps[prop] || '';
      }
    });

    if (!add) {
      manager.oldCssProps = {};
    }
  }
  /**
   * trigger dom event
   * @param {String} event
   * @param {Object} data
   */


  function triggerDomEvent(event, data) {
    var gestureEvent = document.createEvent('Event');
    gestureEvent.initEvent(event, true, true);
    gestureEvent.gesture = data;
    data.target.dispatchEvent(gestureEvent);
  }

  assign(Hammer, {
    INPUT_START: INPUT_START,
    INPUT_MOVE: INPUT_MOVE,
    INPUT_END: INPUT_END,
    INPUT_CANCEL: INPUT_CANCEL,
    STATE_POSSIBLE: STATE_POSSIBLE,
    STATE_BEGAN: STATE_BEGAN,
    STATE_CHANGED: STATE_CHANGED,
    STATE_ENDED: STATE_ENDED,
    STATE_RECOGNIZED: STATE_RECOGNIZED,
    STATE_CANCELLED: STATE_CANCELLED,
    STATE_FAILED: STATE_FAILED,
    DIRECTION_NONE: DIRECTION_NONE,
    DIRECTION_LEFT: DIRECTION_LEFT,
    DIRECTION_RIGHT: DIRECTION_RIGHT,
    DIRECTION_UP: DIRECTION_UP,
    DIRECTION_DOWN: DIRECTION_DOWN,
    DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL,
    DIRECTION_VERTICAL: DIRECTION_VERTICAL,
    DIRECTION_ALL: DIRECTION_ALL,
    Manager: Manager,
    Input: Input,
    TouchAction: TouchAction,
    TouchInput: TouchInput,
    MouseInput: MouseInput,
    PointerEventInput: PointerEventInput,
    TouchMouseInput: TouchMouseInput,
    SingleTouchInput: SingleTouchInput,
    Recognizer: Recognizer,
    AttrRecognizer: AttrRecognizer,
    Tap: TapRecognizer,
    Pan: PanRecognizer,
    Swipe: SwipeRecognizer,
    Pinch: PinchRecognizer,
    Rotate: RotateRecognizer,
    Press: PressRecognizer,
    on: addEventListeners,
    off: removeEventListeners,
    each: each,
    merge: merge,
    extend: extend,
    assign: assign,
    inherit: inherit,
    bindFn: bindFn,
    prefixed: prefixed
  }); // this prevents errors when Hammer is loaded in the presence of an AMD
  //  style loader but by script tag, not by the loader.

  var freeGlobal = typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}; // jshint ignore:line

  freeGlobal.Hammer = Hammer;

  if (typeof define === 'function' && define.amd) {
    define(function () {
      return Hammer;
    });
  } else if (typeof module != 'undefined' && module.exports) {
    module.exports = Hammer;
  } else {
    window[exportName] = Hammer;
  }
})(window, document, 'Hammer');
},{}],"jfJW":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.enhancePointerEventInput = enhancePointerEventInput;
exports.enhanceMouseInput = enhanceMouseInput;
var INPUT_START = 1;
var INPUT_MOVE = 2;
var INPUT_END = 4;
var MOUSE_INPUT_MAP = {
  mousedown: INPUT_START,
  mousemove: INPUT_MOVE,
  mouseup: INPUT_END
};

function some(array, predict) {
  for (var i = 0; i < array.length; i++) {
    if (predict(array[i])) {
      return true;
    }
  }

  return false;
}

function enhancePointerEventInput(PointerEventInput) {
  var oldHandler = PointerEventInput.prototype.handler;

  PointerEventInput.prototype.handler = function handler(ev) {
    var store = this.store;

    if (ev.button > 0) {
      if (!some(store, function (e) {
        return e.pointerId === ev.pointerId;
      })) {
        store.push(ev);
      }
    }

    oldHandler.call(this, ev);
  };
}

function enhanceMouseInput(MouseInput) {
  MouseInput.prototype.handler = function handler(ev) {
    var eventType = MOUSE_INPUT_MAP[ev.type];

    if (eventType & INPUT_START && ev.button >= 0) {
      this.pressed = true;
    }

    if (eventType & INPUT_MOVE && ev.which === 0) {
      eventType = INPUT_END;
    }

    if (!this.pressed) {
      return;
    }

    if (eventType & INPUT_END) {
      this.pressed = false;
    }

    this.callback(this.manager, eventType, {
      pointers: [ev],
      changedPointers: [ev],
      pointerType: 'mouse',
      srcEvent: ev
    });
  };
}
},{}],"DRDa":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.Manager = void 0;

var _hammerjs = _interopRequireDefault(require("hammerjs"));

var _hammerOverrides = require("./hammer-overrides");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

(0, _hammerOverrides.enhancePointerEventInput)(_hammerjs.default.PointerEventInput);
(0, _hammerOverrides.enhanceMouseInput)(_hammerjs.default.MouseInput);
var Manager = _hammerjs.default.Manager;
exports.Manager = Manager;
var _default = _hammerjs.default;
exports.default = _default;
},{"hammerjs":"dowO","./hammer-overrides":"jfJW"}],"DVMa":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.GESTURE_EVENT_ALIASES = exports.EVENT_RECOGNIZER_MAP = exports.INPUT_EVENT_TYPES = exports.BASIC_EVENT_ALIASES = exports.RECOGNIZER_FALLBACK_MAP = exports.RECOGNIZER_COMPATIBLE_MAP = exports.RECOGNIZERS = void 0;

var _hammer = _interopRequireDefault(require("./utils/hammer"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var RECOGNIZERS = _hammer.default ? [[_hammer.default.Rotate, {
  enable: false
}], [_hammer.default.Pinch, {
  enable: false
}], [_hammer.default.Swipe, {
  enable: false
}], [_hammer.default.Pan, {
  threshold: 0,
  enable: false
}], [_hammer.default.Press, {
  enable: false
}], [_hammer.default.Tap, {
  event: 'doubletap',
  taps: 2,
  enable: false
}], [_hammer.default.Tap, {
  event: 'anytap',
  enable: false
}], [_hammer.default.Tap, {
  enable: false
}]] : null;
exports.RECOGNIZERS = RECOGNIZERS;
var RECOGNIZER_COMPATIBLE_MAP = {
  rotate: ['pinch'],
  pan: ['press', 'doubletap', 'anytap', 'tap'],
  doubletap: ['anytap'],
  anytap: ['tap']
};
exports.RECOGNIZER_COMPATIBLE_MAP = RECOGNIZER_COMPATIBLE_MAP;
var RECOGNIZER_FALLBACK_MAP = {
  doubletap: ['tap']
};
exports.RECOGNIZER_FALLBACK_MAP = RECOGNIZER_FALLBACK_MAP;
var BASIC_EVENT_ALIASES = {
  pointerdown: 'pointerdown',
  pointermove: 'pointermove',
  pointerup: 'pointerup',
  touchstart: 'pointerdown',
  touchmove: 'pointermove',
  touchend: 'pointerup',
  mousedown: 'pointerdown',
  mousemove: 'pointermove',
  mouseup: 'pointerup'
};
exports.BASIC_EVENT_ALIASES = BASIC_EVENT_ALIASES;
var INPUT_EVENT_TYPES = {
  KEY_EVENTS: ['keydown', 'keyup'],
  MOUSE_EVENTS: ['mousedown', 'mousemove', 'mouseup', 'mouseover', 'mouseout', 'mouseleave'],
  WHEEL_EVENTS: ['wheel', 'mousewheel', 'DOMMouseScroll']
};
exports.INPUT_EVENT_TYPES = INPUT_EVENT_TYPES;
var EVENT_RECOGNIZER_MAP = {
  tap: 'tap',
  anytap: 'anytap',
  doubletap: 'doubletap',
  press: 'press',
  pinch: 'pinch',
  pinchin: 'pinch',
  pinchout: 'pinch',
  pinchstart: 'pinch',
  pinchmove: 'pinch',
  pinchend: 'pinch',
  pinchcancel: 'pinch',
  rotate: 'rotate',
  rotatestart: 'rotate',
  rotatemove: 'rotate',
  rotateend: 'rotate',
  rotatecancel: 'rotate',
  pan: 'pan',
  panstart: 'pan',
  panmove: 'pan',
  panup: 'pan',
  pandown: 'pan',
  panleft: 'pan',
  panright: 'pan',
  panend: 'pan',
  pancancel: 'pan',
  swipe: 'swipe',
  swipeleft: 'swipe',
  swiperight: 'swipe',
  swipeup: 'swipe',
  swipedown: 'swipe'
};
exports.EVENT_RECOGNIZER_MAP = EVENT_RECOGNIZER_MAP;
var GESTURE_EVENT_ALIASES = {
  click: 'tap',
  anyclick: 'anytap',
  dblclick: 'doubletap',
  mousedown: 'pointerdown',
  mousemove: 'pointermove',
  mouseup: 'pointerup',
  mouseover: 'pointerover',
  mouseout: 'pointerout',
  mouseleave: 'pointerleave'
};
exports.GESTURE_EVENT_ALIASES = GESTURE_EVENT_ALIASES;
},{"./utils/hammer":"DRDa"}],"FNyj":[function(require,module,exports) {
var global = arguments[3];
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.passiveSupported = exports.document = exports.global = exports.window = exports.userAgent = void 0;
var userAgent = typeof navigator !== 'undefined' && navigator.userAgent ? navigator.userAgent.toLowerCase() : '';
exports.userAgent = userAgent;
var window_ = typeof window !== 'undefined' ? window : global;
exports.window = window_;
var global_ = typeof global !== 'undefined' ? global : window;
exports.global = global_;
var document_ = typeof document !== 'undefined' ? document : {};
exports.document = document_;
var passiveSupported = false;
exports.passiveSupported = passiveSupported;

try {
  var options = {
    get passive() {
      exports.passiveSupported = passiveSupported = true;
      return true;
    }

  };
  window_.addEventListener('test', options, options);
  window_.removeEventListener('test', options, options);
} catch (err) {}
},{}],"IXef":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _constants = require("../constants");

var _globals = require("../utils/globals");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var firefox = _globals.userAgent.indexOf('firefox') !== -1;
var WHEEL_EVENTS = _constants.INPUT_EVENT_TYPES.WHEEL_EVENTS;
var EVENT_TYPE = 'wheel';
var WHEEL_DELTA_MAGIC_SCALER = 4.000244140625;
var WHEEL_DELTA_PER_LINE = 40;
var SHIFT_MULTIPLIER = 0.25;

var WheelInput = function () {
  function WheelInput(element, callback) {
    var _this = this;

    var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
    (0, _classCallCheck2.default)(this, WheelInput);
    this.element = element;
    this.callback = callback;
    this.options = Object.assign({
      enable: true
    }, options);
    this.events = WHEEL_EVENTS.concat(options.events || []);
    this.handleEvent = this.handleEvent.bind(this);
    this.events.forEach(function (event) {
      return element.addEventListener(event, _this.handleEvent, _globals.passiveSupported ? {
        passive: false
      } : false);
    });
  }

  (0, _createClass2.default)(WheelInput, [{
    key: "destroy",
    value: function destroy() {
      var _this2 = this;

      this.events.forEach(function (event) {
        return _this2.element.removeEventListener(event, _this2.handleEvent);
      });
    }
  }, {
    key: "enableEventType",
    value: function enableEventType(eventType, enabled) {
      if (eventType === EVENT_TYPE) {
        this.options.enable = enabled;
      }
    }
  }, {
    key: "handleEvent",
    value: function handleEvent(event) {
      if (!this.options.enable) {
        return;
      }

      var value = event.deltaY;

      if (_globals.window.WheelEvent) {
        if (firefox && event.deltaMode === _globals.window.WheelEvent.DOM_DELTA_PIXEL) {
          value /= _globals.window.devicePixelRatio;
        }

        if (event.deltaMode === _globals.window.WheelEvent.DOM_DELTA_LINE) {
          value *= WHEEL_DELTA_PER_LINE;
        }
      }

      var wheelPosition = {
        x: event.clientX,
        y: event.clientY
      };

      if (value !== 0 && value % WHEEL_DELTA_MAGIC_SCALER === 0) {
        value = Math.floor(value / WHEEL_DELTA_MAGIC_SCALER);
      }

      if (event.shiftKey && value) {
        value = value * SHIFT_MULTIPLIER;
      }

      this._onWheel(event, -value, wheelPosition);
    }
  }, {
    key: "_onWheel",
    value: function _onWheel(srcEvent, delta, position) {
      this.callback({
        type: EVENT_TYPE,
        center: position,
        delta: delta,
        srcEvent: srcEvent,
        pointerType: 'mouse',
        target: srcEvent.target
      });
    }
  }]);
  return WheelInput;
}();

exports.default = WheelInput;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","../constants":"DVMa","../utils/globals":"FNyj"}],"QjpP":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _constants = require("../constants");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var MOUSE_EVENTS = _constants.INPUT_EVENT_TYPES.MOUSE_EVENTS;
var MOVE_EVENT_TYPE = 'pointermove';
var OVER_EVENT_TYPE = 'pointerover';
var OUT_EVENT_TYPE = 'pointerout';
var LEAVE_EVENT_TYPE = 'pointerleave';

var MoveInput = function () {
  function MoveInput(element, callback) {
    var _this = this;

    var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
    (0, _classCallCheck2.default)(this, MoveInput);
    this.element = element;
    this.callback = callback;
    this.pressed = false;
    this.options = Object.assign({
      enable: true
    }, options);
    this.enableMoveEvent = this.options.enable;
    this.enableLeaveEvent = this.options.enable;
    this.enableOutEvent = this.options.enable;
    this.enableOverEvent = this.options.enable;
    this.events = MOUSE_EVENTS.concat(options.events || []);
    this.handleEvent = this.handleEvent.bind(this);
    this.events.forEach(function (event) {
      return element.addEventListener(event, _this.handleEvent);
    });
  }

  (0, _createClass2.default)(MoveInput, [{
    key: "destroy",
    value: function destroy() {
      var _this2 = this;

      this.events.forEach(function (event) {
        return _this2.element.removeEventListener(event, _this2.handleEvent);
      });
    }
  }, {
    key: "enableEventType",
    value: function enableEventType(eventType, enabled) {
      if (eventType === MOVE_EVENT_TYPE) {
        this.enableMoveEvent = enabled;
      }

      if (eventType === OVER_EVENT_TYPE) {
        this.enableOverEvent = enabled;
      }

      if (eventType === OUT_EVENT_TYPE) {
        this.enableOutEvent = enabled;
      }

      if (eventType === LEAVE_EVENT_TYPE) {
        this.enableLeaveEvent = enabled;
      }
    }
  }, {
    key: "handleEvent",
    value: function handleEvent(event) {
      this.handleOverEvent(event);
      this.handleOutEvent(event);
      this.handleLeaveEvent(event);
      this.handleMoveEvent(event);
    }
  }, {
    key: "handleOverEvent",
    value: function handleOverEvent(event) {
      if (this.enableOverEvent) {
        if (event.type === 'mouseover') {
          this.callback({
            type: OVER_EVENT_TYPE,
            srcEvent: event,
            pointerType: 'mouse',
            target: event.target
          });
        }
      }
    }
  }, {
    key: "handleOutEvent",
    value: function handleOutEvent(event) {
      if (this.enableOutEvent) {
        if (event.type === 'mouseout') {
          this.callback({
            type: OUT_EVENT_TYPE,
            srcEvent: event,
            pointerType: 'mouse',
            target: event.target
          });
        }
      }
    }
  }, {
    key: "handleLeaveEvent",
    value: function handleLeaveEvent(event) {
      if (this.enableLeaveEvent) {
        if (event.type === 'mouseleave') {
          this.callback({
            type: LEAVE_EVENT_TYPE,
            srcEvent: event,
            pointerType: 'mouse',
            target: event.target
          });
        }
      }
    }
  }, {
    key: "handleMoveEvent",
    value: function handleMoveEvent(event) {
      if (this.enableMoveEvent) {
        switch (event.type) {
          case 'mousedown':
            if (event.button >= 0) {
              this.pressed = true;
            }

            break;

          case 'mousemove':
            if (event.which === 0) {
              this.pressed = false;
            }

            if (!this.pressed) {
              this.callback({
                type: MOVE_EVENT_TYPE,
                srcEvent: event,
                pointerType: 'mouse',
                target: event.target
              });
            }

            break;

          case 'mouseup':
            this.pressed = false;
            break;

          default:
        }
      }
    }
  }]);
  return MoveInput;
}();

exports.default = MoveInput;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","../constants":"DVMa"}],"DKwi":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _constants = require("../constants");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var KEY_EVENTS = _constants.INPUT_EVENT_TYPES.KEY_EVENTS;
var DOWN_EVENT_TYPE = 'keydown';
var UP_EVENT_TYPE = 'keyup';

var KeyInput = function () {
  function KeyInput(element, callback) {
    var _this = this;

    var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
    (0, _classCallCheck2.default)(this, KeyInput);
    this.element = element;
    this.callback = callback;
    this.options = Object.assign({
      enable: true
    }, options);
    this.enableDownEvent = this.options.enable;
    this.enableUpEvent = this.options.enable;
    this.events = KEY_EVENTS.concat(options.events || []);
    this.handleEvent = this.handleEvent.bind(this);
    element.tabIndex = 1;
    element.style.outline = 'none';
    this.events.forEach(function (event) {
      return element.addEventListener(event, _this.handleEvent);
    });
  }

  (0, _createClass2.default)(KeyInput, [{
    key: "destroy",
    value: function destroy() {
      var _this2 = this;

      this.events.forEach(function (event) {
        return _this2.element.removeEventListener(event, _this2.handleEvent);
      });
    }
  }, {
    key: "enableEventType",
    value: function enableEventType(eventType, enabled) {
      if (eventType === DOWN_EVENT_TYPE) {
        this.enableDownEvent = enabled;
      }

      if (eventType === UP_EVENT_TYPE) {
        this.enableUpEvent = enabled;
      }
    }
  }, {
    key: "handleEvent",
    value: function handleEvent(event) {
      var targetElement = event.target || event.srcElement;

      if (targetElement.tagName === 'INPUT' && targetElement.type === 'text' || targetElement.tagName === 'TEXTAREA') {
        return;
      }

      if (this.enableDownEvent && event.type === 'keydown') {
        this.callback({
          type: DOWN_EVENT_TYPE,
          srcEvent: event,
          key: event.key,
          target: event.target
        });
      }

      if (this.enableUpEvent && event.type === 'keyup') {
        this.callback({
          type: UP_EVENT_TYPE,
          srcEvent: event,
          key: event.key,
          target: event.target
        });
      }
    }
  }]);
  return KeyInput;
}();

exports.default = KeyInput;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","../constants":"DVMa"}],"TZDz":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var EVENT_TYPE = 'contextmenu';

var ContextmenuInput = function () {
  function ContextmenuInput(element, callback) {
    var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
    (0, _classCallCheck2.default)(this, ContextmenuInput);
    this.element = element;
    this.callback = callback;
    this.options = Object.assign({
      enable: true
    }, options);
    this.handleEvent = this.handleEvent.bind(this);
    element.addEventListener('contextmenu', this.handleEvent);
  }

  (0, _createClass2.default)(ContextmenuInput, [{
    key: "destroy",
    value: function destroy() {
      this.element.removeEventListener('contextmenu', this.handleEvent);
    }
  }, {
    key: "enableEventType",
    value: function enableEventType(eventType, enabled) {
      if (eventType === EVENT_TYPE) {
        this.options.enable = enabled;
      }
    }
  }, {
    key: "handleEvent",
    value: function handleEvent(event) {
      if (!this.options.enable) {
        return;
      }

      this.callback({
        type: EVENT_TYPE,
        center: {
          x: event.clientX,
          y: event.clientY
        },
        srcEvent: event,
        pointerType: 'mouse',
        target: event.target
      });
    }
  }]);
  return ContextmenuInput;
}();

exports.default = ContextmenuInput;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky"}],"BEng":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.whichButtons = whichButtons;
exports.getOffsetPosition = getOffsetPosition;
var DOWN_EVENT = 1;
var MOVE_EVENT = 2;
var UP_EVENT = 4;
var MOUSE_EVENTS = {
  pointerdown: DOWN_EVENT,
  pointermove: MOVE_EVENT,
  pointerup: UP_EVENT,
  mousedown: DOWN_EVENT,
  mousemove: MOVE_EVENT,
  mouseup: UP_EVENT
};
var MOUSE_EVENT_WHICH_LEFT = 1;
var MOUSE_EVENT_WHICH_MIDDLE = 2;
var MOUSE_EVENT_WHICH_RIGHT = 3;
var MOUSE_EVENT_BUTTON_LEFT = 0;
var MOUSE_EVENT_BUTTON_MIDDLE = 1;
var MOUSE_EVENT_BUTTON_RIGHT = 2;
var MOUSE_EVENT_BUTTONS_LEFT_MASK = 1;
var MOUSE_EVENT_BUTTONS_RIGHT_MASK = 2;
var MOUSE_EVENT_BUTTONS_MIDDLE_MASK = 4;

function whichButtons(event) {
  var eventType = MOUSE_EVENTS[event.srcEvent.type];

  if (!eventType) {
    return null;
  }

  var _event$srcEvent = event.srcEvent,
      buttons = _event$srcEvent.buttons,
      button = _event$srcEvent.button,
      which = _event$srcEvent.which;
  var leftButton = false;
  var middleButton = false;
  var rightButton = false;

  if (eventType === UP_EVENT || eventType === MOVE_EVENT && !Number.isFinite(buttons)) {
    leftButton = which === MOUSE_EVENT_WHICH_LEFT;
    middleButton = which === MOUSE_EVENT_WHICH_MIDDLE;
    rightButton = which === MOUSE_EVENT_WHICH_RIGHT;
  } else if (eventType === MOVE_EVENT) {
    leftButton = Boolean(buttons & MOUSE_EVENT_BUTTONS_LEFT_MASK);
    middleButton = Boolean(buttons & MOUSE_EVENT_BUTTONS_MIDDLE_MASK);
    rightButton = Boolean(buttons & MOUSE_EVENT_BUTTONS_RIGHT_MASK);
  } else if (eventType === DOWN_EVENT) {
    leftButton = button === MOUSE_EVENT_BUTTON_LEFT;
    middleButton = button === MOUSE_EVENT_BUTTON_MIDDLE;
    rightButton = button === MOUSE_EVENT_BUTTON_RIGHT;
  }

  return {
    leftButton: leftButton,
    middleButton: middleButton,
    rightButton: rightButton
  };
}

function getOffsetPosition(event, rootElement) {
  var srcEvent = event.srcEvent;

  if (!event.center && !Number.isFinite(srcEvent.clientX)) {
    return null;
  }

  var center = event.center || {
    x: srcEvent.clientX,
    y: srcEvent.clientY
  };
  var rect = rootElement.getBoundingClientRect();
  var scaleX = rect.width / rootElement.offsetWidth;
  var scaleY = rect.height / rootElement.offsetHeight;
  var offsetCenter = {
    x: (center.x - rect.left - rootElement.clientLeft) / scaleX,
    y: (center.y - rect.top - rootElement.clientTop) / scaleY
  };
  return {
    center: center,
    offsetCenter: offsetCenter
  };
}
},{}],"vVMy":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _eventUtils = require("./event-utils");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var EventRegistrar = function () {
  function EventRegistrar(eventManager) {
    (0, _classCallCheck2.default)(this, EventRegistrar);
    this.eventManager = eventManager;
    this.handlers = [];
    this.handlersByElement = new Map();
    this.handleEvent = this.handleEvent.bind(this);
  }

  (0, _createClass2.default)(EventRegistrar, [{
    key: "isEmpty",
    value: function isEmpty() {
      return this.handlers.length === 0;
    }
  }, {
    key: "add",
    value: function add(type, handler) {
      var srcElement = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'root';
      var once = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
      var handlers = this.handlers,
          handlersByElement = this.handlersByElement;

      if (!handlersByElement.has(srcElement)) {
        handlersByElement.set(srcElement, []);
      }

      var entry = {
        type: type,
        handler: handler,
        srcElement: srcElement,
        once: once
      };
      handlers.push(entry);
      handlersByElement.get(srcElement).push(entry);
    }
  }, {
    key: "remove",
    value: function remove(type, handler) {
      var handlers = this.handlers,
          handlersByElement = this.handlersByElement;

      for (var i = handlers.length - 1; i >= 0; i--) {
        var entry = handlers[i];

        if (entry.type === type && entry.handler === handler) {
          handlers.splice(i, 1);
          var entries = handlersByElement.get(entry.srcElement);
          entries.splice(entries.indexOf(entry), 1);

          if (entries.length === 0) {
            handlersByElement["delete"](entry.srcElement);
          }
        }
      }
    }
  }, {
    key: "handleEvent",
    value: function handleEvent(event) {
      if (this.isEmpty()) {
        return;
      }

      var mjolnirEvent = this._normalizeEvent(event);

      var target = event.srcEvent.target;

      while (target && target !== mjolnirEvent.rootElement) {
        this._emit(mjolnirEvent, target);

        if (mjolnirEvent.handled) {
          return;
        }

        target = target.parentNode;
      }

      this._emit(mjolnirEvent, 'root');
    }
  }, {
    key: "_emit",
    value: function _emit(event, srcElement) {
      var entries = this.handlersByElement.get(srcElement);

      if (entries) {
        var immediatePropagationStopped = false;

        var stopPropagation = function stopPropagation() {
          event.handled = true;
        };

        var stopImmediatePropagation = function stopImmediatePropagation() {
          event.handled = true;
          immediatePropagationStopped = true;
        };

        var entriesToRemove = [];

        for (var i = 0; i < entries.length; i++) {
          var _entries$i = entries[i],
              type = _entries$i.type,
              handler = _entries$i.handler,
              once = _entries$i.once;
          handler(Object.assign({}, event, {
            type: type,
            stopPropagation: stopPropagation,
            stopImmediatePropagation: stopImmediatePropagation
          }));

          if (once) {
            entriesToRemove.push(entries[i]);
          }

          if (immediatePropagationStopped) {
            break;
          }
        }

        for (var _i = 0; _i < entriesToRemove.length; _i++) {
          var _entriesToRemove$_i = entriesToRemove[_i],
              type = _entriesToRemove$_i.type,
              handler = _entriesToRemove$_i.handler;
          this.remove(type, handler);
        }
      }
    }
  }, {
    key: "_normalizeEvent",
    value: function _normalizeEvent(event) {
      var rootElement = this.eventManager.element;
      return Object.assign({}, event, (0, _eventUtils.whichButtons)(event), (0, _eventUtils.getOffsetPosition)(event, rootElement), {
        handled: false,
        rootElement: rootElement
      });
    }
  }]);
  return EventRegistrar;
}();

exports.default = EventRegistrar;
},{"@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","./event-utils":"BEng"}],"Vp4T":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));

var _hammer = require("./utils/hammer");

var _wheelInput = _interopRequireDefault(require("./inputs/wheel-input"));

var _moveInput = _interopRequireDefault(require("./inputs/move-input"));

var _keyInput = _interopRequireDefault(require("./inputs/key-input"));

var _contextmenuInput = _interopRequireDefault(require("./inputs/contextmenu-input"));

var _eventRegistrar = _interopRequireDefault(require("./utils/event-registrar"));

var _constants = require("./constants");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var DEFAULT_OPTIONS = {
  events: null,
  recognizers: null,
  recognizerOptions: {},
  Manager: _hammer.Manager,
  touchAction: 'none'
};

var EventManager = function () {
  function EventManager() {
    var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
    var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck2.default)(this, EventManager);
    this.options = Object.assign({}, DEFAULT_OPTIONS, options);
    this.events = new Map();
    this._onBasicInput = this._onBasicInput.bind(this);
    this._onOtherEvent = this._onOtherEvent.bind(this);
    this.setElement(element);
    var events = options.events;

    if (events) {
      this.on(events);
    }
  }

  (0, _createClass2.default)(EventManager, [{
    key: "setElement",
    value: function setElement(element) {
      var _this = this;

      if (this.element) {
        this.destroy();
      }

      this.element = element;

      if (!element) {
        return;
      }

      var options = this.options;
      var ManagerClass = options.Manager;
      this.manager = new ManagerClass(element, {
        touchAction: options.touchAction,
        recognizers: options.recognizers || _constants.RECOGNIZERS
      }).on('hammer.input', this._onBasicInput);

      if (!options.recognizers) {
        Object.keys(_constants.RECOGNIZER_COMPATIBLE_MAP).forEach(function (name) {
          var recognizer = _this.manager.get(name);

          if (recognizer) {
            _constants.RECOGNIZER_COMPATIBLE_MAP[name].forEach(function (otherName) {
              recognizer.recognizeWith(otherName);
            });
          }
        });
      }

      for (var recognizerName in options.recognizerOptions) {
        var recognizer = this.manager.get(recognizerName);

        if (recognizer) {
          var recognizerOption = options.recognizerOptions[recognizerName];
          delete recognizerOption.enable;
          recognizer.set(recognizerOption);
        }
      }

      this.wheelInput = new _wheelInput.default(element, this._onOtherEvent, {
        enable: false
      });
      this.moveInput = new _moveInput.default(element, this._onOtherEvent, {
        enable: false
      });
      this.keyInput = new _keyInput.default(element, this._onOtherEvent, {
        enable: false
      });
      this.contextmenuInput = new _contextmenuInput.default(element, this._onOtherEvent, {
        enable: false
      });
      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = this.events[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var _step$value = (0, _slicedToArray2.default)(_step.value, 2),
              eventAlias = _step$value[0],
              eventRegistrar = _step$value[1];

          if (!eventRegistrar.isEmpty()) {
            this._toggleRecognizer(eventRegistrar.recognizerName, true);

            this.manager.on(eventAlias, eventRegistrar.handleEvent);
          }
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator["return"] != null) {
            _iterator["return"]();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }
    }
  }, {
    key: "destroy",
    value: function destroy() {
      if (this.element) {
        this.wheelInput.destroy();
        this.moveInput.destroy();
        this.keyInput.destroy();
        this.contextmenuInput.destroy();
        this.manager.destroy();
        this.wheelInput = null;
        this.moveInput = null;
        this.keyInput = null;
        this.contextmenuInput = null;
        this.manager = null;
        this.element = null;
      }
    }
  }, {
    key: "on",
    value: function on(event, handler, srcElement) {
      this._addEventHandler(event, handler, srcElement, false);
    }
  }, {
    key: "once",
    value: function once(event, handler, srcElement) {
      this._addEventHandler(event, handler, srcElement, true);
    }
  }, {
    key: "off",
    value: function off(event, handler) {
      this._removeEventHandler(event, handler);
    }
  }, {
    key: "_toggleRecognizer",
    value: function _toggleRecognizer(name, enabled) {
      var manager = this.manager;

      if (!manager) {
        return;
      }

      var recognizer = manager.get(name);

      if (recognizer && recognizer.options.enable !== enabled) {
        recognizer.set({
          enable: enabled
        });
        var fallbackRecognizers = _constants.RECOGNIZER_FALLBACK_MAP[name];

        if (fallbackRecognizers && !this.options.recognizers) {
          fallbackRecognizers.forEach(function (otherName) {
            var otherRecognizer = manager.get(otherName);

            if (enabled) {
              otherRecognizer.requireFailure(name);
              recognizer.dropRequireFailure(otherName);
            } else {
              otherRecognizer.dropRequireFailure(name);
            }
          });
        }
      }

      this.wheelInput.enableEventType(name, enabled);
      this.moveInput.enableEventType(name, enabled);
      this.keyInput.enableEventType(name, enabled);
      this.contextmenuInput.enableEventType(name, enabled);
    }
  }, {
    key: "_addEventHandler",
    value: function _addEventHandler(event, handler, srcElement, once) {
      if (typeof event !== 'string') {
        srcElement = handler;

        for (var eventName in event) {
          this._addEventHandler(eventName, event[eventName], srcElement, once);
        }

        return;
      }

      var manager = this.manager,
          events = this.events;
      var eventAlias = _constants.GESTURE_EVENT_ALIASES[event] || event;
      var eventRegistrar = events.get(eventAlias);

      if (!eventRegistrar) {
        eventRegistrar = new _eventRegistrar.default(this);
        events.set(eventAlias, eventRegistrar);
        eventRegistrar.recognizerName = _constants.EVENT_RECOGNIZER_MAP[eventAlias] || eventAlias;

        if (manager) {
          manager.on(eventAlias, eventRegistrar.handleEvent);
        }
      }

      this._toggleRecognizer(eventRegistrar.recognizerName, true);

      eventRegistrar.add(event, handler, srcElement, once);
    }
  }, {
    key: "_removeEventHandler",
    value: function _removeEventHandler(event, handler) {
      if (typeof event !== 'string') {
        for (var eventName in event) {
          this._removeEventHandler(eventName, event[eventName]);
        }

        return;
      }

      var events = this.events;
      var eventAlias = _constants.GESTURE_EVENT_ALIASES[event] || event;
      var eventRegistrar = events.get(eventAlias);

      if (!eventRegistrar) {
        return;
      }

      eventRegistrar.remove(event, handler);

      if (eventRegistrar.isEmpty()) {
        var recognizerName = eventRegistrar.recognizerName;
        var isRecognizerUsed = false;
        var _iteratorNormalCompletion2 = true;
        var _didIteratorError2 = false;
        var _iteratorError2 = undefined;

        try {
          for (var _iterator2 = events.values()[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
            var eh = _step2.value;

            if (eh.recognizerName === recognizerName && !eh.isEmpty()) {
              isRecognizerUsed = true;
              break;
            }
          }
        } catch (err) {
          _didIteratorError2 = true;
          _iteratorError2 = err;
        } finally {
          try {
            if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) {
              _iterator2["return"]();
            }
          } finally {
            if (_didIteratorError2) {
              throw _iteratorError2;
            }
          }
        }

        if (!isRecognizerUsed) {
          this._toggleRecognizer(recognizerName, false);
        }
      }
    }
  }, {
    key: "_onBasicInput",
    value: function _onBasicInput(event) {
      var srcEvent = event.srcEvent;
      var alias = _constants.BASIC_EVENT_ALIASES[srcEvent.type];

      if (alias) {
        this.manager.emit(alias, event);
      }
    }
  }, {
    key: "_onOtherEvent",
    value: function _onOtherEvent(event) {
      this.manager.emit(event.type, event);
    }
  }]);
  return EventManager;
}();

exports.default = EventManager;
},{"@babel/runtime/helpers/esm/slicedToArray":"U1JK","@babel/runtime/helpers/esm/classCallCheck":"uYrB","@babel/runtime/helpers/esm/createClass":"Q7Ky","./utils/hammer":"DRDa","./inputs/wheel-input":"IXef","./inputs/move-input":"QjpP","./inputs/key-input":"DKwi","./inputs/contextmenu-input":"TZDz","./utils/event-registrar":"vVMy","./constants":"DVMa"}],"NqPa":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "EventManager", {
  enumerable: true,
  get: function () {
    return _eventManager.default;
  }
});

var _eventManager = _interopRequireDefault(require("./event-manager"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./event-manager":"Vp4T"}],"Dij8":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _layerManager = _interopRequireDefault(require("./layer-manager"));

var _viewManager = _interopRequireDefault(require("./view-manager"));

var _mapView = _interopRequireDefault(require("../views/map-view"));

var _effectManager = _interopRequireDefault(require("../experimental/lib/effect-manager"));

var _effect = _interopRequireDefault(require("../experimental/lib/effect"));

var _log = _interopRequireDefault(require("../utils/log"));

var _constants = _interopRequireDefault(require("luma.gl/constants"));

var _luma = require("luma.gl");

var _probe = require("probe.gl");

var _mjolnir = require("mjolnir.js");

var _assert = _interopRequireDefault(require("../utils/assert"));

var _constants2 = require("./constants");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.


/* global document */
function noop() {}

var getCursor = function getCursor(_ref) {
  var isDragging = _ref.isDragging;
  return isDragging ? 'grabbing' : 'grab';
};

function getPropTypes(PropTypes) {
  // Note: Arrays (layers, views, ) can contain falsy values
  return {
    id: PropTypes.string,
    width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
    height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
    // layer/view/controller settings
    layers: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
    layerFilter: PropTypes.func,
    views: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
    viewState: PropTypes.object,
    effects: PropTypes.arrayOf(PropTypes.instanceOf(_effect.default)),
    controller: PropTypes.oneOfType([PropTypes.func, PropTypes.bool, PropTypes.object]),
    // GL settings
    gl: PropTypes.object,
    glOptions: PropTypes.object,
    parameters: PropTypes.object,
    pickingRadius: PropTypes.number,
    useDevicePixels: PropTypes.bool,
    // Callbacks
    onWebGLInitialized: PropTypes.func,
    onResize: PropTypes.func,
    onViewStateChange: PropTypes.func,
    onBeforeRender: PropTypes.func,
    onAfterRender: PropTypes.func,
    onLayerClick: PropTypes.func,
    onLayerHover: PropTypes.func,
    onLoad: PropTypes.func,
    // Debug settings
    debug: PropTypes.bool,
    drawPickingColors: PropTypes.bool,
    // Experimental props
    // Forces a redraw every animation frame
    _animate: PropTypes.bool
  };
}

var defaultProps = {
  id: 'deckgl-overlay',
  width: '100%',
  height: '100%',
  pickingRadius: 0,
  layerFilter: null,
  glOptions: {},
  gl: null,
  layers: [],
  effects: [],
  views: null,
  controller: null,
  // Rely on external controller, e.g. react-map-gl
  useDevicePixels: true,
  _animate: false,
  onWebGLInitialized: noop,
  onResize: noop,
  onViewStateChange: noop,
  onBeforeRender: noop,
  onAfterRender: noop,
  onLayerClick: null,
  onLayerHover: null,
  onLoad: noop,
  _onMetrics: null,
  getCursor: getCursor,
  debug: false,
  drawPickingColors: false
};

var Deck =
/*#__PURE__*/
function () {
  function Deck(props) {
    _classCallCheck(this, Deck);

    props = Object.assign({}, defaultProps, props);
    this.width = 0; // "read-only", auto-updated from canvas

    this.height = 0; // "read-only", auto-updated from canvas
    // Maps view descriptors to vieports, rebuilds when width/height/viewState/views change

    this.viewManager = null;
    this.layerManager = null;
    this.effectManager = null;
    this.stats = new _probe.Stats({
      id: 'deck.gl'
    });
    this._needsRedraw = true;
    this.viewState = props.initialViewState || null; // Internal view state if no callback is supplied

    this.interactiveState = {
      isDragging: false // Whether the cursor is down

    }; // Bind methods

    this._onEvent = this._onEvent.bind(this);
    this._onClick = this._onClick.bind(this);
    this._onPointerMove = this._onPointerMove.bind(this);
    this._onPointerLeave = this._onPointerLeave.bind(this);
    this._pickAndCallback = this._pickAndCallback.bind(this);
    this._onRendererInitialized = this._onRendererInitialized.bind(this);
    this._onRenderFrame = this._onRenderFrame.bind(this);
    this._onViewStateChange = this._onViewStateChange.bind(this);
    this._onInteractiveStateChange = this._onInteractiveStateChange.bind(this);

    if (!props.gl) {
      // Note: LayerManager creation deferred until gl context available
      if (typeof document !== 'undefined') {
        this.canvas = this._createCanvas(props);
      }
    }

    this.animationLoop = this._createAnimationLoop(props);
    this.setProps(props);
    this.animationLoop.start();
  }

  _createClass(Deck, [{
    key: "finalize",
    value: function finalize() {
      this.animationLoop.stop();
      this.animationLoop = null;

      if (this.layerManager) {
        this.layerManager.finalize();
        this.layerManager = null;
      }

      if (this.viewManager) {
        this.viewManager.finalize();
        this.viewManager = null;
      }

      if (this.eventManager) {
        this.eventManager.destroy();
      }
    }
  }, {
    key: "setProps",
    value: function setProps(props) {
      this.stats.timeStart('deck.setProps');
      props = Object.assign({}, this.props, props);
      this.props = props; // Update CSS size of canvas

      this._setCanvasSize(props); // We need to overwrite CSS style width and height with actual, numeric values


      var newProps = Object.assign({}, props, {
        views: this._getViews(props),
        width: this.width,
        height: this.height
      });

      var viewState = this._getViewState(props);

      if (viewState) {
        newProps.viewState = viewState;
      } // Update view manager props


      if (this.viewManager) {
        this.viewManager.setProps(newProps);
      } // Update layer manager props (but not size)


      if (this.layerManager) {
        this.layerManager.setProps(newProps);
      } // Update animation loop


      if (this.animationLoop) {
        this.animationLoop.setProps(newProps);
      }

      this.stats.timeEnd('deck.setProps');
    } // Public API
    // Check if a redraw is needed
    // Returns `false` or a string summarizing the redraw reason

  }, {
    key: "needsRedraw",
    value: function needsRedraw() {
      var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          _ref2$clearRedrawFlag = _ref2.clearRedrawFlags,
          clearRedrawFlags = _ref2$clearRedrawFlag === void 0 ? true : _ref2$clearRedrawFlag;

      if (this.props._animate) {
        return 'Deck._animate';
      }

      var redraw = this._needsRedraw;

      if (clearRedrawFlags) {
        this._needsRedraw = false;
      }

      var viewManagerNeedsRedraw = this.viewManager.needsRedraw({
        clearRedrawFlags: clearRedrawFlags
      });
      var layerManagerNeedsRedraw = this.layerManager.needsRedraw({
        clearRedrawFlags: clearRedrawFlags
      });
      redraw = redraw || viewManagerNeedsRedraw || layerManagerNeedsRedraw;
      return redraw;
    }
  }, {
    key: "getViews",
    value: function getViews() {
      return this.viewManager.views;
    } // Get a set of viewports for a given width and height

  }, {
    key: "getViewports",
    value: function getViewports(rect) {
      return this.viewManager.getViewports(rect);
    }
  }, {
    key: "pickObject",
    value: function pickObject(_ref3) {
      var x = _ref3.x,
          y = _ref3.y,
          _ref3$radius = _ref3.radius,
          radius = _ref3$radius === void 0 ? 0 : _ref3$radius,
          _ref3$layerIds = _ref3.layerIds,
          layerIds = _ref3$layerIds === void 0 ? null : _ref3$layerIds;
      this.stats.timeStart('deck.pickObject');
      var selectedInfos = this.layerManager.pickObject({
        x: x,
        y: y,
        radius: radius,
        layerIds: layerIds,
        viewports: this.getViewports({
          x: x,
          y: y
        }),
        mode: 'query',
        depth: 1
      });
      this.stats.timeEnd('deck.pickObject');
      return selectedInfos.length ? selectedInfos[0] : null;
    }
  }, {
    key: "pickMultipleObjects",
    value: function pickMultipleObjects(_ref4) {
      var x = _ref4.x,
          y = _ref4.y,
          _ref4$radius = _ref4.radius,
          radius = _ref4$radius === void 0 ? 0 : _ref4$radius,
          _ref4$layerIds = _ref4.layerIds,
          layerIds = _ref4$layerIds === void 0 ? null : _ref4$layerIds,
          _ref4$depth = _ref4.depth,
          depth = _ref4$depth === void 0 ? 10 : _ref4$depth;
      this.stats.timeStart('deck.pickMultipleObjects');
      var selectedInfos = this.layerManager.pickObject({
        x: x,
        y: y,
        radius: radius,
        layerIds: layerIds,
        viewports: this.getViewports({
          x: x,
          y: y
        }),
        mode: 'query',
        depth: depth
      });
      this.stats.timeEnd('deck.pickMultipleObjects');
      return selectedInfos;
    }
  }, {
    key: "pickObjects",
    value: function pickObjects(_ref5) {
      var x = _ref5.x,
          y = _ref5.y,
          _ref5$width = _ref5.width,
          width = _ref5$width === void 0 ? 1 : _ref5$width,
          _ref5$height = _ref5.height,
          height = _ref5$height === void 0 ? 1 : _ref5$height,
          _ref5$layerIds = _ref5.layerIds,
          layerIds = _ref5$layerIds === void 0 ? null : _ref5$layerIds;
      this.stats.timeStart('deck.pickObjects');
      var infos = this.layerManager.pickObjects({
        x: x,
        y: y,
        width: width,
        height: height,
        layerIds: layerIds,
        viewports: this.getViewports({
          x: x,
          y: y,
          width: width,
          height: height
        })
      });
      this.stats.timeEnd('deck.pickObjects');
      return infos;
    } // Private Methods
    // canvas, either string, canvas or `null`

  }, {
    key: "_createCanvas",
    value: function _createCanvas(props) {
      var canvas = props.canvas; // TODO EventManager should accept element id

      if (typeof canvas === 'string') {
        /* global document */
        canvas = document.getElementById(canvas);
        (0, _assert.default)(canvas);
      }

      if (!canvas) {
        canvas = document.createElement('canvas');
        var parent = props.parent || document.body;
        parent.appendChild(canvas);
      }

      var id = props.id,
          style = props.style;
      canvas.id = id;
      Object.assign(canvas.style, style);
      return canvas;
    } // Updates canvas width and/or height, if provided as props

  }, {
    key: "_setCanvasSize",
    value: function _setCanvasSize(props) {
      if (!this.canvas) {
        return;
      }

      var width = props.width,
          height = props.height; // Set size ONLY if props are being provided, otherwise let canvas be layouted freely

      if (width || width === 0) {
        width = Number.isFinite(width) ? "".concat(width, "px") : width;
        this.canvas.style.width = width;
      }

      if (height || height === 0) {
        height = Number.isFinite(height) ? "".concat(height, "px") : height; // Note: position==='absolute' required for height 100% to work

        this.canvas.style.position = 'absolute';
        this.canvas.style.height = height;
      }
    } // If canvas size has changed, updates

  }, {
    key: "_updateCanvasSize",
    value: function _updateCanvasSize() {
      if (this._checkForCanvasSizeChange()) {
        var width = this.width,
            height = this.height;
        this.viewManager.setProps({
          width: width,
          height: height
        });
        this.props.onResize({
          width: this.width,
          height: this.height
        });
      }
    } // If canvas size has changed, reads out the new size and returns true

  }, {
    key: "_checkForCanvasSizeChange",
    value: function _checkForCanvasSizeChange() {
      var canvas = this.canvas;

      if (!canvas) {
        return false;
      } // Fallback to width/height when clientWidth/clientHeight are 0 or undefined.


      var newWidth = canvas.clientWidth || canvas.width;
      var newHeight = canvas.clientHeight || canvas.height;

      if (newWidth !== this.width || newHeight !== this.height) {
        this.width = newWidth;
        this.height = newHeight;
        return true;
      }

      return false;
    }
  }, {
    key: "_createAnimationLoop",
    value: function _createAnimationLoop(props) {
      var _this = this;

      var width = props.width,
          height = props.height,
          gl = props.gl,
          glOptions = props.glOptions,
          debug = props.debug,
          useDevicePixels = props.useDevicePixels,
          autoResizeDrawingBuffer = props.autoResizeDrawingBuffer;
      return new _luma.AnimationLoop({
        width: width,
        height: height,
        useDevicePixels: useDevicePixels,
        autoResizeDrawingBuffer: autoResizeDrawingBuffer,
        onCreateContext: function onCreateContext(opts) {
          return gl || (0, _luma.createGLContext)(Object.assign({}, glOptions, opts, {
            canvas: _this.canvas,
            debug: debug
          }));
        },
        onInitialize: this._onRendererInitialized,
        onRender: this._onRenderFrame,
        onBeforeRender: props.onBeforeRender,
        onAfterRender: props.onAfterRender
      });
    } // Get the most relevant view state: props.viewState, if supplied, shadows internal viewState
    // TODO: For backwards compatibility ensure numeric width and height is added to the viewState

  }, {
    key: "_getViewState",
    value: function _getViewState(props) {
      return props.viewState || this.viewState;
    } // Get the view descriptor list

  }, {
    key: "_getViews",
    value: function _getViews(props) {
      // Default to a full screen map view port
      var views = props.views || [new _mapView.default({
        id: 'default-view'
      })];
      views = Array.isArray(views) ? views : [views];

      if (views.length && props.controller) {
        // Backward compatibility: support controller prop
        views[0].props.controller = props.controller;
      }

      return views;
    }
  }, {
    key: "_pickAndCallback",
    value: function _pickAndCallback(options) {
      var pos = options.event.offsetCenter; // Do not trigger callbacks when click/hover position is invalid. Doing so will cause a
      // assertion error when attempting to unproject the position.

      if (!pos) {
        return;
      }

      var radius = this.props.pickingRadius;
      var selectedInfos = this.layerManager.pickObject({
        x: pos.x,
        y: pos.y,
        radius: radius,
        viewports: this.getViewports(pos),
        mode: options.mode,
        depth: 1,
        event: options.event
      });

      if (options.callback && selectedInfos) {
        var firstInfo = selectedInfos.find(function (info) {
          return info.index >= 0;
        }) || null; // As per documentation, send null value when no valid object is picked.

        options.callback(firstInfo, selectedInfos, options.event.srcEvent);
      }
    }
  }, {
    key: "_updateCursor",
    value: function _updateCursor() {
      if (this.canvas) {
        this.canvas.style.cursor = this.props.getCursor(this.interactiveState);
      }
    } // Updates animation props on the layer context

  }, {
    key: "_updateAnimationProps",
    value: function _updateAnimationProps(animationProps) {
      this.layerManager.context.animationProps = animationProps;
    } // Deep integration (Mapbox styles)

  }, {
    key: "_setGLContext",
    value: function _setGLContext(gl) {
      if (this.layerManager) {
        return;
      } // if external context...


      if (!this.canvas) {
        this.canvas = gl.canvas;
        (0, _luma.trackContextState)(gl, {
          enable: true,
          copyState: true
        });
      }

      (0, _luma.setParameters)(gl, {
        blend: true,
        blendFunc: [_constants.default.SRC_ALPHA, _constants.default.ONE_MINUS_SRC_ALPHA, _constants.default.ONE, _constants.default.ONE_MINUS_SRC_ALPHA],
        polygonOffsetFill: true,
        depthTest: true,
        depthFunc: _constants.default.LEQUAL
      });
      this.props.onWebGLInitialized(gl);

      if (!this.props._customRender) {
        this.eventManager = new _mjolnir.EventManager(gl.canvas, {
          events: {
            click: this._onClick,
            pointermove: this._onPointerMove,
            pointerleave: this._onPointerLeave
          }
        });

        for (var eventType in _constants2.EVENTS) {
          this.eventManager.on(eventType, this._onEvent);
        }
      }

      this.viewManager = new _viewManager.default({
        eventManager: this.eventManager,
        onViewStateChange: this._onViewStateChange,
        onInteractiveStateChange: this._onInteractiveStateChange,
        views: this._getViews(this.props),
        viewState: this._getViewState(this.props),
        width: this.width,
        height: this.height
      }); // viewManager must be initialized before layerManager
      // layerManager depends on viewport created by viewManager.

      (0, _assert.default)(this.viewManager);
      var viewport = this.viewManager.getViewports()[0]; // Note: avoid React setState due GL animation loop / setState timing issue

      this.layerManager = new _layerManager.default(gl, {
        stats: this.stats,
        viewport: viewport
      });
      this.effectManager = new _effectManager.default({
        gl: gl,
        layerManager: this.layerManager
      });
      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = this.props.effects[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var effect = _step.value;
          this.effectManager.addEffect(effect);
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return != null) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }

      this.setProps(this.props);

      this._updateCanvasSize();

      this.props.onLoad();
    }
  }, {
    key: "_drawLayers",
    value: function _drawLayers(redrawReason) {
      var gl = this.layerManager.context.gl;
      (0, _luma.setParameters)(gl, this.props.parameters);
      this.props.onBeforeRender({
        gl: gl
      });
      this.layerManager.drawLayers({
        pass: 'screen',
        viewports: this.viewManager.getViewports(),
        views: this.viewManager.getViews(),
        redrawReason: redrawReason,
        drawPickingColors: this.props.drawPickingColors,
        // Debug picking, helps in framebuffered layers
        customRender: Boolean(this.props._customRender)
      });
      this.props.onAfterRender({
        gl: gl
      });
    } // Callbacks

  }, {
    key: "_onRendererInitialized",
    value: function _onRendererInitialized(_ref6) {
      var gl = _ref6.gl;

      this._setGLContext(gl);
    }
  }, {
    key: "_onRenderFrame",
    value: function _onRenderFrame(animationProps) {
      // Log perf stats every second
      if (this.stats.oneSecondPassed()) {
        var table = this.stats.getStatsTable();
        this.stats.reset();

        _log.default.table(3, table)(); // Experimental: report metrics


        if (this.props._onMetrics) {
          for (var key in table) {
            table[key] = table[key].total;
          }

          this.props._onMetrics(table);
        }
      }

      this._updateCanvasSize();

      this._updateCursor(); // Update layers if needed (e.g. some async prop has loaded)
      // Note: This can trigger a redraw


      this.layerManager.updateLayers();
      this.stats.bump('fps'); // Needs to be done before drawing

      this._updateAnimationProps(animationProps); // Check if we need to redraw


      var redrawReason = this.needsRedraw({
        clearRedrawFlags: true
      });

      if (!redrawReason) {
        return;
      }

      this.stats.bump('redraw');

      if (this.props._customRender) {
        this.props._customRender();
      } else {
        this._drawLayers(redrawReason);
      }
    } // Callbacks

  }, {
    key: "_onViewStateChange",
    value: function _onViewStateChange(params) {
      // Let app know that view state is changing, and give it a chance to change it
      var viewState = this.props.onViewStateChange(params) || params.viewState; // If initialViewState was set on creation, auto track position

      if (this.viewState) {
        this.viewState[params.viewId] = viewState;
        this.viewManager.setProps({
          viewState: viewState
        });
      }
    }
  }, {
    key: "_onInteractiveStateChange",
    value: function _onInteractiveStateChange(_ref7) {
      var _ref7$isDragging = _ref7.isDragging,
          isDragging = _ref7$isDragging === void 0 ? false : _ref7$isDragging;

      if (isDragging !== this.interactiveState.isDragging) {
        this.interactiveState.isDragging = isDragging;
      }
    } // Route move events to layers. call the `onHover` prop of any picked layer,
    // and `onLayerHover` is called directly from here with any picking info generated by `pickLayer`.
    // @param {Object} event  A mjolnir.js event

  }, {
    key: "_onClick",
    value: function _onClick(event) {
      this._pickAndCallback({
        callback: this.props.onLayerClick,
        event: event,
        mode: 'click'
      });
    }
  }, {
    key: "_onEvent",
    value: function _onEvent(event) {
      var eventOptions = _constants2.EVENTS[event.type];
      var pos = event.offsetCenter;

      if (!eventOptions || !pos) {
        return;
      } // Reuse last picked object


      var info = this.layerManager.getLastPickedObject({
        x: pos.x,
        y: pos.y,
        viewports: this.getViewports(pos)
      });
      var layer = info.layer;
      var layerHandler = layer && (layer[eventOptions.handler] || layer.props[eventOptions.handler]);
      var rootHandler = this.props[eventOptions.handler];
      var handled = false;

      if (layerHandler) {
        handled = layerHandler.call(layer, info, event);
      }

      if (!handled && rootHandler) {
        rootHandler(info, event);
      }
    }
  }, {
    key: "_onPointerMove",
    value: function _onPointerMove(event) {
      if (event.leftButton || event.rightButton) {
        // Do not trigger onHover callbacks if mouse button is down.
        return;
      }

      this._pickAndCallback({
        callback: this.props.onLayerHover,
        event: event,
        mode: 'hover'
      });
    }
  }, {
    key: "_onPointerLeave",
    value: function _onPointerLeave(event) {
      this.layerManager.pickObject({
        x: -1,
        y: -1,
        viewports: [],
        radius: 1,
        mode: 'hover'
      });

      if (this.props.onLayerHover) {
        this.props.onLayerHover(null, [], event.srcEvent);
      }
    }
  }]);

  return Deck;
}();

exports.default = Deck;
Deck.getPropTypes = getPropTypes;
Deck.defaultProps = defaultProps;
},{"./layer-manager":"jqu2","./view-manager":"SRCU","../views/map-view":"mzbM","../experimental/lib/effect-manager":"V03Y","../experimental/lib/effect":"GHnM","../utils/log":"q39U","luma.gl/constants":"lMsC","luma.gl":"GAQa","probe.gl":"aapK","mjolnir.js":"NqPa","../utils/assert":"sRS1","./constants":"GfMx"}],"WzXM":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _layer = _interopRequireDefault(require("./layer"));

var _log = _interopRequireDefault(require("../utils/log"));

var _flatten = require("../utils/flatten");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _get(target, property, receiver) {
  if (typeof Reflect !== "undefined" && Reflect.get) {
    _get = Reflect.get;
  } else {
    _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(target, property, receiver || target);
}

function _superPropBase(object, property) {
  while (!Object.prototype.hasOwnProperty.call(object, property)) {
    object = _getPrototypeOf(object);
    if (object === null) break;
  }

  return object;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.


var CompositeLayer =
/*#__PURE__*/
function (_Layer) {
  _inherits(CompositeLayer, _Layer);

  function CompositeLayer() {
    _classCallCheck(this, CompositeLayer);

    return _possibleConstructorReturn(this, _getPrototypeOf(CompositeLayer).apply(this, arguments));
  }

  _createClass(CompositeLayer, [{
    key: "getSubLayers",
    value: function getSubLayers() {
      return this.internalState && this.internalState.subLayers || [];
    } // initializeState is usually not needed for composite layers
    // Provide empty definition to disable check for missing definition

  }, {
    key: "initializeState",
    value: function initializeState() {} // Updates selected state members and marks the composite layer to need rerender

  }, {
    key: "setState",
    value: function setState(updateObject) {
      _get(_getPrototypeOf(CompositeLayer.prototype), "setState", this).call(this, updateObject);

      this.setLayerNeedsUpdate();
    } // called to augment the info object that is bubbled up from a sublayer
    // override Layer.getPickingInfo() because decoding / setting uniform do
    // not apply to a composite layer.
    // @return null to cancel event

  }, {
    key: "getPickingInfo",
    value: function getPickingInfo(_ref) {
      var info = _ref.info;
      return info;
    } // Implement to generate subLayers

  }, {
    key: "renderLayers",
    value: function renderLayers() {
      return null;
    } // Returns true if sub layer needs to be rendered

  }, {
    key: "shouldRenderSubLayer",
    value: function shouldRenderSubLayer(id, data) {
      var overridingProps = this.props._subLayerProps;
      return data && data.length || overridingProps && overridingProps[id];
    } // Returns sub layer class for a specific sublayer

  }, {
    key: "getSubLayerClass",
    value: function getSubLayerClass(id, DefaultLayerClass) {
      var overridingProps = this.props._subLayerProps;
      return overridingProps && overridingProps[id] && overridingProps[id].type || DefaultLayerClass;
    } // Returns sub layer props for a specific sublayer

  }, {
    key: "getSubLayerProps",
    value: function getSubLayerProps(sublayerProps) {
      var _this$props = this.props,
          opacity = _this$props.opacity,
          pickable = _this$props.pickable,
          visible = _this$props.visible,
          parameters = _this$props.parameters,
          getPolygonOffset = _this$props.getPolygonOffset,
          highlightedObjectIndex = _this$props.highlightedObjectIndex,
          autoHighlight = _this$props.autoHighlight,
          highlightColor = _this$props.highlightColor,
          coordinateSystem = _this$props.coordinateSystem,
          coordinateOrigin = _this$props.coordinateOrigin,
          wrapLongitude = _this$props.wrapLongitude,
          positionFormat = _this$props.positionFormat,
          modelMatrix = _this$props.modelMatrix,
          overridingProps = _this$props._subLayerProps;
      var newProps = {
        opacity: opacity,
        pickable: pickable,
        visible: visible,
        parameters: parameters,
        getPolygonOffset: getPolygonOffset,
        highlightedObjectIndex: highlightedObjectIndex,
        autoHighlight: autoHighlight,
        highlightColor: highlightColor,
        coordinateSystem: coordinateSystem,
        coordinateOrigin: coordinateOrigin,
        wrapLongitude: wrapLongitude,
        positionFormat: positionFormat,
        modelMatrix: modelMatrix
      };

      if (sublayerProps) {
        Object.assign(newProps, sublayerProps, // experimental feature that allows users to override sublayer props via parent layer prop
        overridingProps && overridingProps[sublayerProps.id], {
          id: "".concat(this.props.id, "-").concat(sublayerProps.id),
          updateTriggers: Object.assign({
            all: this.props.updateTriggers.all
          }, sublayerProps.updateTriggers)
        });
      }

      return newProps;
    }
  }, {
    key: "_getAttributeManager",
    value: function _getAttributeManager() {
      return null;
    } // Called by layer manager to render subLayers

  }, {
    key: "_renderLayers",
    value: function _renderLayers() {
      var subLayers = this.internalState.subLayers;

      if (subLayers && !this.needsUpdate()) {
        _log.default.log(3, "Composite layer reused subLayers ".concat(this), this.internalState.subLayers)();
      } else {
        subLayers = this.renderLayers(); // Flatten the returned array, removing any null, undefined or false
        // this allows layers to render sublayers conditionally
        // (see CompositeLayer.renderLayers docs)

        subLayers = (0, _flatten.flatten)(subLayers, {
          filter: Boolean
        });
        this.internalState.subLayers = subLayers;

        _log.default.log(2, "Composite layer rendered new subLayers ".concat(this), subLayers)();
      } // populate reference to parent layer (this layer)
      // NOTE: needs to be done even when reusing layers as the parent may have changed


      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = subLayers[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var layer = _step.value;
          layer.parent = this;
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return != null) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }
    }
  }, {
    key: "isComposite",
    get: function get() {
      return true;
    }
  }]);

  return CompositeLayer;
}(_layer.default);

exports.default = CompositeLayer;
CompositeLayer.layerName = 'CompositeLayer';
},{"./layer":"qSjy","../utils/log":"q39U","../utils/flatten":"uWrz"}],"o4gX":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _controller = _interopRequireDefault(require("./controller"));

var _viewState = _interopRequireDefault(require("./view-state"));

var _math = require("math.gl");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _slicedToArray(arr, i) {
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
}

function _nonIterableRest() {
  throw new TypeError("Invalid attempt to destructure non-iterable instance");
}

function _iterableToArrayLimit(arr, i) {
  var _arr = [];
  var _n = true;
  var _d = false;
  var _e = undefined;

  try {
    for (var _i = arr[Symbol.iterator](), _s; !(_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;
}

function _arrayWithHoles(arr) {
  if (Array.isArray(arr)) return arr;
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
}

var MOVEMENT_SPEED = 1; // 1 meter per keyboard click

var ROTATION_STEP_DEGREES = 2;
/* Helpers */

function ensureFinite(value, fallbackValue) {
  return Number.isFinite(value) ? value : fallbackValue;
}

var FirstPersonState =
/*#__PURE__*/
function (_ViewState) {
  _inherits(FirstPersonState, _ViewState);

  function FirstPersonState(_ref) {
    var _this;

    var width = _ref.width,
        height = _ref.height,
        position = _ref.position,
        bearing = _ref.bearing,
        pitch = _ref.pitch,
        longitude = _ref.longitude,
        latitude = _ref.latitude,
        zoom = _ref.zoom,
        _ref$syncBearing = _ref.syncBearing,
        syncBearing = _ref$syncBearing === void 0 ? true : _ref$syncBearing,
        bounds = _ref.bounds,
        startPanEventPosition = _ref.startPanEventPosition,
        startPanPosition = _ref.startPanPosition,
        startRotateCenter = _ref.startRotateCenter,
        startRotateViewport = _ref.startRotateViewport,
        startZoomPos = _ref.startZoomPos,
        startZoom = _ref.startZoom;

    _classCallCheck(this, FirstPersonState);

    _this = _possibleConstructorReturn(this, _getPrototypeOf(FirstPersonState).call(this, {
      width: width,
      height: height,
      position: position,
      bearing: bearing,
      pitch: pitch,
      longitude: longitude,
      latitude: latitude,
      zoom: zoom
    }));
    _this._interactiveState = {
      startPanEventPosition: startPanEventPosition,
      startPanPosition: startPanPosition,
      startRotateCenter: startRotateCenter,
      startRotateViewport: startRotateViewport,
      startZoomPos: startZoomPos,
      startZoom: startZoom
    };
    return _this;
  }
  /* Public API */


  _createClass(FirstPersonState, [{
    key: "getInteractiveState",
    value: function getInteractiveState() {
      return this._interactiveState;
    }
    /**
     * Start panning
     * @param {[Number, Number]} pos - position on screen where the pointer grabs
     */

  }, {
    key: "panStart",
    value: function panStart(_ref2) {
      var pos = _ref2.pos;
      var _this$_viewportProps = this._viewportProps,
          translationX = _this$_viewportProps.translationX,
          translationY = _this$_viewportProps.translationY;
      return this._getUpdatedState({
        startPanPosition: [translationX, translationY],
        startPanEventPosition: pos
      });
    }
    /**
     * Pan
     * @param {[Number, Number]} pos - position on screen where the pointer is
     */

  }, {
    key: "pan",
    value: function pan(_ref3) {
      var pos = _ref3.pos,
          startPos = _ref3.startPos;
      var startPanEventPosition = this._interactiveState.startPanEventPosition || startPos; // when the mouse starts dragging outside of this viewport, then drags over it.
      // TODO - use interactionState flag instead

      if (!startPanEventPosition) {
        return this;
      }

      var _ref4 = this._interactiveState.startPanPosition || [],
          _ref5 = _slicedToArray(_ref4, 2),
          translationX = _ref5[0],
          translationY = _ref5[1];

      translationX = ensureFinite(translationX, this._viewportProps.translationX);
      translationY = ensureFinite(translationY, this._viewportProps.translationY);
      var deltaX = pos[0] - startPanEventPosition[0];
      var deltaY = pos[1] - startPanEventPosition[1];
      return this._getUpdatedState({
        translationX: translationX + deltaX,
        translationY: translationY - deltaY
      });
    }
    /**
     * End panning
     * Must call if `panStart()` was called
     */

  }, {
    key: "panEnd",
    value: function panEnd() {
      return this._getUpdatedState({
        startPanPosition: null,
        startPanPos: null
      });
    }
    /**
     * Start rotating
     * @param {[Number, Number]} pos - position on screen where the pointer grabs
     */

  }, {
    key: "rotateStart",
    value: function rotateStart(_ref6) {
      var pos = _ref6.pos;
      return this._getUpdatedState({
        startRotateCenter: this._viewportProps.position,
        startRotateViewport: this._viewportProps
      });
    }
    /**
     * Rotate
     * @param {[Number, Number]} pos - position on screen where the pointer is
     */

  }, {
    key: "rotate",
    value: function rotate(_ref7) {
      var deltaScaleX = _ref7.deltaScaleX,
          deltaScaleY = _ref7.deltaScaleY; // when the mouse starts dragging outside of this viewport, then drags over it.
      // TODO - use interactionState flag instead

      if (!this._interactiveState.startRotateCenter) {
        return this;
      }

      var _this$_viewportProps2 = this._viewportProps,
          bearing = _this$_viewportProps2.bearing,
          pitch = _this$_viewportProps2.pitch;
      return this._getUpdatedState({
        bearing: bearing + deltaScaleX * 10,
        pitch: pitch - deltaScaleY * 10
      });
    }
    /**
     * End rotating
     * Must call if `rotateStart()` was called
     */

  }, {
    key: "rotateEnd",
    value: function rotateEnd() {
      return this._getUpdatedState({
        startRotateCenter: null,
        startRotateViewport: null
      });
    }
    /**
     * Start zooming
     * @param {[Number, Number]} pos - position on screen where the pointer grabs
     */

  }, {
    key: "zoomStart",
    value: function zoomStart(_ref8) {
      var pos = _ref8.pos;
      return this._getUpdatedState({
        startZoomPos: pos,
        startZoom: this._viewportProps.zoom
      });
    }
    /**
     * Zoom
     * @param {[Number, Number]} pos - position on screen where the current center is
     * @param {[Number, Number]} startPos - the center position at
     *   the start of the operation. Must be supplied of `zoomStart()` was not called
     * @param {Number} scale - a number between [0, 1] specifying the accumulated
     *   relative scale.
     */

  }, {
    key: "zoom",
    value: function zoom(_ref9) {
      var pos = _ref9.pos,
          startPos = _ref9.startPos,
          scale = _ref9.scale;
      var _this$_viewportProps3 = this._viewportProps,
          zoom = _this$_viewportProps3.zoom,
          minZoom = _this$_viewportProps3.minZoom,
          maxZoom = _this$_viewportProps3.maxZoom,
          width = _this$_viewportProps3.width,
          height = _this$_viewportProps3.height,
          translationX = _this$_viewportProps3.translationX,
          translationY = _this$_viewportProps3.translationY;
      var startZoomPos = this._interactiveState.startZoomPos || startPos || pos;
      var newZoom = (0, _math.clamp)(zoom * scale, minZoom, maxZoom);
      var deltaX = pos[0] - startZoomPos[0];
      var deltaY = pos[1] - startZoomPos[1]; // Zoom around the center position

      var cx = startZoomPos[0] - width / 2;
      var cy = height / 2 - startZoomPos[1];
      /* eslint-disable no-unused-vars */

      var newTranslationX = cx - (cx - translationX) * newZoom / zoom + deltaX;
      var newTranslationY = cy - (cy - translationY) * newZoom / zoom - deltaY;
      /* eslint-enable no-unused-vars */
      // return this._getUpdatedState({
      //   position
      //   translationX: newTranslationX,
      //   translationY: newTranslationY
      // });
      // TODO HACK

      return newZoom / zoom < 1 ? this.moveBackward() : this.moveForward();
    }
    /**
     * End zooming
     * Must call if `zoomStart()` was called
     */

  }, {
    key: "zoomEnd",
    value: function zoomEnd() {
      return this._getUpdatedState({
        startZoomPos: null,
        startZoom: null
      });
    }
  }, {
    key: "moveLeft",
    value: function moveLeft() {
      var bearing = this._viewportProps.bearing;
      var newBearing = bearing - ROTATION_STEP_DEGREES;
      return this._getUpdatedState({
        bearing: newBearing
      });
    }
  }, {
    key: "moveRight",
    value: function moveRight() {
      var bearing = this._viewportProps.bearing;
      var newBearing = bearing + ROTATION_STEP_DEGREES;
      return this._getUpdatedState({
        bearing: newBearing
      });
    }
  }, {
    key: "moveForward",
    value: function moveForward() {
      var position = this._viewportProps.position;
      var direction = this.getDirection();
      var delta = new _math.Vector3(direction).normalize().scale(MOVEMENT_SPEED);
      return this._getUpdatedState({
        position: new _math.Vector3(position).add(delta)
      });
    }
  }, {
    key: "moveBackward",
    value: function moveBackward() {
      var position = this._viewportProps.position;
      var direction = this.getDirection();
      var delta = new _math.Vector3(direction).normalize().scale(-MOVEMENT_SPEED);
      return this._getUpdatedState({
        position: new _math.Vector3(position).add(delta)
      });
    }
  }, {
    key: "moveUp",
    value: function moveUp() {
      var position = this._viewportProps.position;
      var delta = [0, 0, 1];
      return this._getUpdatedState({
        position: new _math.Vector3(position).add(delta)
      });
    }
  }, {
    key: "moveDown",
    value: function moveDown() {
      var position = this._viewportProps.position;
      var delta = position[2] >= 1 ? [0, 0, -1] : [0, 0, 0];
      return this._getUpdatedState({
        position: new _math.Vector3(position).add(delta)
      });
    }
  }, {
    key: "zoomIn",
    value: function zoomIn() {
      return this._getUpdatedState({
        zoom: this._viewportProps.zoom + 0.2
      });
    }
  }, {
    key: "zoomOut",
    value: function zoomOut() {
      return this._getUpdatedState({
        zoom: this._viewportProps.zoom - 0.2
      });
    }
    /* Private methods */

  }, {
    key: "_getUpdatedState",
    value: function _getUpdatedState(newProps) {
      // Update _viewportProps
      return new FirstPersonState(Object.assign({}, this._viewportProps, this._interactiveState, newProps));
    }
  }]);

  return FirstPersonState;
}(_viewState.default);

var FirstPersonController =
/*#__PURE__*/
function (_Controller) {
  _inherits(FirstPersonController, _Controller);

  function FirstPersonController(props) {
    _classCallCheck(this, FirstPersonController);

    return _possibleConstructorReturn(this, _getPrototypeOf(FirstPersonController).call(this, FirstPersonState, props));
  }

  return FirstPersonController;
}(_controller.default);

exports.default = FirstPersonController;
},{"./controller":"Gii9","./view-state":"YDzL","math.gl":"dl2t"}],"fsKb":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _view = _interopRequireDefault(require("./view"));

var _viewport = _interopRequireDefault(require("../viewports/viewport"));

var _math = require("math.gl");

var _firstPersonController = _interopRequireDefault(require("../controllers/first-person-controller"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
}

function getDirectionFromBearingAndPitch(_ref) {
  var bearing = _ref.bearing,
      pitch = _ref.pitch;
  var spherical = new _math._SphericalCoordinates({
    bearing: bearing,
    pitch: pitch
  });
  var direction = spherical.toVector3().normalize();
  return direction;
}

var FirstPersonView =
/*#__PURE__*/
function (_View) {
  _inherits(FirstPersonView, _View);

  function FirstPersonView() {
    _classCallCheck(this, FirstPersonView);

    return _possibleConstructorReturn(this, _getPrototypeOf(FirstPersonView).apply(this, arguments));
  }

  _createClass(FirstPersonView, [{
    key: "_getViewport",
    value: function _getViewport(props) {
      // TODO - push direction handling into Matrix4.lookAt
      var _props$viewState = props.viewState,
          _props$viewState$mode = _props$viewState.modelMatrix,
          modelMatrix = _props$viewState$mode === void 0 ? null : _props$viewState$mode,
          bearing = _props$viewState.bearing,
          _props$viewState$up = _props$viewState.up,
          up = _props$viewState$up === void 0 ? [0, 0, 1] : _props$viewState$up; // Always calculate direction from bearing and pitch

      var dir = getDirectionFromBearingAndPitch({
        bearing: bearing,
        pitch: 89
      }); // Direction is relative to model coordinates, of course

      var center = modelMatrix ? modelMatrix.transformDirection(dir) : dir; // Just the direction. All the positioning is done in viewport.js

      var viewMatrix = new _math.Matrix4().lookAt({
        eye: [0, 0, 0],
        center: center,
        up: up
      });
      return new _viewport.default(Object.assign({}, props, {
        zoom: null,
        // triggers meter level zoom
        viewMatrix: viewMatrix
      }));
    }
  }, {
    key: "controller",
    get: function get() {
      return this._getControllerProps({
        type: _firstPersonController.default
      });
    }
  }]);

  return FirstPersonView;
}(_view.default);

exports.default = FirstPersonView;
FirstPersonView.displayName = 'FirstPersonView';
},{"./view":"K8TO","../viewports/viewport":"RXGn","math.gl":"dl2t","../controllers/first-person-controller":"o4gX"}],"B6sS":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _view = _interopRequireDefault(require("./view"));

var _viewport = _interopRequireDefault(require("../viewports/viewport"));

var _math = require("math.gl");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
}

function getDirectionFromBearingAndPitch(_ref) {
  var bearing = _ref.bearing,
      pitch = _ref.pitch;
  var spherical = new _math._SphericalCoordinates({
    bearing: bearing,
    pitch: pitch
  });
  return spherical.toVector3().normalize();
}

var ThirdPersonView =
/*#__PURE__*/
function (_View) {
  _inherits(ThirdPersonView, _View);

  function ThirdPersonView() {
    _classCallCheck(this, ThirdPersonView);

    return _possibleConstructorReturn(this, _getPrototypeOf(ThirdPersonView).apply(this, arguments));
  }

  _createClass(ThirdPersonView, [{
    key: "_getViewport",
    value: function _getViewport(props) {
      var _props$viewState = props.viewState,
          bearing = _props$viewState.bearing,
          pitch = _props$viewState.pitch,
          position = _props$viewState.position,
          up = _props$viewState.up,
          zoom = _props$viewState.zoom;
      var direction = getDirectionFromBearingAndPitch({
        bearing: bearing,
        pitch: pitch
      });
      var distance = zoom * 50; // TODO somehow need to flip z to make it work
      // check if the position offset is done in the base viewport

      var eye = direction.scale(-distance).multiply(new _math.Vector3(1, 1, -1));
      var viewMatrix = new _math.Matrix4().multiplyRight(new _math.Matrix4().lookAt({
        eye: eye,
        center: position,
        up: up
      }));
      return new _viewport.default(Object.assign({}, props, {
        id: this.id,
        zoom: null,
        // triggers meter level zoom
        viewMatrix: viewMatrix
      }));
    }
  }]);

  return ThirdPersonView;
}(_view.default);

exports.default = ThirdPersonView;
ThirdPersonView.displayName = 'ThirdPersonView';
},{"./view":"K8TO","../viewports/viewport":"RXGn","math.gl":"dl2t"}],"fW7L":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _viewport = _interopRequireDefault(require("../viewports/viewport"));

var _mathUtils = require("../utils/math-utils");

var mat4 = _interopRequireWildcard(require("gl-matrix/mat4"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _slicedToArray(arr, i) {
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
}

function _nonIterableRest() {
  throw new TypeError("Invalid attempt to destructure non-iterable instance");
}

function _iterableToArrayLimit(arr, i) {
  var _arr = [];
  var _n = true;
  var _d = false;
  var _e = undefined;

  try {
    for (var _i = arr[Symbol.iterator](), _s; !(_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;
}

function _arrayWithHoles(arr) {
  if (Array.isArray(arr)) return arr;
}

function _toConsumableArray(arr) {
  return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
}

function _nonIterableSpread() {
  throw new TypeError("Invalid attempt to spread non-iterable instance");
}

function _iterableToArray(iter) {
  if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}

function _arrayWithoutHoles(arr) {
  if (Array.isArray(arr)) {
    for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
      arr2[i] = arr[i];
    }

    return arr2;
  }
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
}

var DEGREES_TO_RADIANS = Math.PI / 180;
/*
 * A deck.gl Viewport class used by OrbitController
 * Adds zoom and pixel translation on top of the PerspectiveViewport
 */

var OrbitViewport =
/*#__PURE__*/
function (_Viewport) {
  _inherits(OrbitViewport, _Viewport);

  function OrbitViewport(_ref) {
    var _this;

    var _ref$id = _ref.id,
        id = _ref$id === void 0 ? 'orbit-viewport' : _ref$id,
        width = _ref.width,
        height = _ref.height,
        distance = _ref.distance,
        _ref$rotationX = _ref.rotationX,
        rotationX = _ref$rotationX === void 0 ? 0 : _ref$rotationX,
        _ref$rotationOrbit = _ref.rotationOrbit,
        rotationOrbit = _ref$rotationOrbit === void 0 ? 0 : _ref$rotationOrbit,
        _ref$orbitAxis = _ref.orbitAxis,
        orbitAxis = _ref$orbitAxis === void 0 ? 'Z' : _ref$orbitAxis,
        _ref$lookAt = _ref.lookAt,
        lookAt = _ref$lookAt === void 0 ? [0, 0, 0] : _ref$lookAt,
        _ref$up = _ref.up,
        up = _ref$up === void 0 ? [0, 1, 0] : _ref$up,
        _ref$fov = _ref.fov,
        fov = _ref$fov === void 0 ? 75 : _ref$fov,
        _ref$near = _ref.near,
        near = _ref$near === void 0 ? 1 : _ref$near,
        _ref$far = _ref.far,
        far = _ref$far === void 0 ? 100 : _ref$far,
        _ref$zoom = _ref.zoom,
        zoom = _ref$zoom === void 0 ? 1 : _ref$zoom;

    _classCallCheck(this, OrbitViewport); // TODO - Once OrbitViewport is aligned with the View system, deprecated it
    // log.deprecated('OrbitViewport', 'OrbitView')();


    var rotationMatrix = mat4.rotateX([], (0, _mathUtils.createMat4)(), -rotationX / 180 * Math.PI);

    if (orbitAxis === 'Z') {
      mat4.rotateZ(rotationMatrix, rotationMatrix, -rotationOrbit / 180 * Math.PI);
    } else {
      mat4.rotateY(rotationMatrix, rotationMatrix, -rotationOrbit / 180 * Math.PI);
    }

    var translateMatrix = (0, _mathUtils.createMat4)();
    mat4.scale(translateMatrix, translateMatrix, [zoom, zoom, zoom]);
    mat4.translate(translateMatrix, translateMatrix, [-lookAt[0], -lookAt[1], -lookAt[2]]);
    var viewMatrix = mat4.lookAt([], [0, 0, distance], [0, 0, 0], up);
    var fovRadians = fov * DEGREES_TO_RADIANS;
    var aspect = width / height;
    var perspectiveMatrix = mat4.perspective([], fovRadians, aspect, near, far);
    _this = _possibleConstructorReturn(this, _getPrototypeOf(OrbitViewport).call(this, {
      id: id,
      viewMatrix: mat4.multiply(viewMatrix, viewMatrix, mat4.multiply(rotationMatrix, rotationMatrix, translateMatrix)),
      projectionMatrix: perspectiveMatrix,
      width: width,
      height: height
    }));
    _this.width = width;
    _this.height = height;
    _this.distance = distance;
    _this.rotationX = rotationX;
    _this.rotationOrbit = rotationOrbit;
    _this.orbitAxis = orbitAxis;
    _this.lookAt = lookAt;
    _this.up = up;
    _this.fov = fov;
    _this.near = near;
    _this.far = far;
    _this.zoom = zoom;
    return _this;
  }

  _createClass(OrbitViewport, [{
    key: "project",
    value: function project(xyz) {
      var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
          _ref2$topLeft = _ref2.topLeft,
          topLeft = _ref2$topLeft === void 0 ? false : _ref2$topLeft;

      var v = (0, _mathUtils.transformVector)(this.pixelProjectionMatrix, [].concat(_toConsumableArray(xyz), [1]));

      var _v = _slicedToArray(v, 3),
          x = _v[0],
          y = _v[1],
          z = _v[2];

      var y2 = topLeft ? this.height - y : y;
      return [x, y2, z];
    }
  }, {
    key: "unproject",
    value: function unproject(xyz) {
      var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
          _ref3$topLeft = _ref3.topLeft,
          topLeft = _ref3$topLeft === void 0 ? false : _ref3$topLeft;

      var _xyz = _slicedToArray(xyz, 3),
          x = _xyz[0],
          y = _xyz[1],
          z = _xyz[2];

      var y2 = topLeft ? this.height - y : y;
      return (0, _mathUtils.transformVector)(this.pixelUnprojectionMatrix, [x, y2, z, 1]);
    }
    /** Get camera `distance` to make view fit a box centered at lookat position in the viewport.
     * @param {Array} sizes - [sizeX, sizeY, sizeZ]], define the dimensions of bounding box
     * @returns {Nunber} the new distance parameter
     */

  }, {
    key: "getDistance",
    value: function getDistance(_ref4) {
      var boundingBox = _ref4.boundingBox,
          fov = _ref4.fov;
      var halfMaxSide = Math.max(boundingBox[0], boundingBox[1], boundingBox[2]) / 2;
      var distance = halfMaxSide / Math.tan(fov / 180 * Math.PI / 2);
      return distance;
    }
    /** Move camera to make a model bounding box centered at lookat position fit in the viewport.
     * @param {Array} boundingBox - [sizeX, sizeY, sizeZ]], define the dimensions of bounding box
     * @returns a new OrbitViewport object
     */

  }, {
    key: "fitBounds",
    value: function fitBounds(boundingBox) {
      var width = this.width,
          height = this.height,
          rotationX = this.rotationX,
          rotationOrbit = this.rotationOrbit,
          orbitAxis = this.orbitAxis,
          lookAt = this.lookAt,
          up = this.up,
          fov = this.fov,
          near = this.near,
          far = this.far,
          zoom = this.zoom;
      return new OrbitViewport({
        width: width,
        height: height,
        rotationX: rotationX,
        rotationOrbit: rotationOrbit,
        orbitAxis: orbitAxis,
        up: up,
        fov: fov,
        near: near,
        far: far,
        zoom: zoom,
        lookAt: lookAt,
        distance: this.getDistance({
          boundingBox: boundingBox,
          fov: fov
        })
      });
    }
  }]);

  return OrbitViewport;
}(_viewport.default);

exports.default = OrbitViewport;
OrbitViewport.displayName = 'OrbitViewport';
},{"../viewports/viewport":"RXGn","../utils/math-utils":"Pq0P","gl-matrix/mat4":"Nd3D"}],"KyrE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _math = require("math.gl");

var _controller = _interopRequireDefault(require("./controller"));

var _orbitViewport = _interopRequireDefault(require("../deprecated/orbit-viewport"));

var _assert = _interopRequireDefault(require("../utils/assert"));

var _linearInterpolator = _interopRequireDefault(require("../transitions/linear-interpolator"));

var _transitionManager = require("./transition-manager");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

var ZOOM_TRANSITION_PROPS = {
  transitionDuration: 300,
  transitionEasing: function transitionEasing(t) {
    return t;
  },
  transitionInterpolator: new _linearInterpolator.default(['zoom']),
  transitionInterruption: _transitionManager.TRANSITION_EVENTS.BREAK
};
var defaultState = {
  lookAt: [0, 0, 0],
  rotationX: 0,
  rotationOrbit: 0,
  fov: 50,
  near: 1,
  far: 100,
  translationX: 0,
  translationY: 0,
  zoom: 1
};
var defaultConstraints = {
  minZoom: 0,
  maxZoom: Infinity
};
/* Helpers */

function ensureFinite(value, fallbackValue) {
  return Number.isFinite(value) ? value : fallbackValue;
}

var OrbitState =
/*#__PURE__*/
function () {
  function OrbitState(_ref) {
    var width = _ref.width,
        height = _ref.height,
        distance = _ref.distance,
        rotationX = _ref.rotationX,
        rotationOrbit = _ref.rotationOrbit,
        orbitAxis = _ref.orbitAxis,
        bounds = _ref.bounds,
        lookAt = _ref.lookAt,
        fov = _ref.fov,
        near = _ref.near,
        far = _ref.far,
        translationX = _ref.translationX,
        translationY = _ref.translationY,
        zoom = _ref.zoom,
        minZoom = _ref.minZoom,
        maxZoom = _ref.maxZoom,
        startPanViewport = _ref.startPanViewport,
        startPanPos = _ref.startPanPos,
        isPanning = _ref.isPanning,
        startRotateViewport = _ref.startRotateViewport,
        isRotating = _ref.isRotating,
        startZoomViewport = _ref.startZoomViewport,
        startZoomPos = _ref.startZoomPos;

    _classCallCheck(this, OrbitState);

    (0, _assert.default)(Number.isFinite(width), '`width` must be supplied');
    (0, _assert.default)(Number.isFinite(height), '`height` must be supplied');
    (0, _assert.default)(Number.isFinite(distance), '`distance` must be supplied');
    this._viewportProps = this._applyConstraints({
      width: width,
      height: height,
      distance: distance,
      rotationX: ensureFinite(rotationX, defaultState.rotationX),
      rotationOrbit: ensureFinite(rotationOrbit, defaultState.rotationOrbit),
      orbitAxis: orbitAxis,
      bounds: bounds,
      lookAt: lookAt || defaultState.lookAt,
      fov: ensureFinite(fov, defaultState.fov),
      near: ensureFinite(near, defaultState.near),
      far: ensureFinite(far, defaultState.far),
      translationX: ensureFinite(translationX, defaultState.translationX),
      translationY: ensureFinite(translationY, defaultState.translationY),
      zoom: ensureFinite(zoom, defaultState.zoom),
      minZoom: ensureFinite(minZoom, defaultConstraints.minZoom),
      maxZoom: ensureFinite(maxZoom, defaultConstraints.maxZoom)
    });
    this._interactiveState = {
      startPanViewport: startPanViewport,
      startPanPos: startPanPos,
      isPanning: isPanning,
      startRotateViewport: startRotateViewport,
      isRotating: isRotating,
      startZoomViewport: startZoomViewport,
      startZoomPos: startZoomPos
    };
  }
  /* Public API */


  _createClass(OrbitState, [{
    key: "getViewportProps",
    value: function getViewportProps() {
      return this._viewportProps;
    }
  }, {
    key: "getInteractiveState",
    value: function getInteractiveState() {
      return this._interactiveState;
    }
    /**
     * Start panning
     * @param {[Number, Number]} pos - position on screen where the pointer grabs
     */

  }, {
    key: "panStart",
    value: function panStart(_ref2) {
      var pos = _ref2.pos;
      var viewport = new _orbitViewport.default(this._viewportProps);
      return this._getUpdatedOrbitState({
        startPanPos: pos,
        startPanViewport: viewport
      });
    }
    /**
     * Pan
     * @param {[Number, Number]} pos - position on screen where the pointer is
     */

  }, {
    key: "pan",
    value: function pan(_ref3) {
      var pos = _ref3.pos,
          startPos = _ref3.startPos;

      if (this._interactiveState.isRotating) {
        return this._getUpdatedOrbitState();
      }

      var startPanPos = this._interactiveState.startPanPos || startPos;
      (0, _assert.default)(startPanPos, '`startPanPos` props is required');
      var viewport = this._interactiveState.startPanViewport || new _orbitViewport.default(this._viewportProps);
      var deltaX = pos[0] - startPanPos[0];
      var deltaY = pos[1] - startPanPos[1];
      var center = viewport.project(viewport.lookAt);
      var newLookAt = viewport.unproject([center[0] - deltaX, center[1] - deltaY, center[2]]);
      return this._getUpdatedOrbitState({
        lookAt: newLookAt,
        isPanning: true
      });
    }
    /**
     * End panning
     * Must call if `panStart()` was called
     */

  }, {
    key: "panEnd",
    value: function panEnd() {
      return this._getUpdatedOrbitState({
        startPanViewport: null,
        startPanPos: null,
        isPanning: null
      });
    }
    /**
     * Start rotating
     * @param {[Number, Number]} pos - position on screen where the pointer grabs
     */

  }, {
    key: "rotateStart",
    value: function rotateStart(_ref4) {
      var pos = _ref4.pos; // Rotation center should be the worldspace position at the center of the
      // the screen. If not found, use the last one.

      var viewport = new _orbitViewport.default(this._viewportProps);
      return this._getUpdatedOrbitState({
        startRotateViewport: viewport
      });
    }
    /**
     * Rotate
     * @param {[Number, Number]} pos - position on screen where the pointer is
     */

  }, {
    key: "rotate",
    value: function rotate(_ref5) {
      var deltaScaleX = _ref5.deltaScaleX,
          deltaScaleY = _ref5.deltaScaleY;

      if (this._interactiveState.isPanning) {
        return this._getUpdatedOrbitState();
      }

      var startRotateViewport = this._interactiveState.startRotateViewport;

      var _ref6 = startRotateViewport || {},
          rotationX = _ref6.rotationX,
          rotationOrbit = _ref6.rotationOrbit;

      rotationX = ensureFinite(rotationX, this._viewportProps.rotationX);
      rotationOrbit = ensureFinite(rotationOrbit, this._viewportProps.rotationOrbit);
      var newRotationX = (0, _math.clamp)(rotationX - deltaScaleY * 180, -89.999, 89.999);
      var newRotationOrbit = (rotationOrbit - deltaScaleX * 180) % 360;
      return this._getUpdatedOrbitState({
        rotationX: newRotationX,
        rotationOrbit: newRotationOrbit,
        isRotating: true
      });
    }
    /**
     * End rotating
     * Must call if `rotateStart()` was called
     */

  }, {
    key: "rotateEnd",
    value: function rotateEnd() {
      return this._getUpdatedOrbitState({
        startRotateViewport: null,
        isRotating: null
      });
    } // default implementation of shortest path between two view states

  }, {
    key: "shortestPathFrom",
    value: function shortestPathFrom(viewState) {
      var props = Object.assign({}, this._viewportProps);
      return props;
    }
    /**
     * Start zooming
     * @param {[Number, Number]} pos - position on screen where the pointer grabs
     */

  }, {
    key: "zoomStart",
    value: function zoomStart(_ref7) {
      var pos = _ref7.pos;
      var viewport = new _orbitViewport.default(this._viewportProps);
      return this._getUpdatedOrbitState({
        startZoomViewport: viewport,
        startZoomPos: pos
      });
    }
    /**
     * Zoom
     * @param {[Number, Number]} pos - position on screen where the current center is
     * @param {[Number, Number]} startPos - the center position at
     *   the start of the operation. Must be supplied of `zoomStart()` was not called
     * @param {Number} scale - a number between [0, 1] specifying the accumulated
     *   relative scale.
     */

  }, {
    key: "zoom",
    value: function zoom(_ref8) {
      var pos = _ref8.pos,
          startPos = _ref8.startPos,
          scale = _ref8.scale;
      var _this$_viewportProps = this._viewportProps,
          zoom = _this$_viewportProps.zoom,
          minZoom = _this$_viewportProps.minZoom,
          maxZoom = _this$_viewportProps.maxZoom,
          width = _this$_viewportProps.width,
          height = _this$_viewportProps.height;
      var startZoomPos = this._interactiveState.startZoomPos || startPos || pos;
      var viewport = this._interactiveState.startZoomViewport || new _orbitViewport.default(this._viewportProps);
      var newZoom = (0, _math.clamp)(zoom * scale, minZoom, maxZoom);
      var deltaX = pos[0] - startZoomPos[0];
      var deltaY = pos[1] - startZoomPos[1]; // Zoom around the center position

      var cx = startZoomPos[0] - width / 2;
      var cy = height / 2 - startZoomPos[1];
      var center = viewport.project(viewport.lookAt);
      var newCenterX = center[0] - cx + cx * newZoom / zoom + deltaX;
      var newCenterY = center[1] + cy - cy * newZoom / zoom - deltaY;
      var newLookAt = viewport.unproject([newCenterX, newCenterY, center[2]]);
      return this._getUpdatedOrbitState({
        lookAt: newLookAt,
        zoom: newZoom
      });
    }
    /**
     * End zooming
     * Must call if `zoomStart()` was called
     */

  }, {
    key: "zoomEnd",
    value: function zoomEnd() {
      return this._getUpdatedOrbitState({
        startZoomPos: null
      });
    }
    /* Private methods */

  }, {
    key: "_getUpdatedOrbitState",
    value: function _getUpdatedOrbitState(newProps) {
      // Update _viewportProps
      return new OrbitState(Object.assign({}, this._viewportProps, this._interactiveState, newProps));
    } // Apply any constraints (mathematical or defined by _viewportProps) to map state

  }, {
    key: "_applyConstraints",
    value: function _applyConstraints(props) {
      // Ensure zoom is within specified range
      var maxZoom = props.maxZoom,
          minZoom = props.minZoom,
          zoom = props.zoom;
      props.zoom = zoom > maxZoom ? maxZoom : zoom;
      props.zoom = zoom < minZoom ? minZoom : zoom;
      return props;
    }
  }]);

  return OrbitState;
}();

var OrbitController =
/*#__PURE__*/
function (_Controller) {
  _inherits(OrbitController, _Controller);

  function OrbitController(props) {
    _classCallCheck(this, OrbitController);

    return _possibleConstructorReturn(this, _getPrototypeOf(OrbitController).call(this, OrbitState, props));
  }

  _createClass(OrbitController, [{
    key: "_getTransitionProps",
    value: function _getTransitionProps() {
      // Enable transitions for zoom change
      return ZOOM_TRANSITION_PROPS;
    }
  }]);

  return OrbitController;
}(_controller.default);

exports.default = OrbitController;
},{"math.gl":"dl2t","./controller":"Gii9","../deprecated/orbit-viewport":"fW7L","../utils/assert":"sRS1","../transitions/linear-interpolator":"wq52","./transition-manager":"bUf5"}],"i2zU":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _view = _interopRequireDefault(require("./view"));

var _viewport = _interopRequireDefault(require("../viewports/viewport"));

var _mathUtils = require("../utils/math-utils");

var mat4 = _interopRequireWildcard(require("gl-matrix/mat4"));

var _orbitController = _interopRequireDefault(require("../controllers/orbit-controller"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _slicedToArray(arr, i) {
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
}

function _nonIterableRest() {
  throw new TypeError("Invalid attempt to destructure non-iterable instance");
}

function _iterableToArrayLimit(arr, i) {
  var _arr = [];
  var _n = true;
  var _d = false;
  var _e = undefined;

  try {
    for (var _i = arr[Symbol.iterator](), _s; !(_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;
}

function _arrayWithHoles(arr) {
  if (Array.isArray(arr)) return arr;
}

function _toConsumableArray(arr) {
  return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
}

function _nonIterableSpread() {
  throw new TypeError("Invalid attempt to spread non-iterable instance");
}

function _iterableToArray(iter) {
  if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}

function _arrayWithoutHoles(arr) {
  if (Array.isArray(arr)) {
    for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
      arr2[i] = arr[i];
    }

    return arr2;
  }
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
}

var DEGREES_TO_RADIANS = Math.PI / 180; // TODO - remove need for custom project overrides

var OrbitViewport =
/*#__PURE__*/
function (_Viewport) {
  _inherits(OrbitViewport, _Viewport);

  function OrbitViewport() {
    _classCallCheck(this, OrbitViewport);

    return _possibleConstructorReturn(this, _getPrototypeOf(OrbitViewport).apply(this, arguments));
  }

  _createClass(OrbitViewport, [{
    key: "project",
    value: function project(xyz) {
      var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
          _ref$topLeft = _ref.topLeft,
          topLeft = _ref$topLeft === void 0 ? false : _ref$topLeft;

      var v = (0, _mathUtils.transformVector)(this.pixelProjectionMatrix, [].concat(_toConsumableArray(xyz), [1]));

      var _v = _slicedToArray(v, 3),
          x = _v[0],
          y = _v[1],
          z = _v[2];

      var y2 = topLeft ? this.height - y : y;
      return [x, y2, z];
    }
  }, {
    key: "unproject",
    value: function unproject(xyz) {
      var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
          _ref2$topLeft = _ref2.topLeft,
          topLeft = _ref2$topLeft === void 0 ? false : _ref2$topLeft;

      var _xyz = _slicedToArray(xyz, 3),
          x = _xyz[0],
          y = _xyz[1],
          z = _xyz[2];

      var y2 = topLeft ? this.height - y : y;
      return (0, _mathUtils.transformVector)(this.pixelUnprojectionMatrix, [x, y2, z, 1]);
    }
  }]);

  return OrbitViewport;
}(_viewport.default);

var OrbitView =
/*#__PURE__*/
function (_View) {
  _inherits(OrbitView, _View);

  function OrbitView() {
    _classCallCheck(this, OrbitView);

    return _possibleConstructorReturn(this, _getPrototypeOf(OrbitView).apply(this, arguments));
  }

  _createClass(OrbitView, [{
    key: "_getViewport",

    /* eslint-disable complexity, max-statements */
    value: function _getViewport(props) {
      var viewState = props.viewState;
      var width = props.width || 1;
      var height = props.height || 1; // Get view matrix parameters from view state
      // Projection matrix arguments
      // TODO - Extracting from viewState is deprecated

      var fovy = props.fov || props.fovy || viewState.fovy || 75; // Field of view covered by camera

      var near = props.near || viewState.near || 1; // Distance of near clipping plane

      var far = props.far || viewState.far || 100; // Distance of far clipping plane

      var aspect = Number.isFinite(viewState.aspect) ? viewState.aspect : width / height;
      var fovyRadians = fovy * DEGREES_TO_RADIANS;
      return new OrbitViewport({
        id: this.id,
        viewMatrix: this._getViewMatrix(props.viewState),
        projectionMatrix: mat4.perspective([], fovyRadians, aspect, near, far),
        x: props.x,
        y: props.y,
        width: width,
        height: height
      });
    }
    /* eslint-enable complexity, max-statements */

  }, {
    key: "_getViewMatrix",
    value: function _getViewMatrix(viewState) {
      var distance = viewState.distance,
          _viewState$rotationX = viewState.rotationX,
          rotationX = _viewState$rotationX === void 0 ? 0 : _viewState$rotationX,
          _viewState$rotationOr = viewState.rotationOrbit,
          rotationOrbit = _viewState$rotationOr === void 0 ? 0 : _viewState$rotationOr,
          _viewState$orbitAxis = viewState.orbitAxis,
          orbitAxis = _viewState$orbitAxis === void 0 ? 'Z' : _viewState$orbitAxis,
          _viewState$lookAt = viewState.lookAt,
          lookAt = _viewState$lookAt === void 0 ? [0, 0, 0] : _viewState$lookAt,
          _viewState$up = viewState.up,
          up = _viewState$up === void 0 ? [0, 1, 0] : _viewState$up,
          _viewState$zoom = viewState.zoom,
          zoom = _viewState$zoom === void 0 ? 1 : _viewState$zoom;
      var rotationMatrix = mat4.rotateX([], (0, _mathUtils.createMat4)(), -rotationX / 180 * Math.PI);

      if (orbitAxis === 'Z') {
        mat4.rotateZ(rotationMatrix, rotationMatrix, -rotationOrbit / 180 * Math.PI);
      } else {
        mat4.rotateY(rotationMatrix, rotationMatrix, -rotationOrbit / 180 * Math.PI);
      }

      var translateMatrix = (0, _mathUtils.createMat4)();
      mat4.scale(translateMatrix, translateMatrix, [zoom, zoom, zoom]);
      mat4.translate(translateMatrix, translateMatrix, [-lookAt[0], -lookAt[1], -lookAt[2]]);
      var viewMatrix = mat4.lookAt([], [0, 0, distance], [0, 0, 0], up);
      mat4.multiply(viewMatrix, viewMatrix, mat4.multiply(rotationMatrix, rotationMatrix, translateMatrix));
      return viewMatrix;
    }
    /** Move camera to make a model bounding box centered at lookat position fit in the viewport.
     * @param {Array} boundingBox - [sizeX, sizeY, sizeZ]], define the dimensions of bounding box
     * @returns a new OrbitViewport object
     */

  }, {
    key: "fitBounds",
    value: function fitBounds(boundingBox, viewState) {
      var width = this.width,
          height = this.height,
          fov = this.fov,
          near = this.near,
          far = this.far;
      return this._getViewport({
        width: width,
        height: height,
        fov: fov,
        near: near,
        far: far
      });
    }
  }, {
    key: "controller",
    get: function get() {
      return this._getControllerProps({
        type: _orbitController.default
      });
    }
  }], [{
    key: "getDistance",
    // Get camera `distance` to make view fit a box centered at lookat position in the viewport.
    // @param {Array} boundingBox - [sizeX, sizeY, sizeZ]], defines the dimensions of bounding box
    value: function getDistance(_ref3) {
      var boundingBox = _ref3.boundingBox,
          fov = _ref3.fov;
      var halfMaxSide = Math.max(boundingBox[0], boundingBox[1], boundingBox[2]) / 2;
      var distance = halfMaxSide / Math.tan(fov / 180 * Math.PI / 2);
      return distance;
    }
  }]);

  return OrbitView;
}(_view.default);

exports.default = OrbitView;
OrbitView.displayName = 'OrbitView';
},{"./view":"K8TO","../viewports/viewport":"RXGn","../utils/math-utils":"Pq0P","gl-matrix/mat4":"Nd3D","../controllers/orbit-controller":"KyrE"}],"aIfR":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _view = _interopRequireDefault(require("./view"));

var _viewport = _interopRequireDefault(require("../viewports/viewport"));

var mat4 = _interopRequireWildcard(require("gl-matrix/mat4"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
}

var DEGREES_TO_RADIANS = Math.PI / 180;

var PerspectiveView =
/*#__PURE__*/
function (_View) {
  _inherits(PerspectiveView, _View);

  function PerspectiveView() {
    _classCallCheck(this, PerspectiveView);

    return _possibleConstructorReturn(this, _getPrototypeOf(PerspectiveView).apply(this, arguments));
  }

  _createClass(PerspectiveView, [{
    key: "_getViewport",
    value: function _getViewport(props) {
      var x = props.x,
          y = props.y,
          width = props.width,
          height = props.height,
          viewState = props.viewState;
      var eye = viewState.eye,
          _viewState$lookAt = viewState.lookAt,
          lookAt = _viewState$lookAt === void 0 ? [0, 0, 0] : _viewState$lookAt,
          _viewState$up = viewState.up,
          up = _viewState$up === void 0 ? [0, 1, 0] : _viewState$up; // Projection matrix arguments
      // TODO - Extracting from viewState is deprecated

      var fovy = props.fovy || viewState.fovy || 75; // Field of view covered by camera

      var near = props.near || viewState.near || 1; // Distance of near clipping plane

      var far = props.far || viewState.far || 100; // Distance of far clipping plane

      var aspect = Number.isFinite(viewState.aspect) ? viewState.aspect : width / height;
      var fovyRadians = fovy * DEGREES_TO_RADIANS;
      return new _viewport.default({
        id: this.id,
        x: x,
        y: y,
        width: width,
        height: height,
        viewMatrix: mat4.lookAt([], eye, lookAt, up),
        projectionMatrix: mat4.perspective([], fovyRadians, aspect, near, far)
      });
    }
  }]);

  return PerspectiveView;
}(_view.default);

exports.default = PerspectiveView;
PerspectiveView.displayName = 'PerspectiveView';
},{"./view":"K8TO","../viewports/viewport":"RXGn","gl-matrix/mat4":"Nd3D"}],"Z1xL":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _controller = _interopRequireDefault(require("./controller"));

var _viewState = _interopRequireDefault(require("./view-state"));

var _math = require("math.gl");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
}

var MOVEMENT_SPEED = 10; // per keyboard click

var DEFAULT_STATE = {
  zoom: 0,
  offset: [0, 0],
  minZoom: -10,
  maxZoom: 10
};

var zoom2Scale = function zoom2Scale(zoom) {
  return Math.pow(2, zoom);
};

var OrthographicState =
/*#__PURE__*/
function (_ViewState) {
  _inherits(OrthographicState, _ViewState);

  function OrthographicState(_ref) {
    var _this;

    var width = _ref.width,
        height = _ref.height,
        _ref$offset = _ref.offset,
        offset = _ref$offset === void 0 ? DEFAULT_STATE.offset : _ref$offset,
        _ref$zoom = _ref.zoom,
        zoom = _ref$zoom === void 0 ? DEFAULT_STATE.zoom : _ref$zoom,
        _ref$minZoom = _ref.minZoom,
        minZoom = _ref$minZoom === void 0 ? DEFAULT_STATE.minZoom : _ref$minZoom,
        _ref$maxZoom = _ref.maxZoom,
        maxZoom = _ref$maxZoom === void 0 ? DEFAULT_STATE.maxZoom : _ref$maxZoom,
        startPanPosition = _ref.startPanPosition,
        startPanOffset = _ref.startPanOffset,
        startZoomPosition = _ref.startZoomPosition,
        startZoom = _ref.startZoom;

    _classCallCheck(this, OrthographicState);

    _this = _possibleConstructorReturn(this, _getPrototypeOf(OrthographicState).call(this, {
      width: width,
      height: height,
      offset: offset,
      zoom: zoom,
      minZoom: minZoom,
      maxZoom: maxZoom
    }));
    _this._interactiveState = {
      startPanPosition: startPanPosition,
      startPanOffset: startPanOffset,
      startZoomPosition: startZoomPosition,
      startZoom: startZoom
    };
    return _this;
  }
  /* Public API */


  _createClass(OrthographicState, [{
    key: "getInteractiveState",
    value: function getInteractiveState() {
      return this._interactiveState;
    }
    /**
     * Start panning
     * @param {[Number, Number]} pos - position on screen where the pointer grabs
     */

  }, {
    key: "panStart",
    value: function panStart(_ref2) {
      var pos = _ref2.pos;
      var offset = this._viewportProps.offset;
      return this._getUpdatedState({
        startPanPosition: pos,
        startPanOffset: offset
      });
    }
    /**
     * Pan
     * @param {[Number, Number]} pos - position on screen where the pointer is
     */

  }, {
    key: "pan",
    value: function pan(_ref3) {
      var pos = _ref3.pos;
      var _this$_interactiveSta = this._interactiveState,
          startPanPosition = _this$_interactiveSta.startPanPosition,
          startPanOffset = _this$_interactiveSta.startPanOffset;
      var delta = new _math.Vector2(pos).subtract(startPanPosition);
      return this._getUpdatedState({
        offset: new _math.Vector2(startPanOffset).subtract(delta)
      });
    }
    /**
     * End panning
     * Must call if `panStart()` was called
     */

  }, {
    key: "panEnd",
    value: function panEnd() {
      return this._getUpdatedState({
        startPanPosition: null,
        startPanOffset: null
      });
    }
    /**
     * Start rotating
     * @param {[Number, Number]} pos - position on screen where the pointer grabs
     */

  }, {
    key: "rotateStart",
    value: function rotateStart(_ref4) {
      var pos = _ref4.pos;
      return this;
    }
    /**
     * Rotate
     * @param {[Number, Number]} pos - position on screen where the pointer is
     */

  }, {
    key: "rotate",
    value: function rotate(_ref5) {
      var deltaScaleX = _ref5.deltaScaleX,
          deltaScaleY = _ref5.deltaScaleY;
      return this;
    }
    /**
     * End rotating
     * Must call if `rotateStart()` was called
     */

  }, {
    key: "rotateEnd",
    value: function rotateEnd() {
      return this;
    } // Calculates new zoom

  }, {
    key: "_calculateNewZoom",
    value: function _calculateNewZoom(_ref6) {
      var scale = _ref6.scale,
          startZoom = _ref6.startZoom;
      var _this$_viewportProps = this._viewportProps,
          maxZoom = _this$_viewportProps.maxZoom,
          minZoom = _this$_viewportProps.minZoom;
      var zoom = startZoom + Math.log2(scale);
      return (0, _math.clamp)(zoom, minZoom, maxZoom);
    }
    /**
     * Start zooming
     * @param {[Number, Number]} pos - position on screen where the center is
     */

  }, {
    key: "zoomStart",
    value: function zoomStart(_ref7) {
      var pos = _ref7.pos;
      return this._getUpdatedState({
        startZoomPosition: pos,
        startZoom: this._viewportProps.zoom
      });
    }
    /**
     * Zoom
     * @param {Number} scale - a number between [0, 1] specifying the accumulated
     *   relative scale.
     * @param {[number, number]} pos - current mouse cursor screen position
     */

  }, {
    key: "zoom",
    value: function zoom(_ref8) {
      var pos = _ref8.pos,
          startPos = _ref8.startPos,
          scale = _ref8.scale;
      var _this$_viewportProps2 = this._viewportProps,
          zoom = _this$_viewportProps2.zoom,
          width = _this$_viewportProps2.width,
          height = _this$_viewportProps2.height,
          offset = _this$_viewportProps2.offset;
      var _this$_interactiveSta2 = this._interactiveState,
          startZoom = _this$_interactiveSta2.startZoom,
          startZoomPosition = _this$_interactiveSta2.startZoomPosition;

      if (!Number.isFinite(startZoom)) {
        // We have two modes of zoom:
        // scroll zoom that are discrete events (transform from the current zoom level),
        // and pinch zoom that are continuous events (transform from the zoom level when
        // pinch started).
        // If startZoom state is defined, then use the startZoom state;
        // otherwise assume discrete zooming
        startZoom = zoom;
        startZoomPosition = startPos || pos;
      }

      var newZoom = this._calculateNewZoom({
        scale: scale,
        startZoom: startZoom
      });

      var startScale = zoom2Scale(startZoom);
      var newScale = zoom2Scale(newZoom);
      var centerX = width / 2 - offset[0];
      var centerY = height / 2 - offset[1];
      var dX = (startZoomPosition[0] - centerX) * (newScale / startScale - 1);
      var dY = (startZoomPosition[1] - centerY) * (newScale / startScale - 1);
      return this._getUpdatedState({
        zoom: newZoom,
        offset: [offset[0] + dX, offset[1] + dY]
      });
    }
    /**
     * End zooming
     * Must call if `zoomStart()` was called
     */

  }, {
    key: "zoomEnd",
    value: function zoomEnd() {
      return this._getUpdatedState({
        startZoomPosition: null,
        startZoom: null
      });
    }
  }, {
    key: "_zoomFromCenter",
    value: function _zoomFromCenter(scale) {
      var _this$_viewportProps3 = this._viewportProps,
          width = _this$_viewportProps3.width,
          height = _this$_viewportProps3.height,
          offset = _this$_viewportProps3.offset;
      return this.zoom({
        pos: [width / 2 - offset[0], height / 2 - offset[1]],
        scale: scale
      });
    }
  }, {
    key: "zoomIn",
    value: function zoomIn() {
      return this._zoomFromCenter(2);
    }
  }, {
    key: "zoomOut",
    value: function zoomOut() {
      return this._zoomFromCenter(0.5);
    }
  }, {
    key: "moveLeft",
    value: function moveLeft() {
      var offset = this._viewportProps.offset;
      var delta = [MOVEMENT_SPEED, 0];
      return this._getUpdatedState({
        offset: new _math.Vector2(offset).add(delta)
      });
    }
  }, {
    key: "moveRight",
    value: function moveRight() {
      var offset = this._viewportProps.offset;
      var delta = [-MOVEMENT_SPEED, 0];
      return this._getUpdatedState({
        offset: new _math.Vector2(offset).add(delta)
      });
    }
  }, {
    key: "moveUp",
    value: function moveUp() {
      var offset = this._viewportProps.offset;
      var delta = [0, MOVEMENT_SPEED];
      return this._getUpdatedState({
        offset: new _math.Vector2(offset).add(delta)
      });
    }
  }, {
    key: "moveDown",
    value: function moveDown() {
      var offset = this._viewportProps.offset;
      var delta = [0, -MOVEMENT_SPEED];
      return this._getUpdatedState({
        offset: new _math.Vector2(offset).add(delta)
      });
    }
    /* Private methods */

  }, {
    key: "_getUpdatedState",
    value: function _getUpdatedState(newProps) {
      // Update _viewportProps
      return new OrthographicState(Object.assign({}, this._viewportProps, this._interactiveState, newProps));
    }
  }]);

  return OrthographicState;
}(_viewState.default);

var OrthographicController =
/*#__PURE__*/
function (_Controller) {
  _inherits(OrthographicController, _Controller);

  function OrthographicController(props) {
    var _this2;

    _classCallCheck(this, OrthographicController);

    _this2 = _possibleConstructorReturn(this, _getPrototypeOf(OrthographicController).call(this, OrthographicState, props));
    _this2.invertPan = true;
    return _this2;
  }

  _createClass(OrthographicController, [{
    key: "_onPanRotate",
    value: function _onPanRotate(event) {
      if (!this.dragRotate) {
        return false;
      }

      return this._onPanRotateMap(event);
    }
  }]);

  return OrthographicController;
}(_controller.default);

exports.default = OrthographicController;
},{"./controller":"Gii9","./view-state":"YDzL","math.gl":"dl2t"}],"pEX0":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _view = _interopRequireDefault(require("./view"));

var _viewport = _interopRequireDefault(require("../viewports/viewport"));

var _math = require("math.gl");

var _orthographicController = _interopRequireDefault(require("../controllers/orthographic-controller"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
}

var OrthographicView =
/*#__PURE__*/
function (_View) {
  _inherits(OrthographicView, _View);

  function OrthographicView() {
    _classCallCheck(this, OrthographicView);

    return _possibleConstructorReturn(this, _getPrototypeOf(OrthographicView).apply(this, arguments));
  }

  _createClass(OrthographicView, [{
    key: "_getViewport",
    value: function _getViewport(_ref) {
      var x = _ref.x,
          y = _ref.y,
          width = _ref.width,
          height = _ref.height,
          viewState = _ref.viewState; // Get view matrix parameters from view state

      var _viewState$offset = viewState.offset,
          offset = _viewState$offset === void 0 ? [0, 0] : _viewState$offset,
          _viewState$zoom = viewState.zoom,
          zoom = _viewState$zoom === void 0 ? 0 : _viewState$zoom; // Make sure Matrix4.ortho doesn't crash on 0 width/height

      width = width || 1;
      height = height || 1;
      var scale = Math.pow(2, zoom); // Get projection matrix parameters from the view itself
      // NOTE: automatically calculated from width and height if not provided

      var _this$props = this.props,
          _this$props$eye = _this$props.eye,
          eye = _this$props$eye === void 0 ? [0, 0, 1] : _this$props$eye,
          _this$props$lookAt = _this$props.lookAt,
          lookAt = _this$props$lookAt === void 0 ? [0, 0, 0] : _this$props$lookAt,
          _this$props$up = _this$props.up,
          up = _this$props$up === void 0 ? [0, 1, 0] : _this$props$up,
          _this$props$left = _this$props.left,
          left = _this$props$left === void 0 ? (-width / 2 + offset[0]) / scale : _this$props$left,
          _this$props$top = _this$props.top,
          top = _this$props$top === void 0 ? (-height / 2 + offset[1]) / scale : _this$props$top,
          _this$props$right = _this$props.right,
          right = _this$props$right === void 0 ? (width / 2 + offset[0]) / scale : _this$props$right,
          _this$props$bottom = _this$props.bottom,
          bottom = _this$props$bottom === void 0 ? (height / 2 + offset[1]) / scale : _this$props$bottom,
          _this$props$near = _this$props.near,
          near = _this$props$near === void 0 ? 1 : _this$props$near,
          _this$props$far = _this$props.far,
          far = _this$props$far === void 0 ? 100 : _this$props$far;
      return new _viewport.default({
        id: this.id,
        x: x,
        y: y,
        width: width,
        height: height,
        viewMatrix: new _math.Matrix4().lookAt({
          eye: eye,
          lookAt: lookAt,
          up: up
        }),
        projectionMatrix: new _math.Matrix4().ortho({
          left: left,
          right: right,
          bottom: bottom,
          top: top,
          near: near,
          far: far
        }),
        zoom: zoom
      });
    }
  }, {
    key: "controller",
    get: function get() {
      return this._getControllerProps({
        type: _orthographicController.default
      });
    }
  }]);

  return OrthographicView;
}(_view.default);

exports.default = OrthographicView;
OrthographicView.displayName = 'OrthographicView';
},{"./view":"K8TO","../viewports/viewport":"RXGn","math.gl":"dl2t","../controllers/orthographic-controller":"Z1xL"}],"PYQE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var _default = "#define SHADER_NAME reflection-effect-vs\n\nattribute vec3 vertices;\n\nvarying vec2 uv;\n\nvoid main(void) {\n  uv = vertices.xy;\n  gl_Position = vec4(2. * vertices.xy - vec2(1., 1.), 1., 1.);\n}\n";
exports.default = _default;
},{}],"XjfX":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var _default = "#define SHADER_NAME reflection-effect-fs\n\nprecision highp float;\n\nuniform sampler2D reflectionTexture;\nuniform int reflectionTextureWidth;\nuniform int reflectionTextureHeight;\n\nuniform float reflectivity;\nuniform float blur;\n\n\nvarying vec2 uv;\n\n#define KERNEL_SIZE 7\n\n/*\n * Samples from tex with a gaussian-shaped patch, centered at uv and\n * with standard deviation sigma.  The size of the texture in\n * pixels must be specified by dim\n */\nvec4 sample_gaussian(sampler2D tex, vec2 dim, vec2 uv, float sigma) {\n  if (sigma == 0.0) {\n    return texture2D(tex, uv);\n  }\n\n  vec2 delta = 1.0 / dim;\n  vec2 top_left = uv - delta * float(KERNEL_SIZE+1) / 2.0;\n\n  vec4 color = vec4(0);\n  float sum = 0.0;\n  for (int i = 0; i <  KERNEL_SIZE; ++i) {\n    for (int j = 0; j < KERNEL_SIZE; ++j) {\n      vec2 uv2 = top_left + vec2(i, j) * delta;\n      float d = length((uv2 - uv) * dim);\n      float f = exp(-(d*d) / (2.0*sigma * sigma));\n      color += f * texture2D(tex, uv2);\n      sum += f;\n    }\n  }\n  return color / sum;\n}\n\nvoid main(void) {\n  //map blur in [0, 1] to sigma in [0, inf]\n  //alpha will determine the \"steepness\" of our curve.\n  //this was picked just to make the scale feel \"natural\"\n  //if our image is 1000 pixels wide, a blur of 0.5 should correspond\n  //to a sigma of 1 pixels\n  float alpha = 1000.0;\n  float sigma = blur / (alpha * (1.0 - blur));\n  //let this be our standard deviation in terms of screen-widths.\n  //rewrite this in terms of pixels.\n  sigma *= float(reflectionTextureWidth);\n\n\n  gl_FragColor = sample_gaussian(reflectionTexture, vec2(reflectionTextureWidth,\n    reflectionTextureHeight), vec2(uv.x, 1. - uv.y), sigma);\n  //because our canvas expects alphas to be pre-multiplied, we multiply by whole\n  //color vector by reflectivity, not just the alpha channel\n  gl_FragColor *= reflectivity;\n}\n";
exports.default = _default;
},{}],"Wcnv":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _constants = _interopRequireDefault(require("luma.gl/constants"));

var _luma = require("luma.gl");

var _effect = _interopRequireDefault(require("../lib/effect"));

var _webMercatorViewport = _interopRequireDefault(require("../../viewports/web-mercator-viewport"));

var _reflectionEffectVertex = _interopRequireDefault(require("./reflection-effect-vertex.glsl"));

var _reflectionEffectFragment = _interopRequireDefault(require("./reflection-effect-fragment.glsl"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.

/* global window */


var ReflectionEffect =
/*#__PURE__*/
function (_Effect) {
  _inherits(ReflectionEffect, _Effect);
  /**
   * @classdesc
   * ReflectionEffect
   *
   * @class
   * @param reflectivity How visible reflections should be over the map, between 0 and 1
   * @param blur how blurry the reflection should be, between 0 and 1
   */


  function ReflectionEffect() {
    var _this;

    var reflectivity = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.5;
    var blur = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.5;

    _classCallCheck(this, ReflectionEffect);

    _this = _possibleConstructorReturn(this, _getPrototypeOf(ReflectionEffect).call(this));
    _this.reflectivity = reflectivity;
    _this.blur = blur;
    _this.framebuffer = null;

    _this.setNeedsRedraw();

    return _this;
  }

  _createClass(ReflectionEffect, [{
    key: "getShaders",
    value: function getShaders() {
      return {
        vs: _reflectionEffectVertex.default,
        fs: _reflectionEffectFragment.default,
        modules: [],
        shaderCache: this.context.shaderCache
      };
    }
  }, {
    key: "initialize",
    value: function initialize(_ref) {
      var gl = _ref.gl,
          layerManager = _ref.layerManager;
      this.unitQuad = new _luma.Model(gl, Object.assign({}, this.getShaders(), {
        id: 'reflection-effect',
        geometry: new _luma.Geometry({
          drawMode: _constants.default.TRIANGLE_FAN,
          vertices: new Float32Array([0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0])
        })
      }));
      this.framebuffer = new _luma.Framebuffer(gl, {
        depth: true
      });
    }
  }, {
    key: "preDraw",
    value: function preDraw(_ref2) {
      var gl = _ref2.gl,
          layerManager = _ref2.layerManager;
      var viewport = layerManager.context.viewport;
      /*
       * the renderer already has a reference to this, but we don't have a reference to the renderer.
       * when we refactor the camera code, we should make sure we get a reference to the renderer so
       * that we can keep this in one place.
       */

      var dpi = typeof window !== 'undefined' && window.devicePixelRatio || 1;
      this.framebuffer.resize({
        width: dpi * viewport.width,
        height: dpi * viewport.height
      });
      var pitch = viewport.pitch;
      this.framebuffer.bind();
      /* this is a huge hack around the existing viewport class.
       * TODO in the future, once we implement bona-fide cameras, we really need to fix this.
       */

      layerManager.setViewport(new _webMercatorViewport.default(Object.assign({}, viewport, {
        pitch: -180 - pitch
      })));
      gl.clear(_constants.default.COLOR_BUFFER_BIT | _constants.default.DEPTH_BUFFER_BIT);
      layerManager.drawLayers({
        pass: 'reflection'
      });
      layerManager.setViewport(viewport);
      this.framebuffer.unbind();
    }
  }, {
    key: "draw",
    value: function draw(_ref3) {
      var gl = _ref3.gl,
          layerManager = _ref3.layerManager;
      /*
       * Render our unit quad.
       * This will cover the entire screen, but will lie behind all other geometry.
       * This quad will sample the previously generated reflection texture
       * in order to create the reflection effect
       */

      this.unitQuad.render({
        reflectionTexture: this.framebuffer.texture,
        reflectionTextureWidth: this.framebuffer.width,
        reflectionTextureHeight: this.framebuffer.height,
        reflectivity: this.reflectivity,
        blur: this.blur
      });
    }
  }, {
    key: "finalize",
    value: function finalize(_ref4) {
      /* TODO: Free resources? */
      var gl = _ref4.gl,
          layerManager = _ref4.layerManager;
    }
  }]);

  return ReflectionEffect;
}(_effect.default);

exports.default = ReflectionEffect;
},{"luma.gl/constants":"lMsC","luma.gl":"GAQa","../lib/effect":"GHnM","../../viewports/web-mercator-viewport":"uuqX","./reflection-effect-vertex.glsl":"PYQE","./reflection-effect-fragment.glsl":"XjfX"}],"pNmY":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _transitionInterpolator = _interopRequireDefault(require("./transition-interpolator"));

var _math = require("math.gl");

var _viewportMercatorProject = require("viewport-mercator-project");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
}

var LINEARLY_INTERPOLATED_PROPS = ['bearing', 'pitch'];
/**
 * This class adapts mapbox-gl-js Map#flyTo animation so it can be used in
 * react/redux architecture.
 * mapbox-gl-js flyTo : https://www.mapbox.com/mapbox-gl-js/api/#map#flyto.
 * It implements “Smooth and efficient zooming and panning.” algorithm by
 * "Jarke J. van Wijk and Wim A.A. Nuij"
 */

var FlyToInterpolator =
/*#__PURE__*/
function (_TransitionInterpolat) {
  _inherits(FlyToInterpolator, _TransitionInterpolat);

  function FlyToInterpolator() {
    _classCallCheck(this, FlyToInterpolator);

    return _possibleConstructorReturn(this, _getPrototypeOf(FlyToInterpolator).call(this, {
      compare: ['longitude', 'latitude', 'zoom', 'bearing', 'pitch'],
      extract: ['width', 'height', 'longitude', 'latitude', 'zoom', 'bearing', 'pitch'],
      required: ['width', 'height', 'latitude', 'longitude', 'zoom']
    }));
  }

  _createClass(FlyToInterpolator, [{
    key: "interpolateProps",
    value: function interpolateProps(startProps, endProps, t) {
      var viewport = (0, _viewportMercatorProject.flyToViewport)(startProps, endProps, t); // Linearly interpolate 'bearing' and 'pitch'.
      // If pitch/bearing are not supplied, they are interpreted as zeros in viewport calculation
      // (fallback defined in WebMercatorViewport)
      // Because there is no guarantee that the current controller's ViewState normalizes
      // these props, safe guard is needed to avoid generating NaNs

      for (var _i = 0; _i < LINEARLY_INTERPOLATED_PROPS.length; _i++) {
        var key = LINEARLY_INTERPOLATED_PROPS[_i];
        viewport[key] = (0, _math.lerp)(startProps[key] || 0, endProps[key] || 0, t);
      }

      return viewport;
    }
  }]);

  return FlyToInterpolator;
}(_transitionInterpolator.default);

exports.default = FlyToInterpolator;
},{"./transition-interpolator":"zzBl","math.gl":"dl2t","viewport-mercator-project":"K6fX"}],"oA4T":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

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;
}

function _slicedToArray(arr, i) {
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
}

function _nonIterableRest() {
  throw new TypeError("Invalid attempt to destructure non-iterable instance");
}

function _iterableToArrayLimit(arr, i) {
  var _arr = [];
  var _n = true;
  var _d = false;
  var _e = undefined;

  try {
    for (var _i = arr[Symbol.iterator](), _s; !(_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;
}

function _arrayWithHoles(arr) {
  if (Array.isArray(arr)) return arr;
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
// getValue takes an array of points returns a value to sort the bins on.
// by default it returns the number of points
// this is where to pass in a function to color the bins by
// avg/mean/max of specific value of the point


var defaultGetValue = function defaultGetValue(points) {
  return points.length;
};

var BinSorter =
/*#__PURE__*/
function () {
  function BinSorter() {
    var bins = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
    var getValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultGetValue;

    _classCallCheck(this, BinSorter);

    this.sortedBins = this.getSortedBins(bins, getValue);
    this.maxCount = this.getMaxCount();
    this.binMap = this.getBinMap();
  }
  /**
   * Get an array of object with sorted values and index of bins
   * @param {Array} bins
   * @param {Function} getValue
   * @return {Array} array of values and index lookup
   */


  _createClass(BinSorter, [{
    key: "getSortedBins",
    value: function getSortedBins(bins, getValue) {
      return bins.reduce(function (accu, h, i) {
        var value = getValue(h.points);

        if (value !== null && value !== undefined) {
          // filter bins if value is null or undefined
          accu.push({
            i: Number.isFinite(h.index) ? h.index : i,
            value: value,
            counts: h.points.length
          });
        }

        return accu;
      }, []).sort(function (a, b) {
        return a.value - b.value;
      });
    }
    /**
     * Get range of values of all bins
     * @param {Number[]} range
     * @param {Number} range[0] - lower bound
     * @param {Number} range[1] - upper bound
     * @return {Array} array of new value range
     */

  }, {
    key: "getValueRange",
    value: function getValueRange(_ref) {
      var _ref2 = _slicedToArray(_ref, 2),
          lower = _ref2[0],
          upper = _ref2[1];

      var len = this.sortedBins.length;

      if (!len) {
        return [0, 0];
      }

      var lowerIdx = Math.ceil(lower / 100 * (len - 1));
      var upperIdx = Math.floor(upper / 100 * (len - 1));
      return [this.sortedBins[lowerIdx].value, this.sortedBins[upperIdx].value];
    }
    /**
     * Get ths max count of all bins
     * @return {Number | Boolean} max count
     */

  }, {
    key: "getMaxCount",
    value: function getMaxCount() {
      var maxCount = 0;
      this.sortedBins.forEach(function (x) {
        return maxCount = maxCount > x.counts ? maxCount : x.counts;
      });
      return maxCount;
    }
    /**
     * Get a mapping from cell/hexagon index to sorted bin
     * This is used to retrieve bin value for color calculation
     * @return {Object} bin index to sortedBins
     */

  }, {
    key: "getBinMap",
    value: function getBinMap() {
      return this.sortedBins.reduce(function (mapper, curr) {
        return Object.assign(mapper, _defineProperty({}, curr.i, curr));
      }, {});
    }
  }]);

  return BinSorter;
}();

exports.default = BinSorter;
},{}],"LN2C":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _flatten = require("./flatten");

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.


var TypedArrayManager =
/*#__PURE__*/
function () {
  function TypedArrayManager() {
    var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
        _ref$overAlloc = _ref.overAlloc,
        overAlloc = _ref$overAlloc === void 0 ? 1 : _ref$overAlloc;

    _classCallCheck(this, TypedArrayManager);

    this.overAlloc = overAlloc;
  }

  _createClass(TypedArrayManager, [{
    key: "allocate",
    value: function allocate(typedArray, count, _ref2) {
      var size = _ref2.size,
          type = _ref2.type,
          _ref2$copy = _ref2.copy,
          copy = _ref2$copy === void 0 ? false : _ref2$copy;
      var newSize = count * size;

      if (typedArray && newSize <= typedArray.length) {
        return typedArray;
      } // Allocate at least one element to ensure a valid buffer


      var allocSize = Math.max(Math.ceil(newSize * this.overAlloc), 1);

      var newArray = this._allocate(type, allocSize);

      if (typedArray && copy) {
        newArray.set(typedArray);
      }

      this._release(typedArray);

      return newArray;
    }
  }, {
    key: "_allocate",
    value: function _allocate() {
      var Type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Float32Array;
      var size = arguments.length > 1 ? arguments[1] : undefined;

      if (Type === Uint16Array && size > 65535) {
        throw new Error('Vertex count exceeds browser index limit');
      } // TODO - check if available in pool


      return new Type(size);
    }
  }, {
    key: "_release",
    value: function _release(typedArray) {// TODO - add to pool
      // logFunctions.onUpdate({
      //   level: LOG_DETAIL_PRIORITY,
      //   message: `${attributeName} allocated ${allocCount}`,
      //   id: this.id
      // });
    }
  }]);

  return TypedArrayManager;
}();

var Tesselator =
/*#__PURE__*/
function () {
  function Tesselator() {
    var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

    _classCallCheck(this, Tesselator);

    var _opts$attributes = opts.attributes,
        attributes = _opts$attributes === void 0 ? {} : _opts$attributes;
    this.typedArrayManager = new TypedArrayManager();
    this.indexLayout = null;
    this.bufferLayout = null;
    this.vertexCount = 0;
    this.instanceCount = 0;
    this.attributes = {};
    this._attributeDefs = attributes;
    this.updateGeometry(opts);
    Object.seal(this);
  }
  /* Public methods */


  _createClass(Tesselator, [{
    key: "updateGeometry",
    value: function updateGeometry(_ref3) {
      var data = _ref3.data,
          getGeometry = _ref3.getGeometry,
          positionFormat = _ref3.positionFormat,
          fp64 = _ref3.fp64;
      this.data = data;
      this.getGeometry = getGeometry;
      this.fp64 = fp64;
      this.positionSize = positionFormat === 'XY' ? 2 : 3;

      this._rebuildGeometry();
    }
  }, {
    key: "updatePartialGeometry",
    value: function updatePartialGeometry(_ref4) {
      var start = _ref4.start,
          count = _ref4.count,
          objects = _ref4.objects;
    } // TODO

    /* Subclass interface */
    // Update the positions of a single geometry

  }, {
    key: "updateGeometryAttributes",
    value: function updateGeometryAttributes(geometry, startIndex, size) {
      throw new Error('Not implemented');
    } // Returns the number of vertices in a geometry

  }, {
    key: "getGeometrySize",
    value: function getGeometrySize(geometry) {
      throw new Error('Not implemented');
    }
    /* Private utility methods */

    /**
     * Visit all objects
     * `data` is expected to be an iterable consistent with the base Layer expectation
     */

  }, {
    key: "_forEachGeometry",
    value: function _forEachGeometry(visitor) {
      var data = this.data,
          getGeometry = this.getGeometry;
      var dataIndex = 0;
      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = data[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var object = _step.value;
          var geometry = getGeometry(object);
          visitor(geometry, dataIndex++);
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return != null) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }
    }
  }, {
    key: "_updateAttribute",
    value: function _updateAttribute(_ref5) {
      var target = _ref5.target,
          size = _ref5.size,
          getValue = _ref5.getValue;
      var data = this.data,
          bufferLayout = this.bufferLayout;
      var i = 0;
      var dataIndex = 0;
      var _iteratorNormalCompletion2 = true;
      var _didIteratorError2 = false;
      var _iteratorError2 = undefined;

      try {
        for (var _iterator2 = data[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
          var object = _step2.value;
          var value = getValue(object, dataIndex);
          var numVertices = bufferLayout[dataIndex++];
          (0, _flatten.fillArray)({
            target: target,
            source: value,
            start: i,
            count: numVertices
          });
          i += numVertices * size;
        }
      } catch (err) {
        _didIteratorError2 = true;
        _iteratorError2 = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
            _iterator2.return();
          }
        } finally {
          if (_didIteratorError2) {
            throw _iteratorError2;
          }
        }
      }

      return target;
    }
  }, {
    key: "_rebuildGeometry",
    value: function _rebuildGeometry() {
      var _this = this;

      if (!this.data || !this.getGeometry) {
        return;
      } // count instances


      var indexLayout = [];
      var bufferLayout = [];
      var instanceCount = 0;

      this._forEachGeometry(function (geometry, dataIndex) {
        var count = _this.getGeometrySize(geometry);

        instanceCount += count;
        bufferLayout[dataIndex] = count;
      }); // allocate attributes


      var attributes = this.attributes,
          _attributeDefs = this._attributeDefs,
          typedArrayManager = this.typedArrayManager,
          fp64 = this.fp64;

      for (var name in _attributeDefs) {
        var def = _attributeDefs[name]; // do not create fp64-only attributes unless in fp64 mode

        if (!def.fp64Only || fp64) {
          attributes[name] = typedArrayManager.allocate(attributes[name], instanceCount, def);
        }
      }

      this.indexLayout = indexLayout;
      this.bufferLayout = bufferLayout;
      this.instanceCount = instanceCount;
      var context = {
        vertexStart: 0,
        indexStart: 0
      };

      this._forEachGeometry(function (geometry, dataIndex) {
        var geometrySize = bufferLayout[dataIndex];
        context.geometryIndex = dataIndex;
        context.geometrySize = geometrySize;

        _this.updateGeometryAttributes(geometry, context);

        context.vertexStart += geometrySize;
        context.indexStart += indexLayout[dataIndex] || 0;
      });

      this.vertexCount = context.indexStart;
    }
  }]);

  return Tesselator;
}();

exports.default = Tesselator;
},{"./flatten":"uWrz"}],"PHo8":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.defaultColorRange = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var defaultColorRange = [[255, 255, 178], [254, 217, 118], [254, 178, 76], [253, 141, 60], [240, 59, 32], [189, 0, 38]];
exports.defaultColorRange = defaultColorRange;
},{}],"Mnhz":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.linearScale = linearScale;
exports.quantizeScale = quantizeScale;
exports.getQuantizeScale = getQuantizeScale;
exports.getLinearScale = getLinearScale;

var _log = _interopRequireDefault(require("./log"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
// Linear scale maps continuous domain to continuous range
function linearScale(domain, range, value) {
  return (value - domain[0]) / (domain[1] - domain[0]) * (range[1] - range[0]) + range[0];
} // Quantize scale is similar to linear scales,
// except it uses a discrete rather than continuous range


function quantizeScale(domain, range, value) {
  var domainRange = domain[1] - domain[0];

  if (domainRange <= 0) {
    _log.default.warn('quantizeScale: invalid domain, returning range[0]')();

    return range[0];
  }

  var step = domainRange / range.length;
  var idx = Math.floor((value - domain[0]) / step);
  var clampIdx = Math.max(Math.min(idx, range.length - 1), 0);
  return range[clampIdx];
} // return a quantize scale function


function getQuantizeScale(domain, range) {
  return function (value) {
    return quantizeScale(domain, range, value);
  };
} // return a linear scale funciton


function getLinearScale(domain, range) {
  return function (value) {
    return (value - domain[0]) / (domain[1] - domain[0]) * (range[1] - range[0]) + range[0];
  };
}
},{"./log":"q39U"}],"O8Mj":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.WEIGHT_SIZE = exports.PIXEL_SIZE = exports.IDENTITY_MATRIX = exports.DEFAULT_WEIGHT_PARAMS = exports.ELEMENTCOUNT = exports.EQUATION_MAP = exports.MAX_MIN_BLEND_EQUATION = exports.MAX_BLEND_EQUATION = exports.MIN_BLEND_EQUATION = exports.MAX_32_BIT_FLOAT = exports.DEFAULT_RUN_PARAMS = exports.DEFAULT_CHANGE_FLAGS = exports.AGGREGATION_OPERATION = void 0;

var _constants = _interopRequireDefault(require("luma.gl/constants"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _EQUATION_MAP;

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;
}

// public
var AGGREGATION_OPERATION = {
  SUM: 1,
  MEAN: 2,
  MIN: 3,
  MAX: 4
}; // private

exports.AGGREGATION_OPERATION = AGGREGATION_OPERATION;
var DEFAULT_CHANGE_FLAGS = {
  dataChanged: true,
  viewportChanged: true,
  cellSizeChanged: true
};
exports.DEFAULT_CHANGE_FLAGS = DEFAULT_CHANGE_FLAGS;
var DEFAULT_RUN_PARAMS = {
  changeFlags: DEFAULT_CHANGE_FLAGS,
  projectPoints: false,
  useGPU: true,
  fp64: false,
  viewport: null,
  gridTransformMatrix: null,
  createBufferObjects: true
};
exports.DEFAULT_RUN_PARAMS = DEFAULT_RUN_PARAMS;
var MAX_32_BIT_FLOAT = 3.402823466e38;
exports.MAX_32_BIT_FLOAT = MAX_32_BIT_FLOAT;
var MIN_BLEND_EQUATION = [_constants.default.MIN, _constants.default.FUNC_ADD];
exports.MIN_BLEND_EQUATION = MIN_BLEND_EQUATION;
var MAX_BLEND_EQUATION = [_constants.default.MAX, _constants.default.FUNC_ADD];
exports.MAX_BLEND_EQUATION = MAX_BLEND_EQUATION;
var MAX_MIN_BLEND_EQUATION = [_constants.default.MAX, _constants.default.MIN];
exports.MAX_MIN_BLEND_EQUATION = MAX_MIN_BLEND_EQUATION;
var EQUATION_MAP = (_EQUATION_MAP = {}, _defineProperty(_EQUATION_MAP, AGGREGATION_OPERATION.SUM, _constants.default.FUNC_ADD), _defineProperty(_EQUATION_MAP, AGGREGATION_OPERATION.MEAN, _constants.default.FUNC_ADD), _defineProperty(_EQUATION_MAP, AGGREGATION_OPERATION.MIN, MIN_BLEND_EQUATION), _defineProperty(_EQUATION_MAP, AGGREGATION_OPERATION.MAX, MAX_BLEND_EQUATION), _EQUATION_MAP);
exports.EQUATION_MAP = EQUATION_MAP;
var ELEMENTCOUNT = 4;
exports.ELEMENTCOUNT = ELEMENTCOUNT;
var DEFAULT_WEIGHT_PARAMS = {
  size: 1,
  operation: AGGREGATION_OPERATION.SUM,
  needMin: false,
  needMax: false,
  combineMaxMin: false
};
exports.DEFAULT_WEIGHT_PARAMS = DEFAULT_WEIGHT_PARAMS;
var IDENTITY_MATRIX = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
var PIXEL_SIZE = 4; // RGBA32F

exports.PIXEL_SIZE = PIXEL_SIZE;
var WEIGHT_SIZE = 3;
exports.WEIGHT_SIZE = WEIGHT_SIZE;
},{"luma.gl/constants":"lMsC"}],"dEjh":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2018 Uber Technologies, Inc.
//
// 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.
var _default = "#define SHADER_NAME gpu-aggregation-to-grid-vs\n\nattribute vec2 positions;\nattribute vec3 weights;\nuniform vec2 windowSize;\nuniform vec2 cellSize;\nuniform vec2 gridSize;\nuniform mat4 uProjectionMatrix;\nuniform bool projectPoints;\n\nvarying vec3 vWeights;\n\nvec2 project_to_pixel(vec4 pos) {\n  vec4 result =  uProjectionMatrix * pos;\n  return result.xy/result.w;\n}\n\nvoid main(void) {\n\n  vWeights = weights;\n\n  vec4 windowPos = vec4(positions, 0, 1.);\n  if (projectPoints) {\n    windowPos = project_position_to_clipspace(vec3(positions, 0), vec2(0, 0), vec3(0, 0, 0));\n  }\n\n  vec2 pos = project_to_pixel(windowPos);\n\n  // Transform (0,0):windowSize -> (0, 0): gridSize\n  pos = floor(pos / cellSize);\n\n  // Transform (0,0):gridSize -> (-1, -1):(1,1)\n  pos = (pos * (2., 2.) / (gridSize)) - (1., 1.);\n\n  // Move to pixel center, pixel-size in screen sapce (2/gridSize) * 0.5 => 1/gridSize\n  vec2 offset = 1.0 / gridSize;\n  pos = pos + offset;\n\n  gl_Position = vec4(pos, 0.0, 1.0);\n}\n";
exports.default = _default;
},{}],"yJON":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2018 Uber Technologies, Inc.
//
// 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.
var _default = "#define SHADER_NAME gpu-aggregation-to-grid-vs-64\n\nattribute vec2 positions;\nattribute vec2 positions64xyLow;\nattribute vec3 weights;\nuniform vec2 windowSize;\nuniform vec2 cellSize;\nuniform vec2 gridSize;\nuniform vec2 uProjectionMatrixFP64[16];\nuniform bool projectPoints;\n\nvarying vec3 vWeights;\n\nvoid project_to_pixel(vec2 pos, vec2 pos64xyLow, out vec2 pixelXY64[2]) {\n\n  vec2 result64[4];\n  vec2 position64[4];\n  position64[0] = vec2(pos.x, pos64xyLow.x);\n  position64[1] = vec2(pos.y, pos64xyLow.y);\n  position64[2] = vec2(0., 0.);\n  position64[3] = vec2(1., 0.);\n  mat4_vec4_mul_fp64(uProjectionMatrixFP64, position64,\n  result64);\n\n  pixelXY64[0] = div_fp64(result64[0], result64[3]);\n  pixelXY64[1] = div_fp64(result64[1], result64[3]);\n}\n\nvoid main(void) {\n\n  vWeights = weights;\n\n  vec2 windowPos = positions;\n  vec2 windowPos64xyLow = positions64xyLow;\n  if (projectPoints) {\n    vec2 projectedXY[2];\n    project_position_fp64(windowPos, windowPos64xyLow, projectedXY);\n    windowPos.x = projectedXY[0].x;\n    windowPos.y = projectedXY[1].x;\n    windowPos64xyLow.x = projectedXY[0].y;\n    windowPos64xyLow.y = projectedXY[1].y;\n  }\n\n  vec2 pixelXY64[2];\n  project_to_pixel(windowPos, windowPos64xyLow, pixelXY64);\n\n  // Transform (0,0):windowSize -> (0, 0): gridSize\n  vec2 gridXY64[2];\n  gridXY64[0] = div_fp64(pixelXY64[0], vec2(cellSize.x, 0));\n  gridXY64[1] = div_fp64(pixelXY64[1], vec2(cellSize.y, 0));\n  float x = floor(gridXY64[0].x);\n  float y = floor(gridXY64[1].x);\n  vec2 pos = vec2(x, y);\n\n  // Transform (0,0):gridSize -> (-1, -1):(1,1)\n  pos = (pos * (2., 2.) / (gridSize)) - (1., 1.);\n\n  // Move to pixel center, pixel-size in screen sapce (2/gridSize) * 0.5 => 1/gridSize\n  vec2 offset = 1.0 / gridSize;\n  pos = pos + offset;\n\n  gl_Position = vec4(pos, 0.0, 1.0);\n}\n";
exports.default = _default;
},{}],"nv7u":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2018 Uber Technologies, Inc.
//
// 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.
var _default = "#define SHADER_NAME gpu-aggregation-to-grid-fs\n\nprecision highp float;\n\nvarying vec3 vWeights;\n\nvoid main(void) {\n  gl_FragColor = vec4(vWeights, 1.0);\n}\n";
exports.default = _default;
},{}],"TY3n":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2018 Uber Technologies, Inc.
//
// 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.
var _default = "#version 300 es\n#define SHADER_NAME gpu-aggregation-all-vs-64\n\nin vec2 position;\nuniform vec2 gridSize;\n\nout vec2 vTextureCoord;\nvoid main(void) {\n  // Map each position to single pixel\n  vec2 pos = vec2(-1.0, -1.0);\n\n  // Move to pixel center, pixel-size in screen sapce (2/gridSize) * 0.5 => 1/gridSize\n  vec2 offset = 1.0 / gridSize;\n  pos = pos + offset;\n\n  gl_Position = vec4(pos, 0.0, 1.0);\n\n  float yIndex = floor(float(gl_InstanceID) / gridSize[0]);\n  float xIndex = float(gl_InstanceID) - (yIndex * gridSize[0]);\n\n  vec2 yIndexFP64 = vec2(yIndex, 0.);\n  vec2 xIndexFP64 = vec2(xIndex, 0.);\n  vec2 gridSizeYFP64 = vec2(gridSize[1], 0.);\n  vec2 gridSizeXFP64 = vec2(gridSize[0], 0.);\n\n  vec2 texCoordXFP64 = div_fp64(yIndexFP64, gridSizeYFP64);\n  vec2 texCoordYFP64 = div_fp64(xIndexFP64, gridSizeXFP64);\n\n  vTextureCoord = vec2(texCoordYFP64.x, texCoordXFP64.x);\n}\n";
exports.default = _default;
},{}],"IMZc":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2018 Uber Technologies, Inc.
//
// 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.
var _default = "#version 300 es\n#define SHADER_NAME gpu-aggregation-all-fs\n\nprecision highp float;\n\nin vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform bool combineMaxMin;\nout vec4 fragColor;\nvoid main(void) {\n  vec4 textureColor = texture(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));\n  if (textureColor.a == 0.) {\n    discard;\n  }\n  fragColor.rgb = textureColor.rgb;\n  // if combineMinMax is true, use Alpha channel for first weights min value.\n  fragColor.a = combineMaxMin ? textureColor.r : textureColor.a;\n}\n";
exports.default = _default;
},{}],"YCPC":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2018 Uber Technologies, Inc.
//
// 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.
var _default = "#define SHADER_NAME gpu-aggregation-transform-mean-vs\nattribute vec4 aggregationValues;\nvarying vec4 meanValues;\n\nvoid main()\n{\n  // TODO: Use 64-bit division ?? not needed given this is aggregation ??\n  bool isCellValid = bool(aggregationValues.w > 0.);\n  // aggregationValues:  XYZ contain aggregated values, W contains count\n  meanValues.xyz = isCellValid ? aggregationValues.xyz/aggregationValues.w : vec3(0, 0, 0);\n  meanValues.w = aggregationValues.w;\n}\n";
exports.default = _default;
},{}],"Exxp":[function(require,module,exports) {

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getFloatTexture = getFloatTexture;
exports.getFramebuffer = getFramebuffer;
exports.getFloatArray = getFloatArray;
exports.updateBuffer = updateBuffer;

var _constants = _interopRequireDefault(require("luma.gl/constants"));

var _luma = require("luma.gl");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

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;
} // Helper methods used by GPUGridAggregator.


function getFloatTexture(gl, opts) {
  var _parameters;

  var _opts$width = opts.width,
      width = _opts$width === void 0 ? 1 : _opts$width,
      _opts$height = opts.height,
      height = _opts$height === void 0 ? 1 : _opts$height;
  var texture = new _luma.Texture2D(gl, {
    data: null,
    format: _constants.default.RGBA32F,
    type: _constants.default.FLOAT,
    border: 0,
    mipmaps: false,
    parameters: (_parameters = {}, _defineProperty(_parameters, _constants.default.TEXTURE_MAG_FILTER, _constants.default.NEAREST), _defineProperty(_parameters, _constants.default.TEXTURE_MIN_FILTER, _constants.default.NEAREST), _parameters),
    dataFormat: _constants.default.RGBA,
    width: width,
    height: height
  });
  return texture;
}

function getFramebuffer(gl, opts) {
  var id = opts.id,
      _opts$width2 = opts.width,
      width = _opts$width2 === void 0 ? 1 : _opts$width2,
      _opts$height2 = opts.height,
      height = _opts$height2 === void 0 ? 1 : _opts$height2;
  var texture = opts.texture || getFloatTexture(gl, opts);
  var fb = new _luma.Framebuffer(gl, {
    id: id,
    width: width,
    height: height,
    attachments: _defineProperty({}, _constants.default.COLOR_ATTACHMENT0, texture)
  });
  return fb;
}

function getFloatArray(array, size) {
  var fillValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;

  if (!array || array.length < size) {
    return new Float32Array(size).fill(fillValue);
  }

  return array;
}

function updateBuffer(_ref) {
  var gl = _ref.gl,
      bufferName = _ref.bufferName,
      data = _ref.data,
      result = _ref.result;

  if (result[bufferName]) {
    result[bufferName].subData({
      data: data
    });
  } else {
    result[bufferName] = new _luma.Buffer(gl, data);
  }
}
},{"luma.gl/constants":"lMsC","luma.gl":"GAQa"}],"uIry":[function(require,module,exports) {

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _constants = _interopRequireDefault(require("luma.gl/constants"));

var _luma = require("luma.gl");

var _core = require("@deck.gl/core");

var _assert = _interopRequireDefault(require("../../../utils/assert"));

var _viewportMercatorProject = require("viewport-mercator-project");

var _gpuGridAggregatorConstants = require("./gpu-grid-aggregator-constants");

var _aggregateToGridVs = _interopRequireDefault(require("./aggregate-to-grid-vs.glsl"));

var _aggregateToGridVs2 = _interopRequireDefault(require("./aggregate-to-grid-vs-64.glsl"));

var _aggregateToGridFs = _interopRequireDefault(require("./aggregate-to-grid-fs.glsl"));

var _aggregateAllVs = _interopRequireDefault(require("./aggregate-all-vs-64.glsl"));

var _aggregateAllFs = _interopRequireDefault(require("./aggregate-all-fs.glsl"));

var _transformMeanVs = _interopRequireDefault(require("./transform-mean-vs.glsl"));

var _gpuGridAggregatorUtils = require("./gpu-grid-aggregator-utils.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

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;
}

function _slicedToArray(arr, i) {
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
}

function _nonIterableRest() {
  throw new TypeError("Invalid attempt to destructure non-iterable instance");
}

function _iterableToArrayLimit(arr, i) {
  var _arr = [];
  var _n = true;
  var _d = false;
  var _e = undefined;

  try {
    for (var _i = arr[Symbol.iterator](), _s; !(_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;
}

function _arrayWithHoles(arr) {
  if (Array.isArray(arr)) return arr;
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

var fp64ifyMatrix4 = _luma.fp64.fp64ifyMatrix4;

var GPUGridAggregator =
/*#__PURE__*/
function () {
  _createClass(GPUGridAggregator, null, [{
    key: "getAggregationData",
    // Decode and return aggregation data of given pixel.
    value: function getAggregationData(_ref) {
      var aggregationData = _ref.aggregationData,
          maxData = _ref.maxData,
          pixelIndex = _ref.pixelIndex;
      (0, _assert.default)(aggregationData.length >= (pixelIndex + 1) * _gpuGridAggregatorConstants.PIXEL_SIZE);
      (0, _assert.default)(maxData.length === _gpuGridAggregatorConstants.PIXEL_SIZE);
      var index = pixelIndex * _gpuGridAggregatorConstants.PIXEL_SIZE;
      var cellCount = aggregationData[index + 3];
      var cellWeight = aggregationData[index];
      var totalCount = maxData[3];
      var maxCellWieght = maxData[0];
      return {
        cellCount: cellCount,
        cellWeight: cellWeight,
        totalCount: totalCount,
        maxCellWieght: maxCellWieght
      };
    } // Decodes and retuns counts and weights of all cells

  }, {
    key: "getCellData",
    value: function getCellData(_ref2) {
      var countsData = _ref2.countsData,
          _ref2$size = _ref2.size,
          size = _ref2$size === void 0 ? 1 : _ref2$size;
      var numCells = countsData.length / 4;
      var cellWeights = new Float32Array(numCells * size);
      var cellCounts = new Uint32Array(numCells);

      for (var i = 0; i < numCells; i++) {
        // weights in RGB channels
        for (var sizeIndex = 0; sizeIndex < size; sizeIndex++) {
          cellWeights[i * size + sizeIndex] = countsData[i * 4 + sizeIndex];
        } // count in Alpha channel


        cellCounts[i] = countsData[i * 4 + 3];
      }

      return {
        cellCounts: cellCounts,
        cellWeights: cellWeights
      };
    } // DEBUG ONLY
    // static logData({aggregationBuffer, minBuffer, maxBuffer, maxMinBuffer}) {
    //   const agrData = aggregationBuffer.getData();
    //   for (let index = 0; index < agrData.length; index += 4) {
    //     if (agrData[index + 3] > 0) {
    //       console.log(
    //         `index: ${index} weights: ${agrData[index]} ${agrData[index + 1]} ${
    //           agrData[index + 2]
    //         } count: ${agrData[index + 3]}`
    //       );
    //     }
    //   }
    // }

  }]);

  function GPUGridAggregator(gl) {
    var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

    _classCallCheck(this, GPUGridAggregator);

    this.id = opts.id || 'gpu-grid-aggregator';
    this.shaderCache = opts.shaderCache || null;
    this.gl = gl;
    this.state = {
      // cache weights and position data to process when data is not changed
      weights: null,
      gridPositions: null,
      positionsBuffer: null,
      positions64xyLowBuffer: null,
      vertexCount: 0,
      // flags/variables that affect the aggregation
      fp64: null,
      useGPU: null,
      numCol: 0,
      numRow: 0,
      windowSize: null,
      cellSize: null,
      // per weight GPU resources
      weightAttributes: {},
      textures: {},
      meanTextures: {},
      buffers: {},
      framebuffers: {},
      maxMinFramebuffers: {},
      minFramebuffers: {},
      maxFramebuffers: {},
      equations: {}
    };
    this._hasGPUSupport = (0, _luma.isWebGL2)(gl) && // gl_InstanceID usage in min/max calculation shaders
    (0, _luma.hasFeatures)(this.gl, _luma.FEATURES.BLEND_EQUATION_MINMAX, // set min/max blend modes
    _luma.FEATURES.COLOR_ATTACHMENT_RGBA32F, // render to float texture
    _luma.FEATURES.TEXTURE_FLOAT // sample from a float texture
    );
  } // Delete owned resources.

  /* eslint no-unused-expressions: ["error", { "allowShortCircuit": true }] */


  _createClass(GPUGridAggregator, [{
    key: "delete",
    value: function _delete() {
      var gridAggregationModel = this.gridAggregationModel,
          allAggregationModel = this.allAggregationModel,
          meanTransform = this.meanTransform;
      var _this$state = this.state,
          positionsBuffer = _this$state.positionsBuffer,
          position64Buffer = _this$state.position64Buffer,
          framebuffers = _this$state.framebuffers,
          maxMinFramebuffers = _this$state.maxMinFramebuffers,
          minFramebuffers = _this$state.minFramebuffers,
          maxFramebuffers = _this$state.maxFramebuffers,
          meanTextures = _this$state.meanTextures;
      gridAggregationModel && gridAggregationModel.delete();
      allAggregationModel && allAggregationModel.delete();
      meanTransform && meanTransform.delete();
      positionsBuffer && positionsBuffer.delete();
      position64Buffer && position64Buffer.delete();
      this.deleteResources(framebuffers);
      this.deleteResources(maxMinFramebuffers);
      this.deleteResources(minFramebuffers);
      this.deleteResources(maxFramebuffers);
      this.deleteResources(meanTextures);
    } // Perform aggregation and retun the results

  }, {
    key: "run",
    value: function run() {
      var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      var aggregationParams = this.getAggregationParams(opts);
      this.updateGridSize(aggregationParams);
      var useGPU = aggregationParams.useGPU;

      if (this._hasGPUSupport && useGPU) {
        return this.runAggregationOnGPU(aggregationParams);
      }

      if (useGPU) {
        _core.log.warn('ScreenGridAggregator: GPU Aggregation not supported, falling back to CPU')();
      }

      return this.runAggregationOnCPU(aggregationParams);
    } // PRIVATE
    // Common methods

  }, {
    key: "deleteResources",
    value: function deleteResources(obj) {
      for (var name in obj) {
        obj[name].delete();
      }
    }
  }, {
    key: "getAggregationParams",
    value: function getAggregationParams(opts) {
      var aggregationParams = Object.assign({}, _gpuGridAggregatorConstants.DEFAULT_RUN_PARAMS, opts);
      var useGPU = aggregationParams.useGPU,
          gridTransformMatrix = aggregationParams.gridTransformMatrix,
          viewport = aggregationParams.viewport,
          weights = aggregationParams.weights,
          projectPoints = aggregationParams.projectPoints,
          cellSize = aggregationParams.cellSize;

      if (this.state.useGPU !== useGPU) {
        // CPU/GPU resources need to reinitialized, force set the change flags.
        aggregationParams.changeFlags = Object.assign({}, aggregationParams.changeFlags, _gpuGridAggregatorConstants.DEFAULT_CHANGE_FLAGS);
      }

      if (cellSize && (!this.state.cellSize || this.state.cellSize[0] !== cellSize[0] || this.state.cellSize[1] !== cellSize[1])) {
        aggregationParams.changeFlags.cellSizeChanged = true; // For GridLayer aggregation, cellSize is calculated by parsing all input data as it depends
        // on bounding box, cache cellSize

        this.setState({
          cellSize: cellSize
        });
      }

      this.validateProps(aggregationParams, opts);
      this.setState({
        useGPU: useGPU
      });
      aggregationParams.gridTransformMatrix = (projectPoints ? viewport.viewportMatrix : gridTransformMatrix) || _gpuGridAggregatorConstants.IDENTITY_MATRIX;

      if (weights) {
        aggregationParams.weights = this.normalizeWeightParams(weights); // cache weights to process when only cellSize or viewport is changed.
        // position data is cached in Buffers for GPU case and in 'gridPositions' for CPU case.

        this.setState({
          weights: aggregationParams.weights
        });
      }

      return aggregationParams;
    }
  }, {
    key: "normalizeWeightParams",
    value: function normalizeWeightParams(weights) {
      var result = {};

      for (var id in weights) {
        result[id] = Object.assign({}, _gpuGridAggregatorConstants.DEFAULT_WEIGHT_PARAMS, weights[id]);
      }

      return result;
    } // Update priveate state

  }, {
    key: "setState",
    value: function setState(updateObject) {
      Object.assign(this.state, updateObject);
    }
  }, {
    key: "shouldTransformToGrid",
    value: function shouldTransformToGrid(opts) {
      var projectPoints = opts.projectPoints,
          changeFlags = opts.changeFlags;

      if (!this.state.gridPositions || changeFlags.dataChanged || projectPoints && changeFlags.viewportChanged // world space aggregation (GridLayer) doesn't change when viewport is changed.
      ) {
          return true;
        }

      return false;
    }
  }, {
    key: "updateGridSize",
    value: function updateGridSize(opts) {
      var viewport = opts.viewport,
          cellSize = opts.cellSize;
      var width = opts.width || viewport.width;
      var height = opts.height || viewport.height;
      var numCol = Math.ceil(width / cellSize[0]);
      var numRow = Math.ceil(height / cellSize[1]);
      this.setState({
        numCol: numCol,
        numRow: numRow,
        windowSize: [width, height]
      });
    } // validate and assert

  }, {
    key: "validateProps",
    value: function validateProps(aggregationParams, opts) {
      var changeFlags = aggregationParams.changeFlags,
          projectPoints = aggregationParams.projectPoints,
          gridTransformMatrix = aggregationParams.gridTransformMatrix;
      (0, _assert.default)(changeFlags.dataChanged || changeFlags.viewportChanged || changeFlags.cellSizeChanged); // assert for required options

      (0, _assert.default)(!changeFlags.dataChanged || opts.positions && opts.weights && (!opts.projectPositions || opts.viewport) && opts.cellSize);
      (0, _assert.default)(!changeFlags.cellSizeChanged || opts.cellSize); // viewport need only when performing screen space aggregation (projectPoints is true)

      (0, _assert.default)(!(changeFlags.viewportChanged && projectPoints) || opts.viewport);

      if (projectPoints && gridTransformMatrix) {
        _core.log.warn('projectPoints is true, gridTransformMatrix is ignored')();
      }
    } // CPU Aggregation methods
    // aggregated weight value to a cell

    /* eslint-disable max-depth */

  }, {
    key: "calculateAggregationData",
    value: function calculateAggregationData(opts) {
      var weights = opts.weights,
          results = opts.results,
          cellIndex = opts.cellIndex,
          posIndex = opts.posIndex;

      for (var id in weights) {
        var _weights$id = weights[id],
            values = _weights$id.values,
            size = _weights$id.size,
            operation = _weights$id.operation;
        var aggregationData = results[id].aggregationData; // Fill RGB with weights

        for (var sizeIndex = 0; sizeIndex < size; sizeIndex++) {
          var cellElementIndex = cellIndex + sizeIndex;
          var weightComponent = values[posIndex * _gpuGridAggregatorConstants.WEIGHT_SIZE + sizeIndex];

          if (aggregationData[cellIndex + 3] === 0) {
            // if the cell is getting update the first time, set the value directly.
            aggregationData[cellElementIndex] = weightComponent;
          } else {
            switch (operation) {
              case _gpuGridAggregatorConstants.AGGREGATION_OPERATION.SUM:
              case _gpuGridAggregatorConstants.AGGREGATION_OPERATION.MEAN:
                aggregationData[cellElementIndex] += weightComponent; // MEAN value is calculated during 'calculateMeanMaxMinData'

                break;

              case _gpuGridAggregatorConstants.AGGREGATION_OPERATION.MIN:
                aggregationData[cellElementIndex] = Math.min(aggregationData[cellElementIndex], weightComponent);
                break;

              case _gpuGridAggregatorConstants.AGGREGATION_OPERATION.MAX:
                aggregationData[cellElementIndex] = Math.max(aggregationData[cellElementIndex], weightComponent);
                break;

              default:
                // Not a valid operation enum.
                (0, _assert.default)(false);
                break;
            }
          }
        } // Track the count per grid-cell


        aggregationData[cellIndex + 3]++;
      }
    }
    /* eslint-disable max-depth, complexity */

  }, {
    key: "calculateMeanMaxMinData",
    value: function calculateMeanMaxMinData(opts) {
      var validCellIndices = opts.validCellIndices,
          results = opts.results,
          weights = opts.weights; // collect max/min values

      validCellIndices.forEach(function (cellIndex) {
        for (var id in results) {
          var _weights$id2 = weights[id],
              size = _weights$id2.size,
              needMin = _weights$id2.needMin,
              needMax = _weights$id2.needMax,
              operation = _weights$id2.operation;
          var _results$id = results[id],
              aggregationData = _results$id.aggregationData,
              minData = _results$id.minData,
              maxData = _results$id.maxData,
              maxMinData = _results$id.maxMinData;
          var calculateMinMax = needMin || needMax;
          var calculateMean = operation === _gpuGridAggregatorConstants.AGGREGATION_OPERATION.MEAN;
          var combineMaxMin = needMin && needMax && weights[id].combineMaxMin;
          var count = aggregationData[cellIndex + _gpuGridAggregatorConstants.ELEMENTCOUNT - 1];

          for (var sizeIndex = 0; sizeIndex < size && (calculateMinMax || calculateMean); sizeIndex++) {
            var cellElementIndex = cellIndex + sizeIndex;
            var weight = aggregationData[cellElementIndex];

            if (calculateMean) {
              aggregationData[cellElementIndex] /= count;
              weight = aggregationData[cellElementIndex];
            }

            if (combineMaxMin) {
              // use RGB for max values for 3 weights.
              maxMinData[sizeIndex] = Math.max(maxMinData[sizeIndex], weight);
            } else {
              if (needMin) {
                minData[sizeIndex] = Math.min(minData[sizeIndex], weight);
              }

              if (needMax) {
                maxData[sizeIndex] = Math.max(maxData[sizeIndex], weight);
              }
            }
          } // update total aggregation values.


          if (combineMaxMin) {
            // Use Alpha channel to store total min value for weight#0
            maxMinData[_gpuGridAggregatorConstants.ELEMENTCOUNT - 1] = Math.min(maxMinData[_gpuGridAggregatorConstants.ELEMENTCOUNT - 1], aggregationData[cellIndex + 0]);
          } else {
            // Use Alpha channel to store total counts.
            if (needMin) {
              minData[_gpuGridAggregatorConstants.ELEMENTCOUNT - 1] += count;
            }

            if (needMax) {
              maxData[_gpuGridAggregatorConstants.ELEMENTCOUNT - 1] += count;
            }
          }
        }
      });
    }
    /* eslint-enable max-depth */

  }, {
    key: "initCPUResults",
    value: function initCPUResults(opts) {
      var weights = opts.weights || this.state.weights;
      var _this$state2 = this.state,
          numCol = _this$state2.numCol,
          numRow = _this$state2.numRow;
      var results = {}; // setup results object

      for (var id in weights) {
        var _weights$id3 = weights[id],
            aggregationData = _weights$id3.aggregationData,
            minData = _weights$id3.minData,
            maxData = _weights$id3.maxData,
            maxMinData = _weights$id3.maxMinData;
        var _weights$id4 = weights[id],
            needMin = _weights$id4.needMin,
            needMax = _weights$id4.needMax;
        var combineMaxMin = needMin && needMax && weights[id].combineMaxMin;
        var aggregationSize = numCol * numRow * _gpuGridAggregatorConstants.ELEMENTCOUNT;
        aggregationData = (0, _gpuGridAggregatorUtils.getFloatArray)(aggregationData, aggregationSize);

        if (combineMaxMin) {
          maxMinData = (0, _gpuGridAggregatorUtils.getFloatArray)(maxMinData, _gpuGridAggregatorConstants.ELEMENTCOUNT); // RGB for max value

          maxMinData.fill(-Infinity, 0, _gpuGridAggregatorConstants.ELEMENTCOUNT - 1); // Alpha for min value

          maxMinData[_gpuGridAggregatorConstants.ELEMENTCOUNT - 1] = Infinity;
        } else {
          // RGB for min/max values
          // Alpha for total count
          if (needMin) {
            minData = (0, _gpuGridAggregatorUtils.getFloatArray)(minData, _gpuGridAggregatorConstants.ELEMENTCOUNT, Infinity);
            minData[_gpuGridAggregatorConstants.ELEMENTCOUNT - 1] = 0;
          }

          if (needMax) {
            maxData = (0, _gpuGridAggregatorUtils.getFloatArray)(maxData, _gpuGridAggregatorConstants.ELEMENTCOUNT, -Infinity);
            maxData[_gpuGridAggregatorConstants.ELEMENTCOUNT - 1] = 0;
          }
        }

        results[id] = Object.assign({}, weights[id], {
          aggregationData: aggregationData,
          minData: minData,
          maxData: maxData,
          maxMinData: maxMinData
        });
      }

      return results;
    }
    /* eslint-disable max-statements */

  }, {
    key: "runAggregationOnCPU",
    value: function runAggregationOnCPU(opts) {
      var positions = opts.positions,
          cellSize = opts.cellSize,
          gridTransformMatrix = opts.gridTransformMatrix,
          viewport = opts.viewport,
          projectPoints = opts.projectPoints;
      var weights = opts.weights;
      var _this$state3 = this.state,
          numCol = _this$state3.numCol,
          numRow = _this$state3.numRow;
      var results = this.initCPUResults(opts); // screen space or world space projection required

      var gridTransformRequired = this.shouldTransformToGrid(opts);
      var gridPositions;
      var pos = [0, 0, 0];
      (0, _assert.default)(gridTransformRequired || opts.changeFlags.cellSizeChanged);
      var posCount;

      if (gridTransformRequired) {
        posCount = positions.length / 2;
        gridPositions = new Float64Array(positions.length);
        this.setState({
          gridPositions: gridPositions
        });
      } else {
        gridPositions = this.state.gridPositions;
        weights = this.state.weights;
        posCount = gridPositions.length / 2;
      }

      var validCellIndices = new Set();

      for (var posIndex = 0; posIndex < posCount; posIndex++) {
        var x = void 0;
        var y = void 0;

        if (gridTransformRequired) {
          pos[0] = positions[posIndex * 2];
          pos[1] = positions[posIndex * 2 + 1];

          if (projectPoints) {
            var _viewport$project = viewport.project(pos);

            var _viewport$project2 = _slicedToArray(_viewport$project, 2);

            x = _viewport$project2[0];
            y = _viewport$project2[1];
          } else {
            var _worldToPixels = (0, _viewportMercatorProject.worldToPixels)(pos, gridTransformMatrix);

            var _worldToPixels2 = _slicedToArray(_worldToPixels, 2);

            x = _worldToPixels2[0];
            y = _worldToPixels2[1];
          }

          gridPositions[posIndex * 2] = x;
          gridPositions[posIndex * 2 + 1] = y;
        } else {
          x = gridPositions[posIndex * 2];
          y = gridPositions[posIndex * 2 + 1];
        }

        var colId = Math.floor(x / cellSize[0]);
        var rowId = Math.floor(y / cellSize[1]);

        if (colId >= 0 && colId < numCol && rowId >= 0 && rowId < numRow) {
          var cellIndex = (colId + rowId * numCol) * _gpuGridAggregatorConstants.ELEMENTCOUNT;
          validCellIndices.add(cellIndex);
          this.calculateAggregationData({
            weights: weights,
            results: results,
            cellIndex: cellIndex,
            posIndex: posIndex
          });
        }
      }

      this.calculateMeanMaxMinData({
        validCellIndices: validCellIndices,
        results: results,
        weights: weights
      }); // Update buffer objects.

      this.updateAggregationBuffers(opts, results);
      return results;
    }
    /* eslint-disable max-statements */

  }, {
    key: "updateAggregationBuffers",
    value: function updateAggregationBuffers(opts, results) {
      if (!opts.createBufferObjects) {
        return;
      }

      var weights = opts.weights || this.state.weights;

      for (var id in results) {
        var _results$id2 = results[id],
            aggregationData = _results$id2.aggregationData,
            minData = _results$id2.minData,
            maxData = _results$id2.maxData,
            maxMinData = _results$id2.maxMinData;
        var _weights$id5 = weights[id],
            needMin = _weights$id5.needMin,
            needMax = _weights$id5.needMax;
        var combineMaxMin = needMin && needMax && weights[id].combineMaxMin;
        (0, _gpuGridAggregatorUtils.updateBuffer)({
          gl: this.gl,
          bufferName: 'aggregationBuffer',
          data: aggregationData,
          result: results[id]
        });

        if (combineMaxMin) {
          (0, _gpuGridAggregatorUtils.updateBuffer)({
            gl: this.gl,
            bufferName: 'maxMinBuffer',
            data: maxMinData,
            result: results[id]
          });
        } else {
          if (needMin) {
            (0, _gpuGridAggregatorUtils.updateBuffer)({
              gl: this.gl,
              bufferName: 'minBuffer',
              data: minData,
              result: results[id]
            });
          }

          if (needMax) {
            (0, _gpuGridAggregatorUtils.updateBuffer)({
              gl: this.gl,
              bufferName: 'maxBuffer',
              data: maxData,
              result: results[id]
            });
          }
        }
      }
    } // GPU Aggregation methods

  }, {
    key: "getAggregateData",
    value: function getAggregateData(opts) {
      var results = {};
      var _this$state4 = this.state,
          textures = _this$state4.textures,
          framebuffers = _this$state4.framebuffers,
          maxMinFramebuffers = _this$state4.maxMinFramebuffers,
          minFramebuffers = _this$state4.minFramebuffers,
          maxFramebuffers = _this$state4.maxFramebuffers,
          weights = _this$state4.weights;

      for (var id in weights) {
        results[id] = {};
        var _weights$id6 = weights[id],
            needMin = _weights$id6.needMin,
            needMax = _weights$id6.needMax,
            combineMaxMin = _weights$id6.combineMaxMin;
        results[id].aggregationTexture = textures[id];
        results[id].aggregationBuffer = framebuffers[id].readPixelsToBuffer({
          buffer: weights[id].aggregationBuffer,
          // update if a buffer is provided
          type: _constants.default.FLOAT
        });

        if (needMin && needMax && combineMaxMin) {
          results[id].maxMinBuffer = maxMinFramebuffers[id].readPixelsToBuffer({
            buffer: weights[id].maxMinBuffer,
            // update if a buffer is provided
            type: _constants.default.FLOAT
          });
        } else {
          if (needMin) {
            results[id].minBuffer = minFramebuffers[id].readPixelsToBuffer({
              buffer: weights[id].minBuffer,
              // update if a buffer is provided
              type: _constants.default.FLOAT
            });
          }

          if (needMax) {
            results[id].maxBuffer = maxFramebuffers[id].readPixelsToBuffer({
              buffer: weights[id].maxBuffer,
              // update if a buffer is provided
              type: _constants.default.FLOAT
            });
          }
        }
      }

      return results;
    }
  }, {
    key: "getAggregationModel",
    value: function getAggregationModel() {
      var fp64 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
      var gl = this.gl,
          shaderCache = this.shaderCache;
      return new _luma.Model(gl, {
        id: 'Gird-Aggregation-Model',
        vs: fp64 ? _aggregateToGridVs2.default : _aggregateToGridVs.default,
        fs: _aggregateToGridFs.default,
        modules: fp64 ? ['fp64', 'project64'] : ['project32'],
        shaderCache: shaderCache,
        vertexCount: 0,
        drawMode: _constants.default.POINTS
      });
    }
  }, {
    key: "getAllAggregationModel",
    value: function getAllAggregationModel() {
      var fp64 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
      var gl = this.gl,
          shaderCache = this.shaderCache;
      return new _luma.Model(gl, {
        id: 'All-Aggregation-Model',
        vs: _aggregateAllVs.default,
        fs: _aggregateAllFs.default,
        modules: ['fp64'],
        shaderCache: shaderCache,
        vertexCount: 1,
        drawMode: _constants.default.POINTS,
        isInstanced: true,
        instanceCount: 0,
        attributes: {
          position: new _luma.Buffer(gl, {
            size: 2,
            data: new Float32Array([0, 0])
          })
        }
      });
    }
  }, {
    key: "getMeanTransform",
    value: function getMeanTransform(opts) {
      if (this.meanTransform) {
        this.meanTransform.update(opts);
      } else {
        this.meanTransform = new _luma.Transform(this.gl, Object.assign({}, {
          vs: _transformMeanVs.default,
          _targetTextureVarying: 'meanValues'
        }, opts));
      }

      return this.meanTransform;
    }
  }, {
    key: "renderAggregateData",
    value: function renderAggregateData(opts) {
      var cellSize = opts.cellSize,
          viewport = opts.viewport,
          gridTransformMatrix = opts.gridTransformMatrix,
          projectPoints = opts.projectPoints;
      var _this$state5 = this.state,
          numCol = _this$state5.numCol,
          numRow = _this$state5.numRow,
          windowSize = _this$state5.windowSize,
          maxMinFramebuffers = _this$state5.maxMinFramebuffers,
          minFramebuffers = _this$state5.minFramebuffers,
          maxFramebuffers = _this$state5.maxFramebuffers,
          weights = _this$state5.weights;
      var uProjectionMatrixFP64 = fp64ifyMatrix4(gridTransformMatrix);
      var gridSize = [numCol, numRow];
      var parameters = {
        blend: true,
        depthTest: false,
        blendFunc: [_constants.default.ONE, _constants.default.ONE]
      };
      var moduleSettings = {
        viewport: viewport
      };
      var uniforms = {
        windowSize: windowSize,
        cellSize: cellSize,
        gridSize: gridSize,
        uProjectionMatrix: gridTransformMatrix,
        uProjectionMatrixFP64: uProjectionMatrixFP64,
        projectPoints: projectPoints
      };

      for (var id in weights) {
        var _weights$id7 = weights[id],
            needMin = _weights$id7.needMin,
            needMax = _weights$id7.needMax;
        var combineMaxMin = needMin && needMax && weights[id].combineMaxMin;
        this.renderToWeightsTexture({
          id: id,
          parameters: parameters,
          moduleSettings: moduleSettings,
          uniforms: uniforms,
          gridSize: gridSize
        });

        if (combineMaxMin) {
          this.renderToMaxMinTexture({
            id: id,
            parameters: Object.assign({}, parameters, {
              blendEquation: _gpuGridAggregatorConstants.MAX_MIN_BLEND_EQUATION
            }),
            gridSize: gridSize,
            minOrMaxFb: maxMinFramebuffers[id],
            clearParams: {
              clearColor: [0, 0, 0, _gpuGridAggregatorConstants.MAX_32_BIT_FLOAT]
            },
            combineMaxMin: combineMaxMin
          });
        } else {
          if (needMin) {
            this.renderToMaxMinTexture({
              id: id,
              parameters: Object.assign({}, parameters, {
                blendEquation: _gpuGridAggregatorConstants.MIN_BLEND_EQUATION
              }),
              gridSize: gridSize,
              minOrMaxFb: minFramebuffers[id],
              clearParams: {
                clearColor: [_gpuGridAggregatorConstants.MAX_32_BIT_FLOAT, _gpuGridAggregatorConstants.MAX_32_BIT_FLOAT, _gpuGridAggregatorConstants.MAX_32_BIT_FLOAT, 0]
              },
              combineMaxMin: combineMaxMin
            });
          }

          if (needMax) {
            this.renderToMaxMinTexture({
              id: id,
              parameters: Object.assign({}, parameters, {
                blendEquation: _gpuGridAggregatorConstants.MAX_BLEND_EQUATION
              }),
              gridSize: gridSize,
              minOrMaxFb: maxFramebuffers[id],
              combineMaxMin: combineMaxMin
            });
          }
        }
      }
    } // render all aggregated grid-cells to generate Min, Max or MaxMin data texture

  }, {
    key: "renderToMaxMinTexture",
    value: function renderToMaxMinTexture(opts) {
      var id = opts.id,
          parameters = opts.parameters,
          gridSize = opts.gridSize,
          minOrMaxFb = opts.minOrMaxFb,
          combineMaxMin = opts.combineMaxMin,
          _opts$clearParams = opts.clearParams,
          clearParams = _opts$clearParams === void 0 ? {} : _opts$clearParams;
      var framebuffers = this.state.framebuffers;
      var gl = this.gl,
          allAggregationModel = this.allAggregationModel;
      minOrMaxFb.bind();
      gl.viewport(0, 0, gridSize[0], gridSize[1]);
      (0, _luma.withParameters)(gl, clearParams, function () {
        gl.clear(gl.COLOR_BUFFER_BIT);
      });
      allAggregationModel.draw({
        parameters: parameters,
        uniforms: {
          uSampler: framebuffers[id].texture,
          gridSize: gridSize,
          combineMaxMin: combineMaxMin
        }
      });
      minOrMaxFb.unbind();
    } // render all data points to aggregate weights

  }, {
    key: "renderToWeightsTexture",
    value: function renderToWeightsTexture(opts) {
      var id = opts.id,
          parameters = opts.parameters,
          moduleSettings = opts.moduleSettings,
          uniforms = opts.uniforms,
          gridSize = opts.gridSize;
      var _this$state6 = this.state,
          framebuffers = _this$state6.framebuffers,
          equations = _this$state6.equations,
          weightAttributes = _this$state6.weightAttributes,
          weights = _this$state6.weights;
      var gl = this.gl,
          gridAggregationModel = this.gridAggregationModel;
      var operation = weights[id].operation;
      framebuffers[id].bind();
      gl.viewport(0, 0, gridSize[0], gridSize[1]);
      var clearColor = operation === _gpuGridAggregatorConstants.AGGREGATION_OPERATION.MIN ? [_gpuGridAggregatorConstants.MAX_32_BIT_FLOAT, _gpuGridAggregatorConstants.MAX_32_BIT_FLOAT, _gpuGridAggregatorConstants.MAX_32_BIT_FLOAT, 0] : [0, 0, 0, 0];
      (0, _luma.withParameters)(gl, {
        clearColor: clearColor
      }, function () {
        gl.clear(gl.COLOR_BUFFER_BIT);
      });
      var attributes = {
        weights: weightAttributes[id]
      };
      gridAggregationModel.draw({
        parameters: Object.assign({}, parameters, {
          blendEquation: equations[id]
        }),
        moduleSettings: moduleSettings,
        uniforms: uniforms,
        attributes: attributes
      });
      framebuffers[id].unbind();

      if (operation === _gpuGridAggregatorConstants.AGGREGATION_OPERATION.MEAN) {
        var _this$state7 = this.state,
            meanTextures = _this$state7.meanTextures,
            textures = _this$state7.textures;
        var transformOptions = {
          _sourceTextures: {
            aggregationValues: meanTextures[id]
          },
          // contains aggregated data
          _targetTexture: textures[id],
          // store mean values,
          elementCount: textures[id].width * textures[id].height
        };
        var meanTransform = this.getMeanTransform(transformOptions);
        meanTransform.run({
          parameters: {
            blend: false,
            depthTest: false
          }
        }); // update framebuffer with mean results so readPixelsToBuffer returns mean values

        framebuffers[id].attach(_defineProperty({}, _constants.default.COLOR_ATTACHMENT0, textures[id]));
      }
    }
  }, {
    key: "runAggregationOnGPU",
    value: function runAggregationOnGPU(opts) {
      this.updateModels(opts);
      this.setupFramebuffers(opts);
      this.renderAggregateData(opts);
      return this.getAggregateData(opts);
    } // set up framebuffer for each weight

    /* eslint-disable complexity, max-depth */

  }, {
    key: "setupFramebuffers",
    value: function setupFramebuffers(opts) {
      var _this$state8 = this.state,
          numCol = _this$state8.numCol,
          numRow = _this$state8.numRow,
          textures = _this$state8.textures,
          framebuffers = _this$state8.framebuffers,
          maxMinFramebuffers = _this$state8.maxMinFramebuffers,
          minFramebuffers = _this$state8.minFramebuffers,
          maxFramebuffers = _this$state8.maxFramebuffers,
          meanTextures = _this$state8.meanTextures,
          equations = _this$state8.equations,
          weights = _this$state8.weights;
      var framebufferSize = {
        width: numCol,
        height: numRow
      };

      for (var id in weights) {
        var _weights$id8 = weights[id],
            needMin = _weights$id8.needMin,
            needMax = _weights$id8.needMax,
            combineMaxMin = _weights$id8.combineMaxMin,
            operation = _weights$id8.operation;
        textures[id] = weights[id].aggregationTexture || textures[id] || (0, _gpuGridAggregatorUtils.getFloatTexture)(this.gl, {
          id: "".concat(id, "-texture"),
          width: numCol,
          height: numRow
        });
        textures[id].resize(framebufferSize);
        var texture = textures[id];

        if (operation === _gpuGridAggregatorConstants.AGGREGATION_OPERATION.MEAN) {
          // For MEAN, we first aggregatet into a temp texture
          meanTextures[id] = meanTextures[id] || (0, _gpuGridAggregatorUtils.getFloatTexture)(this.gl, {
            id: "".concat(id, "-mean-texture"),
            width: numCol,
            height: numRow
          });
          meanTextures[id].resize(framebufferSize);
          texture = meanTextures[id];
        }

        if (framebuffers[id]) {
          framebuffers[id].attach(_defineProperty({}, _constants.default.COLOR_ATTACHMENT0, texture));
        } else {
          framebuffers[id] = (0, _gpuGridAggregatorUtils.getFramebuffer)(this.gl, {
            id: "".concat(id, "-fb"),
            width: numCol,
            height: numRow,
            texture: texture
          });
        }

        framebuffers[id].resize(framebufferSize);
        equations[id] = _gpuGridAggregatorConstants.EQUATION_MAP[operation]; // For min/max framebuffers will use default size 1X1

        if (needMin || needMax) {
          if (needMin && needMax && combineMaxMin) {
            maxMinFramebuffers[id] = maxMinFramebuffers[id] || (0, _gpuGridAggregatorUtils.getFramebuffer)(this.gl, {
              id: "".concat(id, "-maxMinFb")
            });
          } else {
            if (needMin) {
              minFramebuffers[id] = minFramebuffers[id] || (0, _gpuGridAggregatorUtils.getFramebuffer)(this.gl, {
                id: "".concat(id, "-minFb")
              });
            }

            if (needMax) {
              maxFramebuffers[id] = maxFramebuffers[id] || (0, _gpuGridAggregatorUtils.getFramebuffer)(this.gl, {
                id: "".concat(id, "-maxFb")
              });
            }
          }
        }
      }
    }
    /* eslint-enable complexity, max-depth */

  }, {
    key: "setupModels",
    value: function setupModels() {
      var fp64 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;

      if (this.gridAggregationModel) {
        this.gridAggregationModel.delete();
      }

      this.gridAggregationModel = this.getAggregationModel(fp64);

      if (this.allAggregationModel) {
        this.allAggregationModel.delete();
      }

      this.allAggregationModel = this.getAllAggregationModel(fp64);
    } // set up buffers for all weights

  }, {
    key: "setupWeightAttributes",
    value: function setupWeightAttributes(opts) {
      var _this$state9 = this.state,
          weightAttributes = _this$state9.weightAttributes,
          vertexCount = _this$state9.vertexCount,
          weights = _this$state9.weights;

      for (var id in weights) {
        var values = weights[id].values; // values can be Array, Float32Array or Buffer

        if (Array.isArray(values) || values.constructor === Float32Array) {
          (0, _assert.default)(values.length / 3 === vertexCount);
          var typedArray = Array.isArray(values) ? new Float32Array(values) : values;

          if (weightAttributes[id] instanceof _luma.Buffer) {
            weightAttributes[id].setData(typedArray);
          } else {
            weightAttributes[id] = new _luma.Buffer(this.gl, typedArray);
          }
        } else {
          // assert((values instanceof Attribute) || (values instanceof Buffer));
          (0, _assert.default)(values instanceof _luma.Buffer);
          weightAttributes[id] = values;
        }
      }
    }
    /* eslint-disable max-statements */

  }, {
    key: "updateModels",
    value: function updateModels(opts) {
      var gl = this.gl;
      var positions = opts.positions,
          positions64xyLow = opts.positions64xyLow,
          changeFlags = opts.changeFlags;
      var _this$state10 = this.state,
          numCol = _this$state10.numCol,
          numRow = _this$state10.numRow;
      var _this$state11 = this.state,
          positionsBuffer = _this$state11.positionsBuffer,
          positions64xyLowBuffer = _this$state11.positions64xyLowBuffer;
      var aggregationModelAttributes = {};
      var createPos64xyLow = false;

      if (opts.fp64 !== this.state.fp64) {
        this.setupModels(opts.fp64);
        this.setState({
          fp64: opts.fp64
        });

        if (opts.fp64) {
          createPos64xyLow = true;
        }
      }

      if (changeFlags.dataChanged || !positionsBuffer) {
        if (positionsBuffer) {
          positionsBuffer.delete();
        }

        var vertexCount = positions.length / 2; // positionsBuffer = new Buffer(gl, {size: 2, data: new Float32Array(positions)});

        positionsBuffer = new _luma.Buffer(gl, new Float32Array(positions));
        createPos64xyLow = opts.fp64;
        Object.assign(aggregationModelAttributes, {
          positions: positionsBuffer
        });
        this.setState({
          positionsBuffer: positionsBuffer,
          vertexCount: vertexCount
        });
        this.setupWeightAttributes(opts);
        this.gridAggregationModel.setVertexCount(vertexCount);
      }

      if (createPos64xyLow) {
        (0, _assert.default)(positions64xyLow);

        if (positions64xyLowBuffer) {
          positions64xyLowBuffer.delete();
        }

        positions64xyLowBuffer = new _luma.Buffer(gl, {
          size: 2,
          data: new Float32Array(positions64xyLow)
        });
        Object.assign(aggregationModelAttributes, {
          positions64xyLow: positions64xyLowBuffer
        });
        this.setState({
          positions64xyLowBuffer: positions64xyLowBuffer
        });
      }

      this.gridAggregationModel.setAttributes(aggregationModelAttributes);

      if (changeFlags.cellSizeChanged || changeFlags.viewportChanged) {
        this.allAggregationModel.setInstanceCount(numCol * numRow);
      }
    }
    /* eslint-enable max-statements */

  }]);

  return GPUGridAggregator;
}();

exports.default = GPUGridAggregator;
},{"luma.gl/constants":"lMsC","luma.gl":"GAQa","@deck.gl/core":"Tk4X","../../../utils/assert":"sRS1","viewport-mercator-project":"K6fX","./gpu-grid-aggregator-constants":"O8Mj","./aggregate-to-grid-vs.glsl":"dEjh","./aggregate-to-grid-vs-64.glsl":"yJON","./aggregate-to-grid-fs.glsl":"nv7u","./aggregate-all-vs-64.glsl":"TY3n","./aggregate-all-fs.glsl":"IMZc","./transform-mean-vs.glsl":"YCPC","./gpu-grid-aggregator-utils.js":"Exxp"}],"ptqg":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.createIterable = createIterable;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var EMPTY_ARRAY = [];
var placeholderArray = [];
/*
 * Create an Iterable
 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols
 * and a "context" tracker from the given data
 */

function createIterable(data) {
  var iterable = EMPTY_ARRAY;
  var objectInfo = {
    index: -1,
    data: data,
    // visitor can optionally utilize this to avoid constructing a new array for every object
    target: []
  };

  if (!data) {
    iterable = EMPTY_ARRAY;
  } else if (typeof data[Symbol.iterator] === 'function') {
    // data is already an iterable
    iterable = data;
  } else if (data.length > 0) {
    placeholderArray.length = data.length;
    iterable = placeholderArray;
  }

  return {
    iterable: iterable,
    objectInfo: objectInfo
  };
}
},{}],"cWfN":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.pointToDensityGridData = pointToDensityGridData;
exports.alignToCell = alignToCell;

var _assert = _interopRequireDefault(require("../../../utils/assert"));

var _math = require("math.gl");

var _luma = require("luma.gl");

var _constants = require("../../../lib/constants");

var _iterableUtils = require("../../../utils/iterable-utils");

var _count = require("../../../utils/count");

var _gpuGridAggregatorConstants = require("./gpu-grid-aggregator-constants");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var fp64LowPart = _luma.fp64.fp64LowPart;
var R_EARTH = 6378000;
var DEFAULT_WEIGHT = [1, 0, 0]; // Takes data and aggregation params and returns aggregated data.

function pointToDensityGridData(_ref) {
  var data = _ref.data,
      getPosition = _ref.getPosition,
      cellSizeMeters = _ref.cellSizeMeters,
      gpuGridAggregator = _ref.gpuGridAggregator,
      gpuAggregation = _ref.gpuAggregation,
      aggregationFlags = _ref.aggregationFlags,
      getWeight = _ref.getWeight,
      _ref$fp = _ref.fp64,
      fp64 = _ref$fp === void 0 ? false : _ref$fp,
      _ref$coordinateSystem = _ref.coordinateSystem,
      coordinateSystem = _ref$coordinateSystem === void 0 ? _constants.COORDINATE_SYSTEM.LNGLAT : _ref$coordinateSystem,
      _ref$viewport = _ref.viewport,
      viewport = _ref$viewport === void 0 ? null : _ref$viewport,
      _ref$boundingBox = _ref.boundingBox,
      boundingBox = _ref$boundingBox === void 0 ? null : _ref$boundingBox;
  var gridData = {};
  (0, _assert.default)(aggregationFlags.dataChanged || aggregationFlags.cellSizeChanged || aggregationFlags.viewportChanged);

  if (aggregationFlags.dataChanged) {
    gridData = parseGridData(data, getPosition, getWeight);
    boundingBox = gridData.boundingBox;
  }

  var cellSize = [cellSizeMeters, cellSizeMeters];
  var worldOrigin = [0, 0];
  (0, _assert.default)(coordinateSystem === _constants.COORDINATE_SYSTEM.LNGLAT || coordinateSystem === _constants.COORDINATE_SYSTEM.IDENTITY);

  switch (coordinateSystem) {
    case _constants.COORDINATE_SYSTEM.LNGLAT:
    case _constants.COORDINATE_SYSTEM.LNGLAT_DEPRECATED:
      var gridOffset = getGridOffset(boundingBox, cellSizeMeters);
      cellSize = [gridOffset.xOffset, gridOffset.yOffset];
      worldOrigin = [-180, -90]; // Origin used to define grid cell boundaries

      break;

    case _constants.COORDINATE_SYSTEM.IDENTITY:
      var width = viewport.width,
          height = viewport.height;
      worldOrigin = [-width / 2, -height / 2]; // Origin used to define grid cell boundaries

      break;

    default:
      // Currently other coodinate systems not supported/verified.
      (0, _assert.default)(false);
  }

  var opts = getGPUAggregationParams({
    boundingBox: boundingBox,
    cellSize: cellSize,
    worldOrigin: worldOrigin
  });
  var aggregatedData = gpuGridAggregator.run({
    positions: gridData.positions,
    positions64xyLow: gridData.positions64xyLow,
    weights: gridData.weights,
    cellSize: cellSize,
    width: opts.width,
    height: opts.height,
    gridTransformMatrix: opts.gridTransformMatrix,
    useGPU: gpuAggregation,
    changeFlags: aggregationFlags,
    fp64: fp64
  });
  return {
    countsBuffer: aggregatedData.weight1.aggregationBuffer,
    maxCountBuffer: aggregatedData.weight1.maxBuffer,
    countsData: aggregatedData.weight1.aggregationData,
    maxCountData: aggregatedData.weight1.maxData,
    gridSize: opts.gridSize,
    gridOrigin: opts.gridOrigin,
    cellSize: cellSize,
    boundingBox: boundingBox
  };
} // Parse input data to build positions, wights and bounding box.

/* eslint-disable max-statements */


function parseGridData(data, getPosition) {
  var getWeight = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  var pointCount = (0, _count.count)(data);
  var positions = new Float32Array(pointCount * 2);
  var positions64xyLow = new Float32Array(pointCount * 2);
  var weightValues = new Float32Array(pointCount * 3);
  var yMin = Infinity;
  var yMax = -Infinity;
  var xMin = Infinity;
  var xMax = -Infinity;
  var y;
  var x;

  var _createIterable = (0, _iterableUtils.createIterable)(data),
      iterable = _createIterable.iterable,
      objectInfo = _createIterable.objectInfo;

  var _iteratorNormalCompletion = true;
  var _didIteratorError = false;
  var _iteratorError = undefined;

  try {
    for (var _iterator = iterable[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
      var object = _step.value;
      objectInfo.index++;
      var position = getPosition(object, objectInfo);
      var index = objectInfo.index;
      x = position[0];
      y = position[1];
      positions[index * 2] = x;
      positions[index * 2 + 1] = y;
      positions64xyLow[index * 2] = fp64LowPart(x);
      positions64xyLow[index * 2 + 1] = fp64LowPart(y);
      var weight = getWeight ? getWeight(object, objectInfo) : DEFAULT_WEIGHT; // Aggregator expects each weight is an array of size 3

      if (Array.isArray(weight)) {
        weightValues[index * 3] = weight[0];
        weightValues[index * 3 + 1] = weight[1];
        weightValues[index * 3 + 2] = weight[2];
      } else {
        // backward compitability
        weightValues[index * 3] = weight;
      }

      if (Number.isFinite(y) && Number.isFinite(x)) {
        yMin = y < yMin ? y : yMin;
        yMax = y > yMax ? y : yMax;
        xMin = x < xMin ? x : xMin;
        xMax = x > xMax ? x : xMax;
      }
    }
  } catch (err) {
    _didIteratorError = true;
    _iteratorError = err;
  } finally {
    try {
      if (!_iteratorNormalCompletion && _iterator.return != null) {
        _iterator.return();
      }
    } finally {
      if (_didIteratorError) {
        throw _iteratorError;
      }
    }
  }

  var weights = {
    weight1: {
      size: 1,
      operation: _gpuGridAggregatorConstants.AGGREGATION_OPERATION.SUM,
      needMax: true,
      values: weightValues
    }
  };
  var boundingBox = {
    xMin: xMin,
    xMax: xMax,
    yMin: yMin,
    yMax: yMax
  };
  return {
    positions: positions,
    positions64xyLow: positions64xyLow,
    weights: weights,
    boundingBox: boundingBox
  };
}
/* eslint-enable max-statements */

/**
 * Based on geometric center of sample points, calculate cellSize in lng/lat (degree) space
 * @param {object} gridData - contains bounding box of data
 * @param {number} cellSize - grid cell size in meters
 * @returns {yOffset, xOffset} - cellSize size lng/lat (degree) space.
 */


function getGridOffset(boundingBox, cellSize) {
  var yMin = boundingBox.yMin,
      yMax = boundingBox.yMax;
  var latMin = yMin;
  var latMax = yMax;
  var centerLat = (latMin + latMax) / 2;
  return calculateGridLatLonOffset(cellSize, centerLat);
}
/**
 * calculate grid layer cell size in lat lon based on world unit size
 * and current latitude
 * @param {number} cellSize
 * @param {number} latitude
 * @returns {object} - lat delta and lon delta
 */


function calculateGridLatLonOffset(cellSize, latitude) {
  var yOffset = calculateLatOffset(cellSize);
  var xOffset = calculateLonOffset(latitude, cellSize);
  return {
    yOffset: yOffset,
    xOffset: xOffset
  };
}
/**
 * with a given x-km change, calculate the increment of latitude
 * based on stackoverflow http://stackoverflow.com/questions/7477003
 * @param {number} dy - change in km
 * @return {number} - increment in latitude
 */


function calculateLatOffset(dy) {
  return dy / R_EARTH * (180 / Math.PI);
}
/**
 * with a given x-km change, and current latitude
 * calculate the increment of longitude
 * based on stackoverflow http://stackoverflow.com/questions/7477003
 * @param {number} lat - latitude of current location (based on city)
 * @param {number} dx - change in km
 * @return {number} - increment in longitude
 */


function calculateLonOffset(lat, dx) {
  return dx / R_EARTH * (180 / Math.PI) / Math.cos(lat * Math.PI / 180);
} // Aligns `inValue` to given `cellSize`


function alignToCell(inValue, cellSize) {
  var sign = inValue < 0 ? -1 : 1;
  var value = sign < 0 ? Math.abs(inValue) + cellSize : Math.abs(inValue);
  value = Math.floor(value / cellSize) * cellSize;
  return value * sign;
} // Calculate grid parameters


function getGPUAggregationParams(_ref2) {
  var boundingBox = _ref2.boundingBox,
      cellSize = _ref2.cellSize,
      worldOrigin = _ref2.worldOrigin;
  var yMin = boundingBox.yMin,
      yMax = boundingBox.yMax,
      xMin = boundingBox.xMin,
      xMax = boundingBox.xMax; // NOTE: this alignment will match grid cell boundaries with existing CPU implementation
  // this gurantees identical aggregation results when switching between CPU and GPU aggregation.
  // Also gurantees same cell boundaries, when overlapping between two different layers (like ScreenGrid and Contour)
  // We first move worldOrigin to [0, 0], align the lower bounding box , then move worldOrigin to its original value.

  var originX = alignToCell(xMin - worldOrigin[0], cellSize[0]) + worldOrigin[0];
  var originY = alignToCell(yMin - worldOrigin[1], cellSize[1]) + worldOrigin[1]; // Setup transformation matrix so that every point is in +ve range

  var gridTransformMatrix = new _math.Matrix4().translate([-1 * originX, -1 * originY, 0]); // const cellSize = [gridOffset.xOffset, gridOffset.yOffset];

  var gridOrigin = [originX, originY];
  var width = xMax - xMin + cellSize[0];
  var height = yMax - yMin + cellSize[1];
  var gridSize = [Math.ceil(width / cellSize[0]), Math.ceil(height / cellSize[1])];
  return {
    gridOrigin: gridOrigin,
    gridSize: gridSize,
    width: width,
    height: height,
    gridTransformMatrix: gridTransformMatrix
  };
}
},{"../../../utils/assert":"sRS1","math.gl":"dl2t","luma.gl":"GAQa","../../../lib/constants":"GfMx","../../../utils/iterable-utils":"ptqg","../../../utils/count":"W4L2","./gpu-grid-aggregator-constants":"O8Mj"}],"Tk4X":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "COORDINATE_SYSTEM", {
  enumerable: true,
  get: function () {
    return _constants.COORDINATE_SYSTEM;
  }
});
Object.defineProperty(exports, "Deck", {
  enumerable: true,
  get: function () {
    return _deck.default;
  }
});
Object.defineProperty(exports, "LayerManager", {
  enumerable: true,
  get: function () {
    return _layerManager.default;
  }
});
Object.defineProperty(exports, "AttributeManager", {
  enumerable: true,
  get: function () {
    return _attributeManager.default;
  }
});
Object.defineProperty(exports, "Layer", {
  enumerable: true,
  get: function () {
    return _layer.default;
  }
});
Object.defineProperty(exports, "CompositeLayer", {
  enumerable: true,
  get: function () {
    return _compositeLayer.default;
  }
});
Object.defineProperty(exports, "Viewport", {
  enumerable: true,
  get: function () {
    return _viewport.default;
  }
});
Object.defineProperty(exports, "WebMercatorViewport", {
  enumerable: true,
  get: function () {
    return _webMercatorViewport.default;
  }
});
Object.defineProperty(exports, "project", {
  enumerable: true,
  get: function () {
    return _project.default;
  }
});
Object.defineProperty(exports, "project64", {
  enumerable: true,
  get: function () {
    return _project2.default;
  }
});
Object.defineProperty(exports, "lighting", {
  enumerable: true,
  get: function () {
    return _lighting.default;
  }
});
Object.defineProperty(exports, "View", {
  enumerable: true,
  get: function () {
    return _view.default;
  }
});
Object.defineProperty(exports, "MapView", {
  enumerable: true,
  get: function () {
    return _mapView.default;
  }
});
Object.defineProperty(exports, "FirstPersonView", {
  enumerable: true,
  get: function () {
    return _firstPersonView.default;
  }
});
Object.defineProperty(exports, "ThirdPersonView", {
  enumerable: true,
  get: function () {
    return _thirdPersonView.default;
  }
});
Object.defineProperty(exports, "OrbitView", {
  enumerable: true,
  get: function () {
    return _orbitView.default;
  }
});
Object.defineProperty(exports, "PerspectiveView", {
  enumerable: true,
  get: function () {
    return _perspectiveView.default;
  }
});
Object.defineProperty(exports, "OrthographicView", {
  enumerable: true,
  get: function () {
    return _orthographicView.default;
  }
});
Object.defineProperty(exports, "Controller", {
  enumerable: true,
  get: function () {
    return _controller.default;
  }
});
Object.defineProperty(exports, "MapController", {
  enumerable: true,
  get: function () {
    return _mapController.default;
  }
});
Object.defineProperty(exports, "_FirstPersonController", {
  enumerable: true,
  get: function () {
    return _firstPersonController.default;
  }
});
Object.defineProperty(exports, "_OrbitController", {
  enumerable: true,
  get: function () {
    return _orbitController.default;
  }
});
Object.defineProperty(exports, "_OrthographicController", {
  enumerable: true,
  get: function () {
    return _orthographicController.default;
  }
});
Object.defineProperty(exports, "_EffectManager", {
  enumerable: true,
  get: function () {
    return _effectManager.default;
  }
});
Object.defineProperty(exports, "_Effect", {
  enumerable: true,
  get: function () {
    return _effect.default;
  }
});
Object.defineProperty(exports, "_ReflectionEffect", {
  enumerable: true,
  get: function () {
    return _reflectionEffect.default;
  }
});
Object.defineProperty(exports, "TRANSITION_EVENTS", {
  enumerable: true,
  get: function () {
    return _transitionManager.TRANSITION_EVENTS;
  }
});
Object.defineProperty(exports, "LinearInterpolator", {
  enumerable: true,
  get: function () {
    return _linearInterpolator.default;
  }
});
Object.defineProperty(exports, "FlyToInterpolator", {
  enumerable: true,
  get: function () {
    return _viewportFlyToInterpolator.default;
  }
});
Object.defineProperty(exports, "log", {
  enumerable: true,
  get: function () {
    return _log.default;
  }
});
Object.defineProperty(exports, "_GPUGridAggregator", {
  enumerable: true,
  get: function () {
    return _gpuGridAggregator.default;
  }
});
Object.defineProperty(exports, "AGGREGATION_OPERATION", {
  enumerable: true,
  get: function () {
    return _gpuGridAggregatorConstants.AGGREGATION_OPERATION;
  }
});
Object.defineProperty(exports, "_pointToDensityGridData", {
  enumerable: true,
  get: function () {
    return _gridAggregationUtils.pointToDensityGridData;
  }
});
Object.defineProperty(exports, "createIterable", {
  enumerable: true,
  get: function () {
    return _iterableUtils.createIterable;
  }
});
exports.experimental = void 0;

require("./lib/init");

require("./shaderlib");

var _constants = require("./lib/constants");

var _deck = _interopRequireDefault(require("./lib/deck"));

var _layerManager = _interopRequireDefault(require("./lib/layer-manager"));

var _attributeManager = _interopRequireDefault(require("./lib/attribute-manager"));

var _layer = _interopRequireDefault(require("./lib/layer"));

var _compositeLayer = _interopRequireDefault(require("./lib/composite-layer"));

var _viewport = _interopRequireDefault(require("./viewports/viewport"));

var _webMercatorViewport = _interopRequireDefault(require("./viewports/web-mercator-viewport"));

var _project = _interopRequireDefault(require("./shaderlib/project/project"));

var _project2 = _interopRequireDefault(require("./shaderlib/project64/project64"));

var _lighting = _interopRequireDefault(require("./shaderlib/lighting/lighting"));

var _view = _interopRequireDefault(require("./views/view"));

var _mapView = _interopRequireDefault(require("./views/map-view"));

var _firstPersonView = _interopRequireDefault(require("./views/first-person-view"));

var _thirdPersonView = _interopRequireDefault(require("./views/third-person-view"));

var _orbitView = _interopRequireDefault(require("./views/orbit-view"));

var _perspectiveView = _interopRequireDefault(require("./views/perspective-view"));

var _orthographicView = _interopRequireDefault(require("./views/orthographic-view"));

var _controller = _interopRequireDefault(require("./controllers/controller"));

var _mapController = _interopRequireDefault(require("./controllers/map-controller"));

var _firstPersonController = _interopRequireDefault(require("./controllers/first-person-controller"));

var _orbitController = _interopRequireDefault(require("./controllers/orbit-controller"));

var _orthographicController = _interopRequireDefault(require("./controllers/orthographic-controller"));

var _effectManager = _interopRequireDefault(require("./experimental/lib/effect-manager"));

var _effect = _interopRequireDefault(require("./experimental/lib/effect"));

var _reflectionEffect = _interopRequireDefault(require("./experimental/reflection-effect/reflection-effect"));

var _transitionManager = require("./controllers/transition-manager");

var _linearInterpolator = _interopRequireDefault(require("./transitions/linear-interpolator"));

var _viewportFlyToInterpolator = _interopRequireDefault(require("./transitions/viewport-fly-to-interpolator"));

var _log = _interopRequireDefault(require("./utils/log"));

var _flatten = require("./utils/flatten");

var _binSorter = _interopRequireDefault(require("./utils/bin-sorter"));

var _tesselator = _interopRequireDefault(require("./utils/tesselator"));

var _colorUtils = require("./utils/color-utils");

var _scaleUtils = require("./utils/scale-utils");

var _gpuGridAggregator = _interopRequireDefault(require("./experimental/utils/gpu-grid-aggregation/gpu-grid-aggregator"));

var _gpuGridAggregatorConstants = require("./experimental/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants");

var _gridAggregationUtils = require("./experimental/utils/gpu-grid-aggregation/grid-aggregation-utils");

var _iterableUtils = require("./utils/iterable-utils");

var _count = require("./utils/count");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.

/* eslint-disable max-len */
// Intialize globals, check version
// Import shaderlib to make sure shader modules are initialized
// Core Library
// Experimental Pure JS (non-React) bindings
// Viewports
// Shader modules
// Controllers
// Experimental Controllers
// EXPERIMENTAL EXPORTS
// Experimental Effects (non-React) bindings
// Eperimental Transitions
// Layer utilities
// Export? move to luma.gl or math.gl?
// Export? move to luma.gl or math.gl?
// Exports for layers
// Experimental Features may change in minor version bumps, use at your own risk)
var experimental = {
  BinSorter: _binSorter.default,
  Tesselator: _tesselator.default,
  linearScale: _scaleUtils.linearScale,
  getLinearScale: _scaleUtils.getLinearScale,
  quantizeScale: _scaleUtils.quantizeScale,
  getQuantizeScale: _scaleUtils.getQuantizeScale,
  defaultColorRange: _colorUtils.defaultColorRange,
  flattenVertices: _flatten.flattenVertices,
  fillArray: _flatten.fillArray,
  count: _count.count
};
exports.experimental = experimental;
},{"./lib/init":"xwR1","./shaderlib":"DJFh","./lib/constants":"GfMx","./lib/deck":"Dij8","./lib/layer-manager":"jqu2","./lib/attribute-manager":"Vv1w","./lib/layer":"qSjy","./lib/composite-layer":"WzXM","./viewports/viewport":"RXGn","./viewports/web-mercator-viewport":"uuqX","./shaderlib/project/project":"LUEV","./shaderlib/project64/project64":"v9HK","./shaderlib/lighting/lighting":"ZHHu","./views/view":"K8TO","./views/map-view":"mzbM","./views/first-person-view":"fsKb","./views/third-person-view":"B6sS","./views/orbit-view":"i2zU","./views/perspective-view":"aIfR","./views/orthographic-view":"pEX0","./controllers/controller":"Gii9","./controllers/map-controller":"TKv4","./controllers/first-person-controller":"o4gX","./controllers/orbit-controller":"KyrE","./controllers/orthographic-controller":"Z1xL","./experimental/lib/effect-manager":"V03Y","./experimental/lib/effect":"GHnM","./experimental/reflection-effect/reflection-effect":"Wcnv","./controllers/transition-manager":"bUf5","./transitions/linear-interpolator":"wq52","./transitions/viewport-fly-to-interpolator":"pNmY","./utils/log":"q39U","./utils/flatten":"uWrz","./utils/bin-sorter":"oA4T","./utils/tesselator":"LN2C","./utils/color-utils":"PHo8","./utils/scale-utils":"Mnhz","./experimental/utils/gpu-grid-aggregation/gpu-grid-aggregator":"uIry","./experimental/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants":"O8Mj","./experimental/utils/gpu-grid-aggregation/grid-aggregation-utils":"cWfN","./utils/iterable-utils":"ptqg","./utils/count":"W4L2"}],"QJXN":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var _default = "#define SHADER_NAME arc-layer-vertex-shader\n\nattribute vec3 positions;\nattribute vec4 instanceSourceColors;\nattribute vec4 instanceTargetColors;\nattribute vec4 instancePositions;\nattribute vec4 instancePositions64Low;\nattribute vec3 instancePickingColors;\nattribute float instanceWidths;\n\nuniform float numSegments;\nuniform float opacity;\nuniform float widthScale;\n\nvarying vec4 vColor;\n\nfloat paraboloid(vec2 source, vec2 target, float ratio) {\n\n  vec2 x = mix(source, target, ratio);\n  vec2 center = mix(source, target, 0.5);\n\n  float dSourceCenter = distance(source, center);\n  float dXCenter = distance(x, center);\n  return (dSourceCenter + dXCenter) * (dSourceCenter - dXCenter);\n}\n\n// offset vector by strokeWidth pixels\n// offset_direction is -1 (left) or 1 (right)\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n  // normalized direction of the line\n  vec2 dir_screenspace = normalize(line_clipspace * project_uViewportSize);\n  // rotate by 90 degrees\n  dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n\n  vec2 offset_screenspace = dir_screenspace * offset_direction * instanceWidths * widthScale / 2.0;\n  vec2 offset_clipspace = project_pixel_to_clipspace(offset_screenspace).xy;\n\n  return offset_clipspace;\n}\n\nfloat getSegmentRatio(float index) {\n  return smoothstep(0.0, 1.0, index / (numSegments - 1.0));\n}\n\nvec3 getPos(vec2 source, vec2 target, float segmentRatio) {\n  float vertex_height = paraboloid(source, target, segmentRatio);\n\n  return vec3(\n    mix(source, target, segmentRatio),\n    sqrt(max(0.0, vertex_height))\n  );\n}\n\nvoid main(void) {\n  vec2 source = project_position(vec3(instancePositions.xy, 0.0), instancePositions64Low.xy).xy;\n  vec2 target = project_position(vec3(instancePositions.zw, 0.0), instancePositions64Low.zw).xy;\n\n  float segmentIndex = positions.x;\n  float segmentRatio = getSegmentRatio(segmentIndex);\n  // if it's the first point, use next - current as direction\n  // otherwise use current - prev\n  float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n  float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n\n  vec3 currPos = getPos(source, target, segmentRatio);\n  vec3 nextPos = getPos(source, target, nextSegmentRatio);\n  vec4 curr = project_to_clipspace(vec4(currPos, 1.0));\n  vec4 next = project_to_clipspace(vec4(nextPos, 1.0));\n\n  // extrude\n  vec2 offset = getExtrusionOffset((next.xy - curr.xy) * indexDir, positions.y);\n  gl_Position = curr + vec4(offset, 0.0, 0.0);\n\n  vec4 color = mix(instanceSourceColors, instanceTargetColors, segmentRatio) / 255.;\n  vColor = vec4(color.rgb, color.a * opacity);\n\n  // Set color to be rendered to picking fbo (also used to check for selection highlight).\n  picking_setPickingColor(instancePickingColors);\n}\n";
exports.default = _default;
},{}],"Do9p":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var _default = "#define SHADER_NAME arc-layer-vertex-shader-64\n\nattribute vec3 positions;\nattribute vec4 instanceSourceColors;\nattribute vec4 instanceTargetColors;\n\nattribute vec4 instancePositions;\nattribute vec4 instancePositions64Low;\n\nattribute vec3 instancePickingColors;\nattribute float instanceWidths;\n\nuniform float numSegments;\nuniform float opacity;\nuniform float widthScale;\n\nvarying vec4 vColor;\n\nvec2 paraboloid_fp64(vec2 source[2], vec2 target[2], float ratio) {\n\n  vec2 x[2];\n  vec2_mix_fp64(source, target, ratio, x);\n  vec2 center[2];\n  vec2_mix_fp64(source, target, 0.5, center);\n\n  vec2 dSourceCenter = vec2_distance_fp64(source, center);\n  vec2 dXCenter = vec2_distance_fp64(x, center);\n  return mul_fp64(sum_fp64(dSourceCenter, dXCenter), sub_fp64(dSourceCenter, dXCenter));\n}\n\n// offset vector by strokeWidth pixels\n// offset_direction is -1 (left) or 1 (right)\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n  // normalized direction of the line\n  vec2 dir_screenspace = normalize(line_clipspace * project_uViewportSize);\n  // rotate by 90 degrees\n  dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n\n  vec2 offset_screenspace = dir_screenspace * offset_direction * instanceWidths * widthScale / 2.0;\n  vec2 offset_clipspace = project_pixel_to_clipspace(offset_screenspace).xy;\n\n  return offset_clipspace;\n}\n\nfloat getSegmentRatio(float index) {\n  return smoothstep(0.0, 1.0, index / (numSegments - 1.0));\n}\n\nvoid get_pos_fp64(vec2 source[2], vec2 target[2], float segmentRatio, out vec2 position[4]) {\n\n  vec2 vertex_height = paraboloid_fp64(source, target, segmentRatio);\n\n  vec2 position_temp[2];\n\n  vec2_mix_fp64(source, target, segmentRatio, position_temp);\n\n  position[0] = position_temp[0];\n  position[1] = position_temp[1];\n\n  if (vertex_height.x < 0.0 || (vertex_height.x == 0.0 && vertex_height.y <= 0.0)) {\n    vertex_height = vec2(0.0, 0.0);\n  }\n\n  position[2] = sqrt_fp64(vertex_height);\n  position[3] = vec2(1.0, 0.0);\n}\n\nvoid main(void) {\n  vec2 projected_source_coord[2];\n  vec2 projected_target_coord[2];\n\n  project_position_fp64(instancePositions.xy, instancePositions64Low.xy, projected_source_coord);\n  project_position_fp64(instancePositions.zw, instancePositions64Low.zw, projected_target_coord);\n\n  float segmentIndex = positions.x;\n  float segmentRatio = getSegmentRatio(segmentIndex);\n\n  // if it's the first point, use next - current as direction\n  // otherwise use current - prev\n  float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n  float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n\n  vec2 curr_pos_modelspace[4];\n\n  get_pos_fp64(projected_source_coord, projected_target_coord, segmentRatio,\n    curr_pos_modelspace);\n\n  vec2 next_pos_modelspace[4];\n\n  get_pos_fp64(projected_source_coord, projected_target_coord, nextSegmentRatio,\n    next_pos_modelspace);\n\n  vec4 curr_pos_clipspace = project_to_clipspace_fp64(curr_pos_modelspace);\n  vec4 next_pos_clipspace = project_to_clipspace_fp64(next_pos_modelspace);\n\n  vec2 offset = getExtrusionOffset(next_pos_clipspace.xy - curr_pos_clipspace.xy, positions.y);\n\n  gl_Position = curr_pos_clipspace + vec4(offset, 0.0, 0.0);\n\n  vec4 color = mix(instanceSourceColors, instanceTargetColors, segmentRatio) / 255.;\n  vColor = vec4(color.rgb, color.a * opacity);\n\n  // Set color to be rendered to picking fbo (also used to check for selection highlight).\n  picking_setPickingColor(instancePickingColors);\n}\n";
exports.default = _default;
},{}],"yOwb":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var _default = "#define SHADER_NAME arc-layer-fragment-shader\n\nprecision highp float;\n\nvarying vec4 vColor;\n\nvoid main(void) {\n  gl_FragColor = vColor;\n\n  // use highlight color if this fragment belongs to the selected object.\n  gl_FragColor = picking_filterHighlightColor(gl_FragColor);\n\n  // use picking color if rendering to picking FBO.\n  gl_FragColor = picking_filterPickingColor(gl_FragColor);\n}\n";
exports.default = _default;
},{}],"gGfz":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _core = require("@deck.gl/core");

var _constants = _interopRequireDefault(require("luma.gl/constants"));

var _luma = require("luma.gl");

var _arcLayerVertex = _interopRequireDefault(require("./arc-layer-vertex.glsl"));

var _arcLayerVertex2 = _interopRequireDefault(require("./arc-layer-vertex-64.glsl"));

var _arcLayerFragment = _interopRequireDefault(require("./arc-layer-fragment.glsl"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _get(target, property, receiver) {
  if (typeof Reflect !== "undefined" && Reflect.get) {
    _get = Reflect.get;
  } else {
    _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(target, property, receiver || target);
}

function _superPropBase(object, property) {
  while (!Object.prototype.hasOwnProperty.call(object, property)) {
    object = _getPrototypeOf(object);
    if (object === null) break;
  }

  return object;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.


var fp64LowPart = _luma.fp64.fp64LowPart;
var DEFAULT_COLOR = [0, 0, 0, 255];
var defaultProps = {
  fp64: false,
  getSourcePosition: {
    type: 'accessor',
    value: function value(x) {
      return x.sourcePosition;
    }
  },
  getTargetPosition: {
    type: 'accessor',
    value: function value(x) {
      return x.targetPosition;
    }
  },
  getSourceColor: {
    type: 'accessor',
    value: DEFAULT_COLOR
  },
  getTargetColor: {
    type: 'accessor',
    value: DEFAULT_COLOR
  },
  getStrokeWidth: {
    type: 'accessor',
    value: 1
  },
  widthScale: {
    type: 'number',
    value: 1,
    min: 0
  },
  // deprecated
  strokeWidth: {
    deprecatedFor: 'getStrokeWidth'
  }
};

var ArcLayer =
/*#__PURE__*/
function (_Layer) {
  _inherits(ArcLayer, _Layer);

  function ArcLayer() {
    _classCallCheck(this, ArcLayer);

    return _possibleConstructorReturn(this, _getPrototypeOf(ArcLayer).apply(this, arguments));
  }

  _createClass(ArcLayer, [{
    key: "getShaders",
    value: function getShaders() {
      return this.use64bitProjection() ? {
        vs: _arcLayerVertex2.default,
        fs: _arcLayerFragment.default,
        modules: ['project64', 'picking']
      } : {
        vs: _arcLayerVertex.default,
        fs: _arcLayerFragment.default,
        modules: ['picking']
      }; // 'project' module added by default.
    }
  }, {
    key: "initializeState",
    value: function initializeState() {
      var attributeManager = this.getAttributeManager();
      /* eslint-disable max-len */

      attributeManager.addInstanced({
        instancePositions: {
          size: 4,
          transition: true,
          accessor: ['getSourcePosition', 'getTargetPosition'],
          update: this.calculateInstancePositions
        },
        instancePositions64Low: {
          size: 4,
          accessor: ['getSourcePosition', 'getTargetPosition'],
          update: this.calculateInstancePositions64Low
        },
        instanceSourceColors: {
          size: 4,
          type: _constants.default.UNSIGNED_BYTE,
          transition: true,
          accessor: 'getSourceColor',
          defaultValue: DEFAULT_COLOR
        },
        instanceTargetColors: {
          size: 4,
          type: _constants.default.UNSIGNED_BYTE,
          transition: true,
          accessor: 'getTargetColor',
          defaultValue: DEFAULT_COLOR
        },
        instanceWidths: {
          size: 1,
          transition: true,
          accessor: 'getStrokeWidth',
          defaultValue: 1
        }
      });
      /* eslint-enable max-len */
    }
  }, {
    key: "updateState",
    value: function updateState(_ref) {
      var props = _ref.props,
          oldProps = _ref.oldProps,
          changeFlags = _ref.changeFlags;

      _get(_getPrototypeOf(ArcLayer.prototype), "updateState", this).call(this, {
        props: props,
        oldProps: oldProps,
        changeFlags: changeFlags
      }); // Re-generate model if geometry changed


      if (props.fp64 !== oldProps.fp64) {
        var gl = this.context.gl;

        if (this.state.model) {
          this.state.model.delete();
        }

        this.setState({
          model: this._getModel(gl)
        });
        this.getAttributeManager().invalidateAll();
      }

      this.state.model.setUniforms({
        widthScale: props.widthScale
      });
    }
  }, {
    key: "_getModel",
    value: function _getModel(gl) {
      var positions = [];
      var NUM_SEGMENTS = 50;
      /*
       *  (0, -1)-------------_(1, -1)
       *       |          _,-"  |
       *       o      _,-"      o
       *       |  _,-"          |
       *   (0, 1)"-------------(1, 1)
       */

      for (var i = 0; i < NUM_SEGMENTS; i++) {
        positions = positions.concat([i, -1, 0, i, 1, 0]);
      }

      var model = new _luma.Model(gl, Object.assign({}, this.getShaders(), {
        id: this.props.id,
        geometry: new _luma.Geometry({
          drawMode: _constants.default.TRIANGLE_STRIP,
          attributes: {
            positions: new Float32Array(positions)
          }
        }),
        isInstanced: true,
        shaderCache: this.context.shaderCache
      }));
      model.setUniforms({
        numSegments: NUM_SEGMENTS
      });
      return model;
    }
  }, {
    key: "calculateInstancePositions",
    value: function calculateInstancePositions(attribute) {
      var _this$props = this.props,
          data = _this$props.data,
          getSourcePosition = _this$props.getSourcePosition,
          getTargetPosition = _this$props.getTargetPosition;
      var value = attribute.value,
          size = attribute.size;
      var i = 0;
      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = data[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var object = _step.value;
          var sourcePosition = getSourcePosition(object);
          var targetPosition = getTargetPosition(object);
          value[i + 0] = sourcePosition[0];
          value[i + 1] = sourcePosition[1];
          value[i + 2] = targetPosition[0];
          value[i + 3] = targetPosition[1];
          i += size;
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return != null) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }
    }
  }, {
    key: "calculateInstancePositions64Low",
    value: function calculateInstancePositions64Low(attribute) {
      var isFP64 = this.use64bitPositions();
      attribute.constant = !isFP64;

      if (!isFP64) {
        attribute.value = new Float32Array(4);
        return;
      }

      var _this$props2 = this.props,
          data = _this$props2.data,
          getSourcePosition = _this$props2.getSourcePosition,
          getTargetPosition = _this$props2.getTargetPosition;
      var value = attribute.value,
          size = attribute.size;
      var i = 0;
      var _iteratorNormalCompletion2 = true;
      var _didIteratorError2 = false;
      var _iteratorError2 = undefined;

      try {
        for (var _iterator2 = data[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
          var object = _step2.value;
          var sourcePosition = getSourcePosition(object);
          var targetPosition = getTargetPosition(object);
          value[i + 0] = fp64LowPart(sourcePosition[0]);
          value[i + 1] = fp64LowPart(sourcePosition[1]);
          value[i + 2] = fp64LowPart(targetPosition[0]);
          value[i + 3] = fp64LowPart(targetPosition[1]);
          i += size;
        }
      } catch (err) {
        _didIteratorError2 = true;
        _iteratorError2 = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
            _iterator2.return();
          }
        } finally {
          if (_didIteratorError2) {
            throw _iteratorError2;
          }
        }
      }
    }
  }]);

  return ArcLayer;
}(_core.Layer);

exports.default = ArcLayer;
ArcLayer.layerName = 'ArcLayer';
ArcLayer.defaultProps = defaultProps;
},{"@deck.gl/core":"Tk4X","luma.gl/constants":"lMsC","luma.gl":"GAQa","./arc-layer-vertex.glsl":"QJXN","./arc-layer-vertex-64.glsl":"Do9p","./arc-layer-fragment.glsl":"yOwb"}],"Fz9d":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var _default = "#define SHADER_NAME icon-layer-vertex-shader\n\nattribute vec2 positions;\n\nattribute vec3 instancePositions;\nattribute vec2 instancePositions64xyLow;\nattribute float instanceSizes;\nattribute float instanceAngles;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\nattribute vec4 instanceIconFrames;\nattribute float instanceColorModes;\nattribute vec2 instanceOffsets;\n\nuniform float sizeScale;\nuniform vec2 iconsTextureDim;\n\nvarying float vColorMode;\nvarying vec4 vColor;\nvarying vec2 vTextureCoords;\n\nvec2 rotate_by_angle(vec2 vertex, float angle) {\n  float angle_radian = angle * PI / 180.0;\n  float cos_angle = cos(angle_radian);\n  float sin_angle = sin(angle_radian);\n  mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle);\n  return rotationMatrix * vertex;\n}\n\nvoid main(void) {\n  vec2 iconSize = instanceIconFrames.zw;\n  // scale icon height to match instanceSize\n  float instanceScale = iconSize.y == 0.0 ? 0.0 : instanceSizes / iconSize.y;\n\n  // scale and rotate vertex in \"pixel\" value and convert back to fraction in clipspace\n  vec2 pixelOffset = positions / 2.0 * iconSize + instanceOffsets;\n  pixelOffset = rotate_by_angle(pixelOffset, instanceAngles) * sizeScale * instanceScale;\n  pixelOffset.y *= -1.0;\n\n  gl_Position = project_position_to_clipspace(instancePositions, instancePositions64xyLow, vec3(0.0));\n  gl_Position += project_pixel_to_clipspace(pixelOffset);\n\n  vTextureCoords = mix(\n    instanceIconFrames.xy,\n    instanceIconFrames.xy + iconSize,\n    (positions.xy + 1.0) / 2.0\n  ) / iconsTextureDim;\n\n  vTextureCoords.y = 1.0 - vTextureCoords.y;\n\n  vColor = instanceColors / 255.;\n\n  vColorMode = instanceColorModes;\n\n  // Set color to be rendered to picking fbo (also used to check for selection highlight).\n  picking_setPickingColor(instancePickingColors);\n}\n";
exports.default = _default;
},{}],"Q4Se":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var _default = "#define SHADER_NAME icon-layer-fragment-shader\n\nprecision highp float;\n\nuniform float opacity;\nuniform sampler2D iconsTexture;\n\nvarying float vColorMode;\nvarying vec4 vColor;\nvarying vec2 vTextureCoords;\n\nconst float MIN_ALPHA = 0.05;\n\nvoid main(void) {\n  vec4 texColor = texture2D(iconsTexture, vTextureCoords);\n\n  // if colorMode == 0, use pixel color from the texture\n  // if colorMode == 1 or rendering picking buffer, use texture as transparency mask\n  vec3 color = mix(texColor.rgb, vColor.rgb, vColorMode);\n  // Take the global opacity and the alpha from vColor into account for the alpha component\n  float a = texColor.a * opacity * vColor.a;\n\n  if (a < MIN_ALPHA) {\n    discard;\n  }\n\n  gl_FragColor = vec4(color, a);\n\n  // use highlight color if this fragment belongs to the selected object.\n  gl_FragColor = picking_filterHighlightColor(gl_FragColor);\n\n  // use picking color if rendering to picking FBO.\n  gl_FragColor = picking_filterPickingColor(gl_FragColor);\n}\n";
exports.default = _default;
},{}],"Gnyp":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.buildMapping = buildMapping;
exports.default = void 0;

var _constants = _interopRequireDefault(require("luma.gl/constants"));

var _luma = require("luma.gl");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _slicedToArray(arr, i) {
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
}

function _nonIterableRest() {
  throw new TypeError("Invalid attempt to destructure non-iterable instance");
}

function _iterableToArrayLimit(arr, i) {
  var _arr = [];
  var _n = true;
  var _d = false;
  var _e = undefined;

  try {
    for (var _i = arr[Symbol.iterator](), _s; !(_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;
}

function _arrayWithHoles(arr) {
  if (Array.isArray(arr)) return arr;
}

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;
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}
/* global document */


var MAX_CANVAS_WIDTH = 1024;
var DEFAULT_BUFFER = 4;
var DEFAULT_TEXTURE_MIN_FILTER = _constants.default.LINEAR_MIPMAP_LINEAR; // GL.LINEAR is the default value but explicitly set it here

var DEFAULT_TEXTURE_MAG_FILTER = _constants.default.LINEAR;

var noop = function noop() {};

function nextPowOfTwo(number) {
  return Math.pow(2, Math.ceil(Math.log2(number)));
} // resize image to given width and height


function resizeImage(ctx, imageData, width, height) {
  var naturalWidth = imageData.naturalWidth,
      naturalHeight = imageData.naturalHeight;

  if (width === naturalWidth && height === naturalHeight) {
    return imageData;
  }

  ctx.canvas.height = height;
  ctx.canvas.width = width;
  ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height); // image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight

  ctx.drawImage(imageData, 0, 0, naturalWidth, naturalHeight, 0, 0, width, height);
  return ctx.canvas;
} // traverse icons in a row of icon atlas
// extend each icon with left-top coordinates


function buildRowMapping(mapping, columns, yOffset) {
  for (var i = 0; i < columns.length; i++) {
    var _columns$i = columns[i],
        icon = _columns$i.icon,
        xOffset = _columns$i.xOffset;
    mapping[icon.url] = Object.assign({}, icon, {
      x: xOffset,
      y: yOffset
    });
  }
}
/**
 * Generate coordinate mapping to retrieve icon left-top position from an icon atlas
 * @param icons {Array<Object>} list of icons, each icon requires url, width, height
 * @param buffer {Number} add buffer to the right and bottom side of the image
 * @param maxCanvasHeight {Number}
 * @returns {{mapping: {'/icon/1': {url, width, height, ...}},, canvasHeight: {Number}}}
 */


function buildMapping(_ref) {
  var icons = _ref.icons,
      buffer = _ref.buffer,
      maxCanvasWidth = _ref.maxCanvasWidth; // x position till current column

  var xOffset = 0; // y position till current row

  var yOffset = 0; // height of current row

  var rowHeight = 0;
  var columns = [];
  var mapping = {}; // Strategy to layout all the icons into a texture:
  // traverse the icons sequentially, layout the icons from left to right, top to bottom
  // when the sum of the icons width is equal or larger than maxCanvasWidth,
  // move to next row starting from total height so far plus max height of the icons in previous row
  // row width is equal to maxCanvasWidth
  // row height is decided by the max height of the icons in that row
  // mapping coordinates of each icon is its left-top position in the texture

  for (var i = 0; i < icons.length; i++) {
    var icon = icons[i];

    if (!mapping[icon.url]) {
      var height = icon.height,
          width = icon.width; // fill one row

      if (xOffset + width + buffer > maxCanvasWidth) {
        buildRowMapping(mapping, columns, yOffset);
        xOffset = 0;
        yOffset = rowHeight + yOffset + buffer;
        rowHeight = 0;
        columns = [];
      }

      columns.push({
        icon: icon,
        xOffset: xOffset
      });
      xOffset = xOffset + width + buffer;
      rowHeight = Math.max(rowHeight, height);
    }
  }

  if (columns.length > 0) {
    buildRowMapping(mapping, columns, yOffset);
  }

  var canvasHeight = nextPowOfTwo(rowHeight + yOffset + buffer);
  return {
    mapping: mapping,
    canvasHeight: canvasHeight
  };
} // extract unique icons from data


function getIcons(data, getIcon) {
  if (!data || !getIcon) {
    return null;
  }

  var icons = {};
  var _iteratorNormalCompletion = true;
  var _didIteratorError = false;
  var _iteratorError = undefined;

  try {
    for (var _iterator = data[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
      var point = _step.value;
      var icon = getIcon(point);

      if (!icon) {
        throw new Error('Icon is missing.');
      }

      if (!icon.url) {
        throw new Error('Icon url is missing.');
      }

      if (!icons[icon.url]) {
        icons[icon.url] = icon;
      }
    }
  } catch (err) {
    _didIteratorError = true;
    _iteratorError = err;
  } finally {
    try {
      if (!_iteratorNormalCompletion && _iterator.return != null) {
        _iterator.return();
      }
    } finally {
      if (_didIteratorError) {
        throw _iteratorError;
      }
    }
  }

  return icons;
}

var IconManager =
/*#__PURE__*/
function () {
  function IconManager(gl, _ref2) {
    var _ref2$onUpdate = _ref2.onUpdate,
        onUpdate = _ref2$onUpdate === void 0 ? noop : _ref2$onUpdate;

    _classCallCheck(this, IconManager);

    this.gl = gl;
    this.onUpdate = onUpdate;
    this._getIcon = null;
    this._mapping = {};
    this._texture = null;
    this._autoPacking = false;
    this._canvas = null;
  }

  _createClass(IconManager, [{
    key: "getTexture",
    value: function getTexture() {
      return this._texture;
    }
  }, {
    key: "getIconMapping",
    value: function getIconMapping(dataPoint) {
      var icon = this._getIcon(dataPoint);

      var name = this._autoPacking ? icon.url : icon;
      return this._mapping[name] || {};
    }
  }, {
    key: "setProps",
    value: function setProps(_ref3) {
      var autoPacking = _ref3.autoPacking,
          iconAtlas = _ref3.iconAtlas,
          iconMapping = _ref3.iconMapping,
          data = _ref3.data,
          getIcon = _ref3.getIcon;

      if (autoPacking !== undefined) {
        this._autoPacking = autoPacking;
      }

      if (getIcon) {
        this._getIcon = getIcon;
      }

      if (iconMapping) {
        this._mapping = iconMapping;
      }

      if (iconAtlas) {
        this._updateIconAtlas(iconAtlas);
      }

      if (this._autoPacking && (data || getIcon)) {
        this._canvas = this._canvas || document.createElement('canvas');

        this._updateAutoPacking({
          data: data,
          buffer: DEFAULT_BUFFER,
          maxCanvasWidth: MAX_CANVAS_WIDTH
        });
      }
    }
  }, {
    key: "_updateIconAtlas",
    value: function _updateIconAtlas(iconAtlas) {
      var _this = this;

      if (iconAtlas instanceof _luma.Texture2D) {
        var _iconAtlas$setParamet;

        iconAtlas.setParameters((_iconAtlas$setParamet = {}, _defineProperty(_iconAtlas$setParamet, _constants.default.TEXTURE_MIN_FILTER, DEFAULT_TEXTURE_MIN_FILTER), _defineProperty(_iconAtlas$setParamet, _constants.default.TEXTURE_MAG_FILTER, DEFAULT_TEXTURE_MAG_FILTER), _iconAtlas$setParamet));
        this._texture = iconAtlas;
        this.onUpdate();
      } else if (typeof iconAtlas === 'string') {
        var _parameters;

        (0, _luma.loadTextures)(this.gl, {
          urls: [iconAtlas],
          parameters: (_parameters = {}, _defineProperty(_parameters, _constants.default.TEXTURE_MIN_FILTER, DEFAULT_TEXTURE_MIN_FILTER), _defineProperty(_parameters, _constants.default.TEXTURE_MAG_FILTER, DEFAULT_TEXTURE_MAG_FILTER), _parameters)
        }).then(function (_ref4) {
          var _ref5 = _slicedToArray(_ref4, 1),
              texture = _ref5[0];

          _this._texture = texture;

          _this.onUpdate();
        });
      }
    }
  }, {
    key: "_updateAutoPacking",
    value: function _updateAutoPacking(_ref6) {
      var data = _ref6.data,
          buffer = _ref6.buffer,
          maxCanvasWidth = _ref6.maxCanvasWidth;
      var icons = Object.values(getIcons(data, this._getIcon) || {});

      if (icons.length > 0) {
        // generate icon mapping
        var _buildMapping = buildMapping({
          icons: icons,
          buffer: buffer,
          maxCanvasWidth: maxCanvasWidth
        }),
            mapping = _buildMapping.mapping,
            canvasHeight = _buildMapping.canvasHeight;

        this._mapping = mapping; // create new texture

        this._texture = new _luma.Texture2D(this.gl, {
          width: maxCanvasWidth,
          height: canvasHeight
        });
        this.onUpdate(); // load images

        this._loadImages(icons);
      }
    }
  }, {
    key: "_loadImages",
    value: function _loadImages(icons) {
      var _this2 = this;

      var ctx = this._canvas.getContext('2d');

      var canvasHeight = this._texture.height;
      var _iteratorNormalCompletion2 = true;
      var _didIteratorError2 = false;
      var _iteratorError2 = undefined;

      try {
        var _loop = function _loop() {
          var icon = _step2.value;
          (0, _luma.loadImages)({
            urls: [icon.url]
          }).then(function (_ref7) {
            var _parameters2;

            var _ref8 = _slicedToArray(_ref7, 1),
                imageData = _ref8[0];

            var iconMapping = _this2._mapping[icon.url];
            var x = iconMapping.x,
                y = iconMapping.y,
                width = iconMapping.width,
                height = iconMapping.height;
            var data = resizeImage(ctx, imageData, width, height);

            _this2._texture.setSubImageData({
              data: data,
              x: x,
              y: canvasHeight - y - height,
              // flip Y as texture stored as reversed Y
              width: width,
              height: height,
              parameters: (_parameters2 = {}, _defineProperty(_parameters2, _constants.default.TEXTURE_MIN_FILTER, DEFAULT_TEXTURE_MIN_FILTER), _defineProperty(_parameters2, _constants.default.TEXTURE_MAG_FILTER, DEFAULT_TEXTURE_MAG_FILTER), _defineProperty(_parameters2, _constants.default.UNPACK_FLIP_Y_WEBGL, true), _parameters2)
            }); // Call to regenerate mipmaps after modifying texture(s)


            _this2._texture.generateMipmap();

            _this2.onUpdate();
          });
        };

        for (var _iterator2 = icons[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
          _loop();
        }
      } catch (err) {
        _didIteratorError2 = true;
        _iteratorError2 = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
            _iterator2.return();
          }
        } finally {
          if (_didIteratorError2) {
            throw _iteratorError2;
          }
        }
      }
    }
  }]);

  return IconManager;
}();

exports.default = IconManager;
},{"luma.gl/constants":"lMsC","luma.gl":"GAQa"}],"gBB5":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _core = require("@deck.gl/core");

var _constants = _interopRequireDefault(require("luma.gl/constants"));

var _luma = require("luma.gl");

var _iconLayerVertex = _interopRequireDefault(require("./icon-layer-vertex.glsl"));

var _iconLayerFragment = _interopRequireDefault(require("./icon-layer-fragment.glsl"));

var _iconManager = _interopRequireDefault(require("./icon-manager"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _get(target, property, receiver) {
  if (typeof Reflect !== "undefined" && Reflect.get) {
    _get = Reflect.get;
  } else {
    _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(target, property, receiver || target);
}

function _superPropBase(object, property) {
  while (!Object.prototype.hasOwnProperty.call(object, property)) {
    object = _getPrototypeOf(object);
    if (object === null) break;
  }

  return object;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.


var fp64LowPart = _luma.fp64.fp64LowPart;
var DEFAULT_COLOR = [0, 0, 0, 255];
/*
 * @param {object} props
 * @param {Texture2D | string} props.iconAtlas - atlas image url or texture
 * @param {object} props.iconMapping - icon names mapped to icon definitions
 * @param {object} props.iconMapping[icon_name].x - x position of icon on the atlas image
 * @param {object} props.iconMapping[icon_name].y - y position of icon on the atlas image
 * @param {object} props.iconMapping[icon_name].width - width of icon on the atlas image
 * @param {object} props.iconMapping[icon_name].height - height of icon on the atlas image
 * @param {object} props.iconMapping[icon_name].anchorX - x anchor of icon on the atlas image,
 *   default to width / 2
 * @param {object} props.iconMapping[icon_name].anchorY - y anchor of icon on the atlas image,
 *   default to height / 2
 * @param {object} props.iconMapping[icon_name].mask - whether icon is treated as a transparency
 *   mask. If true, user defined color is applied. If false, original color from the image is
 *   applied. Default to false.
 * @param {number} props.size - icon size in pixels
 * @param {func} props.getPosition - returns anchor position of the icon, in [lng, lat, z]
 * @param {func} props.getIcon - returns icon name as a string
 * @param {func} props.getSize - returns icon size multiplier as a number
 * @param {func} props.getColor - returns color of the icon in [r, g, b, a]. Only works on icons
 *   with mask: true.
 * @param {func} props.getAngle - returns rotating angle (in degree) of the icon.
 */

var defaultProps = {
  iconAtlas: null,
  iconMapping: {
    type: 'object',
    value: {},
    async: true
  },
  sizeScale: {
    type: 'number',
    value: 1,
    min: 0
  },
  fp64: false,
  getPosition: {
    type: 'accessor',
    value: function value(x) {
      return x.position;
    }
  },
  getIcon: {
    type: 'accessor',
    value: function value(x) {
      return x.icon;
    }
  },
  getColor: {
    type: 'accessor',
    value: DEFAULT_COLOR
  },
  getSize: {
    type: 'accessor',
    value: 1
  },
  getAngle: {
    type: 'accessor',
    value: 0
  }
};

var IconLayer =
/*#__PURE__*/
function (_Layer) {
  _inherits(IconLayer, _Layer);

  function IconLayer() {
    _classCallCheck(this, IconLayer);

    return _possibleConstructorReturn(this, _getPrototypeOf(IconLayer).apply(this, arguments));
  }

  _createClass(IconLayer, [{
    key: "getShaders",
    value: function getShaders() {
      var projectModule = this.use64bitProjection() ? 'project64' : 'project32';
      return {
        vs: _iconLayerVertex.default,
        fs: _iconLayerFragment.default,
        modules: [projectModule, 'picking']
      };
    }
  }, {
    key: "initializeState",
    value: function initializeState() {
      var _this = this;

      this.state = {
        iconManager: new _iconManager.default(this.context.gl, {
          onUpdate: function onUpdate() {
            return _this._onUpdate();
          }
        })
      };
      var attributeManager = this.getAttributeManager();
      /* eslint-disable max-len */

      attributeManager.addInstanced({
        instancePositions: {
          size: 3,
          transition: true,
          accessor: 'getPosition'
        },
        instancePositions64xyLow: {
          size: 2,
          accessor: 'getPosition',
          update: this.calculateInstancePositions64xyLow
        },
        instanceSizes: {
          size: 1,
          transition: true,
          accessor: 'getSize',
          defaultValue: 1
        },
        instanceOffsets: {
          size: 2,
          accessor: 'getIcon',
          update: this.calculateInstanceOffsets
        },
        instanceIconFrames: {
          size: 4,
          accessor: 'getIcon',
          update: this.calculateInstanceIconFrames
        },
        instanceColorModes: {
          size: 1,
          type: _constants.default.UNSIGNED_BYTE,
          accessor: 'getIcon',
          update: this.calculateInstanceColorMode
        },
        instanceColors: {
          size: 4,
          type: _constants.default.UNSIGNED_BYTE,
          transition: true,
          accessor: 'getColor',
          defaultValue: DEFAULT_COLOR
        },
        instanceAngles: {
          size: 1,
          transition: true,
          accessor: 'getAngle',
          defaultValue: 0
        }
      });
      /* eslint-enable max-len */
    }
    /* eslint-disable max-statements, complexity */

  }, {
    key: "updateState",
    value: function updateState(_ref) {
      var oldProps = _ref.oldProps,
          props = _ref.props,
          changeFlags = _ref.changeFlags;

      _get(_getPrototypeOf(IconLayer.prototype), "updateState", this).call(this, {
        props: props,
        oldProps: oldProps,
        changeFlags: changeFlags
      });

      var attributeManager = this.getAttributeManager();
      var iconManager = this.state.iconManager;
      var iconAtlas = props.iconAtlas,
          iconMapping = props.iconMapping,
          data = props.data,
          getIcon = props.getIcon;
      var iconMappingChanged = false; // prepacked iconAtlas from user

      if (iconAtlas) {
        if (oldProps.iconAtlas !== props.iconAtlas) {
          iconManager.setProps({
            iconAtlas: iconAtlas,
            autoPacking: false
          });
        }

        if (oldProps.iconMapping !== props.iconMapping) {
          iconManager.setProps({
            iconMapping: iconMapping
          });
          iconMappingChanged = true;
        }
      } else {
        // otherwise, use autoPacking
        iconManager.setProps({
          autoPacking: true
        });
      }

      if (changeFlags.dataChanged || changeFlags.updateTriggersChanged && (changeFlags.updateTriggersChanged.all || changeFlags.updateTriggersChanged.getIcon)) {
        iconManager.setProps({
          data: data,
          getIcon: getIcon
        });
        iconMappingChanged = true;
      }

      if (iconMappingChanged) {
        attributeManager.invalidate('instanceOffsets');
        attributeManager.invalidate('instanceIconFrames');
        attributeManager.invalidate('instanceColorModes');
      }

      if (props.fp64 !== oldProps.fp64) {
        var gl = this.context.gl;

        if (this.state.model) {
          this.state.model.delete();
        }

        this.setState({
          model: this._getModel(gl)
        });
        attributeManager.invalidateAll();
      }
    }
    /* eslint-enable max-statements, complexity */

  }, {
    key: "draw",
    value: function draw(_ref2) {
      var uniforms = _ref2.uniforms;
      var sizeScale = this.props.sizeScale;
      var iconManager = this.state.iconManager;
      var iconsTexture = iconManager.getTexture();

      if (iconsTexture) {
        this.state.model.render(Object.assign({}, uniforms, {
          iconsTexture: iconsTexture,
          iconsTextureDim: [iconsTexture.width, iconsTexture.height],
          sizeScale: sizeScale
        }));
      }
    }
  }, {
    key: "_getModel",
    value: function _getModel(gl) {
      var positions = [-1, -1, 0, -1, 1, 0, 1, 1, 0, 1, -1, 0];
      return new _luma.Model(gl, Object.assign({}, this.getShaders(), {
        id: this.props.id,
        geometry: new _luma.Geometry({
          drawMode: _constants.default.TRIANGLE_FAN,
          attributes: {
            positions: new Float32Array(positions)
          }
        }),
        isInstanced: true,
        shaderCache: this.context.shaderCache
      }));
    }
  }, {
    key: "_onUpdate",
    value: function _onUpdate() {
      this.setNeedsRedraw();
    }
  }, {
    key: "calculateInstancePositions64xyLow",
    value: function calculateInstancePositions64xyLow(attribute) {
      var isFP64 = this.use64bitPositions();
      attribute.constant = !isFP64;

      if (!isFP64) {
        attribute.value = new Float32Array(2);
        return;
      }

      var _this$props = this.props,
          data = _this$props.data,
          getPosition = _this$props.getPosition;
      var value = attribute.value;
      var i = 0;
      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = data[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var point = _step.value;
          var position = getPosition(point);
          value[i++] = fp64LowPart(position[0]);
          value[i++] = fp64LowPart(position[1]);
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return != null) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }
    }
  }, {
    key: "calculateInstanceOffsets",
    value: function calculateInstanceOffsets(attribute) {
      var data = this.props.data;
      var iconManager = this.state.iconManager;
      var value = attribute.value;
      var i = 0;
      var _iteratorNormalCompletion2 = true;
      var _didIteratorError2 = false;
      var _iteratorError2 = undefined;

      try {
        for (var _iterator2 = data[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
          var object = _step2.value;
          var rect = iconManager.getIconMapping(object);
          value[i++] = rect.width / 2 - rect.anchorX || 0;
          value[i++] = rect.height / 2 - rect.anchorY || 0;
        }
      } catch (err) {
        _didIteratorError2 = true;
        _iteratorError2 = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
            _iterator2.return();
          }
        } finally {
          if (_didIteratorError2) {
            throw _iteratorError2;
          }
        }
      }
    }
  }, {
    key: "calculateInstanceColorMode",
    value: function calculateInstanceColorMode(attribute) {
      var data = this.props.data;
      var iconManager = this.state.iconManager;
      var value = attribute.value;
      var i = 0;
      var _iteratorNormalCompletion3 = true;
      var _didIteratorError3 = false;
      var _iteratorError3 = undefined;

      try {
        for (var _iterator3 = data[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
          var object = _step3.value;
          var mapping = iconManager.getIconMapping(object);
          var colorMode = mapping.mask;
          value[i++] = colorMode ? 1 : 0;
        }
      } catch (err) {
        _didIteratorError3 = true;
        _iteratorError3 = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
            _iterator3.return();
          }
        } finally {
          if (_didIteratorError3) {
            throw _iteratorError3;
          }
        }
      }
    }
  }, {
    key: "calculateInstanceIconFrames",
    value: function calculateInstanceIconFrames(attribute) {
      var data = this.props.data;
      var iconManager = this.state.iconManager;
      var value = attribute.value;
      var i = 0;
      var _iteratorNormalCompletion4 = true;
      var _didIteratorError4 = false;
      var _iteratorError4 = undefined;

      try {
        for (var _iterator4 = data[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
          var object = _step4.value;
          var rect = iconManager.getIconMapping(object);
          value[i++] = rect.x || 0;
          value[i++] = rect.y || 0;
          value[i++] = rect.width || 0;
          value[i++] = rect.height || 0;
        }
      } catch (err) {
        _didIteratorError4 = true;
        _iteratorError4 = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
            _iterator4.return();
          }
        } finally {
          if (_didIteratorError4) {
            throw _iteratorError4;
          }
        }
      }
    }
  }]);

  return IconLayer;
}(_core.Layer);

exports.default = IconLayer;
IconLayer.layerName = 'IconLayer';
IconLayer.defaultProps = defaultProps;
},{"@deck.gl/core":"Tk4X","luma.gl/constants":"lMsC","luma.gl":"GAQa","./icon-layer-vertex.glsl":"Fz9d","./icon-layer-fragment.glsl":"Q4Se","./icon-manager":"Gnyp"}],"Thtg":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var _default = "#define SHADER_NAME line-layer-vertex-shader\n\nattribute vec3 positions;\nattribute vec3 instanceSourcePositions;\nattribute vec3 instanceTargetPositions;\nattribute vec4 instanceSourceTargetPositions64xyLow;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\nattribute float instanceWidths;\n\nuniform float opacity;\n\nvarying vec4 vColor;\n\n// offset vector by strokeWidth pixels\n// offset_direction is -1 (left) or 1 (right)\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n  // normalized direction of the line\n  vec2 dir_screenspace = normalize(line_clipspace * project_uViewportSize);\n  // rotate by 90 degrees\n  dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n\n  vec2 offset_screenspace = dir_screenspace * offset_direction * instanceWidths / 2.0;\n  vec2 offset_clipspace = project_pixel_to_clipspace(offset_screenspace).xy;\n\n  return offset_clipspace;\n}\n\nvoid main(void) {\n  // Position\n  vec4 source = project_position_to_clipspace(instanceSourcePositions, instanceSourceTargetPositions64xyLow.xy, vec3(0.));\n  vec4 target = project_position_to_clipspace(instanceTargetPositions, instanceSourceTargetPositions64xyLow.zw, vec3(0.));\n\n  // linear interpolation of source & target to pick right coord\n  float segmentIndex = positions.x;\n  vec4 p = mix(source, target, segmentIndex);\n\n  // extrude\n  vec2 offset = getExtrusionOffset(target.xy - source.xy, positions.y);\n  gl_Position = p + vec4(offset, 0.0, 0.0);\n\n  // Color\n  vColor = vec4(instanceColors.rgb, instanceColors.a * opacity) / 255.;\n\n  // Set color to be rendered to picking fbo (also used to check for selection highlight).\n  picking_setPickingColor(instancePickingColors);\n}\n";
exports.default = _default;
},{}],"CqKx":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var _default = "#define SHADER_NAME line-layer-fragment-shader\n\nprecision highp float;\n\nvarying vec4 vColor;\n\nvoid main(void) {\n  gl_FragColor = vColor;\n\n  // use highlight color if this fragment belongs to the selected object.\n  gl_FragColor = picking_filterHighlightColor(gl_FragColor);\n\n  // use picking color if rendering to picking FBO.\n  gl_FragColor = picking_filterPickingColor(gl_FragColor);\n}\n";
exports.default = _default;
},{}],"A8ZW":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _core = require("@deck.gl/core");

var _constants = _interopRequireDefault(require("luma.gl/constants"));

var _luma = require("luma.gl");

var _lineLayerVertex = _interopRequireDefault(require("./line-layer-vertex.glsl"));

var _lineLayerFragment = _interopRequireDefault(require("./line-layer-fragment.glsl"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _get(target, property, receiver) {
  if (typeof Reflect !== "undefined" && Reflect.get) {
    _get = Reflect.get;
  } else {
    _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(target, property, receiver || target);
}

function _superPropBase(object, property) {
  while (!Object.prototype.hasOwnProperty.call(object, property)) {
    object = _getPrototypeOf(object);
    if (object === null) break;
  }

  return object;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.


var fp64LowPart = _luma.fp64.fp64LowPart;
var DEFAULT_COLOR = [0, 0, 0, 255];
var defaultProps = {
  fp64: false,
  getSourcePosition: {
    type: 'accessor',
    value: function value(x) {
      return x.sourcePosition;
    }
  },
  getTargetPosition: {
    type: 'accessor',
    value: function value(x) {
      return x.targetPosition;
    }
  },
  getColor: {
    type: 'accessor',
    value: DEFAULT_COLOR
  },
  getStrokeWidth: {
    type: 'accessor',
    value: 1
  },
  // deprecated
  strokeWidth: {
    deprecatedFor: 'getStrokeWidth'
  }
};

var LineLayer =
/*#__PURE__*/
function (_Layer) {
  _inherits(LineLayer, _Layer);

  function LineLayer() {
    _classCallCheck(this, LineLayer);

    return _possibleConstructorReturn(this, _getPrototypeOf(LineLayer).apply(this, arguments));
  }

  _createClass(LineLayer, [{
    key: "getShaders",
    value: function getShaders() {
      var projectModule = this.use64bitProjection() ? 'project64' : 'project32';
      return {
        vs: _lineLayerVertex.default,
        fs: _lineLayerFragment.default,
        modules: [projectModule, 'picking']
      };
    }
  }, {
    key: "initializeState",
    value: function initializeState() {
      var attributeManager = this.getAttributeManager();
      /* eslint-disable max-len */

      attributeManager.addInstanced({
        instanceSourcePositions: {
          size: 3,
          transition: true,
          accessor: 'getSourcePosition'
        },
        instanceTargetPositions: {
          size: 3,
          transition: true,
          accessor: 'getTargetPosition'
        },
        instanceSourceTargetPositions64xyLow: {
          size: 4,
          accessor: ['getSourcePosition', 'getTargetPosition'],
          update: this.calculateInstanceSourceTargetPositions64xyLow
        },
        instanceColors: {
          size: 4,
          type: _constants.default.UNSIGNED_BYTE,
          transition: true,
          accessor: 'getColor',
          defaultValue: [0, 0, 0, 255]
        },
        instanceWidths: {
          size: 1,
          transition: true,
          accessor: 'getStrokeWidth',
          defaultValue: 1
        }
      });
      /* eslint-enable max-len */
    }
  }, {
    key: "updateState",
    value: function updateState(_ref) {
      var props = _ref.props,
          oldProps = _ref.oldProps,
          changeFlags = _ref.changeFlags;

      _get(_getPrototypeOf(LineLayer.prototype), "updateState", this).call(this, {
        props: props,
        oldProps: oldProps,
        changeFlags: changeFlags
      });

      if (props.fp64 !== oldProps.fp64) {
        var gl = this.context.gl;

        if (this.state.model) {
          this.state.model.delete();
        }

        this.setState({
          model: this._getModel(gl)
        });
        this.getAttributeManager().invalidateAll();
      }
    }
  }, {
    key: "_getModel",
    value: function _getModel(gl) {
      /*
       *  (0, -1)-------------_(1, -1)
       *       |          _,-"  |
       *       o      _,-"      o
       *       |  _,-"          |
       *   (0, 1)"-------------(1, 1)
       */
      var positions = [0, -1, 0, 0, 1, 0, 1, -1, 0, 1, 1, 0];
      return new _luma.Model(gl, Object.assign({}, this.getShaders(), {
        id: this.props.id,
        geometry: new _luma.Geometry({
          drawMode: _constants.default.TRIANGLE_STRIP,
          attributes: {
            positions: new Float32Array(positions)
          }
        }),
        isInstanced: true,
        shaderCache: this.context.shaderCache
      }));
    }
  }, {
    key: "calculateInstanceSourceTargetPositions64xyLow",
    value: function calculateInstanceSourceTargetPositions64xyLow(attribute) {
      var isFP64 = this.use64bitPositions();
      attribute.constant = !isFP64;

      if (!isFP64) {
        attribute.value = new Float32Array(4);
        return;
      }

      var _this$props = this.props,
          data = _this$props.data,
          getSourcePosition = _this$props.getSourcePosition,
          getTargetPosition = _this$props.getTargetPosition;
      var value = attribute.value,
          size = attribute.size;
      var i = 0;
      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = data[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var object = _step.value;
          var sourcePosition = getSourcePosition(object);
          var targetPosition = getTargetPosition(object);
          value[i + 0] = fp64LowPart(sourcePosition[0]);
          value[i + 1] = fp64LowPart(sourcePosition[1]);
          value[i + 2] = fp64LowPart(targetPosition[0]);
          value[i + 3] = fp64LowPart(targetPosition[1]);
          i += size;
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return != null) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }
    }
  }]);

  return LineLayer;
}(_core.Layer);

exports.default = LineLayer;
LineLayer.layerName = 'LineLayer';
LineLayer.defaultProps = defaultProps;
},{"@deck.gl/core":"Tk4X","luma.gl/constants":"lMsC","luma.gl":"GAQa","./line-layer-vertex.glsl":"Thtg","./line-layer-fragment.glsl":"CqKx"}],"wv6N":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var _default = "#define SHADER_NAME point-cloud-layer-vertex-shader\n\nattribute vec3 positions;\nattribute vec3 instanceNormals;\nattribute vec4 instanceColors;\nattribute vec3 instancePositions;\nattribute vec2 instancePositions64xyLow;\nattribute vec3 instancePickingColors;\n\nuniform float opacity;\nuniform float radiusPixels;\n\nvarying vec4 vColor;\nvarying vec2 unitPosition;\n\nvoid main(void) {\n  // position on the containing square in [-1, 1] space\n  unitPosition = positions.xy;\n\n  // Find the center of the point and add the current vertex\n  vec4 position_worldspace;\n  gl_Position = project_position_to_clipspace(instancePositions, instancePositions64xyLow, vec3(0.), position_worldspace);\n  gl_Position += project_pixel_to_clipspace(positions.xy * radiusPixels);\n\n  // Apply lighting\n  float lightWeight = lighting_getLightWeight(position_worldspace.xyz, // the w component is always 1.0\n    project_normal(instanceNormals));\n\n  // Apply opacity to instance color, or return instance picking color\n  vColor = vec4(lightWeight * instanceColors.rgb, instanceColors.a * opacity) / 255.;\n\n  // Set color to be rendered to picking fbo (also used to check for selection highlight).\n  picking_setPickingColor(instancePickingColors);\n}\n";
exports.default = _default;
},{}],"tCz4":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var _default = "#define SHADER_NAME point-cloud-layer-fragment-shader\n\nprecision highp float;\n\nvarying vec4 vColor;\nvarying vec2 unitPosition;\n\nvoid main(void) {\n\n  float distToCenter = length(unitPosition);\n\n  if (distToCenter > 1.0) {\n    discard;\n  }\n\n  gl_FragColor = vColor;\n\n  // use highlight color if this fragment belongs to the selected object.\n  gl_FragColor = picking_filterHighlightColor(gl_FragColor);\n\n  // use picking color if rendering to picking FBO.\n  gl_FragColor = picking_filterPickingColor(gl_FragColor);\n}\n";
exports.default = _default;
},{}],"G23C":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _core = require("@deck.gl/core");

var _constants = _interopRequireDefault(require("luma.gl/constants"));

var _luma = require("luma.gl");

var _pointCloudLayerVertex = _interopRequireDefault(require("./point-cloud-layer-vertex.glsl"));

var _pointCloudLayerFragment = _interopRequireDefault(require("./point-cloud-layer-fragment.glsl"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _get(target, property, receiver) {
  if (typeof Reflect !== "undefined" && Reflect.get) {
    _get = Reflect.get;
  } else {
    _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(target, property, receiver || target);
}

function _superPropBase(object, property) {
  while (!Object.prototype.hasOwnProperty.call(object, property)) {
    object = _getPrototypeOf(object);
    if (object === null) break;
  }

  return object;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.


var fp64LowPart = _luma.fp64.fp64LowPart;
var DEFAULT_COLOR = [0, 0, 0, 255];
var DEFAULT_NORMAL = [0, 0, 1];
var defaultProps = {
  radiusPixels: {
    type: 'number',
    min: 0,
    value: 10
  },
  //  point radius in pixels
  fp64: false,
  getPosition: {
    type: 'accessor',
    value: function value(x) {
      return x.position;
    }
  },
  getNormal: {
    type: 'accessor',
    value: DEFAULT_NORMAL
  },
  getColor: {
    type: 'accessor',
    value: DEFAULT_COLOR
  },
  lightSettings: {}
};

var PointCloudLayer =
/*#__PURE__*/
function (_Layer) {
  _inherits(PointCloudLayer, _Layer);

  function PointCloudLayer() {
    _classCallCheck(this, PointCloudLayer);

    return _possibleConstructorReturn(this, _getPrototypeOf(PointCloudLayer).apply(this, arguments));
  }

  _createClass(PointCloudLayer, [{
    key: "getShaders",
    value: function getShaders(id) {
      var projectModule = this.use64bitProjection() ? 'project64' : 'project32';
      return {
        vs: _pointCloudLayerVertex.default,
        fs: _pointCloudLayerFragment.default,
        modules: [projectModule, 'lighting', 'picking']
      };
    }
  }, {
    key: "initializeState",
    value: function initializeState() {
      /* eslint-disable max-len */
      this.getAttributeManager().addInstanced({
        instancePositions: {
          size: 3,
          transition: true,
          accessor: 'getPosition'
        },
        instancePositions64xyLow: {
          size: 2,
          accessor: 'getPosition',
          update: this.calculateInstancePositions64xyLow
        },
        instanceNormals: {
          size: 3,
          transition: true,
          accessor: 'getNormal',
          defaultValue: DEFAULT_NORMAL
        },
        instanceColors: {
          size: 4,
          type: _constants.default.UNSIGNED_BYTE,
          transition: true,
          accessor: 'getColor',
          defaultValue: DEFAULT_COLOR
        }
      });
      /* eslint-enable max-len */
    }
  }, {
    key: "updateState",
    value: function updateState(_ref) {
      var props = _ref.props,
          oldProps = _ref.oldProps,
          changeFlags = _ref.changeFlags;

      _get(_getPrototypeOf(PointCloudLayer.prototype), "updateState", this).call(this, {
        props: props,
        oldProps: oldProps,
        changeFlags: changeFlags
      });

      if (props.fp64 !== oldProps.fp64) {
        var gl = this.context.gl;

        if (this.state.model) {
          this.state.model.delete();
        }

        this.setState({
          model: this._getModel(gl)
        });
        this.getAttributeManager().invalidateAll();
      }
    }
  }, {
    key: "draw",
    value: function draw(_ref2) {
      var uniforms = _ref2.uniforms;
      var radiusPixels = this.props.radiusPixels;
      this.state.model.render(Object.assign({}, uniforms, {
        radiusPixels: radiusPixels
      }));
    }
  }, {
    key: "_getModel",
    value: function _getModel(gl) {
      // a triangle that minimally cover the unit circle
      var positions = [];

      for (var i = 0; i < 3; i++) {
        var angle = i / 3 * Math.PI * 2;
        positions.push(Math.cos(angle) * 2, Math.sin(angle) * 2, 0);
      }

      return new _luma.Model(gl, Object.assign({}, this.getShaders(), {
        id: this.props.id,
        geometry: new _luma.Geometry({
          drawMode: _constants.default.TRIANGLES,
          attributes: {
            positions: new Float32Array(positions)
          }
        }),
        isInstanced: true,
        shaderCache: this.context.shaderCache
      }));
    }
  }, {
    key: "calculateInstancePositions64xyLow",
    value: function calculateInstancePositions64xyLow(attribute) {
      var isFP64 = this.use64bitPositions();
      attribute.constant = !isFP64;

      if (!isFP64) {
        attribute.value = new Float32Array(2);
        return;
      }

      var _this$props = this.props,
          data = _this$props.data,
          getPosition = _this$props.getPosition;
      var value = attribute.value;
      var i = 0;
      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = data[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var point = _step.value;
          var position = getPosition(point);
          value[i++] = fp64LowPart(position[0]);
          value[i++] = fp64LowPart(position[1]);
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return != null) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }
    }
  }]);

  return PointCloudLayer;
}(_core.Layer);

exports.default = PointCloudLayer;
PointCloudLayer.layerName = 'PointCloudLayer';
PointCloudLayer.defaultProps = defaultProps;
},{"@deck.gl/core":"Tk4X","luma.gl/constants":"lMsC","luma.gl":"GAQa","./point-cloud-layer-vertex.glsl":"wv6N","./point-cloud-layer-fragment.glsl":"tCz4"}],"sIBX":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var _default = "#define SHADER_NAME scatterplot-layer-vertex-shader\n\nattribute vec3 positions;\n\nattribute vec3 instancePositions;\nattribute vec2 instancePositions64xyLow;\nattribute float instanceRadius;\nattribute float instanceLineWidths;\nattribute vec4 instanceFillColors;\nattribute vec4 instanceLineColors;\nattribute vec3 instancePickingColors;\n\nuniform float opacity;\nuniform float radiusScale;\nuniform float radiusMinPixels;\nuniform float radiusMaxPixels;\nuniform float lineWidthScale;\nuniform float lineWidthMinPixels;\nuniform float lineWidthMaxPixels;\nuniform float stroked;\nuniform bool filled;\n\nvarying vec4 vFillColor;\nvarying vec4 vLineColor;\nvarying vec2 unitPosition;\nvarying float innerUnitRadius;\n\nvoid main(void) {\n  // Multiply out radius and clamp to limits\n  float outerRadiusPixels = clamp(\n    project_scale(radiusScale * instanceRadius),\n    radiusMinPixels, radiusMaxPixels\n  );\n  \n  // Multiply out line width and clamp to limits\n  float lineWidth = clamp(\n    project_scale(lineWidthScale * instanceLineWidths), \n    lineWidthMinPixels, lineWidthMaxPixels\n  );\n\n  // outer radius needs to offset by half stroke width\n  outerRadiusPixels += stroked * lineWidth / 2.0;\n\n  // position on the containing square in [-1, 1] space\n  unitPosition = positions.xy;\n\n  innerUnitRadius = 1.0 - stroked * lineWidth / outerRadiusPixels;\n  \n  vec3 offset = positions * outerRadiusPixels;\n  gl_Position = project_position_to_clipspace(instancePositions, instancePositions64xyLow, offset);\n\n  // Apply opacity to instance color, or return instance picking color\n  vFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * opacity) / 255.;\n  vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * opacity) / 255.;\n  \n  // Set color to be rendered to picking fbo (also used to check for selection highlight).\n  picking_setPickingColor(instancePickingColors);\n}\n";
exports.default = _default;
},{}],"mGnv":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var _default = "#define SHADER_NAME scatterplot-layer-fragment-shader\n\nprecision highp float;\n\nuniform bool filled;\n\nvarying vec4 vFillColor;\nvarying vec4 vLineColor;\nvarying vec2 unitPosition;\nvarying float innerUnitRadius;\n\nvoid main(void) {\n\n  float distToCenter = length(unitPosition);\n\n  if (distToCenter > 1.0) {\n    discard;\n  } \n  if (distToCenter > innerUnitRadius) {\n    gl_FragColor = vLineColor;\n  } else if (filled) {\n    gl_FragColor = vFillColor;\n  } else {\n    discard;\n  }\n\n  // use highlight color if this fragment belongs to the selected object.\n  gl_FragColor = picking_filterHighlightColor(gl_FragColor);\n\n  // use picking color if rendering to picking FBO.\n  gl_FragColor = picking_filterPickingColor(gl_FragColor);\n}\n";
exports.default = _default;
},{}],"QcVn":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _core = require("@deck.gl/core");

var _constants = _interopRequireDefault(require("luma.gl/constants"));

var _luma = require("luma.gl");

var _scatterplotLayerVertex = _interopRequireDefault(require("./scatterplot-layer-vertex.glsl"));

var _scatterplotLayerFragment = _interopRequireDefault(require("./scatterplot-layer-fragment.glsl"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _get(target, property, receiver) {
  if (typeof Reflect !== "undefined" && Reflect.get) {
    _get = Reflect.get;
  } else {
    _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(target, property, receiver || target);
}

function _superPropBase(object, property) {
  while (!Object.prototype.hasOwnProperty.call(object, property)) {
    object = _getPrototypeOf(object);
    if (object === null) break;
  }

  return object;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.


var fp64LowPart = _luma.fp64.fp64LowPart;
var DEFAULT_COLOR = [0, 0, 0, 255];
var defaultProps = {
  radiusScale: {
    type: 'number',
    min: 0,
    value: 1
  },
  radiusMinPixels: {
    type: 'number',
    min: 0,
    value: 0
  },
  //  min point radius in pixels
  radiusMaxPixels: {
    type: 'number',
    min: 0,
    value: Number.MAX_SAFE_INTEGER
  },
  // max point radius in pixels
  lineWidthScale: {
    type: 'number',
    min: 0,
    value: 1
  },
  lineWidthMinPixels: {
    type: 'number',
    min: 0,
    value: 0
  },
  lineWidthMaxPixels: {
    type: 'number',
    min: 0,
    value: Number.MAX_SAFE_INTEGER
  },
  stroked: false,
  fp64: false,
  filled: true,
  getPosition: {
    type: 'accessor',
    value: function value(x) {
      return x.position;
    }
  },
  getRadius: {
    type: 'accessor',
    value: 1
  },
  getFillColor: {
    type: 'accessor',
    value: DEFAULT_COLOR
  },
  getLineColor: {
    type: 'accessor',
    value: DEFAULT_COLOR
  },
  getLineWidth: {
    type: 'accessor',
    value: 1
  },
  // deprecated
  strokeWidth: {
    deprecatedFor: 'getLineWidth'
  },
  outline: {
    deprecatedFor: 'stroked'
  },
  getColor: {
    deprecatedFor: ['getFillColor', 'getLineColor']
  }
};

var ScatterplotLayer =
/*#__PURE__*/
function (_Layer) {
  _inherits(ScatterplotLayer, _Layer);

  function ScatterplotLayer() {
    _classCallCheck(this, ScatterplotLayer);

    return _possibleConstructorReturn(this, _getPrototypeOf(ScatterplotLayer).apply(this, arguments));
  }

  _createClass(ScatterplotLayer, [{
    key: "getShaders",
    value: function getShaders(id) {
      var projectModule = this.use64bitProjection() ? 'project64' : 'project32';
      return {
        vs: _scatterplotLayerVertex.default,
        fs: _scatterplotLayerFragment.default,
        modules: [projectModule, 'picking']
      };
    }
  }, {
    key: "initializeState",
    value: function initializeState() {
      this.getAttributeManager().addInstanced({
        instancePositions: {
          size: 3,
          transition: true,
          accessor: 'getPosition'
        },
        instancePositions64xyLow: {
          size: 2,
          accessor: 'getPosition',
          update: this.calculateInstancePositions64xyLow
        },
        instanceRadius: {
          size: 1,
          transition: true,
          accessor: 'getRadius',
          defaultValue: 1
        },
        instanceFillColors: {
          size: 4,
          transition: true,
          type: _constants.default.UNSIGNED_BYTE,
          accessor: 'getFillColor',
          defaultValue: [0, 0, 0, 255]
        },
        instanceLineColors: {
          size: 4,
          transition: true,
          type: _constants.default.UNSIGNED_BYTE,
          accessor: 'getLineColor',
          defaultValue: [0, 0, 0, 255]
        },
        instanceLineWidths: {
          size: 1,
          transition: true,
          accessor: 'getLineWidth',
          defaultValue: 1
        }
      });
    }
  }, {
    key: "updateState",
    value: function updateState(_ref) {
      var props = _ref.props,
          oldProps = _ref.oldProps,
          changeFlags = _ref.changeFlags;

      _get(_getPrototypeOf(ScatterplotLayer.prototype), "updateState", this).call(this, {
        props: props,
        oldProps: oldProps,
        changeFlags: changeFlags
      });

      if (props.fp64 !== oldProps.fp64) {
        var gl = this.context.gl;

        if (this.state.model) {
          this.state.model.delete();
        }

        this.setState({
          model: this._getModel(gl)
        });
        this.getAttributeManager().invalidateAll();
      }
    }
  }, {
    key: "draw",
    value: function draw(_ref2) {
      var uniforms = _ref2.uniforms;
      var _this$props = this.props,
          radiusScale = _this$props.radiusScale,
          radiusMinPixels = _this$props.radiusMinPixels,
          radiusMaxPixels = _this$props.radiusMaxPixels,
          stroked = _this$props.stroked,
          filled = _this$props.filled,
          lineWidthScale = _this$props.lineWidthScale,
          lineWidthMinPixels = _this$props.lineWidthMinPixels,
          lineWidthMaxPixels = _this$props.lineWidthMaxPixels;
      this.state.model.render(Object.assign({}, uniforms, {
        stroked: stroked ? 1 : 0,
        filled: filled,
        radiusScale: radiusScale,
        radiusMinPixels: radiusMinPixels,
        radiusMaxPixels: radiusMaxPixels,
        lineWidthScale: lineWidthScale,
        lineWidthMinPixels: lineWidthMinPixels,
        lineWidthMaxPixels: lineWidthMaxPixels
      }));
    }
  }, {
    key: "_getModel",
    value: function _getModel(gl) {
      // a square that minimally cover the unit circle
      var positions = [-1, -1, 0, -1, 1, 0, 1, 1, 0, 1, -1, 0];
      return new _luma.Model(gl, Object.assign(this.getShaders(), {
        id: this.props.id,
        geometry: new _luma.Geometry({
          drawMode: _constants.default.TRIANGLE_FAN,
          attributes: {
            positions: new Float32Array(positions)
          }
        }),
        isInstanced: true,
        shaderCache: this.context.shaderCache
      }));
    }
  }, {
    key: "calculateInstancePositions64xyLow",
    value: function calculateInstancePositions64xyLow(attribute) {
      var isFP64 = this.use64bitPositions();
      attribute.constant = !isFP64;

      if (!isFP64) {
        attribute.value = new Float32Array(2);
        return;
      }

      var _this$props2 = this.props,
          data = _this$props2.data,
          getPosition = _this$props2.getPosition;
      var value = attribute.value;
      var i = 0;
      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = data[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var point = _step.value;
          var position = getPosition(point);
          value[i++] = fp64LowPart(position[0]);
          value[i++] = fp64LowPart(position[1]);
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return != null) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }
    }
  }]);

  return ScatterplotLayer;
}(_core.Layer);

exports.default = ScatterplotLayer;
ScatterplotLayer.layerName = 'ScatterplotLayer';
ScatterplotLayer.defaultProps = defaultProps;
},{"@deck.gl/core":"Tk4X","luma.gl/constants":"lMsC","luma.gl":"GAQa","./scatterplot-layer-vertex.glsl":"sIBX","./scatterplot-layer-fragment.glsl":"mGnv"}],"k7BO":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var _default = "#version 300 es\n#define SHADER_NAME screen-grid-layer-vertex-shader\n#define RANGE_COUNT 6\n\nin vec3 vertices;\nin vec3 instancePositions;\nin vec4 instanceCounts;\nin vec3 instancePickingColors;\n\nlayout(std140) uniform;\nuniform float opacity;\nuniform vec3 cellScale;\nuniform vec4 minColor;\nuniform vec4 maxColor;\nuniform AggregationData\n{\n  vec4 maxCount;\n} aggregationData;\n\nuniform vec4 colorRange[RANGE_COUNT];\nuniform vec2 colorDomain;\nuniform bool shouldUseMinMax;\n\nout vec4 vColor;\nout float vSampleCount;\n\nvec4 quantizeScale(vec2 domain, vec4 range[RANGE_COUNT], float value) {\n  vec4 outColor = vec4(0., 0., 0., 0.);\n  if (value >= domain.x && value <= domain.y) {\n    float domainRange = domain.y - domain.x;\n    if (domainRange <= 0.) {\n      outColor = colorRange[0];\n    } else {\n      float rangeCount = float(RANGE_COUNT);\n      float rangeStep = domainRange / rangeCount;\n      float idx = floor((value - domain.x) / rangeStep);\n      idx = clamp(idx, 0., rangeCount - 1.);\n      int intIdx = int(idx);\n      outColor = colorRange[intIdx];\n    }\n  }\n  outColor = outColor / 255.;\n  return outColor;\n}\n\nvoid main(void) {\n  vSampleCount = instanceCounts.a;\n\n  float weight = instanceCounts.r ;\n  float maxWeight = aggregationData.maxCount.r;\n  float step = weight / maxWeight;\n  vec4 minMaxColor = mix(minColor, maxColor, step) / 255.;\n\n  vec2 domain = colorDomain;\n  float domainMaxValid = float(colorDomain.y != 0.);\n  domain.y = mix(maxWeight, colorDomain.y, domainMaxValid);\n  vec4 rangeColor = quantizeScale(domain, colorRange, weight);\n\n  float rangeMinMax = float(shouldUseMinMax);\n  vec4 color = mix(rangeColor, minMaxColor, rangeMinMax);\n  vColor = vec4(color.rgb, color.a * opacity);\n\n  // Set color to be rendered to picking fbo (also used to check for selection highlight).\n  picking_setPickingColor(instancePickingColors);\n\n  gl_Position = vec4(instancePositions + vertices * cellScale, 1.);\n}\n";
exports.default = _default;
},{}],"UiJN":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var _default = "#define SHADER_NAME screen-grid-layer-vertex-shader-webgl1\n#define RANGE_COUNT 6\n\nattribute vec3 vertices;\nattribute vec3 instancePositions;\nattribute vec4 instanceCounts;\nattribute vec3 instancePickingColors;\n\nuniform float opacity;\nuniform vec3 cellScale;\nuniform vec4 minColor;\nuniform vec4 maxColor;\nuniform float maxWeight;\nuniform vec4 colorRange[RANGE_COUNT];\nuniform vec2 colorDomain;\nuniform bool shouldUseMinMax;\n\nvarying vec4 vColor;\nvarying float vSampleCount;\n\nvec4 quantizeScale(vec2 domain, vec4 range[RANGE_COUNT], float value) {\n  vec4 outColor = vec4(0., 0., 0., 0.);\n  if (value >= domain.x && value <= domain.y) {\n    float domainRange = domain.y - domain.x;\n    if (domainRange <= 0.) {\n      outColor = colorRange[0];\n    } else {\n      float rangeCount = float(RANGE_COUNT);\n      float rangeStep = domainRange / rangeCount;\n      float idx = floor((value - domain.x) / rangeStep);\n      idx = clamp(idx, 0., rangeCount - 1.);\n      int intIdx = int(idx);\n      outColor = colorRange[intIdx];\n    }\n  }\n  outColor = outColor / 255.;\n  return outColor;\n}\n\nvoid main(void) {\n  vSampleCount = instanceCounts.a;\n\n  float weight = instanceCounts.r;\n  float step = weight / maxWeight;\n  vec4 minMaxColor = mix(minColor, maxColor, step) / 255.;\n\n  vec2 domain = colorDomain;\n  float domainMaxValid = float(colorDomain.y != 0.);\n  domain.y = mix(maxWeight, colorDomain.y, domainMaxValid);\n  vec4 rangeColor = quantizeScale(domain, colorRange, weight);\n\n  float rangeMinMax = float(shouldUseMinMax);\n  vec4 color = mix(rangeColor, minMaxColor, rangeMinMax);\n  vColor = vec4(color.rgb, color.a * opacity);\n\n  // Set color to be rendered to picking fbo (also used to check for selection highlight).\n  picking_setPickingColor(instancePickingColors);\n\n  gl_Position = vec4(instancePositions + vertices * cellScale, 1.);\n}\n";
exports.default = _default;
},{}],"zGj7":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.

/* fragment shader for the grid-layer */
var _default = "#version 300 es\n#define SHADER_NAME screen-grid-layer-fragment-shader\n\nprecision highp float;\n\nin vec4 vColor;\nin float vSampleCount;\nout vec4 fragColor;\n\nvoid main(void) {\n  if (vSampleCount <= 0.0) {\n    discard;\n  }\n  fragColor = vColor;\n\n  fragColor = picking_filterColor(fragColor);\n}\n";
exports.default = _default;
},{}],"HVXe":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.

/* fragment shader for the grid-layer */
var _default = "#define SHADER_NAME screen-grid-layer-fragment-shader-webgl1\n\nprecision highp float;\n\nvarying vec4 vColor;\nvarying float vSampleCount;\n\nvoid main(void) {\n  if (vSampleCount <= 0.0) {\n    discard;\n  }\n  gl_FragColor = vColor;\n\n  gl_FragColor = picking_filterColor(gl_FragColor);\n}\n";
exports.default = _default;
},{}],"eQFN":[function(require,module,exports) {

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _core = require("@deck.gl/core");

var _constants = _interopRequireDefault(require("luma.gl/constants"));

var _luma = require("luma.gl");

var _screenGridLayerVertex = _interopRequireDefault(require("./screen-grid-layer-vertex.glsl"));

var _screenGridLayerVertexWebgl = _interopRequireDefault(require("./screen-grid-layer-vertex-webgl1.glsl"));

var _screenGridLayerFragment = _interopRequireDefault(require("./screen-grid-layer-fragment.glsl"));

var _screenGridLayerFragmentWebgl = _interopRequireDefault(require("./screen-grid-layer-fragment-webgl1.glsl"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _get(target, property, receiver) {
  if (typeof Reflect !== "undefined" && Reflect.get) {
    _get = Reflect.get;
  } else {
    _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(target, property, receiver || target);
}

function _superPropBase(object, property) {
  while (!Object.prototype.hasOwnProperty.call(object, property)) {
    object = _getPrototypeOf(object);
    if (object === null) break;
  }

  return object;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
// import {Layer, WebMercatorViewport, createIterable, log, experimental} from '@deck.gl/core';


var count = _core.experimental.count,
    defaultColorRange = _core.experimental.defaultColorRange;
var DEFAULT_MINCOLOR = [0, 0, 0, 0];
var DEFAULT_MAXCOLOR = [0, 255, 0, 255];
var AGGREGATION_DATA_UBO_INDEX = 0;
var COLOR_PROPS = ["minColor", "maxColor", "colorRange", "colorDomain"];
var defaultProps = {
  cellSizePixels: {
    value: 100,
    min: 1
  },
  cellMarginPixels: {
    value: 2,
    min: 0,
    max: 5
  },
  colorDomain: null,
  colorRange: defaultColorRange,
  getPosition: {
    type: 'accessor',
    value: function value(d) {
      return d.position;
    }
  },
  getWeight: {
    type: 'accessor',
    value: function value(d) {
      return [1, 0, 0];
    }
  },
  gpuAggregation: true,
  aggregation: 'SUM'
};

var ScreenGridLayer =
/*#__PURE__*/
function (_Layer) {
  _inherits(ScreenGridLayer, _Layer);

  function ScreenGridLayer() {
    _classCallCheck(this, ScreenGridLayer);

    return _possibleConstructorReturn(this, _getPrototypeOf(ScreenGridLayer).apply(this, arguments));
  }

  _createClass(ScreenGridLayer, [{
    key: "getShaders",
    value: function getShaders() {
      var shaders = (0, _luma.isWebGL2)(this.context.gl) ? {
        vs: _screenGridLayerVertex.default,
        fs: _screenGridLayerFragment.default
      } : {
        vs: _screenGridLayerVertexWebgl.default,
        fs: _screenGridLayerFragmentWebgl.default
      };
      shaders.modules = ['picking'];
      return shaders;
    }
  }, {
    key: "initializeState",
    value: function initializeState() {
      var attributeManager = this.getAttributeManager();
      var gl = this.context.gl;
      /* eslint-disable max-len */

      attributeManager.addInstanced({
        instancePositions: {
          size: 3,
          update: this.calculateInstancePositions
        },
        instanceCounts: {
          size: 4,
          transition: true,
          accessor: ['getPosition', 'getWeight'],
          update: this.calculateInstanceCounts,
          noAlloc: true
        }
      });
      /* eslint-disable max-len */

      var options = {
        id: "".concat(this.id, "-aggregator"),
        shaderCache: this.context.shaderCache
      };

      var maxBuffer = this._getMaxCountBuffer(gl);

      var weights = {
        color: {
          size: 1,
          operation: _core.AGGREGATION_OPERATION.SUM,
          needMax: true,
          maxBuffer: maxBuffer
        }
      };
      this.setState({
        model: this._getModel(gl),
        gpuGridAggregator: new _core._GPUGridAggregator(gl, options),
        maxBuffer: maxBuffer,
        weights: weights,
        aggregationResults: null
      });

      this._setupUniformBuffer();
    }
  }, {
    key: "shouldUpdateState",
    value: function shouldUpdateState(_ref) {
      var changeFlags = _ref.changeFlags;
      return changeFlags.somethingChanged;
    }
  }, {
    key: "updateState",
    value: function updateState(opts) {
      _get(_getPrototypeOf(ScreenGridLayer.prototype), "updateState", this).call(this, opts);

      this._updateUniforms(opts);

      if (opts.changeFlags.dataChanged) {
        this._processData();
      }

      var changeFlags = this._getAggregationChangeFlags(opts);

      if (changeFlags) {
        this._updateAggregation(changeFlags);
      }
    }
  }, {
    key: "draw",
    value: function draw(_ref2) {
      var uniforms = _ref2.uniforms;
      var gl = this.context.gl;
      var _this$props$parameter = this.props.parameters,
          parameters = _this$props$parameter === void 0 ? {} : _this$props$parameter;
      var minColor = this.props.minColor || DEFAULT_MINCOLOR;
      var maxColor = this.props.maxColor || DEFAULT_MAXCOLOR; // If colorDomain not specified we use default domain [1, maxCount]
      // maxCount value will be deduced from aggregated buffer in the vertex shader.

      var colorDomain = this.props.colorDomain || [1, 0];
      var _this$state = this.state,
          model = _this$state.model,
          maxBuffer = _this$state.maxBuffer,
          cellScale = _this$state.cellScale,
          shouldUseMinMax = _this$state.shouldUseMinMax,
          colorRange = _this$state.colorRange,
          maxWeight = _this$state.maxWeight;
      var layerUniforms = {
        minColor: minColor,
        maxColor: maxColor,
        cellScale: cellScale,
        colorRange: colorRange,
        colorDomain: colorDomain,
        shouldUseMinMax: shouldUseMinMax
      };

      if ((0, _luma.isWebGL2)(gl)) {
        maxBuffer.bind({
          target: _constants.default.UNIFORM_BUFFER
        });
      } else {
        layerUniforms.maxWeight = maxWeight;
      }

      uniforms = Object.assign(layerUniforms, uniforms);
      model.draw({
        uniforms: uniforms,
        parameters: Object.assign({
          depthTest: false,
          depthMask: false
        }, parameters)
      });

      if ((0, _luma.isWebGL2)(gl)) {
        maxBuffer.unbind();
      }
    }
  }, {
    key: "calculateInstancePositions",
    value: function calculateInstancePositions(attribute, _ref3) {
      var numInstances = _ref3.numInstances;
      var _this$context$viewpor = this.context.viewport,
          width = _this$context$viewpor.width,
          height = _this$context$viewpor.height;
      var cellSizePixels = this.props.cellSizePixels;
      var numCol = this.state.numCol;
      var value = attribute.value,
          size = attribute.size;

      for (var i = 0; i < numInstances; i++) {
        var x = i % numCol;
        var y = Math.floor(i / numCol);
        value[i * size + 0] = x * cellSizePixels / width * 2 - 1;
        value[i * size + 1] = 1 - y * cellSizePixels / height * 2;
        value[i * size + 2] = 0;
      }
    }
  }, {
    key: "calculateInstanceCounts",
    value: function calculateInstanceCounts(attribute, _ref4) {
      var numInstances = _ref4.numInstances;
      var aggregationBuffer = this.state.aggregationBuffer;
      attribute.update({
        buffer: aggregationBuffer
      });
    }
  }, {
    key: "getPickingInfo",
    value: function getPickingInfo(_ref5) {
      var info = _ref5.info,
          mode = _ref5.mode;
      var index = info.index;

      if (index >= 0) {
        var aggregationResults = this.state.aggregationResults; // Cache aggregationResults to avoid multiple buffer reads.

        aggregationResults.aggregationData = aggregationResults.aggregationData || this.state.aggregationBuffer.getData();
        aggregationResults.maxData = aggregationResults.maxData || this.state.maxBuffer.getData();
        var aggregationData = aggregationResults.aggregationData,
            maxData = aggregationResults.maxData; // Each instance (one cell) is aggregated into single pixel,
        // Get current instance's aggregation details.

        info.object = _core._GPUGridAggregator.getAggregationData({
          aggregationData: aggregationData,
          maxData: maxData,
          pixelIndex: index
        });
      }

      return info;
    } // HELPER Methods

  }, {
    key: "_getAggregationChangeFlags",
    value: function _getAggregationChangeFlags(_ref6) {
      var oldProps = _ref6.oldProps,
          props = _ref6.props,
          changeFlags = _ref6.changeFlags;
      var cellSizeChanged = props.cellSizePixels !== oldProps.cellSizePixels || props.cellMarginPixels !== oldProps.cellMarginPixels;
      var dataChanged = changeFlags.dataChanged || props.aggregation !== oldProps.aggregation;
      var viewportChanged = changeFlags.viewportChanged;

      if (cellSizeChanged || dataChanged || viewportChanged) {
        return {
          cellSizeChanged: cellSizeChanged,
          dataChanged: dataChanged,
          viewportChanged: viewportChanged
        };
      }

      return null;
    }
  }, {
    key: "_getModel",
    value: function _getModel(gl) {
      return new _luma.Model(gl, Object.assign({}, this.getShaders(), {
        id: this.props.id,
        geometry: new _luma.Geometry({
          drawMode: _constants.default.TRIANGLE_FAN,
          attributes: {
            vertices: new Float32Array([0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0])
          }
        }),
        isInstanced: true,
        shaderCache: this.context.shaderCache
      }));
    } // Creates and returns a Uniform Buffer object to hold maxCount value.

  }, {
    key: "_getMaxCountBuffer",
    value: function _getMaxCountBuffer(gl) {
      return new _luma.Buffer(gl, {
        bytes: 4 * 4,
        // Four floats
        size: 4,
        index: AGGREGATION_DATA_UBO_INDEX
      });
    } // Process 'data' and build positions and weights Arrays.

  }, {
    key: "_processData",
    value: function _processData() {
      var _this$props = this.props,
          data = _this$props.data,
          getPosition = _this$props.getPosition,
          getWeight = _this$props.getWeight;
      var pointCount = count(data);
      var positions = new Float64Array(pointCount * 2);
      var colorWeights = new Float32Array(pointCount * 3);
      var weights = this.state.weights;

      var _createIterable = (0, _core.createIterable)(data),
          iterable = _createIterable.iterable,
          objectInfo = _createIterable.objectInfo;

      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = iterable[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var object = _step.value;
          objectInfo.index++;
          var position = getPosition(object, objectInfo);
          var weight = getWeight(object, objectInfo);
          var index = objectInfo.index;
          positions[index * 2] = position[0];
          positions[index * 2 + 1] = position[1];

          if (Array.isArray(weight)) {
            colorWeights[index * 3] = weight[0];
            colorWeights[index * 3 + 1] = weight[1];
            colorWeights[index * 3 + 2] = weight[2];
          } else {
            // backward compitability
            colorWeights[index * 3] = weight;
          }
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return != null) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }

      weights.color.values = colorWeights;
      this.setState({
        positions: positions
      });
    } // Set a binding point for the aggregation uniform block index

  }, {
    key: "_setupUniformBuffer",
    value: function _setupUniformBuffer() {
      var gl = this.context.gl; // For WebGL1, uniform buffer is not used.

      if (!(0, _luma.isWebGL2)(gl)) {
        return;
      }

      var programHandle = this.state.model.program.handle; // TODO: Replace with luma.gl api when ready.

      var uniformBlockIndex = gl.getUniformBlockIndex(programHandle, 'AggregationData');
      gl.uniformBlockBinding(programHandle, uniformBlockIndex, AGGREGATION_DATA_UBO_INDEX);
    }
  }, {
    key: "_shouldUseMinMax",
    value: function _shouldUseMinMax() {
      var _this$props2 = this.props,
          minColor = _this$props2.minColor,
          maxColor = _this$props2.maxColor,
          colorDomain = _this$props2.colorDomain,
          colorRange = _this$props2.colorRange;

      if (minColor || maxColor) {
        _core.log.deprecated('ScreenGridLayer props: minColor and maxColor', 'colorRange, colorDomain')();

        return true;
      } // minColor and maxColor not supplied, check if colorRange or colorDomain supplied.
      // NOTE: colorDomain and colorRange are experimental features, use them only when supplied.


      if (colorDomain || colorRange) {
        return false;
      } // None specified, use default minColor and maxColor


      return true;
    }
  }, {
    key: "_updateAggregation",
    value: function _updateAggregation(changeFlags) {
      var attributeManager = this.getAttributeManager();

      if (changeFlags.cellSizeChanged || changeFlags.viewportChanged) {
        this._updateGridParams();

        attributeManager.invalidateAll();
      }

      var _this$props3 = this.props,
          cellSizePixels = _this$props3.cellSizePixels,
          gpuAggregation = _this$props3.gpuAggregation;
      var _this$state2 = this.state,
          positions = _this$state2.positions,
          weights = _this$state2.weights;
      var viewport = this.context.viewport;
      weights.color.operation = _core.AGGREGATION_OPERATION[this.props.aggregation.toUpperCase()] || _core.AGGREGATION_OPERATION.SUM;
      var projectPoints = false;
      var gridTransformMatrix = null;

      if (this.context.viewport instanceof _core.WebMercatorViewport) {
        // project points from world space (lng/lat) to viewport (screen) space.
        projectPoints = true;
      } else {
        projectPoints = false; // Use pixelProjectionMatrix to transform points to viewport (screen) space.

        gridTransformMatrix = viewport.pixelProjectionMatrix;
      }

      var results = this.state.gpuGridAggregator.run({
        positions: positions,
        weights: weights,
        cellSize: [cellSizePixels, cellSizePixels],
        viewport: viewport,
        changeFlags: changeFlags,
        useGPU: gpuAggregation,
        projectPoints: projectPoints,
        gridTransformMatrix: gridTransformMatrix
      });
      var maxWeight = results.color.maxData && Number.isFinite(results.color.maxData[0]) ? results.color.maxData[0] : 0; // Under WebGL1 results are available in JS Arrays
      // For WebGL2, data is in Buffer objects and will be read on demand (like picking)

      var aggregationResults = {
        aggregationData: results.color.aggregationData,
        maxData: results.color.maxData
      };
      this.setState({
        aggregationResults: aggregationResults,
        maxWeight: maxWeight // uniform to use under WebGL1

      });
      attributeManager.invalidate('instanceCounts');
    }
  }, {
    key: "_updateUniforms",
    value: function _updateUniforms(_ref7) {
      var oldProps = _ref7.oldProps,
          props = _ref7.props,
          changeFlags = _ref7.changeFlags;
      var newState = {};

      if (COLOR_PROPS.some(function (key) {
        return oldProps[key] !== props[key];
      })) {
        newState.shouldUseMinMax = this._shouldUseMinMax();
      }

      if (oldProps.colorRange !== props.colorRange) {
        var colorRangeUniform = [];
        props.colorRange.forEach(function (color) {
          colorRangeUniform.push(color[0], color[1], color[2], color[3] || 255);
        });
        newState.colorRange = colorRangeUniform;
      }

      if (oldProps.cellMarginPixels !== props.cellMarginPixels || oldProps.cellSizePixels !== props.cellSizePixels || changeFlags.viewportChanged) {
        var _this$context$viewpor2 = this.context.viewport,
            width = _this$context$viewpor2.width,
            height = _this$context$viewpor2.height;
        var _this$props4 = this.props,
            cellSizePixels = _this$props4.cellSizePixels,
            cellMarginPixels = _this$props4.cellMarginPixels;
        var margin = cellSizePixels > cellMarginPixels ? cellMarginPixels : 0;
        newState.cellScale = new Float32Array([(cellSizePixels - margin) / width * 2, -(cellSizePixels - margin) / height * 2, 1]);
      }

      this.setState(newState);
    }
  }, {
    key: "_updateGridParams",
    value: function _updateGridParams() {
      var _this$context$viewpor3 = this.context.viewport,
          width = _this$context$viewpor3.width,
          height = _this$context$viewpor3.height;
      var cellSizePixels = this.props.cellSizePixels;
      var gl = this.context.gl;
      var numCol = Math.ceil(width / cellSizePixels);
      var numRow = Math.ceil(height / cellSizePixels);
      var numInstances = numCol * numRow;
      var dataBytes = numInstances * 4 * 4;
      var aggregationBuffer = this.state.aggregationBuffer;

      if (aggregationBuffer) {
        aggregationBuffer.delete();
      }

      aggregationBuffer = new _luma.Buffer(gl, {
        size: 4,
        bytes: dataBytes,
        type: _constants.default.FLOAT,
        instanced: 1
      });
      this.state.weights.color.aggregationBuffer = aggregationBuffer;
      this.setState({
        numCol: numCol,
        numRow: numRow,
        numInstances: numInstances,
        aggregationBuffer: aggregationBuffer
      });
    }
  }]);

  return ScreenGridLayer;
}(_core.Layer);

exports.default = ScreenGridLayer;
ScreenGridLayer.layerName = 'ScreenGridLayer';
ScreenGridLayer.defaultProps = defaultProps;
},{"@deck.gl/core":"Tk4X","luma.gl/constants":"lMsC","luma.gl":"GAQa","./screen-grid-layer-vertex.glsl":"k7BO","./screen-grid-layer-vertex-webgl1.glsl":"UiJN","./screen-grid-layer-fragment.glsl":"zGj7","./screen-grid-layer-fragment-webgl1.glsl":"HVXe"}],"Lot3":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
// Inspired by screen-grid-layer vertex shader in deck.gl
var _default = "#define SHADER_NAME grid-cell-layer-vertex-shader\n\nattribute vec3 positions;\nattribute vec3 normals;\n\nattribute vec3 instancePositions;\nattribute vec2 instancePositions64xyLow;\nattribute float instanceElevations;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\n\n// Custom uniforms\nuniform float extruded;\nuniform float cellSize;\nuniform float coverage;\nuniform float opacity;\nuniform float elevationScale;\n\n// A magic number to scale elevation so that 1 unit approximate to 1 meter\n#define ELEVATION_SCALE 0.8\n\n// Result\nvarying vec4 vColor;\n\nvoid main(void) {\n\n  // if ahpha == 0.0 or z < 0.0, do not render element\n  float noRender = float(instanceColors.a == 0.0 || instanceElevations < 0.0);\n  float finalCellSize = project_scale(cellSize) * mix(1.0, 0.0, noRender);\n\n  float elevation = 0.0;\n\n  if (extruded > 0.5) {\n    elevation = instanceElevations  * (positions.z + 1.0) *\n      ELEVATION_SCALE * elevationScale;\n  }\n\n  // cube geometry vertics are between -1 to 1, scale and transform it to between 0, 1\n  vec3 extrudedPosition = vec3(instancePositions.xy, elevation);\n  vec2 extrudedPosition64xyLow = instancePositions64xyLow;\n  vec3 offset = vec3(\n    (positions.x * coverage + 1.0) / 2.0 * finalCellSize,\n    (positions.y * coverage - 1.0) / 2.0 * finalCellSize,\n    1.0);\n\n  // extrude positions\n  vec4 position_worldspace;\n  gl_Position = project_position_to_clipspace(extrudedPosition, extrudedPosition64xyLow, offset, position_worldspace);\n\n  float lightWeight = 1.0;\n\n  if (extruded > 0.5) {\n    lightWeight = lighting_getLightWeight(\n      position_worldspace.xyz, // the w component is always 1.0\n      normals\n    );\n  }\n\n  vec3 lightWeightedColor = lightWeight * instanceColors.rgb;\n  vec4 color = vec4(lightWeightedColor, instanceColors.a * opacity) / 255.0;\n  vColor = color;\n\n  // Set color to be rendered to picking fbo (also used to check for selection highlight).\n  picking_setPickingColor(instancePickingColors);\n}\n";
exports.default = _default;
},{}],"xA5e":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var _default = "#define SHADER_NAME grid-cell-layer-fragment-shader\n\nprecision highp float;\n\nvarying vec4 vColor;\n\nvoid main(void) {\n  gl_FragColor = vColor;\n\n  // use highlight color if this fragment belongs to the selected object.\n  gl_FragColor = picking_filterHighlightColor(gl_FragColor);\n\n  // use picking color if rendering to picking FBO.\n  gl_FragColor = picking_filterPickingColor(gl_FragColor);\n}\n";
exports.default = _default;
},{}],"GmiV":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _core = require("@deck.gl/core");

var _constants = _interopRequireDefault(require("luma.gl/constants"));

var _luma = require("luma.gl");

var _gridCellLayerVertex = _interopRequireDefault(require("./grid-cell-layer-vertex.glsl"));

var _gridCellLayerFragment = _interopRequireDefault(require("./grid-cell-layer-fragment.glsl"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _get(target, property, receiver) {
  if (typeof Reflect !== "undefined" && Reflect.get) {
    _get = Reflect.get;
  } else {
    _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(target, property, receiver || target);
}

function _superPropBase(object, property) {
  while (!Object.prototype.hasOwnProperty.call(object, property)) {
    object = _getPrototypeOf(object);
    if (object === null) break;
  }

  return object;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.


var fp64LowPart = _luma.fp64.fp64LowPart;
var DEFAULT_COLOR = [255, 0, 255, 255];
var defaultProps = {
  cellSize: {
    type: 'number',
    min: 0,
    max: 1000,
    value: 1000
  },
  coverage: {
    type: 'number',
    min: 0,
    max: 1,
    value: 1
  },
  elevationScale: {
    type: 'number',
    min: 0,
    value: 1
  },
  extruded: true,
  fp64: false,
  getPosition: {
    type: 'accessor',
    value: function value(x) {
      return x.position;
    }
  },
  getElevation: {
    type: 'accessor',
    value: 1000
  },
  getColor: {
    type: 'accessor',
    value: DEFAULT_COLOR
  },
  lightSettings: {}
};

var GridCellLayer =
/*#__PURE__*/
function (_Layer) {
  _inherits(GridCellLayer, _Layer);

  function GridCellLayer() {
    _classCallCheck(this, GridCellLayer);

    return _possibleConstructorReturn(this, _getPrototypeOf(GridCellLayer).apply(this, arguments));
  }

  _createClass(GridCellLayer, [{
    key: "getShaders",

    /**
     * A generic GridLayer that takes latitude longitude delta of cells as a uniform
     * and the min lat lng of cells. grid can be 3d when pass in a height
     * and set enable3d to true
     *
     * @param {array} props.data -
     * @param {boolean} props.extruded - enable grid elevation
     * @param {number} props.cellSize - grid cell size in meters
     * @param {function} props.getPosition - position accessor, returned as [minLng, minLat]
     * @param {function} props.getElevation - elevation accessor
     * @param {function} props.getColor - color accessor, returned as [r, g, b, a]
     */
    value: function getShaders() {
      var projectModule = this.use64bitProjection() ? 'project64' : 'project32';
      return {
        vs: _gridCellLayerVertex.default,
        fs: _gridCellLayerFragment.default,
        modules: [projectModule, 'lighting', 'picking']
      };
    }
  }, {
    key: "initializeState",
    value: function initializeState() {
      var attributeManager = this.getAttributeManager();
      attributeManager.addInstanced({
        instancePositions: {
          size: 3,
          transition: true,
          accessor: 'getPosition'
        },
        instanceElevations: {
          size: 1,
          transition: true,
          accessor: 'getElevation'
        },
        instancePositions64xyLow: {
          size: 2,
          accessor: 'getPosition',
          update: this.calculateInstancePositions64xyLow
        },
        instanceColors: {
          size: 4,
          type: _constants.default.UNSIGNED_BYTE,
          transition: true,
          accessor: 'getColor',
          defaultValue: DEFAULT_COLOR
        }
      });
    }
  }, {
    key: "updateState",
    value: function updateState(_ref) {
      var props = _ref.props,
          oldProps = _ref.oldProps,
          changeFlags = _ref.changeFlags;

      _get(_getPrototypeOf(GridCellLayer.prototype), "updateState", this).call(this, {
        props: props,
        oldProps: oldProps,
        changeFlags: changeFlags
      }); // Re-generate model if geometry changed


      if (props.fp64 !== oldProps.fp64) {
        var gl = this.context.gl;

        if (this.state.model) {
          this.state.model.delete();
        }

        this.setState({
          model: this._getModel(gl)
        });
        this.getAttributeManager().invalidateAll();
      }
    }
  }, {
    key: "_getModel",
    value: function _getModel(gl) {
      return new _luma.Model(gl, Object.assign({}, this.getShaders(), {
        id: this.props.id,
        geometry: new _luma.CubeGeometry(),
        isInstanced: true,
        shaderCache: this.context.shaderCache
      }));
    }
  }, {
    key: "draw",
    value: function draw(_ref2) {
      var uniforms = _ref2.uniforms;
      var _this$props = this.props,
          cellSize = _this$props.cellSize,
          extruded = _this$props.extruded,
          elevationScale = _this$props.elevationScale,
          coverage = _this$props.coverage;
      this.state.model.render(Object.assign({}, uniforms, {
        cellSize: cellSize,
        extruded: extruded,
        elevationScale: elevationScale,
        coverage: coverage
      }));
    }
  }, {
    key: "calculateInstancePositions64xyLow",
    value: function calculateInstancePositions64xyLow(attribute) {
      var isFP64 = this.use64bitPositions();
      attribute.constant = !isFP64;

      if (!isFP64) {
        attribute.value = new Float32Array(2);
        return;
      }

      var _this$props2 = this.props,
          data = _this$props2.data,
          getPosition = _this$props2.getPosition;
      var value = attribute.value;
      var i = 0;
      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = data[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var point = _step.value;
          var position = getPosition(point);
          value[i++] = fp64LowPart(position[0]);
          value[i++] = fp64LowPart(position[1]);
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return != null) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }
    }
  }]);

  return GridCellLayer;
}(_core.Layer);

exports.default = GridCellLayer;
GridCellLayer.layerName = 'GridCellLayer';
GridCellLayer.defaultProps = defaultProps;
},{"@deck.gl/core":"Tk4X","luma.gl/constants":"lMsC","luma.gl":"GAQa","./grid-cell-layer-vertex.glsl":"Lot3","./grid-cell-layer-fragment.glsl":"xA5e"}],"PRrt":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.pointToDensityGridData = pointToDensityGridData;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var R_EARTH = 6378000;
/**
 * Calculate density grid from an array of points
 * @param {Iterable} points
 * @param {number} cellSize - cell size in meters
 * @param {function} getPosition - position accessor
 * @returns {object} - grid data, cell dimension
 */

function pointToDensityGridData(points, cellSize, getPosition) {
  var _pointsToGridHashing2 = _pointsToGridHashing(points, cellSize, getPosition),
      gridHash = _pointsToGridHashing2.gridHash,
      gridOffset = _pointsToGridHashing2.gridOffset;

  var layerData = _getGridLayerDataFromGridHash(gridHash, gridOffset);

  return {
    gridOffset: gridOffset,
    layerData: layerData
  };
}
/**
 * Project points into each cell, return a hash table of cells
 * @param {Iterable} points
 * @param {number} cellSize - unit size in meters
 * @param {function} getPosition - position accessor
 * @returns {object} - grid hash and cell dimension
 */


function _pointsToGridHashing() {
  var points = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  var cellSize = arguments.length > 1 ? arguments[1] : undefined;
  var getPosition = arguments.length > 2 ? arguments[2] : undefined; // find the geometric center of sample points

  var latMin = Infinity;
  var latMax = -Infinity;
  var pLat;
  var _iteratorNormalCompletion = true;
  var _didIteratorError = false;
  var _iteratorError = undefined;

  try {
    for (var _iterator = points[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
      var pt = _step.value;
      pLat = getPosition(pt)[1];

      if (Number.isFinite(pLat)) {
        latMin = pLat < latMin ? pLat : latMin;
        latMax = pLat > latMax ? pLat : latMax;
      }
    }
  } catch (err) {
    _didIteratorError = true;
    _iteratorError = err;
  } finally {
    try {
      if (!_iteratorNormalCompletion && _iterator.return != null) {
        _iterator.return();
      }
    } finally {
      if (_didIteratorError) {
        throw _iteratorError;
      }
    }
  }

  var centerLat = (latMin + latMax) / 2;

  var gridOffset = _calculateGridLatLonOffset(cellSize, centerLat);

  if (gridOffset.xOffset <= 0 || gridOffset.yOffset <= 0) {
    return {
      gridHash: {},
      gridOffset: gridOffset
    };
  } // calculate count per cell


  var gridHash = {};
  var _iteratorNormalCompletion2 = true;
  var _didIteratorError2 = false;
  var _iteratorError2 = undefined;

  try {
    for (var _iterator2 = points[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
      var _pt = _step2.value;
      var lat = getPosition(_pt)[1];
      var lng = getPosition(_pt)[0];

      if (Number.isFinite(lat) && Number.isFinite(lng)) {
        var latIdx = Math.floor((lat + 90) / gridOffset.yOffset);
        var lonIdx = Math.floor((lng + 180) / gridOffset.xOffset);
        var key = "".concat(latIdx, "-").concat(lonIdx);
        gridHash[key] = gridHash[key] || {
          count: 0,
          points: []
        };
        gridHash[key].count += 1;
        gridHash[key].points.push(_pt);
      }
    }
  } catch (err) {
    _didIteratorError2 = true;
    _iteratorError2 = err;
  } finally {
    try {
      if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
        _iterator2.return();
      }
    } finally {
      if (_didIteratorError2) {
        throw _iteratorError2;
      }
    }
  }

  return {
    gridHash: gridHash,
    gridOffset: gridOffset
  };
}

function _getGridLayerDataFromGridHash(gridHash, gridOffset) {
  return Object.keys(gridHash).reduce(function (accu, key, i) {
    var idxs = key.split('-');
    var latIdx = parseInt(idxs[0], 10);
    var lonIdx = parseInt(idxs[1], 10);
    accu.push(Object.assign({
      index: i,
      position: [-180 + gridOffset.xOffset * lonIdx, -90 + gridOffset.yOffset * latIdx]
    }, gridHash[key]));
    return accu;
  }, []);
}
/**
 * calculate grid layer cell size in lat lon based on world unit size
 * and current latitude
 * @param {number} cellSize
 * @param {number} latitude
 * @returns {object} - lat delta and lon delta
 */


function _calculateGridLatLonOffset(cellSize, latitude) {
  var yOffset = _calculateLatOffset(cellSize);

  var xOffset = _calculateLonOffset(latitude, cellSize);

  return {
    yOffset: yOffset,
    xOffset: xOffset
  };
}
/**
 * with a given x-km change, calculate the increment of latitude
 * based on stackoverflow http://stackoverflow.com/questions/7477003
 * @param {number} dy - change in km
 * @return {number} - increment in latitude
 */


function _calculateLatOffset(dy) {
  return dy / R_EARTH * (180 / Math.PI);
}
/**
 * with a given x-km change, and current latitude
 * calculate the increment of longitude
 * based on stackoverflow http://stackoverflow.com/questions/7477003
 * @param {number} lat - latitude of current location (based on city)
 * @param {number} dx - change in km
 * @return {number} - increment in longitude
 */


function _calculateLonOffset(lat, dx) {
  return dx / R_EARTH * (180 / Math.PI) / Math.cos(lat * Math.PI / 180);
}
},{}],"gCd7":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _core = require("@deck.gl/core");

var _gridCellLayer = _interopRequireDefault(require("../grid-cell-layer/grid-cell-layer"));

var _gridAggregator = require("./grid-aggregator");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.


var BinSorter = _core.experimental.BinSorter,
    defaultColorRange = _core.experimental.defaultColorRange,
    getQuantizeScale = _core.experimental.getQuantizeScale,
    getLinearScale = _core.experimental.getLinearScale;

function nop() {}

var defaultProps = {
  // color
  colorDomain: null,
  colorRange: defaultColorRange,
  getColorValue: {
    type: 'accessor',
    value: function value(points) {
      return points.length;
    }
  },
  lowerPercentile: {
    type: 'number',
    min: 0,
    max: 100,
    value: 0
  },
  upperPercentile: {
    type: 'number',
    min: 0,
    max: 100,
    value: 100
  },
  onSetColorDomain: nop,
  // elevation
  elevationDomain: null,
  elevationRange: [0, 1000],
  getElevationValue: {
    type: 'accessor',
    value: function value(points) {
      return points.length;
    }
  },
  elevationLowerPercentile: {
    type: 'number',
    min: 0,
    max: 100,
    value: 0
  },
  elevationUpperPercentile: {
    type: 'number',
    min: 0,
    max: 100,
    value: 100
  },
  elevationScale: 1,
  onSetElevationDomain: nop,
  // grid
  cellSize: {
    type: 'number',
    min: 0,
    max: 1000,
    value: 1000
  },
  coverage: {
    type: 'number',
    min: 0,
    max: 1,
    value: 1
  },
  getPosition: {
    type: 'accessor',
    value: function value(x) {
      return x.position;
    }
  },
  extruded: false,
  fp64: false,
  // Optional settings for 'lighting' shader module
  lightSettings: {}
};

var GridLayer =
/*#__PURE__*/
function (_CompositeLayer) {
  _inherits(GridLayer, _CompositeLayer);

  function GridLayer() {
    _classCallCheck(this, GridLayer);

    return _possibleConstructorReturn(this, _getPrototypeOf(GridLayer).apply(this, arguments));
  }

  _createClass(GridLayer, [{
    key: "initializeState",
    value: function initializeState() {
      this.state = {
        layerData: [],
        sortedColorBins: null,
        sortedElevationBins: null,
        colorValueDomain: null,
        elevationValueDomain: null,
        colorScaleFunc: nop,
        elevationScaleFunc: nop,
        dimensionUpdaters: this.getDimensionUpdaters()
      };
    }
  }, {
    key: "updateState",
    value: function updateState(_ref) {
      var _this = this;

      var oldProps = _ref.oldProps,
          props = _ref.props,
          changeFlags = _ref.changeFlags;
      var reprojectNeeded = this.needsReProjectPoints(oldProps, props, changeFlags);

      if (changeFlags.dataChanged || reprojectNeeded) {
        // project data into hexagons, and get sortedBins
        this.getLayerData();
      } else {
        var dimensionChanges = this.getDimensionChanges(oldProps, props) || [];
        dimensionChanges.forEach(function (f) {
          return typeof f === 'function' && f.apply(_this);
        });
      }
    }
  }, {
    key: "needsReProjectPoints",
    value: function needsReProjectPoints(oldProps, props, changeFlags) {
      return oldProps.cellSize !== props.cellSize || changeFlags.updateTriggersChanged && (changeFlags.updateTriggersChanged.all || changeFlags.updateTriggersChanged.getPosition);
    }
  }, {
    key: "getDimensionUpdaters",
    value: function getDimensionUpdaters() {
      // dimension updaters are sequential,
      // if the first one needs to be called, the 2nd and 3rd one will automatically
      // be called. e.g. if ColorValue needs to be updated, getColorValueDomain and getColorScale
      // will automatically be called
      return {
        getColor: [{
          id: 'value',
          triggers: ['getColorValue'],
          updater: this.getSortedColorBins
        }, {
          id: 'domain',
          triggers: ['lowerPercentile', 'upperPercentile'],
          updater: this.getColorValueDomain
        }, {
          id: 'scaleFunc',
          triggers: ['colorDomain', 'colorRange'],
          updater: this.getColorScale
        }],
        getElevation: [{
          id: 'value',
          triggers: ['getElevationValue'],
          updater: this.getSortedElevationBins
        }, {
          id: 'domain',
          triggers: ['elevationLowerPercentile', 'elevationUpperPercentile'],
          updater: this.getElevationValueDomain
        }, {
          id: 'scaleFunc',
          triggers: ['elevationDomain', 'elevationRange'],
          updater: this.getElevationScale
        }]
      };
    }
  }, {
    key: "getDimensionChanges",
    value: function getDimensionChanges(oldProps, props) {
      var dimensionUpdaters = this.state.dimensionUpdaters;
      var updaters = []; // get dimension to be updated

      for (var dimensionKey in dimensionUpdaters) {
        // return the first triggered updater for each dimension
        var needUpdate = dimensionUpdaters[dimensionKey].find(function (item) {
          return item.triggers.some(function (t) {
            return oldProps[t] !== props[t];
          });
        });

        if (needUpdate) {
          updaters.push(needUpdate.updater);
        }
      }

      return updaters.length ? updaters : null;
    }
  }, {
    key: "getPickingInfo",
    value: function getPickingInfo(_ref2) {
      var info = _ref2.info;
      var _this$state = this.state,
          sortedColorBins = _this$state.sortedColorBins,
          sortedElevationBins = _this$state.sortedElevationBins;
      var isPicked = info.picked && info.index > -1;
      var object = null;

      if (isPicked) {
        var cell = this.state.layerData[info.index];
        var colorValue = sortedColorBins.binMap[cell.index] && sortedColorBins.binMap[cell.index].value;
        var elevationValue = sortedElevationBins.binMap[cell.index] && sortedElevationBins.binMap[cell.index].value;
        object = Object.assign({
          colorValue: colorValue,
          elevationValue: elevationValue
        }, cell);
      } // add bin colorValue and elevationValue to info


      return Object.assign(info, {
        picked: Boolean(object),
        // override object with picked cell
        object: object
      });
    }
  }, {
    key: "getUpdateTriggers",
    value: function getUpdateTriggers() {
      var _this2 = this;

      var dimensionUpdaters = this.state.dimensionUpdaters; // merge all dimension triggers

      var updateTriggers = {};

      var _loop = function _loop(dimensionKey) {
        updateTriggers[dimensionKey] = {};
        var _iteratorNormalCompletion = true;
        var _didIteratorError = false;
        var _iteratorError = undefined;

        try {
          for (var _iterator = dimensionUpdaters[dimensionKey][Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
            var step = _step.value;
            step.triggers.forEach(function (prop) {
              updateTriggers[dimensionKey][prop] = _this2.props[prop];
            });
          }
        } catch (err) {
          _didIteratorError = true;
          _iteratorError = err;
        } finally {
          try {
            if (!_iteratorNormalCompletion && _iterator.return != null) {
              _iterator.return();
            }
          } finally {
            if (_didIteratorError) {
              throw _iteratorError;
            }
          }
        }
      };

      for (var dimensionKey in dimensionUpdaters) {
        _loop(dimensionKey);
      }

      return updateTriggers;
    }
  }, {
    key: "getLayerData",
    value: function getLayerData() {
      var _this$props = this.props,
          data = _this$props.data,
          cellSize = _this$props.cellSize,
          getPosition = _this$props.getPosition;

      var _pointToDensityGridDa = (0, _gridAggregator.pointToDensityGridData)(data, cellSize, getPosition),
          layerData = _pointToDensityGridDa.layerData;

      this.setState({
        layerData: layerData
      });
      this.getSortedBins();
    }
  }, {
    key: "getValueDomain",
    value: function getValueDomain() {
      this.getColorValueDomain();
      this.getElevationValueDomain();
    }
  }, {
    key: "getSortedBins",
    value: function getSortedBins() {
      this.getSortedColorBins();
      this.getSortedElevationBins();
    }
  }, {
    key: "getSortedColorBins",
    value: function getSortedColorBins() {
      var getColorValue = this.props.getColorValue;
      var sortedColorBins = new BinSorter(this.state.layerData || [], getColorValue);
      this.setState({
        sortedColorBins: sortedColorBins
      });
      this.getColorValueDomain();
    }
  }, {
    key: "getSortedElevationBins",
    value: function getSortedElevationBins() {
      var getElevationValue = this.props.getElevationValue;
      var sortedElevationBins = new BinSorter(this.state.layerData || [], getElevationValue);
      this.setState({
        sortedElevationBins: sortedElevationBins
      });
      this.getElevationValueDomain();
    }
  }, {
    key: "getColorValueDomain",
    value: function getColorValueDomain() {
      var _this$props2 = this.props,
          lowerPercentile = _this$props2.lowerPercentile,
          upperPercentile = _this$props2.upperPercentile,
          onSetColorDomain = _this$props2.onSetColorDomain;
      this.state.colorValueDomain = this.state.sortedColorBins.getValueRange([lowerPercentile, upperPercentile]);

      if (typeof onSetColorDomain === 'function') {
        onSetColorDomain(this.state.colorValueDomain);
      }

      this.getColorScale();
    }
  }, {
    key: "getElevationValueDomain",
    value: function getElevationValueDomain() {
      var _this$props3 = this.props,
          elevationLowerPercentile = _this$props3.elevationLowerPercentile,
          elevationUpperPercentile = _this$props3.elevationUpperPercentile,
          onSetElevationDomain = _this$props3.onSetElevationDomain;
      this.state.elevationValueDomain = this.state.sortedElevationBins.getValueRange([elevationLowerPercentile, elevationUpperPercentile]);

      if (typeof onSetElevationDomain === 'function') {
        onSetElevationDomain(this.state.elevationValueDomain);
      }

      this.getElevationScale();
    }
  }, {
    key: "getColorScale",
    value: function getColorScale() {
      var colorRange = this.props.colorRange;
      var colorDomain = this.props.colorDomain || this.state.colorValueDomain;
      this.state.colorScaleFunc = getQuantizeScale(colorDomain, colorRange);
    }
  }, {
    key: "getElevationScale",
    value: function getElevationScale() {
      var elevationRange = this.props.elevationRange;
      var elevationDomain = this.props.elevationDomain || this.state.elevationValueDomain;
      this.state.elevationScaleFunc = getLinearScale(elevationDomain, elevationRange);
    }
  }, {
    key: "_onGetSublayerColor",
    value: function _onGetSublayerColor(cell) {
      var _this$state2 = this.state,
          sortedColorBins = _this$state2.sortedColorBins,
          colorScaleFunc = _this$state2.colorScaleFunc,
          colorValueDomain = _this$state2.colorValueDomain;
      var cv = sortedColorBins.binMap[cell.index] && sortedColorBins.binMap[cell.index].value;
      var colorDomain = this.props.colorDomain || colorValueDomain;
      var isColorValueInDomain = cv >= colorDomain[0] && cv <= colorDomain[colorDomain.length - 1]; // if cell value is outside domain, set alpha to 0

      var color = isColorValueInDomain ? colorScaleFunc(cv) : [0, 0, 0, 0]; // add alpha to color if not defined in colorRange

      color[3] = Number.isFinite(color[3]) ? color[3] : 255;
      return color;
    }
  }, {
    key: "_onGetSublayerElevation",
    value: function _onGetSublayerElevation(cell) {
      var _this$state3 = this.state,
          sortedElevationBins = _this$state3.sortedElevationBins,
          elevationScaleFunc = _this$state3.elevationScaleFunc,
          elevationValueDomain = _this$state3.elevationValueDomain;
      var ev = sortedElevationBins.binMap[cell.index] && sortedElevationBins.binMap[cell.index].value;
      var elevationDomain = this.props.elevationDomain || elevationValueDomain;
      var isElevationValueInDomain = ev >= elevationDomain[0] && ev <= elevationDomain[elevationDomain.length - 1]; // if cell value is outside domain, set elevation to -1

      return isElevationValueInDomain ? elevationScaleFunc(ev) : -1;
    }
  }, {
    key: "renderLayers",
    value: function renderLayers() {
      var _this$props4 = this.props,
          elevationScale = _this$props4.elevationScale,
          fp64 = _this$props4.fp64,
          extruded = _this$props4.extruded,
          cellSize = _this$props4.cellSize,
          coverage = _this$props4.coverage,
          lightSettings = _this$props4.lightSettings,
          transitions = _this$props4.transitions;
      var SubLayerClass = this.getSubLayerClass('grid-cell', _gridCellLayer.default);
      return new SubLayerClass({
        fp64: fp64,
        cellSize: cellSize,
        coverage: coverage,
        lightSettings: lightSettings,
        elevationScale: elevationScale,
        extruded: extruded,
        getColor: this._onGetSublayerColor.bind(this),
        getElevation: this._onGetSublayerElevation.bind(this),
        transitions: transitions && {
          getColor: transitions.getColorValue,
          getElevation: transitions.getElevationValue
        }
      }, this.getSubLayerProps({
        id: 'grid-cell',
        updateTriggers: this.getUpdateTriggers()
      }), {
        data: this.state.layerData
      });
    }
  }]);

  return GridLayer;
}(_core.CompositeLayer);

exports.default = GridLayer;
GridLayer.layerName = 'GridLayer';
GridLayer.defaultProps = defaultProps;
},{"@deck.gl/core":"Tk4X","../grid-cell-layer/grid-cell-layer":"GmiV","./grid-aggregator":"PRrt"}],"MqzW":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var _default = "\n#define SHADER_NAME hexagon-cell-layer-vertex-shader\n\nattribute vec3 positions;\nattribute vec3 normals;\n\nattribute vec2 instancePositions;\nattribute float instanceElevations;\nattribute vec2 instancePositions64xyLow;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\n\n// Custom uniforms\nuniform float opacity;\nuniform float radius;\nuniform float angle;\nuniform float extruded;\nuniform float coverage;\nuniform float elevationScale;\n\n// Result\nvarying vec4 vColor;\n\n// A magic number to scale elevation so that 1 unit approximate to 1 meter.\n#define ELEVATION_SCALE 0.8\n\nvoid main(void) {\n\n  // rotate primitive position and normal\n  mat2 rotationMatrix = mat2(cos(angle), sin(angle), -sin(angle), cos(angle));\n\n  // calculate elevation, if 3d not enabled set to 0\n  // cylindar gemoetry height are between -0.5 to 0.5, transform it to between 0, 1\n  float elevation = 0.0;\n\n  if (extruded > 0.5) {\n    elevation = instanceElevations * (positions.z + 0.5) *\n      ELEVATION_SCALE * elevationScale;\n  }\n\n  // if ahpha == 0.0 or z < 0.0, do not render element\n  float noRender = float(instanceColors.a == 0.0 || instanceElevations < 0.0);\n  float dotRadius = project_scale(radius) * mix(coverage, 0.0, noRender);\n\n  // project center of hexagon\n  vec3 centroidPosition = vec3(instancePositions, elevation);\n  vec2 centroidPosition64xyLow = instancePositions64xyLow;\n  vec3 offset = vec3(rotationMatrix * positions.xy * dotRadius, 0.);\n\n  vec4 position_worldspace;\n  gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64xyLow, offset, position_worldspace);\n\n  // Light calculations\n  // Worldspace is the linear space after Mercator projection\n\n  vec3 normals_worldspace = vec3(rotationMatrix * normals.xy, normals.z);\n\n  float lightWeight = 1.0;\n\n  if (extruded > 0.5) {\n    lightWeight = lighting_getLightWeight(\n      position_worldspace.xyz, // the w component is always 1.0\n      normals_worldspace\n    );\n  }\n\n  vec3 lightWeightedColor = lightWeight * instanceColors.rgb;\n\n  // opacity-multiplied instance color\n  vColor = vec4(lightWeightedColor, opacity * instanceColors.a) / 255.0;\n\n  // Set color to be rendered to picking fbo (also used to check for selection highlight).\n  picking_setPickingColor(instancePickingColors);\n}\n";
exports.default = _default;
},{}],"PtdY":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var _default = "#define SHADER_NAME hexagon-cell-layer-fragment-shader\n\nprecision highp float;\n\nvarying vec4 vColor;\n\nvoid main(void) {\n  gl_FragColor = vColor;\n\n  // use highlight color if this fragment belongs to the selected object.\n  gl_FragColor = picking_filterHighlightColor(gl_FragColor);\n\n  // use picking color if rendering to picking FBO.\n  gl_FragColor = picking_filterPickingColor(gl_FragColor);\n}\n";
exports.default = _default;
},{}],"XDGA":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _core = require("@deck.gl/core");

var _constants = _interopRequireDefault(require("luma.gl/constants"));

var _luma = require("luma.gl");

var _hexagonCellLayerVertex = _interopRequireDefault(require("./hexagon-cell-layer-vertex.glsl"));

var _hexagonCellLayerFragment = _interopRequireDefault(require("./hexagon-cell-layer-fragment.glsl"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _get(target, property, receiver) {
  if (typeof Reflect !== "undefined" && Reflect.get) {
    _get = Reflect.get;
  } else {
    _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(target, property, receiver || target);
}

function _superPropBase(object, property) {
  while (!Object.prototype.hasOwnProperty.call(object, property)) {
    object = _getPrototypeOf(object);
    if (object === null) break;
  }

  return object;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.


var fp64LowPart = _luma.fp64.fp64LowPart;
var DEFAULT_COLOR = [255, 0, 255, 255];
var defaultProps = {
  hexagonVertices: null,
  radius: {
    type: 'number',
    min: 0,
    value: 1000
  },
  angle: {
    type: 'number',
    value: 0
  },
  coverage: {
    type: 'number',
    min: 0,
    max: 1,
    value: 1
  },
  elevationScale: {
    type: 'number',
    min: 0,
    value: 1
  },
  extruded: true,
  fp64: false,
  getCentroid: {
    type: 'accessor',
    value: function value(x) {
      return x.centroid;
    }
  },
  getColor: {
    type: 'accessor',
    value: DEFAULT_COLOR
  },
  getElevation: {
    type: 'accessor',
    value: 1000
  },
  lightSettings: {}
};

var HexagonCellLayer =
/*#__PURE__*/
function (_Layer) {
  _inherits(HexagonCellLayer, _Layer);

  function HexagonCellLayer() {
    _classCallCheck(this, HexagonCellLayer);

    return _possibleConstructorReturn(this, _getPrototypeOf(HexagonCellLayer).apply(this, arguments));
  }

  _createClass(HexagonCellLayer, [{
    key: "getShaders",
    value: function getShaders() {
      var projectModule = this.use64bitProjection() ? 'project64' : 'project32';
      return {
        vs: _hexagonCellLayerVertex.default,
        fs: _hexagonCellLayerFragment.default,
        modules: [projectModule, 'lighting', 'picking']
      };
    }
    /**
     * DeckGL calls initializeState when GL context is available
     * Essentially a deferred constructor
     */

  }, {
    key: "initializeState",
    value: function initializeState() {
      var attributeManager = this.getAttributeManager();
      /* eslint-disable max-len */

      attributeManager.addInstanced({
        instancePositions: {
          size: 2,
          transition: true,
          accessor: 'getCentroid'
        },
        instanceElevations: {
          size: 1,
          transition: true,
          accessor: 'getElevation'
        },
        instancePositions64xyLow: {
          size: 2,
          accessor: 'getCentroid',
          update: this.calculateInstancePositions64xyLow
        },
        instanceColors: {
          size: 4,
          type: _constants.default.UNSIGNED_BYTE,
          transition: true,
          accessor: 'getColor',
          defaultValue: DEFAULT_COLOR
        }
      });
      /* eslint-enable max-len */
    }
  }, {
    key: "updateState",
    value: function updateState(_ref) {
      var props = _ref.props,
          oldProps = _ref.oldProps,
          changeFlags = _ref.changeFlags;

      _get(_getPrototypeOf(HexagonCellLayer.prototype), "updateState", this).call(this, {
        props: props,
        oldProps: oldProps,
        changeFlags: changeFlags
      });

      if (props.fp64 !== oldProps.fp64) {
        var gl = this.context.gl;

        if (this.state.model) {
          this.state.model.delete();
        }

        this.setState({
          model: this._getModel(gl)
        });
        this.getAttributeManager().invalidateAll();
      }

      if (props.hexagonVertices !== oldProps.hexagonVertices || props.radius !== oldProps.radius || props.angle !== oldProps.angle) {
        this.updateRadiusAngle();
      }
    }
  }, {
    key: "updateRadiusAngle",
    value: function updateRadiusAngle() {
      var _this$props = this.props,
          angle = _this$props.angle,
          radius = _this$props.radius;
      var hexagonVertices = this.props.hexagonVertices;

      if (Array.isArray(hexagonVertices)) {
        if (hexagonVertices.length < 6) {
          _core.log.error('HexagonCellLayer: hexagonVertices needs to be an array of 6 points')();
        } // calculate angle and vertices from hexagonVertices if provided


        var vertices = this.props.hexagonVertices;
        var vertex0 = vertices[0];
        var vertex3 = vertices[3]; // transform to space coordinates

        var viewport = this.context.viewport;

        var _viewport$getDistance = viewport.getDistanceScales(),
            pixelsPerMeter = _viewport$getDistance.pixelsPerMeter;

        var spaceCoord0 = this.projectFlat(vertex0);
        var spaceCoord3 = this.projectFlat(vertex3); // distance between two close centroids

        var dx = spaceCoord0[0] - spaceCoord3[0];
        var dy = spaceCoord0[1] - spaceCoord3[1];
        var dxy = Math.sqrt(dx * dx + dy * dy); // Calculate angle that the perpendicular hexagon vertex axis is tilted

        angle = Math.acos(dx / dxy) * -Math.sign(dy) + Math.PI / 2;
        radius = dxy / 2 / pixelsPerMeter[0];
      }

      this.setState({
        angle: angle,
        radius: radius
      });
    }
  }, {
    key: "getCylinderGeometry",
    value: function getCylinderGeometry(radius) {
      return new _luma.CylinderGeometry({
        radius: radius,
        topRadius: radius,
        bottomRadius: radius,
        topCap: true,
        bottomCap: true,
        height: 1,
        verticalAxis: 'z',
        nradial: 6,
        nvertical: 1
      });
    }
  }, {
    key: "_getModel",
    value: function _getModel(gl) {
      return new _luma.Model(gl, Object.assign({}, this.getShaders(), {
        id: this.props.id,
        geometry: this.getCylinderGeometry(1),
        isInstanced: true,
        shaderCache: this.context.shaderCache
      }));
    }
  }, {
    key: "draw",
    value: function draw(_ref2) {
      var uniforms = _ref2.uniforms;
      var _this$props2 = this.props,
          elevationScale = _this$props2.elevationScale,
          extruded = _this$props2.extruded,
          coverage = _this$props2.coverage;
      var _this$state = this.state,
          radius = _this$state.radius,
          angle = _this$state.angle;
      this.state.model.render(Object.assign({}, uniforms, {
        radius: radius,
        angle: angle,
        extruded: extruded,
        coverage: coverage,
        elevationScale: elevationScale
      }));
    }
  }, {
    key: "calculateInstancePositions64xyLow",
    value: function calculateInstancePositions64xyLow(attribute) {
      var isFP64 = this.use64bitPositions();
      attribute.constant = !isFP64;

      if (!isFP64) {
        attribute.value = new Float32Array(2);
        return;
      }

      var _this$props3 = this.props,
          data = _this$props3.data,
          getCentroid = _this$props3.getCentroid;
      var value = attribute.value;
      var i = 0;
      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = data[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var object = _step.value;
          var position = getCentroid(object);
          value[i++] = fp64LowPart(position[0]);
          value[i++] = fp64LowPart(position[1]);
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return != null) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }
    }
  }]);

  return HexagonCellLayer;
}(_core.Layer);

exports.default = HexagonCellLayer;
HexagonCellLayer.layerName = 'HexagonCellLayer';
HexagonCellLayer.defaultProps = defaultProps;
},{"@deck.gl/core":"Tk4X","luma.gl/constants":"lMsC","luma.gl":"GAQa","./hexagon-cell-layer-vertex.glsl":"MqzW","./hexagon-cell-layer-fragment.glsl":"PtdY"}],"Lmbp":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
var thirdPi = Math.PI / 3,
    angles = [0, thirdPi, 2 * thirdPi, 3 * thirdPi, 4 * thirdPi, 5 * thirdPi];

function pointX(d) {
  return d[0];
}

function pointY(d) {
  return d[1];
}

function _default() {
  var x0 = 0,
      y0 = 0,
      x1 = 1,
      y1 = 1,
      x = pointX,
      y = pointY,
      r,
      dx,
      dy;

  function hexbin(points) {
    var binsById = {},
        bins = [],
        i,
        n = points.length;

    for (i = 0; i < n; ++i) {
      if (isNaN(px = +x.call(null, point = points[i], i, points)) || isNaN(py = +y.call(null, point, i, points))) continue;
      var point,
          px,
          py,
          pj = Math.round(py = py / dy),
          pi = Math.round(px = px / dx - (pj & 1) / 2),
          py1 = py - pj;

      if (Math.abs(py1) * 3 > 1) {
        var px1 = px - pi,
            pi2 = pi + (px < pi ? -1 : 1) / 2,
            pj2 = pj + (py < pj ? -1 : 1),
            px2 = px - pi2,
            py2 = py - pj2;
        if (px1 * px1 + py1 * py1 > px2 * px2 + py2 * py2) pi = pi2 + (pj & 1 ? 1 : -1) / 2, pj = pj2;
      }

      var id = pi + "-" + pj,
          bin = binsById[id];
      if (bin) bin.push(point);else {
        bins.push(bin = binsById[id] = [point]);
        bin.x = (pi + (pj & 1) / 2) * dx;
        bin.y = pj * dy;
      }
    }

    return bins;
  }

  function hexagon(radius) {
    var x0 = 0,
        y0 = 0;
    return angles.map(function (angle) {
      var x1 = Math.sin(angle) * radius,
          y1 = -Math.cos(angle) * radius,
          dx = x1 - x0,
          dy = y1 - y0;
      x0 = x1, y0 = y1;
      return [dx, dy];
    });
  }

  hexbin.hexagon = function (radius) {
    return "m" + hexagon(radius == null ? r : +radius).join("l") + "z";
  };

  hexbin.centers = function () {
    var centers = [],
        j = Math.round(y0 / dy),
        i = Math.round(x0 / dx);

    for (var y = j * dy; y < y1 + r; y += dy, ++j) {
      for (var x = i * dx + (j & 1) * dx / 2; x < x1 + dx / 2; x += dx) {
        centers.push([x, y]);
      }
    }

    return centers;
  };

  hexbin.mesh = function () {
    var fragment = hexagon(r).slice(0, 4).join("l");
    return hexbin.centers().map(function (p) {
      return "M" + p + "m" + fragment;
    }).join("");
  };

  hexbin.x = function (_) {
    return arguments.length ? (x = _, hexbin) : x;
  };

  hexbin.y = function (_) {
    return arguments.length ? (y = _, hexbin) : y;
  };

  hexbin.radius = function (_) {
    return arguments.length ? (r = +_, dx = r * 2 * Math.sin(thirdPi), dy = r * 1.5, hexbin) : r;
  };

  hexbin.size = function (_) {
    return arguments.length ? (x0 = y0 = 0, x1 = +_[0], y1 = +_[1], hexbin) : [x1 - x0, y1 - y0];
  };

  hexbin.extent = function (_) {
    return arguments.length ? (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1], hexbin) : [[x0, y0], [x1, y1]];
  };

  return hexbin.radius(1);
}
},{}],"IuuC":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "hexbin", {
  enumerable: true,
  get: function () {
    return _hexbin.default;
  }
});

var _hexbin = _interopRequireDefault(require("./src/hexbin"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./src/hexbin":"Lmbp"}],"ID8n":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.pointToHexbin = pointToHexbin;
exports.getRadiusInPixel = getRadiusInPixel;

var _d3Hexbin = require("d3-hexbin");

// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.

/**
 * Use d3-hexbin to performs hexagonal binning from geo points to hexagons
 * @param {Iterable} data - array of points
 * @param {Number} radius - hexagon radius in meter
 * @param {function} getPosition - get points lon lat
 * @param {Object} viewport - current viewport object

 * @return {Object} - hexagons and countRange
 */
function pointToHexbin(_ref, viewport) {
  var data = _ref.data,
      radius = _ref.radius,
      getPosition = _ref.getPosition; // get hexagon radius in mercator world unit

  var radiusInPixel = getRadiusInPixel(radius, viewport); // add world space coordinates to points

  var screenPoints = [];
  var _iteratorNormalCompletion = true;
  var _didIteratorError = false;
  var _iteratorError = undefined;

  try {
    for (var _iterator = data[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
      var pt = _step.value;
      screenPoints.push(Object.assign({
        screenCoord: viewport.projectFlat(getPosition(pt))
      }, pt));
    }
  } catch (err) {
    _didIteratorError = true;
    _iteratorError = err;
  } finally {
    try {
      if (!_iteratorNormalCompletion && _iterator.return != null) {
        _iterator.return();
      }
    } finally {
      if (_didIteratorError) {
        throw _iteratorError;
      }
    }
  }

  var newHexbin = (0, _d3Hexbin.hexbin)().radius(radiusInPixel).x(function (d) {
    return d.screenCoord[0];
  }).y(function (d) {
    return d.screenCoord[1];
  });
  var hexagonBins = newHexbin(screenPoints);
  return {
    hexagons: hexagonBins.map(function (hex, index) {
      return {
        centroid: viewport.unprojectFlat([hex.x, hex.y]),
        points: hex,
        index: index
      };
    })
  };
}
/**
 * Get radius in mercator world space coordinates from meter
 * @param {Number} radius - in meter
 * @param {Object} viewport - current viewport object

 * @return {Number} radius in mercator world spcae coordinates
 */


function getRadiusInPixel(radius, viewport) {
  var _viewport$getDistance = viewport.getDistanceScales(),
      pixelsPerMeter = _viewport$getDistance.pixelsPerMeter; // x, y distance should be the same


  return radius * pixelsPerMeter[0];
}
},{"d3-hexbin":"IuuC"}],"I7RZ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _core = require("@deck.gl/core");

var _hexagonCellLayer = _interopRequireDefault(require("../hexagon-cell-layer/hexagon-cell-layer"));

var _hexagonAggregator2 = require("./hexagon-aggregator");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.


var BinSorter = _core.experimental.BinSorter,
    getQuantizeScale = _core.experimental.getQuantizeScale,
    getLinearScale = _core.experimental.getLinearScale,
    defaultColorRange = _core.experimental.defaultColorRange;

function nop() {}

var defaultProps = {
  // color
  colorDomain: null,
  colorRange: defaultColorRange,
  getColorValue: {
    type: 'accessor',
    value: function value(points) {
      return points.length;
    }
  },
  lowerPercentile: {
    type: 'number',
    value: 0,
    min: 0,
    max: 100
  },
  upperPercentile: {
    type: 'number',
    value: 100,
    min: 0,
    max: 100
  },
  onSetColorDomain: nop,
  // elevation
  elevationDomain: null,
  elevationRange: [0, 1000],
  getElevationValue: {
    type: 'accessor',
    value: function value(points) {
      return points.length;
    }
  },
  elevationLowerPercentile: {
    type: 'number',
    value: 0,
    min: 0,
    max: 100
  },
  elevationUpperPercentile: {
    type: 'number',
    value: 100,
    min: 0,
    max: 100
  },
  elevationScale: {
    type: 'number',
    min: 0,
    value: 1
  },
  onSetElevationDomain: nop,
  radius: {
    type: 'number',
    value: 1000,
    min: 1
  },
  coverage: {
    type: 'number',
    min: 0,
    max: 1,
    value: 1
  },
  extruded: false,
  hexagonAggregator: _hexagonAggregator2.pointToHexbin,
  getPosition: {
    type: 'accessor',
    value: function value(x) {
      return x.position;
    }
  },
  fp64: false,
  // Optional settings for 'lighting' shader module
  lightSettings: {}
};

var HexagonLayer =
/*#__PURE__*/
function (_CompositeLayer) {
  _inherits(HexagonLayer, _CompositeLayer);

  function HexagonLayer() {
    _classCallCheck(this, HexagonLayer);

    return _possibleConstructorReturn(this, _getPrototypeOf(HexagonLayer).apply(this, arguments));
  }

  _createClass(HexagonLayer, [{
    key: "initializeState",
    value: function initializeState() {
      this.state = {
        hexagons: [],
        hexagonVertices: null,
        sortedColorBins: null,
        sortedElevationBins: null,
        colorValueDomain: null,
        elevationValueDomain: null,
        colorScaleFunc: nop,
        elevationScaleFunc: nop,
        dimensionUpdaters: this.getDimensionUpdaters()
      };
    }
  }, {
    key: "updateState",
    value: function updateState(_ref) {
      var _this = this;

      var oldProps = _ref.oldProps,
          props = _ref.props,
          changeFlags = _ref.changeFlags;
      var dimensionChanges = this.getDimensionChanges(oldProps, props);

      if (changeFlags.dataChanged || this.needsReProjectPoints(oldProps, props)) {
        // project data into hexagons, and get sortedColorBins
        this.getHexagons();
      } else if (dimensionChanges) {
        dimensionChanges.forEach(function (f) {
          return typeof f === 'function' && f.apply(_this);
        });
      }
    }
  }, {
    key: "needsReProjectPoints",
    value: function needsReProjectPoints(oldProps, props) {
      return oldProps.radius !== props.radius || oldProps.hexagonAggregator !== props.hexagonAggregator;
    }
  }, {
    key: "getDimensionUpdaters",
    value: function getDimensionUpdaters() {
      // dimension updaters are sequential,
      // if the first one needs to be called, the 2nd and 3rd one will automatically
      // be called. e.g. if ColorValue needs to be updated, getColorValueDomain and getColorScale
      // will automatically be called
      return {
        getColor: [{
          id: 'value',
          triggers: ['getColorValue'],
          updater: this.getSortedColorBins
        }, {
          id: 'domain',
          triggers: ['lowerPercentile', 'upperPercentile'],
          updater: this.getColorValueDomain
        }, {
          id: 'scaleFunc',
          triggers: ['colorDomain', 'colorRange'],
          updater: this.getColorScale
        }],
        getElevation: [{
          id: 'value',
          triggers: ['getElevationValue'],
          updater: this.getSortedElevationBins
        }, {
          id: 'domain',
          triggers: ['elevationLowerPercentile', 'elevationUpperPercentile'],
          updater: this.getElevationValueDomain
        }, {
          id: 'scaleFunc',
          triggers: ['elevationDomain', 'elevationRange'],
          updater: this.getElevationScale
        }]
      };
    }
  }, {
    key: "getDimensionChanges",
    value: function getDimensionChanges(oldProps, props) {
      var dimensionUpdaters = this.state.dimensionUpdaters;
      var updaters = []; // get dimension to be updated

      for (var dimensionKey in dimensionUpdaters) {
        // return the first triggered updater for each dimension
        var needUpdate = dimensionUpdaters[dimensionKey].find(function (item) {
          return item.triggers.some(function (t) {
            return oldProps[t] !== props[t];
          });
        });

        if (needUpdate) {
          updaters.push(needUpdate.updater);
        }
      }

      return updaters.length ? updaters : null;
    }
  }, {
    key: "getHexagons",
    value: function getHexagons() {
      var hexagonAggregator = this.props.hexagonAggregator;
      var viewport = this.context.viewport;

      var _hexagonAggregator = hexagonAggregator(this.props, viewport),
          hexagons = _hexagonAggregator.hexagons,
          hexagonVertices = _hexagonAggregator.hexagonVertices;

      this.setState({
        hexagons: hexagons,
        hexagonVertices: hexagonVertices
      });
      this.getSortedBins();
    }
  }, {
    key: "getPickingInfo",
    value: function getPickingInfo(_ref2) {
      var info = _ref2.info;
      var _this$state = this.state,
          sortedColorBins = _this$state.sortedColorBins,
          sortedElevationBins = _this$state.sortedElevationBins;
      var isPicked = info.picked && info.index > -1;
      var object = null;

      if (isPicked) {
        var cell = this.state.hexagons[info.index];
        var colorValue = sortedColorBins.binMap[cell.index] && sortedColorBins.binMap[cell.index].value;
        var elevationValue = sortedElevationBins.binMap[cell.index] && sortedElevationBins.binMap[cell.index].value;
        object = Object.assign({
          colorValue: colorValue,
          elevationValue: elevationValue
        }, cell);
      } // add bin colorValue and elevationValue to info


      return Object.assign(info, {
        picked: Boolean(object),
        // override object with picked cell
        object: object
      });
    }
  }, {
    key: "getUpdateTriggers",
    value: function getUpdateTriggers() {
      var _this2 = this;

      var dimensionUpdaters = this.state.dimensionUpdaters; // merge all dimension triggers

      var updateTriggers = {};

      var _loop = function _loop(dimensionKey) {
        updateTriggers[dimensionKey] = {};
        var _iteratorNormalCompletion = true;
        var _didIteratorError = false;
        var _iteratorError = undefined;

        try {
          for (var _iterator = dimensionUpdaters[dimensionKey][Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
            var step = _step.value;
            step.triggers.forEach(function (prop) {
              updateTriggers[dimensionKey][prop] = _this2.props[prop];
            });
          }
        } catch (err) {
          _didIteratorError = true;
          _iteratorError = err;
        } finally {
          try {
            if (!_iteratorNormalCompletion && _iterator.return != null) {
              _iterator.return();
            }
          } finally {
            if (_didIteratorError) {
              throw _iteratorError;
            }
          }
        }
      };

      for (var dimensionKey in dimensionUpdaters) {
        _loop(dimensionKey);
      }

      return updateTriggers;
    }
  }, {
    key: "getValueDomain",
    value: function getValueDomain() {
      this.getColorValueDomain();
      this.getElevationValueDomain();
    }
  }, {
    key: "getSortedBins",
    value: function getSortedBins() {
      this.getSortedColorBins();
      this.getSortedElevationBins();
    }
  }, {
    key: "getSortedColorBins",
    value: function getSortedColorBins() {
      var getColorValue = this.props.getColorValue;
      var sortedColorBins = new BinSorter(this.state.hexagons || [], getColorValue);
      this.setState({
        sortedColorBins: sortedColorBins
      });
      this.getColorValueDomain();
    }
  }, {
    key: "getSortedElevationBins",
    value: function getSortedElevationBins() {
      var getElevationValue = this.props.getElevationValue;
      var sortedElevationBins = new BinSorter(this.state.hexagons || [], getElevationValue);
      this.setState({
        sortedElevationBins: sortedElevationBins
      });
      this.getElevationValueDomain();
    }
  }, {
    key: "getColorValueDomain",
    value: function getColorValueDomain() {
      var _this$props = this.props,
          lowerPercentile = _this$props.lowerPercentile,
          upperPercentile = _this$props.upperPercentile,
          onSetColorDomain = _this$props.onSetColorDomain;

      if (lowerPercentile > upperPercentile) {
        _core.log.warn('HexagonLayer: lowerPercentile is bigger than upperPercentile')();
      }

      this.state.colorValueDomain = this.state.sortedColorBins.getValueRange([lowerPercentile, upperPercentile]);

      if (typeof onSetColorDomain === 'function') {
        onSetColorDomain(this.state.colorValueDomain);
      }

      this.getColorScale();
    }
  }, {
    key: "getElevationValueDomain",
    value: function getElevationValueDomain() {
      var _this$props2 = this.props,
          elevationLowerPercentile = _this$props2.elevationLowerPercentile,
          elevationUpperPercentile = _this$props2.elevationUpperPercentile,
          onSetElevationDomain = _this$props2.onSetElevationDomain;
      this.state.elevationValueDomain = this.state.sortedElevationBins.getValueRange([elevationLowerPercentile, elevationUpperPercentile]);

      if (typeof onSetElevationDomain === 'function') {
        onSetElevationDomain(this.state.elevationValueDomain);
      }

      this.getElevationScale();
    }
  }, {
    key: "getColorScale",
    value: function getColorScale() {
      var colorRange = this.props.colorRange;
      var colorDomain = this.props.colorDomain || this.state.colorValueDomain;
      this.state.colorScaleFunc = getQuantizeScale(colorDomain, colorRange);
    }
  }, {
    key: "getElevationScale",
    value: function getElevationScale() {
      var elevationRange = this.props.elevationRange;
      var elevationDomain = this.props.elevationDomain || this.state.elevationValueDomain;
      this.state.elevationScaleFunc = getLinearScale(elevationDomain, elevationRange);
    }
  }, {
    key: "_onGetSublayerColor",
    value: function _onGetSublayerColor(cell) {
      var _this$state2 = this.state,
          sortedColorBins = _this$state2.sortedColorBins,
          colorScaleFunc = _this$state2.colorScaleFunc,
          colorValueDomain = _this$state2.colorValueDomain;
      var cv = sortedColorBins.binMap[cell.index] && sortedColorBins.binMap[cell.index].value;
      var colorDomain = this.props.colorDomain || colorValueDomain;
      var isColorValueInDomain = cv >= colorDomain[0] && cv <= colorDomain[colorDomain.length - 1]; // if cell value is outside domain, set alpha to 0

      var color = isColorValueInDomain ? colorScaleFunc(cv) : [0, 0, 0, 0]; // add alpha to color if not defined in colorRange

      color[3] = Number.isFinite(color[3]) ? color[3] : 255;
      return color;
    }
  }, {
    key: "_onGetSublayerElevation",
    value: function _onGetSublayerElevation(cell) {
      var _this$state3 = this.state,
          sortedElevationBins = _this$state3.sortedElevationBins,
          elevationScaleFunc = _this$state3.elevationScaleFunc,
          elevationValueDomain = _this$state3.elevationValueDomain;
      var ev = sortedElevationBins.binMap[cell.index] && sortedElevationBins.binMap[cell.index].value;
      var elevationDomain = this.props.elevationDomain || elevationValueDomain;
      var isElevationValueInDomain = ev >= elevationDomain[0] && ev <= elevationDomain[elevationDomain.length - 1]; // if cell value is outside domain, set elevation to -1

      return isElevationValueInDomain ? elevationScaleFunc(ev) : -1;
    }
  }, {
    key: "renderLayers",
    value: function renderLayers() {
      var _this$props3 = this.props,
          radius = _this$props3.radius,
          elevationScale = _this$props3.elevationScale,
          extruded = _this$props3.extruded,
          coverage = _this$props3.coverage,
          lightSettings = _this$props3.lightSettings,
          fp64 = _this$props3.fp64,
          transitions = _this$props3.transitions;
      var SubLayerClass = this.getSubLayerClass('hexagon-cell', _hexagonCellLayer.default);
      return new SubLayerClass({
        fp64: fp64,
        radius: radius,
        elevationScale: elevationScale,
        angle: Math.PI / 2,
        extruded: extruded,
        coverage: coverage,
        lightSettings: lightSettings,
        getColor: this._onGetSublayerColor.bind(this),
        getElevation: this._onGetSublayerElevation.bind(this),
        transitions: transitions && {
          getColor: transitions.getColorValue,
          getElevation: transitions.getElevationValue
        }
      }, this.getSubLayerProps({
        id: 'hexagon-cell',
        updateTriggers: this.getUpdateTriggers()
      }), {
        data: this.state.hexagons,
        hexagonVertices: this.state.hexagonVertices
      });
    }
  }]);

  return HexagonLayer;
}(_core.CompositeLayer);

exports.default = HexagonLayer;
HexagonLayer.layerName = 'HexagonLayer';
HexagonLayer.defaultProps = defaultProps;
},{"@deck.gl/core":"Tk4X","../hexagon-cell-layer/hexagon-cell-layer":"XDGA","./hexagon-aggregator":"ID8n"}],"IV0u":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _core = require("@deck.gl/core");

var _luma = require("luma.gl");

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.


var Tesselator = _core.experimental.Tesselator;
var fp64LowPart = _luma.fp64.fp64LowPart; // colorArray is used to copy over color values if the passed color is an RGB
// array instead of RGBA

var colorArray = [0, 0, 0, 255]; // This class is set up to allow querying one attribute at a time
// the way the AttributeManager expects it

var PathTesselator =
/*#__PURE__*/
function (_Tesselator) {
  _inherits(PathTesselator, _Tesselator);

  function PathTesselator(_ref) {
    var data = _ref.data,
        getGeometry = _ref.getGeometry,
        positionFormat = _ref.positionFormat,
        fp64 = _ref.fp64;

    _classCallCheck(this, PathTesselator);

    return _possibleConstructorReturn(this, _getPrototypeOf(PathTesselator).call(this, {
      data: data,
      getGeometry: getGeometry,
      fp64: fp64,
      positionFormat: positionFormat,
      attributes: {
        startPositions: {
          size: 3
        },
        endPositions: {
          size: 3
        },
        leftDeltas: {
          size: 3
        },
        rightDeltas: {
          size: 3
        },
        startEndPositions64XyLow: {
          size: 4,
          fp64Only: true
        }
      }
    }));
  }
  /* Getters */


  _createClass(PathTesselator, [{
    key: "get",
    value: function get(attributeName, target, accessor) {
      if (this.attributes[attributeName]) {
        return this.attributes[attributeName];
      }

      switch (attributeName) {
        case 'strokeWidths':
          return this._updateAttribute({
            target: target,
            size: 1,
            getValue: function getValue(object) {
              return [accessor(object)];
            }
          });

        case 'dashArrays':
          return this._updateAttribute({
            target: target,
            size: 2,
            getValue: accessor
          });

        case 'colors':
          return this._updateAttribute({
            target: target,
            size: 4,
            getValue: function getValue(object) {
              var color = accessor(object);

              if (color.length === 4) {
                return color;
              }

              colorArray[0] = color[0];
              colorArray[1] = color[1];
              colorArray[2] = color[2];
              return colorArray;
            }
          });

        case 'pickingColors':
          return this._updateAttribute({
            target: target,
            size: 3,
            getValue: function getValue(object, index) {
              return accessor(index);
            }
          });

        default:
          return null;
      }
    }
    /* Implement base Tesselator interface */

  }, {
    key: "getGeometrySize",
    value: function getGeometrySize(path) {
      return Math.max(0, this.getPathLength(path) - 1);
    }
    /* eslint-disable max-statements, complexity */

  }, {
    key: "updateGeometryAttributes",
    value: function updateGeometryAttributes(path, context) {
      var _this$attributes = this.attributes,
          startPositions = _this$attributes.startPositions,
          endPositions = _this$attributes.endPositions,
          leftDeltas = _this$attributes.leftDeltas,
          rightDeltas = _this$attributes.rightDeltas,
          startEndPositions64XyLow = _this$attributes.startEndPositions64XyLow,
          fp64 = this.fp64;
      var numPoints = context.geometrySize + 1;

      if (numPoints < 2) {
        // ignore invalid path
        return;
      }

      var isPathClosed = this.isClosed(path);
      var startPoint = this.getPointOnPath(path, 0);
      var endPoint = this.getPointOnPath(path, 1);
      var prevPoint = isPathClosed ? this.getPointOnPath(path, numPoints - 2) : startPoint;
      var nextPoint;

      for (var i = context.vertexStart, ptIndex = 1; ptIndex < numPoints; i++, ptIndex++) {
        if (ptIndex + 1 < numPoints) {
          nextPoint = this.getPointOnPath(path, ptIndex + 1);
        } else {
          nextPoint = isPathClosed ? this.getPointOnPath(path, 1) : endPoint;
        }

        startPositions[i * 3] = startPoint[0];
        startPositions[i * 3 + 1] = startPoint[1];
        startPositions[i * 3 + 2] = startPoint[2] || 0;
        endPositions[i * 3] = endPoint[0];
        endPositions[i * 3 + 1] = endPoint[1];
        endPositions[i * 3 + 2] = endPoint[2] || 0;
        leftDeltas[i * 3] = startPoint[0] - prevPoint[0];
        leftDeltas[i * 3 + 1] = startPoint[1] - prevPoint[1];
        leftDeltas[i * 3 + 2] = startPoint[2] - prevPoint[2] || 0;
        rightDeltas[i * 3] = nextPoint[0] - endPoint[0];
        rightDeltas[i * 3 + 1] = nextPoint[1] - endPoint[1];
        rightDeltas[i * 3 + 2] = nextPoint[2] - endPoint[2] || 0;

        if (fp64) {
          startEndPositions64XyLow[i * 4] = fp64LowPart(startPoint[0]);
          startEndPositions64XyLow[i * 4 + 1] = fp64LowPart(startPoint[1]);
          startEndPositions64XyLow[i * 4 + 2] = fp64LowPart(endPoint[0]);
          startEndPositions64XyLow[i * 4 + 3] = fp64LowPart(endPoint[1]);
        }

        prevPoint = startPoint;
        startPoint = endPoint;
        endPoint = nextPoint;
      }
    }
    /* eslint-enable max-statements, complexity */

    /* Utilities */

  }, {
    key: "getPathLength",
    value: function getPathLength(path) {
      if (Number.isFinite(path[0])) {
        // flat format
        return path.length / this.positionSize;
      }

      return path.length;
    }
  }, {
    key: "getPointOnPath",
    value: function getPointOnPath(path, index) {
      if (Number.isFinite(path[0])) {
        // flat format
        var positionSize = this.positionSize; // TODO - avoid creating new arrays when using binary

        return [path[index * positionSize], path[index * positionSize + 1], positionSize === 3 ? path[index * positionSize + 2] : 0];
      }

      return path[index];
    }
  }, {
    key: "isClosed",
    value: function isClosed(path) {
      var numPoints = this.getPathLength(path);
      var firstPoint = this.getPointOnPath(path, 0);
      var lastPoint = this.getPointOnPath(path, numPoints - 1);
      return firstPoint[0] === lastPoint[0] && firstPoint[1] === lastPoint[1] && firstPoint[2] === lastPoint[2];
    }
  }]);

  return PathTesselator;
}(Tesselator);

exports.default = PathTesselator;
},{"@deck.gl/core":"Tk4X","luma.gl":"GAQa"}],"QwFl":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var _default = "#define SHADER_NAME path-layer-vertex-shader-64\n\nattribute vec3 positions;\n\nattribute vec3 instanceStartPositions;\nattribute vec3 instanceEndPositions;\nattribute vec4 instanceStartEndPositions64xyLow;\nattribute vec3 instanceLeftDeltas;\nattribute vec3 instanceRightDeltas;\nattribute float instanceStrokeWidths;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\nattribute vec2 instanceDashArrays;\n\nuniform float widthScale;\nuniform float widthMinPixels;\nuniform float widthMaxPixels;\nuniform float jointType;\nuniform float miterLimit;\n\nuniform float opacity;\n\nvarying vec4 vColor;\nvarying vec2 vCornerOffset;\nvarying float vMiterLength;\nvarying vec2 vDashArray;\nvarying vec2 vPathPosition;\nvarying float vPathLength;\n\nconst float EPSILON = 0.001;\n\nfloat flipIfTrue(bool flag) {\n  return -(float(flag) * 2. - 1.);\n}\n\n// calculate line join positions\nvec3 lineJoin(\n  vec3 prevPoint, vec3 currPoint, vec3 nextPoint,\n  float relativePosition, bool isEnd, bool isJoint,\n  float width\n) {\n  vec2 deltaA = currPoint.xy - prevPoint.xy;\n  vec2 deltaB = nextPoint.xy - currPoint.xy;\n\n  float lenA = length(deltaA);\n  float lenB = length(deltaB);\n\n  // when two points are closer than PIXEL_EPSILON in pixels,\n  // assume they are the same point to avoid precision issue\n  lenA = lenA / width > EPSILON ? lenA : 0.0;\n  lenB = lenB / width > EPSILON ? lenB : 0.0;\n\n  vec2 dirA = lenA > 0. ? normalize(deltaA) : vec2(0.0, 0.0);\n  vec2 dirB = lenB > 0. ? normalize(deltaB) : vec2(0.0, 0.0);\n\n  vec2 perpA = vec2(-dirA.y, dirA.x);\n  vec2 perpB = vec2(-dirB.y, dirB.x);\n\n  // tangent of the corner\n  vec2 tangent = vec2(dirA + dirB);\n  tangent = length(tangent) > 0. ? normalize(tangent) : perpA;\n  // direction of the corner\n  vec2 miterVec = vec2(-tangent.y, tangent.x);\n  // width offset from current position\n  vec2 perp = isEnd ? perpA : perpB;\n  float L = isEnd ? lenA : lenB;\n\n  // cap super sharp angles\n  float sinHalfA = abs(dot(miterVec, perp));\n  float cosHalfA = abs(dot(dirA, miterVec));\n\n  bool turnsRight = dirA.x * dirB.y > dirA.y * dirB.x;\n\n  float offsetScale = 1.0 / max(sinHalfA, EPSILON);\n\n  float cornerPosition = isJoint ?\n    0.0 :\n    flipIfTrue(turnsRight == (relativePosition > 0.0));\n\n  // do not bevel if line segment is too short\n  cornerPosition *=\n    float(cornerPosition <= 0.0 || sinHalfA < min(lenA, lenB) / width * cosHalfA);\n\n  // trim if inside corner extends further than the line segment\n  if (cornerPosition < 0.0) {\n    offsetScale = min(offsetScale, L / width / max(cosHalfA, EPSILON));\n  }\n\n  vMiterLength = cornerPosition >= 0.0 ?\n    mix(offsetScale, 0.0, cornerPosition) :\n    offsetScale * cornerPosition;\n  vMiterLength -= sinHalfA * jointType;\n\n  float offsetDirection = mix(\n    positions.y,\n    mix(\n      flipIfTrue(turnsRight),\n      positions.y * flipIfTrue(turnsRight == (positions.x == 1.)),\n      cornerPosition\n    ),\n    step(0.0, cornerPosition)\n  );\n\n  vec2 offsetVec = mix(miterVec, -tangent, step(0.5, cornerPosition));\n  offsetScale = mix(offsetScale, 1.0 / max(cosHalfA, 0.001), step(0.5, cornerPosition));\n\n  // special treatment for start cap and end cap\n  // TODO - This has an issue. len is always positive because it is length.\n  // Step returns zero if -lenA<0, so practically this is a comparison of\n  // lenA with zero, with lots of problems because of the -lenA. Can we use EPSILON?\n  bool isStartCap = step(0.0, -lenA) > 0.5;\n  bool isEndCap = step(0.0, -lenB) > 0.5;\n  bool isCap = isStartCap || isEndCap;\n\n  // 0: center, 1: side\n  cornerPosition = isCap ? (1.0 - positions.z) : 0.;\n\n  // start of path: use next - curr\n  if (isStartCap) {\n    offsetVec = mix(dirB, perpB, cornerPosition);\n  }\n\n  // end of path: use curr - prev\n  if (isEndCap) {\n    offsetVec = mix(dirA, perpA, cornerPosition);\n  }\n\n  // extend out a triangle to envelope the round cap\n  if (isCap) {\n    offsetScale = mix(4.0 * jointType, 1.0, cornerPosition);\n    vMiterLength = 1.0 - cornerPosition;\n    offsetDirection = mix(flipIfTrue(isStartCap), positions.y, cornerPosition);\n  }\n\n  vCornerOffset = offsetVec * offsetDirection * offsetScale;\n\n  // Generate variables for dash calculation\n  vDashArray = instanceDashArrays;\n  vPathLength = L / width;\n  // vec2 offsetFromStartOfPath = isEnd ? vCornerOffset + deltaA / width : vCornerOffset;\n  vec2 offsetFromStartOfPath = vCornerOffset;\n  if (isEnd) {\n    offsetFromStartOfPath += deltaA / width;\n  }\n  vec2 dir = isEnd ? dirA : dirB;\n  vPathPosition = vec2(\n    positions.y + positions.z * offsetDirection,\n    dot(offsetFromStartOfPath, dir)\n  );\n\n  return currPoint + vec3(vCornerOffset * width, 0.0);\n}\n\n// calculate line join positions\n// extract params from attributes and uniforms\nvec3 lineJoin(vec3 prevPoint, vec3 currPoint, vec3 nextPoint) {\n\n  // relative position to the corner:\n  // -1: inside (smaller side of the angle)\n  // 0: center\n  // 1: outside (bigger side of the angle)\n\n  float relativePosition = positions.y;\n  bool isEnd = positions.x > EPSILON;\n  bool isJoint = positions.z > EPSILON;\n\n  float width = clamp(project_scale(instanceStrokeWidths * widthScale),\n    widthMinPixels, widthMaxPixels) / 2.0;\n\n  return lineJoin(\n    prevPoint, currPoint, nextPoint,\n    relativePosition, isEnd, isJoint,\n    width\n  );\n}\n\nvoid main() {\n  vColor = vec4(instanceColors.rgb, instanceColors.a * opacity) / 255.;\n\n  // Set color to be rendered to picking fbo (also used to check for selection highlight).\n  picking_setPickingColor(instancePickingColors);\n\n  float isEnd = positions.x;\n\n  vec3 prevPosition = instanceStartPositions;\n  vec2 prevPosition64xyLow = instanceStartEndPositions64xyLow.xy;\n  if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT_AUTO_OFFSET) {\n    // In auto offset mode, add delta to low part of the positions for better precision\n    prevPosition64xyLow += mix(-instanceLeftDeltas, vec3(0.0), isEnd).xy;\n  } else {\n    prevPosition += mix(-instanceLeftDeltas, vec3(0.0), isEnd);\n  }\n  prevPosition = project_position(prevPosition, prevPosition64xyLow);\n\n  vec3 currPosition = mix(instanceStartPositions, instanceEndPositions, isEnd);\n  vec2 currPosition64xyLow = mix(instanceStartEndPositions64xyLow.xy, instanceStartEndPositions64xyLow.zw, isEnd);\n  currPosition = project_position(currPosition, currPosition64xyLow);\n\n  vec3 nextPosition = instanceEndPositions;\n  vec2 nextPosition64xyLow = instanceStartEndPositions64xyLow.zw;\n  if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT_AUTO_OFFSET) {\n    // In auto offset mode, add delta to low part of the positions for better precision\n    nextPosition64xyLow += mix(vec3(0.0), instanceRightDeltas, isEnd).xy;\n  } else {\n    nextPosition += mix(vec3(0.0), instanceRightDeltas, isEnd);\n  }\n  nextPosition = project_position(nextPosition, nextPosition64xyLow);\n\n  vec3 pos = lineJoin(prevPosition, currPosition, nextPosition);\n\n  gl_Position = project_to_clipspace(vec4(pos, 1.0));\n}\n";
exports.default = _default;
},{}],"C1fU":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var _default = "\n#define SHADER_NAME path-layer-vertex-shader\n\nattribute vec3 positions;\n\nattribute vec3 instanceStartPositions;\nattribute vec3 instanceEndPositions;\nattribute vec4 instanceStartEndPositions64xyLow;\nattribute vec3 instanceLeftDeltas;\nattribute vec3 instanceRightDeltas;\nattribute float instanceStrokeWidths;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\nattribute vec2 instanceDashArrays;\n\nuniform float widthScale;\nuniform float widthMinPixels;\nuniform float widthMaxPixels;\nuniform float jointType;\nuniform float miterLimit;\n\nuniform float opacity;\n\nvarying vec4 vColor;\nvarying vec2 vCornerOffset;\nvarying float vMiterLength;\nvarying vec2 vDashArray;\nvarying vec2 vPathPosition;\nvarying float vPathLength;\n\nconst float EPSILON = 0.001;\n\nfloat flipIfTrue(bool flag) {\n  return -(float(flag) * 2. - 1.);\n}\n\nvec3 lineJoin(vec2 prevPoint64[2], vec2 currPoint64[2], vec2 nextPoint64[2]) {\n\n  float width = clamp(project_scale(instanceStrokeWidths * widthScale),\n    widthMinPixels, widthMaxPixels) / 2.0;\n\n  vec2 deltaA64[2];\n  vec2 deltaB64[2];\n\n  vec2_sub_fp64(currPoint64, prevPoint64, deltaA64);\n  vec2_sub_fp64(nextPoint64, currPoint64, deltaB64);\n\n  vec2 lengthA64 = vec2_length_fp64(deltaA64);\n  vec2 lengthB64 = vec2_length_fp64(deltaB64);\n\n  vec2 deltaA = vec2(deltaA64[0].x, deltaA64[1].x);\n  vec2 deltaB = vec2(deltaB64[0].x, deltaB64[1].x);\n\n  float lenA = lengthA64.x;\n  float lenB = lengthB64.x;\n\n  vec2 offsetVec;\n  float offsetScale;\n  float offsetDirection;\n\n  // when two points are closer than PIXEL_EPSILON in pixels,\n  // assume they are the same point to avoid precision issue\n  lenA = lenA / width > EPSILON ? lenA : 0.0;\n  lenB = lenB / width > EPSILON ? lenB : 0.0;\n  vec2 dirA = lenA > 0. ? deltaA / lenA : vec2(0.0, 0.0);\n  vec2 dirB = lenB > 0. ? deltaB / lenB : vec2(0.0, 0.0);\n\n  vec2 perpA = vec2(-dirA.y, dirA.x);\n  vec2 perpB = vec2(-dirB.y, dirB.x);\n\n  // tangent of the corner\n  vec2 tangent = vec2(dirA + dirB);\n  tangent = length(tangent) > 0. ? normalize(tangent) : perpA;\n  // direction of the corner\n  vec2 miterVec = vec2(-tangent.y, tangent.x);\n  // width offset from current position\n  vec2 perp = mix(perpB, perpA, positions.x);\n  float L = mix(lenB, lenA, positions.x);\n\n  // cap super sharp angles\n  float sinHalfA = abs(dot(miterVec, perp));\n  float cosHalfA = abs(dot(dirA, miterVec));\n  bool turnsRight = dirA.x * dirB.y > dirA.y * dirB.x;\n\n  // relative position to the corner:\n  // -1: inside (smaller side of the angle)\n  // 0: center\n  // 1: outside (bigger side of the angle)\n  float cornerPosition = mix(\n    flipIfTrue(turnsRight == (positions.y > 0.0)),\n    0.0,\n    positions.z\n  );\n\n  offsetScale = 1.0 / max(sinHalfA, EPSILON);\n\n  // do not bevel if line segment is too short\n  cornerPosition *= float(cornerPosition <= 0.0 || sinHalfA < min(lenA, lenB) / width * cosHalfA);\n  // trim if inside corner extends further than the line segment\n  offsetScale = mix(\n    offsetScale,\n    min(offsetScale, L / width / max(cosHalfA, EPSILON)),\n    float(cornerPosition < 0.0)\n  );\n\n  vMiterLength = mix(\n    offsetScale * cornerPosition,\n    mix(offsetScale, 0.0, cornerPosition),\n    step(0.0, cornerPosition)\n  ) - sinHalfA * jointType;\n  offsetDirection = mix(\n    positions.y,\n    mix(\n      flipIfTrue(turnsRight),\n      positions.y * flipIfTrue(turnsRight == (positions.x == 1.)),\n      cornerPosition\n    ),\n    step(0.0, cornerPosition)\n  );\n  offsetVec = mix(miterVec, -tangent, step(0.5, cornerPosition));\n  offsetScale = mix(offsetScale, 1.0 / max(cosHalfA, 0.001), step(0.5, cornerPosition));\n\n  // special treatment for start cap and end cap\n  // using a small number as the limit for determining if the lenA or lenB is 0\n  float isStartCap = step(lenA, 1.0e-5);\n  float isEndCap = step(lenB, 1.0e-5);\n  float isCap = max(isStartCap, isEndCap);\n\n  // 0: center, 1: side\n  cornerPosition = isCap * (1.0 - positions.z);\n\n  // start of path: use next - curr\n  offsetVec = mix(offsetVec, mix(dirB, perpB, cornerPosition), isStartCap);\n  // end of path: use curr - prev\n  offsetVec = mix(offsetVec, mix(dirA, perpA, cornerPosition), isEndCap);\n\n  // extend out a triangle to envelope the round cap\n  offsetScale = mix(\n    offsetScale,\n    mix(4.0 * jointType, 1.0, cornerPosition),\n    isCap\n  );\n  vMiterLength = mix(vMiterLength, 1.0 - cornerPosition, isCap);\n\n  offsetDirection = mix(\n    offsetDirection,\n    mix(flipIfTrue(isStartCap > 0.), positions.y, cornerPosition),\n    isCap\n  );\n\n  vCornerOffset = offsetVec * offsetDirection * offsetScale;\n\n  // Generate variables for dash calculation\n  vDashArray = instanceDashArrays;\n  vPathLength = L / width;\n  float isEnd = positions.x;\n  vec2 offsetFromStartOfPath = mix(vCornerOffset, vCornerOffset + deltaA / width, isEnd);\n  vec2 dir = mix(dirB, dirA, isEnd);\n  vPathPosition = vec2(\n    positions.y + positions.z * offsetDirection,\n    dot(offsetFromStartOfPath, dir)\n  );\n\n  return vec3(vCornerOffset * width, 0.0);\n}\n\nvoid main() {\n  vColor = vec4(instanceColors.rgb, instanceColors.a * opacity) / 255.;\n\n  // Set color to be rendered to picking fbo (also used to check for selection highlight).\n  picking_setPickingColor(instancePickingColors);\n\n  float isEnd = positions.x;\n\n  // Calculate current position 64bit\n\n  vec3 currPosition = mix(instanceStartPositions, instanceEndPositions, isEnd);\n  vec2 currPosition64xyLow = mix(instanceStartEndPositions64xyLow.xy, instanceStartEndPositions64xyLow.zw, isEnd);\n  vec2 projected_curr_position[2];\n  project_position_fp64(currPosition.xy, currPosition64xyLow, projected_curr_position);\n  float projected_curr_position_z = project_scale(currPosition.z);\n\n  // Calculate previous position\n\n  vec3 prevPosition = mix(-instanceLeftDeltas, vec3(0.0), isEnd) + instanceStartPositions;\n\n  // Calculate prev position 64bit\n\n  vec2 projected_prev_position[2];\n  project_position_fp64(prevPosition.xy, instanceStartEndPositions64xyLow.xy, projected_prev_position);\n\n  // Calculate next positions\n  vec3 nextPosition = mix(vec3(0.0), instanceRightDeltas, isEnd) + instanceEndPositions;\n\n  // Calculate next position 64bit\n\n  vec2 projected_next_position[2];\n  project_position_fp64(nextPosition.xy, instanceStartEndPositions64xyLow.zw, projected_next_position);\n\n  vec3 pos = lineJoin(projected_prev_position, projected_curr_position, projected_next_position);\n  vec2 vertex_pos_modelspace[4];\n\n  vertex_pos_modelspace[0] = sum_fp64(vec2(pos.x, 0.0), projected_curr_position[0]);\n  vertex_pos_modelspace[1] = sum_fp64(vec2(pos.y, 0.0), projected_curr_position[1]);\n  vertex_pos_modelspace[2] = vec2(pos.z + projected_curr_position_z, 0.0);\n  vertex_pos_modelspace[3] = vec2(1.0, 0.0);\n\n  gl_Position = project_to_clipspace_fp64(vertex_pos_modelspace);\n}\n";
exports.default = _default;
},{}],"u5YA":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var _default = "#define SHADER_NAME path-layer-fragment-shader\n\nprecision highp float;\n\nuniform float jointType;\nuniform float miterLimit;\nuniform float alignMode;\n\nvarying vec4 vColor;\nvarying vec2 vCornerOffset;\nvarying float vMiterLength;\nvarying vec2 vDashArray;\n/*\n * vPathPosition represents the relative coordinates of the current fragment on the path segment.\n * vPathPosition.x - position along the width of the path, between [-1, 1]. 0 is the center line.\n * vPathPosition.y - position along the length of the path, between [0, L / width].\n */\nvarying vec2 vPathPosition;\nvarying float vPathLength;\n\n// mod doesn't work correctly for negative numbers\nfloat mod2(float a, float b) {\n  return a - floor(a / b) * b;\n}\n\nfloat round(float x) {\n  return floor(x + 0.5);\n}\n\n// if given position is in the gap part of the dashed line\n// dashArray.x: solid stroke length, relative to width\n// dashArray.y: gap length, relative to width\n// alignMode:\n// 0 - no adjustment\n// o----     ----     ----     ---- o----     -o----     ----     o\n// 1 - stretch to fit, draw half dash at each end for nicer joints\n// o--    ----    ----    ----    --o--      --o--     ----     --o\nbool dash_isFragInGap() {\n  float solidLength = vDashArray.x;\n  float gapLength = vDashArray.y;\n\n  float unitLength = solidLength + gapLength;\n\n  if (unitLength == 0.0) {\n    return false;\n  }\n\n  unitLength = mix(\n    unitLength,\n    vPathLength / round(vPathLength / unitLength),\n    alignMode\n  );\n\n  float offset = alignMode * solidLength / 2.0;\n\n  return gapLength > 0.0 &&\n    vPathPosition.y >= 0.0 &&\n    vPathPosition.y <= vPathLength &&\n    mod2(vPathPosition.y + offset, unitLength) > solidLength;\n}\n\nvoid main(void) {\n  // if joint is rounded, test distance from the corner\n  if (jointType > 0.0 && vMiterLength > 0.0 && length(vCornerOffset) > 1.0) {\n    // Enable to debug joints\n    // gl_FragColor = vec4(0., 1., 0., 1.);\n    // return;\n    discard;\n  }\n  if (jointType == 0.0 && vMiterLength > miterLimit) {\n    // Enable to debug joints\n    // gl_FragColor = vec4(0., 0., 1., 1.);\n    // return;\n    discard;\n  }\n  if (vColor.a == 0.0 || dash_isFragInGap()) {\n    // Enable to debug joints\n    // gl_FragColor = vec4(0., 1., 1., 1.);\n    // return;\n    discard;\n  }\n  gl_FragColor = vColor;\n\n  // use highlight color if this fragment belongs to the selected object.\n  gl_FragColor = picking_filterHighlightColor(gl_FragColor);\n\n  // use picking color if rendering to picking FBO.\n  gl_FragColor = picking_filterPickingColor(gl_FragColor);\n}\n";
exports.default = _default;
},{}],"H5W6":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _core = require("@deck.gl/core");

var _constants = _interopRequireDefault(require("luma.gl/constants"));

var _luma = require("luma.gl");

var _pathTesselator = _interopRequireDefault(require("./path-tesselator"));

var _pathLayerVertex = _interopRequireDefault(require("./path-layer-vertex.glsl"));

var _pathLayerVertex2 = _interopRequireDefault(require("./path-layer-vertex-64.glsl"));

var _pathLayerFragment = _interopRequireDefault(require("./path-layer-fragment.glsl"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _get(target, property, receiver) {
  if (typeof Reflect !== "undefined" && Reflect.get) {
    _get = Reflect.get;
  } else {
    _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(target, property, receiver || target);
}

function _superPropBase(object, property) {
  while (!Object.prototype.hasOwnProperty.call(object, property)) {
    object = _getPrototypeOf(object);
    if (object === null) break;
  }

  return object;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.


var DEFAULT_COLOR = [0, 0, 0, 255];
var defaultProps = {
  widthScale: {
    type: 'number',
    min: 0,
    value: 1
  },
  // stroke width in meters
  widthMinPixels: {
    type: 'number',
    min: 0,
    value: 0
  },
  //  min stroke width in pixels
  widthMaxPixels: {
    type: 'number',
    min: 0,
    value: Number.MAX_SAFE_INTEGER
  },
  // max stroke width in pixels
  rounded: false,
  miterLimit: {
    type: 'number',
    min: 0,
    value: 4
  },
  fp64: false,
  dashJustified: false,
  getPath: {
    type: 'accessor',
    value: function value(object) {
      return object.path;
    }
  },
  getColor: {
    type: 'accessor',
    value: DEFAULT_COLOR
  },
  getWidth: {
    type: 'accessor',
    value: 1
  },
  getDashArray: {
    type: 'accessor',
    value: [0, 0]
  }
};
var ATTRIBUTE_TRANSITION = {
  enter: function enter(value, chunk) {
    return chunk.length ? chunk.subarray(chunk.length - value.length) : value;
  }
};

var PathLayer =
/*#__PURE__*/
function (_Layer) {
  _inherits(PathLayer, _Layer);

  function PathLayer() {
    _classCallCheck(this, PathLayer);

    return _possibleConstructorReturn(this, _getPrototypeOf(PathLayer).apply(this, arguments));
  }

  _createClass(PathLayer, [{
    key: "getShaders",
    value: function getShaders() {
      return this.use64bitProjection() ? {
        vs: _pathLayerVertex2.default,
        fs: _pathLayerFragment.default,
        modules: ['project64', 'picking']
      } : {
        vs: _pathLayerVertex.default,
        fs: _pathLayerFragment.default,
        modules: ['picking']
      }; // 'project' module added by default.
    }
  }, {
    key: "initializeState",
    value: function initializeState() {
      var noAlloc = true;
      var attributeManager = this.getAttributeManager();
      /* eslint-disable max-len */

      attributeManager.addInstanced({
        instanceStartPositions: {
          size: 3,
          transition: ATTRIBUTE_TRANSITION,
          accessor: 'getPath',
          update: this.calculateStartPositions,
          noAlloc: noAlloc
        },
        instanceEndPositions: {
          size: 3,
          transition: ATTRIBUTE_TRANSITION,
          accessor: 'getPath',
          update: this.calculateEndPositions,
          noAlloc: noAlloc
        },
        instanceStartEndPositions64xyLow: {
          size: 4,
          update: this.calculateInstanceStartEndPositions64xyLow,
          noAlloc: noAlloc
        },
        instanceLeftDeltas: {
          size: 3,
          update: this.calculateLeftDeltas,
          noAlloc: noAlloc
        },
        instanceRightDeltas: {
          size: 3,
          update: this.calculateRightDeltas,
          noAlloc: noAlloc
        },
        instanceStrokeWidths: {
          size: 1,
          accessor: 'getWidth',
          transition: ATTRIBUTE_TRANSITION,
          update: this.calculateStrokeWidths,
          defaultValue: 1
        },
        instanceDashArrays: {
          size: 2,
          accessor: 'getDashArray',
          update: this.calculateDashArrays
        },
        instanceColors: {
          size: 4,
          type: _constants.default.UNSIGNED_BYTE,
          accessor: 'getColor',
          transition: ATTRIBUTE_TRANSITION,
          update: this.calculateColors,
          defaultValue: DEFAULT_COLOR
        },
        instancePickingColors: {
          size: 3,
          type: _constants.default.UNSIGNED_BYTE,
          update: this.calculatePickingColors
        }
      });
      /* eslint-enable max-len */

      this.setState({
        pathTesselator: new _pathTesselator.default({})
      });
    }
  }, {
    key: "updateState",
    value: function updateState(_ref) {
      var oldProps = _ref.oldProps,
          props = _ref.props,
          changeFlags = _ref.changeFlags;

      _get(_getPrototypeOf(PathLayer.prototype), "updateState", this).call(this, {
        props: props,
        oldProps: oldProps,
        changeFlags: changeFlags
      });

      var attributeManager = this.getAttributeManager();
      var geometryChanged = changeFlags.dataChanged || props.fp64 !== oldProps.fp64 || changeFlags.updateTriggersChanged && (changeFlags.updateTriggersChanged.all || changeFlags.updateTriggersChanged.getPath);

      if (geometryChanged) {
        this.state.pathTesselator.updateGeometry({
          data: props.data,
          getGeometry: props.getPath,
          positionFormat: props.positionFormat,
          fp64: this.use64bitPositions()
        });
        this.setState({
          numInstances: this.state.pathTesselator.instanceCount
        });
        attributeManager.invalidateAll();
      }

      if (props.fp64 !== oldProps.fp64) {
        var gl = this.context.gl;

        if (this.state.model) {
          this.state.model.delete();
        }

        this.setState({
          model: this._getModel(gl)
        });
        attributeManager.invalidateAll();
      }
    }
  }, {
    key: "draw",
    value: function draw(_ref2) {
      var uniforms = _ref2.uniforms;
      var _this$props = this.props,
          rounded = _this$props.rounded,
          miterLimit = _this$props.miterLimit,
          widthScale = _this$props.widthScale,
          widthMinPixels = _this$props.widthMinPixels,
          widthMaxPixels = _this$props.widthMaxPixels,
          dashJustified = _this$props.dashJustified;
      this.state.model.render(Object.assign({}, uniforms, {
        jointType: Number(rounded),
        alignMode: Number(dashJustified),
        widthScale: widthScale,
        miterLimit: miterLimit,
        widthMinPixels: widthMinPixels,
        widthMaxPixels: widthMaxPixels
      }));
    }
  }, {
    key: "_getModel",
    value: function _getModel(gl) {
      /*
       *       _
       *        "-_ 1                   3                       5
       *     _     "o---------------------o-------------------_-o
       *       -   / ""--..__              '.             _.-' /
       *   _     "@- - - - - ""--..__- - - - x - - - -_.@'    /
       *    "-_  /                   ""--..__ '.  _,-` :     /
       *       "o----------------------------""-o'    :     /
       *      0,2                            4 / '.  :     /
       *                                      /   '.:     /
       *                                     /     :'.   /
       *                                    /     :  ', /
       *                                   /     :     o
       */
      var SEGMENT_INDICES = [// start corner
      0, 2, 1, // body
      1, 2, 4, 1, 4, 3, // end corner
      3, 4, 5]; // [0] position on segment - 0: start, 1: end
      // [1] side of path - -1: left, 0: center, 1: right
      // [2] role - 0: offset point 1: joint point

      var SEGMENT_POSITIONS = [// bevel start corner
      0, 0, 1, // start inner corner
      0, -1, 0, // start outer corner
      0, 1, 0, // end inner corner
      1, -1, 0, // end outer corner
      1, 1, 0, // bevel end corner
      1, 0, 1];
      return new _luma.Model(gl, Object.assign({}, this.getShaders(), {
        id: this.props.id,
        geometry: new _luma.Geometry({
          drawMode: _constants.default.TRIANGLES,
          attributes: {
            indices: new Uint16Array(SEGMENT_INDICES),
            positions: new Float32Array(SEGMENT_POSITIONS)
          }
        }),
        isInstanced: true,
        shaderCache: this.context.shaderCache
      }));
    }
  }, {
    key: "calculateStartPositions",
    value: function calculateStartPositions(attribute) {
      var pathTesselator = this.state.pathTesselator;
      attribute.bufferLayout = pathTesselator.bufferLayout;
      attribute.value = pathTesselator.get('startPositions');
    }
  }, {
    key: "calculateEndPositions",
    value: function calculateEndPositions(attribute) {
      var pathTesselator = this.state.pathTesselator;
      attribute.bufferLayout = pathTesselator.bufferLayout;
      attribute.value = pathTesselator.get('endPositions');
    }
  }, {
    key: "calculateInstanceStartEndPositions64xyLow",
    value: function calculateInstanceStartEndPositions64xyLow(attribute) {
      var isFP64 = this.use64bitPositions();
      attribute.constant = !isFP64;

      if (isFP64) {
        attribute.value = this.state.pathTesselator.get('startEndPositions64XyLow');
      } else {
        attribute.value = new Float32Array(4);
      }
    }
  }, {
    key: "calculateLeftDeltas",
    value: function calculateLeftDeltas(attribute) {
      var pathTesselator = this.state.pathTesselator;
      attribute.value = pathTesselator.get('leftDeltas');
    }
  }, {
    key: "calculateRightDeltas",
    value: function calculateRightDeltas(attribute) {
      var pathTesselator = this.state.pathTesselator;
      attribute.value = pathTesselator.get('rightDeltas');
    }
  }, {
    key: "calculateStrokeWidths",
    value: function calculateStrokeWidths(attribute) {
      var getWidth = this.props.getWidth;
      var pathTesselator = this.state.pathTesselator;
      attribute.bufferLayout = pathTesselator.bufferLayout;
      attribute.value = pathTesselator.get('strokeWidths', attribute.value, getWidth);
    }
  }, {
    key: "calculateDashArrays",
    value: function calculateDashArrays(attribute) {
      var getDashArray = this.props.getDashArray;
      var pathTesselator = this.state.pathTesselator;
      attribute.value = pathTesselator.get('dashArrays', attribute.value, getDashArray);
    }
  }, {
    key: "calculateColors",
    value: function calculateColors(attribute) {
      var getColor = this.props.getColor;
      var pathTesselator = this.state.pathTesselator;
      attribute.bufferLayout = pathTesselator.bufferLayout;
      attribute.value = pathTesselator.get('colors', attribute.value, getColor);
    } // Override the default picking colors calculation

  }, {
    key: "calculatePickingColors",
    value: function calculatePickingColors(attribute) {
      var _this = this;

      var pathTesselator = this.state.pathTesselator;
      var pickingColor = [];
      attribute.value = pathTesselator.get('pickingColors', attribute.value, function (index) {
        return _this.encodePickingColor(index, pickingColor);
      });
    }
  }, {
    key: "clearPickingColor",
    value: function clearPickingColor(color) {
      var pickedPathIndex = this.decodePickingColor(color);
      var bufferLayout = this.state.pathTesselator.bufferLayout;
      var numVertices = bufferLayout[pickedPathIndex];
      var startInstanceIndex = 0;

      for (var pathIndex = 0; pathIndex < pickedPathIndex; pathIndex++) {
        startInstanceIndex += bufferLayout[pathIndex];
      }

      var instancePickingColors = this.getAttributeManager().attributes.instancePickingColors;
      var value = instancePickingColors.value;
      var endInstanceIndex = startInstanceIndex + numVertices;
      value.fill(0, startInstanceIndex * 3, endInstanceIndex * 3);
      instancePickingColors.update({
        value: value
      });
    }
  }]);

  return PathLayer;
}(_core.Layer);

exports.default = PathLayer;
PathLayer.layerName = 'PathLayer';
PathLayer.defaultProps = defaultProps;
},{"@deck.gl/core":"Tk4X","luma.gl/constants":"lMsC","luma.gl":"GAQa","./path-tesselator":"IV0u","./path-layer-vertex.glsl":"QwFl","./path-layer-vertex-64.glsl":"C1fU","./path-layer-fragment.glsl":"u5YA"}],"qpyO":[function(require,module,exports) {
'use strict';

module.exports = earcut;
module.exports.default = earcut;

function earcut(data, holeIndices, dim) {

    dim = dim || 2;

    var hasHoles = holeIndices && holeIndices.length,
        outerLen = hasHoles ? holeIndices[0] * dim : data.length,
        outerNode = linkedList(data, 0, outerLen, dim, true),
        triangles = [];

    if (!outerNode || outerNode.next === outerNode.prev) return triangles;

    var minX, minY, maxX, maxY, x, y, invSize;

    if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);

    // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox
    if (data.length > 80 * dim) {
        minX = maxX = data[0];
        minY = maxY = data[1];

        for (var i = dim; i < outerLen; i += dim) {
            x = data[i];
            y = data[i + 1];
            if (x < minX) minX = x;
            if (y < minY) minY = y;
            if (x > maxX) maxX = x;
            if (y > maxY) maxY = y;
        }

        // minX, minY and invSize are later used to transform coords into integers for z-order calculation
        invSize = Math.max(maxX - minX, maxY - minY);
        invSize = invSize !== 0 ? 1 / invSize : 0;
    }

    earcutLinked(outerNode, triangles, dim, minX, minY, invSize);

    return triangles;
}

// create a circular doubly linked list from polygon points in the specified winding order
function linkedList(data, start, end, dim, clockwise) {
    var i, last;

    if (clockwise === (signedArea(data, start, end, dim) > 0)) {
        for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);
    } else {
        for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);
    }

    if (last && equals(last, last.next)) {
        removeNode(last);
        last = last.next;
    }

    return last;
}

// eliminate colinear or duplicate points
function filterPoints(start, end) {
    if (!start) return start;
    if (!end) end = start;

    var p = start,
        again;
    do {
        again = false;

        if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {
            removeNode(p);
            p = end = p.prev;
            if (p === p.next) break;
            again = true;

        } else {
            p = p.next;
        }
    } while (again || p !== end);

    return end;
}

// main ear slicing loop which triangulates a polygon (given as a linked list)
function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {
    if (!ear) return;

    // interlink polygon nodes in z-order
    if (!pass && invSize) indexCurve(ear, minX, minY, invSize);

    var stop = ear,
        prev, next;

    // iterate through ears, slicing them one by one
    while (ear.prev !== ear.next) {
        prev = ear.prev;
        next = ear.next;

        if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {
            // cut off the triangle
            triangles.push(prev.i / dim);
            triangles.push(ear.i / dim);
            triangles.push(next.i / dim);

            removeNode(ear);

            // skipping the next vertex leads to less sliver triangles
            ear = next.next;
            stop = next.next;

            continue;
        }

        ear = next;

        // if we looped through the whole remaining polygon and can't find any more ears
        if (ear === stop) {
            // try filtering points and slicing again
            if (!pass) {
                earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);

            // if this didn't work, try curing all small self-intersections locally
            } else if (pass === 1) {
                ear = cureLocalIntersections(filterPoints(ear), triangles, dim);
                earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);

            // as a last resort, try splitting the remaining polygon into two
            } else if (pass === 2) {
                splitEarcut(ear, triangles, dim, minX, minY, invSize);
            }

            break;
        }
    }
}

// check whether a polygon node forms a valid ear with adjacent nodes
function isEar(ear) {
    var a = ear.prev,
        b = ear,
        c = ear.next;

    if (area(a, b, c) >= 0) return false; // reflex, can't be an ear

    // now make sure we don't have other points inside the potential ear
    var p = ear.next.next;

    while (p !== ear.prev) {
        if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&
            area(p.prev, p, p.next) >= 0) return false;
        p = p.next;
    }

    return true;
}

function isEarHashed(ear, minX, minY, invSize) {
    var a = ear.prev,
        b = ear,
        c = ear.next;

    if (area(a, b, c) >= 0) return false; // reflex, can't be an ear

    // triangle bbox; min & max are calculated like this for speed
    var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x),
        minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y),
        maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x),
        maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y);

    // z-order range for the current triangle bbox;
    var minZ = zOrder(minTX, minTY, minX, minY, invSize),
        maxZ = zOrder(maxTX, maxTY, minX, minY, invSize);

    var p = ear.prevZ,
        n = ear.nextZ;

    // look for points inside the triangle in both directions
    while (p && p.z >= minZ && n && n.z <= maxZ) {
        if (p !== ear.prev && p !== ear.next &&
            pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&
            area(p.prev, p, p.next) >= 0) return false;
        p = p.prevZ;

        if (n !== ear.prev && n !== ear.next &&
            pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&
            area(n.prev, n, n.next) >= 0) return false;
        n = n.nextZ;
    }

    // look for remaining points in decreasing z-order
    while (p && p.z >= minZ) {
        if (p !== ear.prev && p !== ear.next &&
            pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&
            area(p.prev, p, p.next) >= 0) return false;
        p = p.prevZ;
    }

    // look for remaining points in increasing z-order
    while (n && n.z <= maxZ) {
        if (n !== ear.prev && n !== ear.next &&
            pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&
            area(n.prev, n, n.next) >= 0) return false;
        n = n.nextZ;
    }

    return true;
}

// go through all polygon nodes and cure small local self-intersections
function cureLocalIntersections(start, triangles, dim) {
    var p = start;
    do {
        var a = p.prev,
            b = p.next.next;

        if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {

            triangles.push(a.i / dim);
            triangles.push(p.i / dim);
            triangles.push(b.i / dim);

            // remove two nodes involved
            removeNode(p);
            removeNode(p.next);

            p = start = b;
        }
        p = p.next;
    } while (p !== start);

    return filterPoints(p);
}

// try splitting polygon into two and triangulate them independently
function splitEarcut(start, triangles, dim, minX, minY, invSize) {
    // look for a valid diagonal that divides the polygon into two
    var a = start;
    do {
        var b = a.next.next;
        while (b !== a.prev) {
            if (a.i !== b.i && isValidDiagonal(a, b)) {
                // split the polygon in two by the diagonal
                var c = splitPolygon(a, b);

                // filter colinear points around the cuts
                a = filterPoints(a, a.next);
                c = filterPoints(c, c.next);

                // run earcut on each half
                earcutLinked(a, triangles, dim, minX, minY, invSize);
                earcutLinked(c, triangles, dim, minX, minY, invSize);
                return;
            }
            b = b.next;
        }
        a = a.next;
    } while (a !== start);
}

// link every hole into the outer loop, producing a single-ring polygon without holes
function eliminateHoles(data, holeIndices, outerNode, dim) {
    var queue = [],
        i, len, start, end, list;

    for (i = 0, len = holeIndices.length; i < len; i++) {
        start = holeIndices[i] * dim;
        end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;
        list = linkedList(data, start, end, dim, false);
        if (list === list.next) list.steiner = true;
        queue.push(getLeftmost(list));
    }

    queue.sort(compareX);

    // process holes from left to right
    for (i = 0; i < queue.length; i++) {
        eliminateHole(queue[i], outerNode);
        outerNode = filterPoints(outerNode, outerNode.next);
    }

    return outerNode;
}

function compareX(a, b) {
    return a.x - b.x;
}

// find a bridge between vertices that connects hole with an outer ring and and link it
function eliminateHole(hole, outerNode) {
    outerNode = findHoleBridge(hole, outerNode);
    if (outerNode) {
        var b = splitPolygon(outerNode, hole);
        filterPoints(b, b.next);
    }
}

// David Eberly's algorithm for finding a bridge between hole and outer polygon
function findHoleBridge(hole, outerNode) {
    var p = outerNode,
        hx = hole.x,
        hy = hole.y,
        qx = -Infinity,
        m;

    // find a segment intersected by a ray from the hole's leftmost point to the left;
    // segment's endpoint with lesser x will be potential connection point
    do {
        if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {
            var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);
            if (x <= hx && x > qx) {
                qx = x;
                if (x === hx) {
                    if (hy === p.y) return p;
                    if (hy === p.next.y) return p.next;
                }
                m = p.x < p.next.x ? p : p.next;
            }
        }
        p = p.next;
    } while (p !== outerNode);

    if (!m) return null;

    if (hx === qx) return m; // hole touches outer segment; pick leftmost endpoint

    // look for points inside the triangle of hole point, segment intersection and endpoint;
    // if there are no points found, we have a valid connection;
    // otherwise choose the point of the minimum angle with the ray as connection point

    var stop = m,
        mx = m.x,
        my = m.y,
        tanMin = Infinity,
        tan;

    p = m;

    do {
        if (hx >= p.x && p.x >= mx && hx !== p.x &&
                pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {

            tan = Math.abs(hy - p.y) / (hx - p.x); // tangential

            if (locallyInside(p, hole) &&
                (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) {
                m = p;
                tanMin = tan;
            }
        }

        p = p.next;
    } while (p !== stop);

    return m;
}

// whether sector in vertex m contains sector in vertex p in the same coordinates
function sectorContainsSector(m, p) {
    return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;
}

// interlink polygon nodes in z-order
function indexCurve(start, minX, minY, invSize) {
    var p = start;
    do {
        if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, invSize);
        p.prevZ = p.prev;
        p.nextZ = p.next;
        p = p.next;
    } while (p !== start);

    p.prevZ.nextZ = null;
    p.prevZ = null;

    sortLinked(p);
}

// Simon Tatham's linked list merge sort algorithm
// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html
function sortLinked(list) {
    var i, p, q, e, tail, numMerges, pSize, qSize,
        inSize = 1;

    do {
        p = list;
        list = null;
        tail = null;
        numMerges = 0;

        while (p) {
            numMerges++;
            q = p;
            pSize = 0;
            for (i = 0; i < inSize; i++) {
                pSize++;
                q = q.nextZ;
                if (!q) break;
            }
            qSize = inSize;

            while (pSize > 0 || (qSize > 0 && q)) {

                if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {
                    e = p;
                    p = p.nextZ;
                    pSize--;
                } else {
                    e = q;
                    q = q.nextZ;
                    qSize--;
                }

                if (tail) tail.nextZ = e;
                else list = e;

                e.prevZ = tail;
                tail = e;
            }

            p = q;
        }

        tail.nextZ = null;
        inSize *= 2;

    } while (numMerges > 1);

    return list;
}

// z-order of a point given coords and inverse of the longer side of data bbox
function zOrder(x, y, minX, minY, invSize) {
    // coords are transformed into non-negative 15-bit integer range
    x = 32767 * (x - minX) * invSize;
    y = 32767 * (y - minY) * invSize;

    x = (x | (x << 8)) & 0x00FF00FF;
    x = (x | (x << 4)) & 0x0F0F0F0F;
    x = (x | (x << 2)) & 0x33333333;
    x = (x | (x << 1)) & 0x55555555;

    y = (y | (y << 8)) & 0x00FF00FF;
    y = (y | (y << 4)) & 0x0F0F0F0F;
    y = (y | (y << 2)) & 0x33333333;
    y = (y | (y << 1)) & 0x55555555;

    return x | (y << 1);
}

// find the leftmost node of a polygon ring
function getLeftmost(start) {
    var p = start,
        leftmost = start;
    do {
        if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) leftmost = p;
        p = p.next;
    } while (p !== start);

    return leftmost;
}

// check if a point lies within a convex triangle
function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
    return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&
           (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&
           (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;
}

// check if a diagonal between two polygon nodes is valid (lies in polygon interior)
function isValidDiagonal(a, b) {
    return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges
           (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible
            (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors
            equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case
}

// signed area of a triangle
function area(p, q, r) {
    return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
}

// check if two points are equal
function equals(p1, p2) {
    return p1.x === p2.x && p1.y === p2.y;
}

// check if two segments intersect
function intersects(p1, q1, p2, q2) {
    var o1 = sign(area(p1, q1, p2));
    var o2 = sign(area(p1, q1, q2));
    var o3 = sign(area(p2, q2, p1));
    var o4 = sign(area(p2, q2, q1));

    if (o1 !== o2 && o3 !== o4) return true; // general case

    if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1
    if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1
    if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2
    if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2

    return false;
}

// for collinear points p, q, r, check if point q lies on segment pr
function onSegment(p, q, r) {
    return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);
}

function sign(num) {
    return num > 0 ? 1 : num < 0 ? -1 : 0;
}

// check if a polygon diagonal intersects any polygon segments
function intersectsPolygon(a, b) {
    var p = a;
    do {
        if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&
                intersects(p, p.next, a, b)) return true;
        p = p.next;
    } while (p !== a);

    return false;
}

// check if a polygon diagonal is locally inside the polygon
function locallyInside(a, b) {
    return area(a.prev, a, a.next) < 0 ?
        area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :
        area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;
}

// check if the middle point of a polygon diagonal is inside the polygon
function middleInside(a, b) {
    var p = a,
        inside = false,
        px = (a.x + b.x) / 2,
        py = (a.y + b.y) / 2;
    do {
        if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&
                (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))
            inside = !inside;
        p = p.next;
    } while (p !== a);

    return inside;
}

// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;
// if one belongs to the outer ring and another to a hole, it merges it into a single ring
function splitPolygon(a, b) {
    var a2 = new Node(a.i, a.x, a.y),
        b2 = new Node(b.i, b.x, b.y),
        an = a.next,
        bp = b.prev;

    a.next = b;
    b.prev = a;

    a2.next = an;
    an.prev = a2;

    b2.next = a2;
    a2.prev = b2;

    bp.next = b2;
    b2.prev = bp;

    return b2;
}

// create a node and optionally link it with previous one (in a circular doubly linked list)
function insertNode(i, x, y, last) {
    var p = new Node(i, x, y);

    if (!last) {
        p.prev = p;
        p.next = p;

    } else {
        p.next = last.next;
        p.prev = last;
        last.next.prev = p;
        last.next = p;
    }
    return p;
}

function removeNode(p) {
    p.next.prev = p.prev;
    p.prev.next = p.next;

    if (p.prevZ) p.prevZ.nextZ = p.nextZ;
    if (p.nextZ) p.nextZ.prevZ = p.prevZ;
}

function Node(i, x, y) {
    // vertex index in coordinates array
    this.i = i;

    // vertex coordinates
    this.x = x;
    this.y = y;

    // previous and next vertex nodes in a polygon ring
    this.prev = null;
    this.next = null;

    // z-order curve value
    this.z = null;

    // previous and next nodes in z-order
    this.prevZ = null;
    this.nextZ = null;

    // indicates whether this is a steiner point
    this.steiner = false;
}

// return a percentage difference between the polygon area and its triangulation area;
// used to verify correctness of triangulation
earcut.deviation = function (data, holeIndices, dim, triangles) {
    var hasHoles = holeIndices && holeIndices.length;
    var outerLen = hasHoles ? holeIndices[0] * dim : data.length;

    var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));
    if (hasHoles) {
        for (var i = 0, len = holeIndices.length; i < len; i++) {
            var start = holeIndices[i] * dim;
            var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;
            polygonArea -= Math.abs(signedArea(data, start, end, dim));
        }
    }

    var trianglesArea = 0;
    for (i = 0; i < triangles.length; i += 3) {
        var a = triangles[i] * dim;
        var b = triangles[i + 1] * dim;
        var c = triangles[i + 2] * dim;
        trianglesArea += Math.abs(
            (data[a] - data[c]) * (data[b + 1] - data[a + 1]) -
            (data[a] - data[b]) * (data[c + 1] - data[a + 1]));
    }

    return polygonArea === 0 && trianglesArea === 0 ? 0 :
        Math.abs((trianglesArea - polygonArea) / polygonArea);
};

function signedArea(data, start, end, dim) {
    var sum = 0;
    for (var i = start, j = end - dim; i < end; i += dim) {
        sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);
        j = i;
    }
    return sum;
}

// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts
earcut.flatten = function (data) {
    var dim = data[0][0].length,
        result = {vertices: [], holes: [], dimensions: dim},
        holeIndex = 0;

    for (var i = 0; i < data.length; i++) {
        for (var j = 0; j < data[i].length; j++) {
            for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]);
        }
        if (i > 0) {
            holeIndex += data[i - 1].length;
            result.holes.push(holeIndex);
        }
    }
    return result;
};

},{}],"X9W4":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getVertexCount = getVertexCount;
exports.normalize = normalize;
exports.getSurfaceIndices = getSurfaceIndices;

var _earcut = _interopRequireDefault(require("earcut"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.

/* eslint-disable max-params */
// 4 data formats are supported:
// Simple Polygon: an array of points
// Complex Polygon: an array of array of points (array of rings)
//   with the first ring representing the outer hull and other rings representing holes
// Simple Flat: an array of numbers (flattened "simple polygon")
// Complex Flat: {position: array<number>, holeIndices: array<number>}
//   (flattened "complex polygon")

/**
 * Ensure a polygon is valid format
 * @param {Array|Object} polygon
 */
function validate(polygon) {
  polygon = polygon && polygon.positions || polygon;

  if (!Array.isArray(polygon) && !ArrayBuffer.isView(polygon)) {
    throw new Error('invalid polygon');
  }
}
/**
 * Check if a polygon is simple or complex
 * @param {Array} polygon - either a complex or simple polygon
 * @return {Boolean} - true if the polygon is a simple polygon (i.e. not an array of polygons)
 */


function isSimple(polygon) {
  return polygon.length >= 1 && polygon[0].length >= 2 && Number.isFinite(polygon[0][0]);
}
/**
 * Check if a simple polygon is a closed ring
 * @param {Array} simplePolygon - array of points
 * @return {Boolean} - true if the simple polygon is a closed ring
 */


function isNestedRingClosed(simplePolygon) {
  // check if first and last vertex are the same
  var p0 = simplePolygon[0];
  var p1 = simplePolygon[simplePolygon.length - 1];
  return p0[0] === p1[0] && p0[1] === p1[1] && p0[2] === p1[2];
}
/**
 * Check if a simple flat array is a closed ring
 * @param {Array} positions - array of numbers
 * @param {Number} size - size of a position, 2 (xy) or 3 (xyz)
 * @param {Number} startIndex - start index of the path in the positions array
 * @param {Number} endIndex - end index of the path in the positions array
 * @return {Boolean} - true if the simple flat array is a closed ring
 */


function isFlatRingClosed(positions, size, startIndex, endIndex) {
  for (var i = 0; i < size; i++) {
    if (positions[startIndex + i] !== positions[endIndex - size + i]) {
      return false;
    }
  }

  return true;
}
/**
 * Copy a simple polygon coordinates into a flat array, closes the ring if needed.
 * @param {Float64Array} target - destination
 * @param {Number} targetStartIndex - index in the destination to start copying into
 * @param {Array} simplePolygon - array of points
 * @param {Number} size - size of a position, 2 (xy) or 3 (xyz)
 * @returns {Number} - the index of the write head in the destination
 */


function copyNestedRing(target, targetStartIndex, simplePolygon, size) {
  var targetIndex = targetStartIndex;
  var len = simplePolygon.length;

  for (var i = 0; i < len; i++) {
    for (var j = 0; j < size; j++) {
      target[targetIndex++] = simplePolygon[i][j] || 0;
    }
  }

  if (!isNestedRingClosed(simplePolygon)) {
    for (var _j = 0; _j < size; _j++) {
      target[targetIndex++] = simplePolygon[0][_j] || 0;
    }
  }

  return targetIndex;
}
/**
 * Copy a simple flat array into another flat array, closes the ring if needed.
 * @param {Float64Array} target - destination
 * @param {Number} targetStartIndex - index in the destination to start copying into
 * @param {Array} positions - array of numbers
 * @param {Number} size - size of a position, 2 (xy) or 3 (xyz)
 * @param {Number} [srcStartIndex] - start index of the path in the positions array
 * @param {Number} [srcEndIndex] - end index of the path in the positions array
 * @returns {Number} - the index of the write head in the destination
 */


function copyFlatRing(target, targetStartIndex, positions, size) {
  var srcStartIndex = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
  var srcEndIndex = arguments.length > 5 ? arguments[5] : undefined;
  srcEndIndex = srcEndIndex || positions.length;
  var srcLength = srcEndIndex - srcStartIndex;

  if (srcLength <= 0) {
    return targetStartIndex;
  }

  var targetIndex = targetStartIndex;

  for (var i = 0; i < srcLength; i++) {
    target[targetIndex++] = positions[srcStartIndex + i];
  }

  if (!isFlatRingClosed(positions, size, srcStartIndex, srcEndIndex)) {
    for (var _i = 0; _i < size; _i++) {
      target[targetIndex++] = positions[srcStartIndex + _i];
    }
  }

  return targetIndex;
}
/**
 * Counts the number of vertices in a simple polygon, closes the polygon if needed.
 * @param {Array} simplePolygon - array of points
 * @returns {Number} vertex count
 */


function getNestedVertexCount(simplePolygon) {
  return (isNestedRingClosed(simplePolygon) ? 0 : 1) + simplePolygon.length;
}
/**
 * Counts the number of vertices in a simple flat array, closes the polygon if needed.
 * @param {Array} positions - array of numbers
 * @param {Number} size - size of a position, 2 (xy) or 3 (xyz)
 * @param {Number} [startIndex] - start index of the path in the positions array
 * @param {Number} [endIndex] - end index of the path in the positions array
 * @returns {Number} vertex count
 */


function getFlatVertexCount(positions, size) {
  var startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  var endIndex = arguments.length > 3 ? arguments[3] : undefined;
  endIndex = endIndex || positions.length;

  if (startIndex >= endIndex) {
    return 0;
  }

  return (isFlatRingClosed(positions, size, startIndex, endIndex) ? 0 : 1) + (endIndex - startIndex) / size;
}
/**
 * Counts the number of vertices in any polygon representation.
 * @param {Array|Object} polygon
 * @param {Number} positionSize - size of a position, 2 (xy) or 3 (xyz)
 * @returns {Number} vertex count
 */


function getVertexCount(polygon, positionSize) {
  validate(polygon);

  if (polygon.positions) {
    // complex flat
    var _polygon = polygon,
        positions = _polygon.positions,
        holeIndices = _polygon.holeIndices;

    if (holeIndices) {
      var vertexCount = 0; // split the positions array into `holeIndices.length + 1` rings
      // holeIndices[-1] falls back to 0
      // holeIndices[holeIndices.length] falls back to positions.length

      for (var i = 0; i <= holeIndices.length; i++) {
        vertexCount += getFlatVertexCount(polygon.positions, positionSize, holeIndices[i - 1], holeIndices[i]);
      }

      return vertexCount;
    }

    polygon = positions;
  }

  if (Number.isFinite(polygon[0])) {
    // simple flat
    return getFlatVertexCount(polygon, positionSize);
  }

  if (!isSimple(polygon)) {
    // complex polygon
    var _vertexCount = 0;
    var _iteratorNormalCompletion = true;
    var _didIteratorError = false;
    var _iteratorError = undefined;

    try {
      for (var _iterator = polygon[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
        var simplePolygon = _step.value;
        _vertexCount += getNestedVertexCount(simplePolygon);
      }
    } catch (err) {
      _didIteratorError = true;
      _iteratorError = err;
    } finally {
      try {
        if (!_iteratorNormalCompletion && _iterator.return != null) {
          _iterator.return();
        }
      } finally {
        if (_didIteratorError) {
          throw _iteratorError;
        }
      }
    }

    return _vertexCount;
  } // simple polygon


  return getNestedVertexCount(polygon);
}
/**
 * Normalize any polygon representation into the "complex flat" format
 * @param {Array|Object} polygon
 * @param {Number} positionSize - size of a position, 2 (xy) or 3 (xyz)
 * @param {Number} [vertexCount] - pre-computed vertex count in the polygon.
 *   If provided, will skip counting.
 * @return {Object} - {positions: <Float64Array>, holeIndices: <Array|null>}
 */

/* eslint-disable max-statements */


function normalize(polygon, positionSize, vertexCount) {
  validate(polygon);
  vertexCount = vertexCount || getVertexCount(polygon, positionSize);
  var positions = new Float64Array(vertexCount * positionSize);
  var holeIndices = [];

  if (polygon.positions) {
    // complex flat
    var _polygon2 = polygon,
        srcPositions = _polygon2.positions,
        srcHoleIndices = _polygon2.holeIndices;

    if (srcHoleIndices) {
      var targetIndex = 0; // split the positions array into `holeIndices.length + 1` rings
      // holeIndices[-1] falls back to 0
      // holeIndices[holeIndices.length] falls back to positions.length

      for (var i = 0; i <= srcHoleIndices.length; i++) {
        targetIndex = copyFlatRing(positions, targetIndex, srcPositions, positionSize, srcHoleIndices[i - 1], srcHoleIndices[i]);
        holeIndices.push(targetIndex);
      } // The last one is not a starting index of a hole, remove


      holeIndices.pop();
      return {
        positions: positions,
        holeIndices: holeIndices
      };
    }

    polygon = srcPositions;
  }

  if (Number.isFinite(polygon[0])) {
    // simple flat
    copyFlatRing(positions, 0, polygon, positionSize);
    return {
      positions: positions,
      holeIndices: null
    };
  }

  if (!isSimple(polygon)) {
    // complex polygon
    var _targetIndex = 0;
    var _iteratorNormalCompletion2 = true;
    var _didIteratorError2 = false;
    var _iteratorError2 = undefined;

    try {
      for (var _iterator2 = polygon[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
        var simplePolygon = _step2.value;
        _targetIndex = copyNestedRing(positions, _targetIndex, simplePolygon, positionSize);
        holeIndices.push(_targetIndex);
      } // The last one is not a starting index of a hole, remove

    } catch (err) {
      _didIteratorError2 = true;
      _iteratorError2 = err;
    } finally {
      try {
        if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
          _iterator2.return();
        }
      } finally {
        if (_didIteratorError2) {
          throw _iteratorError2;
        }
      }
    }

    holeIndices.pop(); // last index points to the end of the array, remove it

    return {
      positions: positions,
      holeIndices: holeIndices
    };
  } // simple polygon


  copyNestedRing(positions, 0, polygon, positionSize);
  return {
    positions: positions,
    holeIndices: null
  };
}
/* eslint-enable max-statements */

/*
 * Get vertex indices for drawing polygon mesh
 * @param {Object} normalizedPolygon - {positions, holeIndices}
 * @param {Number} positionSize - size of a position, 2 (xy) or 3 (xyz)
 * @returns {Array} array of indices
 */


function getSurfaceIndices(normalizedPolygon, positionSize) {
  var holeIndices = null;

  if (normalizedPolygon.holeIndices) {
    holeIndices = normalizedPolygon.holeIndices.map(function (positionIndex) {
      return positionIndex / positionSize;
    });
  } // Let earcut triangulate the polygon


  return (0, _earcut.default)(normalizedPolygon.positions, holeIndices, positionSize);
}
},{"earcut":"qpyO"}],"TqB0":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var Polygon = _interopRequireWildcard(require("./polygon"));

var _core = require("@deck.gl/core");

var _luma = require("luma.gl");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
// Handles tesselation of polygons with holes
// - 2D surfaces
// - 2D outlines
// - 3D surfaces (top and sides only)
// - 3D wireframes (not yet)


var Tesselator = _core.experimental.Tesselator;
var fp64LowPart = _luma.fp64.fp64LowPart; // colorArray is used to copy over color values if the passed color is an RGB
// array instead of RGBA

var colorArray = [0, 0, 0, 255]; // This class is set up to allow querying one attribute at a time
// the way the AttributeManager expects it

var PolygonTesselator =
/*#__PURE__*/
function (_Tesselator) {
  _inherits(PolygonTesselator, _Tesselator);

  function PolygonTesselator(_ref) {
    var data = _ref.data,
        getGeometry = _ref.getGeometry,
        fp64 = _ref.fp64,
        positionFormat = _ref.positionFormat,
        _ref$IndexType = _ref.IndexType,
        IndexType = _ref$IndexType === void 0 ? Uint32Array : _ref$IndexType;

    _classCallCheck(this, PolygonTesselator);

    return _possibleConstructorReturn(this, _getPrototypeOf(PolygonTesselator).call(this, {
      data: data,
      getGeometry: getGeometry,
      fp64: fp64,
      positionFormat: positionFormat,
      attributes: {
        positions: {
          size: 3
        },
        positions64xyLow: {
          size: 2,
          fp64Only: true
        },
        vertexValid: {
          type: Uint8ClampedArray,
          size: 1
        },
        indices: {
          type: IndexType,
          size: 1
        }
      }
    }));
  }
  /* Getters */


  _createClass(PolygonTesselator, [{
    key: "get",
    value: function get(attributeName, target, accessor) {
      if (attributeName === 'indices') {
        return this.attributes.indices.subarray(0, this.vertexCount);
      }

      if (this.attributes[attributeName]) {
        return this.attributes[attributeName];
      }

      switch (attributeName) {
        case 'elevations':
          return this._updateAttribute({
            target: target,
            size: 1,
            getValue: function getValue(object) {
              return [accessor(object)];
            }
          });

        case 'colors':
          return this._updateAttribute({
            target: target,
            size: 4,
            getValue: function getValue(object) {
              var color = accessor(object);

              if (color.length === 4) {
                return color;
              }

              colorArray[0] = color[0];
              colorArray[1] = color[1];
              colorArray[2] = color[2];
              return colorArray;
            }
          });

        case 'pickingColors':
          return this._updateAttribute({
            target: target,
            size: 3,
            getValue: function getValue(object, index) {
              return accessor(index);
            }
          });

        default:
          return null;
      }
    }
    /* Implement base Tesselator interface */

  }, {
    key: "getGeometrySize",
    value: function getGeometrySize(polygon) {
      return Polygon.getVertexCount(polygon, this.positionSize);
    }
  }, {
    key: "updateGeometryAttributes",
    value: function updateGeometryAttributes(polygon, context) {
      polygon = Polygon.normalize(polygon, this.positionSize, context.geometrySize);

      this._updateIndices(polygon, context);

      this._updatePositions(polygon, context);
    } // Flatten the indices array

  }, {
    key: "_updateIndices",
    value: function _updateIndices(polygon, _ref2) {
      var geometryIndex = _ref2.geometryIndex,
          offset = _ref2.vertexStart,
          indexStart = _ref2.indexStart;
      var attributes = this.attributes,
          indexLayout = this.indexLayout,
          typedArrayManager = this.typedArrayManager;
      var target = attributes.indices;
      var currentLength = target.length;
      var i = indexStart; // 1. get triangulated indices for the internal areas

      var indices = Polygon.getSurfaceIndices(polygon, this.positionSize); // make sure the buffer is large enough

      if (currentLength < i + indices.length) {
        currentLength = (i + indices.length) * 2;
        target = typedArrayManager.allocate(target, currentLength, {
          type: target.constructor,
          size: 1,
          copy: true
        });
      } // 2. offset each index by the number of indices in previous polygons


      for (var j = 0; j < indices.length; j++) {
        target[i++] = indices[j] + offset;
      }

      indexLayout[geometryIndex] = indices.length;
      attributes.indices = target;
    } // Flatten out all the vertices of all the sub subPolygons

  }, {
    key: "_updatePositions",
    value: function _updatePositions(polygon, _ref3) {
      var vertexStart = _ref3.vertexStart,
          geometrySize = _ref3.geometrySize;
      var _this$attributes = this.attributes,
          positions = _this$attributes.positions,
          positions64xyLow = _this$attributes.positions64xyLow,
          vertexValid = _this$attributes.vertexValid,
          fp64 = this.fp64,
          positionSize = this.positionSize;
      var i = vertexStart;
      var polygonPositions = polygon.positions,
          holeIndices = polygon.holeIndices;

      for (var j = 0; j < geometrySize; j++) {
        var x = polygonPositions[j * positionSize];
        var y = polygonPositions[j * positionSize + 1];
        var z = positionSize > 2 ? polygonPositions[j * positionSize + 2] : 0;
        positions[i * 3] = x;
        positions[i * 3 + 1] = y;
        positions[i * 3 + 2] = z;

        if (fp64) {
          positions64xyLow[i * 2] = fp64LowPart(x);
          positions64xyLow[i * 2 + 1] = fp64LowPart(y);
        }

        vertexValid[i] = 1;
        i++;
      }
      /* We are reusing the some buffer for `nextPositions` by offseting one vertex
       * to the left. As a result,
       * the last vertex of each ring overlaps with the first vertex of the next ring.
       * `vertexValid` is used to mark the end of each ring so we don't draw these
       * segments:
        positions      A0 A1 A2 A3 A4 B0 B1 B2 C0 ...
        nextPositions  A1 A2 A3 A4 B0 B1 B2 C0 C1 ...
        vertexValid    1  1  1  1  0  1  1  0  1 ...
       */


      if (holeIndices) {
        for (var _j = 0; _j < holeIndices.length; _j++) {
          vertexValid[vertexStart + holeIndices[_j] / positionSize - 1] = 0;
        }
      }

      vertexValid[vertexStart + geometrySize - 1] = 0;
    }
  }]);

  return PolygonTesselator;
}(Tesselator);

exports.default = PolygonTesselator;
},{"./polygon":"X9W4","@deck.gl/core":"Tk4X","luma.gl":"GAQa"}],"bhpf":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var _default = "#define SHADER_NAME solid-polygon-layer-vertex-shader\n\nattribute vec2 vertexPositions;\nattribute float vertexValid;\nattribute vec3 positions;\nattribute vec2 positions64xyLow;\nattribute vec3 nextPositions;\nattribute vec2 nextPositions64xyLow;\nattribute float elevations;\nattribute vec4 fillColors;\nattribute vec4 lineColors;\nattribute vec3 pickingColors;\n\nuniform bool isSideVertex;\nuniform bool extruded;\nuniform bool isWireframe;\nuniform float elevationScale;\nuniform float opacity;\n\nvarying vec4 vColor;\nvarying float isValid;\n\nvoid main(void) {\n  vec3 pos;\n  vec2 pos64xyLow;\n  vec3 normal;\n  vec4 colors = isWireframe ? lineColors : fillColors;\n\n  if (isSideVertex) {\n    pos = mix(positions, nextPositions, vertexPositions.x);\n    pos64xyLow = mix(positions64xyLow, nextPositions64xyLow, vertexPositions.x);\n    isValid = vertexValid;\n  } else {\n    pos = positions;\n    pos64xyLow = positions64xyLow;\n    isValid = 1.0;\n  }\n  if (extruded) {\n    pos.z += elevations * vertexPositions.y;\n  }\n  pos.z *= elevationScale;\n\n  vec4 position_worldspace;\n  gl_Position = project_position_to_clipspace(pos, pos64xyLow, vec3(0.), position_worldspace);\n\n  float lightWeight = 1.0;\n  \n  if (extruded) {\n    if (isSideVertex) {\n      normal = vec3(positions.y - nextPositions.y, nextPositions.x - positions.x, 0.0);\n      normal = project_normal(normal);\n    } else {\n      normal = vec3(0.0, 0.0, 1.0);\n    }\n\n    lightWeight = lighting_getLightWeight(position_worldspace.xyz, normal);\n  }\n\n  vec3 lightWeightedColor = lightWeight * colors.rgb;\n  vColor = vec4(lightWeightedColor, colors.a * opacity) / 255.0;\n\n  // Set color to be rendered to picking fbo (also used to check for selection highlight).\n  picking_setPickingColor(pickingColors);\n}\n";
exports.default = _default;
},{}],"xORQ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var _default = "#define SHADER_NAME solid-polygon-layer-fragment-shader\n\nprecision highp float;\n\nvarying vec4 vColor;\nvarying float isValid;\n\nvoid main(void) {\n  if (isValid < 0.5) {\n    discard;\n  }\n\n  gl_FragColor = vColor;\n\n  // use highlight color if this fragment belongs to the selected object.\n  gl_FragColor = picking_filterHighlightColor(gl_FragColor);\n\n  // use picking color if rendering to picking FBO.\n  gl_FragColor = picking_filterPickingColor(gl_FragColor);\n}\n";
exports.default = _default;
},{}],"JyaK":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _core = require("@deck.gl/core");

var _constants = _interopRequireDefault(require("luma.gl/constants"));

var _luma = require("luma.gl");

var _polygonTesselator = _interopRequireDefault(require("./polygon-tesselator"));

var _solidPolygonLayerVertex = _interopRequireDefault(require("./solid-polygon-layer-vertex.glsl"));

var _solidPolygonLayerFragment = _interopRequireDefault(require("./solid-polygon-layer-fragment.glsl"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _get(target, property, receiver) {
  if (typeof Reflect !== "undefined" && Reflect.get) {
    _get = Reflect.get;
  } else {
    _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(target, property, receiver || target);
}

function _superPropBase(object, property) {
  while (!Object.prototype.hasOwnProperty.call(object, property)) {
    object = _getPrototypeOf(object);
    if (object === null) break;
  }

  return object;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.


var DEFAULT_COLOR = [0, 0, 0, 255];
var defaultProps = {
  filled: true,
  // Whether to extrude
  extruded: false,
  // Whether to draw a GL.LINES wireframe of the polygon
  wireframe: false,
  fp64: false,
  // elevation multiplier
  elevationScale: {
    type: 'number',
    min: 0,
    value: 1
  },
  // Accessor for polygon geometry
  getPolygon: {
    type: 'accessor',
    value: function value(f) {
      return f.polygon;
    }
  },
  // Accessor for extrusion height
  getElevation: {
    type: 'accessor',
    value: 1000
  },
  // Accessor for colors
  getFillColor: {
    type: 'accessor',
    value: DEFAULT_COLOR
  },
  getLineColor: {
    type: 'accessor',
    value: DEFAULT_COLOR
  },
  // Optional settings for 'lighting' shader module
  lightSettings: {}
};
var ATTRIBUTE_TRANSITION = {
  enter: function enter(value, chunk) {
    return chunk.length ? chunk.subarray(chunk.length - value.length) : value;
  }
};

var SolidPolygonLayer =
/*#__PURE__*/
function (_Layer) {
  _inherits(SolidPolygonLayer, _Layer);

  function SolidPolygonLayer() {
    _classCallCheck(this, SolidPolygonLayer);

    return _possibleConstructorReturn(this, _getPrototypeOf(SolidPolygonLayer).apply(this, arguments));
  }

  _createClass(SolidPolygonLayer, [{
    key: "getShaders",
    value: function getShaders() {
      var projectModule = this.use64bitProjection() ? 'project64' : 'project32';
      return {
        vs: _solidPolygonLayerVertex.default,
        fs: _solidPolygonLayerFragment.default,
        modules: [projectModule, 'lighting', 'picking']
      };
    }
  }, {
    key: "initializeState",
    value: function initializeState() {
      var gl = this.context.gl;
      this.setState({
        numInstances: 0,
        polygonTesselator: new _polygonTesselator.default({
          IndexType: !gl || (0, _luma.hasFeature)(gl, _luma.FEATURES.ELEMENT_INDEX_UINT32) ? Uint32Array : Uint16Array
        })
      });
      var attributeManager = this.getAttributeManager();
      var noAlloc = true;
      attributeManager.remove(['instancePickingColors']);
      /* eslint-disable max-len */

      attributeManager.add({
        indices: {
          size: 1,
          isIndexed: true,
          update: this.calculateIndices,
          noAlloc: noAlloc
        },
        positions: {
          size: 3,
          transition: ATTRIBUTE_TRANSITION,
          accessor: 'getPolygon',
          update: this.calculatePositions,
          noAlloc: noAlloc
        },
        positions64xyLow: {
          size: 2,
          update: this.calculatePositionsLow,
          noAlloc: noAlloc
        },
        vertexValid: {
          size: 1,
          type: _constants.default.UNSIGNED_BYTE,
          update: this.calculateVertexValid,
          noAlloc: noAlloc
        },
        elevations: {
          size: 1,
          transition: ATTRIBUTE_TRANSITION,
          accessor: 'getElevation',
          update: this.calculateElevations
        },
        fillColors: {
          alias: 'colors',
          size: 4,
          type: _constants.default.UNSIGNED_BYTE,
          transition: ATTRIBUTE_TRANSITION,
          accessor: 'getFillColor',
          update: this.calculateFillColors,
          defaultValue: DEFAULT_COLOR
        },
        lineColors: {
          alias: 'colors',
          size: 4,
          type: _constants.default.UNSIGNED_BYTE,
          transition: ATTRIBUTE_TRANSITION,
          accessor: 'getLineColor',
          update: this.calculateLineColors,
          defaultValue: DEFAULT_COLOR
        },
        pickingColors: {
          size: 3,
          type: _constants.default.UNSIGNED_BYTE,
          update: this.calculatePickingColors
        }
      });
      /* eslint-enable max-len */
    }
  }, {
    key: "draw",
    value: function draw(_ref) {
      var uniforms = _ref.uniforms;
      var _this$props = this.props,
          extruded = _this$props.extruded,
          filled = _this$props.filled,
          wireframe = _this$props.wireframe,
          elevationScale = _this$props.elevationScale;
      var _this$state = this.state,
          topModel = _this$state.topModel,
          sideModel = _this$state.sideModel;
      var renderUniforms = Object.assign({}, uniforms, {
        extruded: Boolean(extruded),
        elevationScale: elevationScale
      }); // Note: the order is important

      if (sideModel) {
        sideModel.setUniforms(renderUniforms);

        if (wireframe) {
          sideModel.setDrawMode(_constants.default.LINE_STRIP);
          sideModel.render({
            isWireframe: true
          });
        }

        if (filled) {
          sideModel.setDrawMode(_constants.default.TRIANGLE_FAN);
          sideModel.render({
            isWireframe: false
          });
        }
      }

      if (topModel) {
        topModel.render(renderUniforms);
      }
    }
  }, {
    key: "updateState",
    value: function updateState(updateParams) {
      _get(_getPrototypeOf(SolidPolygonLayer.prototype), "updateState", this).call(this, updateParams);

      this.updateGeometry(updateParams);
      var props = updateParams.props,
          oldProps = updateParams.oldProps;
      var attributeManager = this.getAttributeManager();
      var regenerateModels = props.fp64 !== oldProps.fp64 || props.filled !== oldProps.filled || props.extruded !== oldProps.extruded;

      if (regenerateModels) {
        if (this.state.models) {
          this.state.models.forEach(function (model) {
            return model.delete();
          });
        }

        this.setState(this._getModels(this.context.gl));
        attributeManager.invalidateAll();
      }
    }
  }, {
    key: "updateGeometry",
    value: function updateGeometry(_ref2) {
      var props = _ref2.props,
          oldProps = _ref2.oldProps,
          changeFlags = _ref2.changeFlags;
      var geometryConfigChanged = changeFlags.dataChanged || props.fp64 !== oldProps.fp64 || changeFlags.updateTriggersChanged && (changeFlags.updateTriggersChanged.all || changeFlags.updateTriggersChanged.getPolygon); // When the geometry config  or the data is changed,
      // tessellator needs to be invoked

      if (geometryConfigChanged) {
        var polygonTesselator = this.state.polygonTesselator;
        polygonTesselator.updateGeometry({
          data: props.data,
          getGeometry: props.getPolygon,
          positionFormat: props.positionFormat,
          fp64: this.use64bitPositions()
        });
        this.setState({
          numInstances: polygonTesselator.instanceCount
        });
        this.getAttributeManager().invalidateAll();
      }
    }
  }, {
    key: "updateAttributes",
    value: function updateAttributes(props) {
      _get(_getPrototypeOf(SolidPolygonLayer.prototype), "updateAttributes", this).call(this, props);

      var attributes = this.getAttributeManager().getChangedAttributes({
        clearChangedFlags: true
      });
      var _this$state2 = this.state,
          topModel = _this$state2.topModel,
          sideModel = _this$state2.sideModel;
      var numInstances = this.getNumInstances();

      if (topModel) {
        if (attributes.indices) {
          var vertexCount = attributes.indices.value.length;
          topModel.setVertexCount(vertexCount);
        }

        topModel.setAttributes(attributes);
      }

      if (sideModel) {
        // Remove one to account for the offset
        sideModel.setInstanceCount(numInstances - 1);
        var newAttributes = {};

        for (var attributeName in attributes) {
          var attribute = attributes[attributeName];

          if (attributeName !== 'indices') {
            // Apply layout override to the attribute.
            newAttributes[attributeName] = Object.assign({}, attribute, {
              isInstanced: true,
              buffer: attribute.getBuffer()
            });
          }
        }

        if (newAttributes.positions) {
          newAttributes.nextPositions = Object.assign({}, newAttributes.positions, {
            id: 'nextPositions',
            offset: 12 // 1 vertex * 3 floats * 4 bits

          });
        }

        if (newAttributes.positions64xyLow) {
          newAttributes.nextPositions64xyLow = Object.assign({}, newAttributes.positions64xyLow, {
            id: 'nextPositions64xyLow',
            offset: 8 // 1 vertex * 2 floats * 4 bits

          });
        }

        sideModel.setAttributes(newAttributes);
      }
    }
  }, {
    key: "_getModels",
    value: function _getModels(gl) {
      var _this$props2 = this.props,
          id = _this$props2.id,
          filled = _this$props2.filled,
          extruded = _this$props2.extruded;
      var topModel;
      var sideModel;

      if (filled) {
        topModel = new _luma.Model(gl, Object.assign({}, this.getShaders(), {
          id: "".concat(id, "-top"),
          geometry: new _luma.Geometry({
            drawMode: _constants.default.TRIANGLES,
            attributes: {
              vertexPositions: {
                size: 2,
                constant: true,
                value: new Float32Array([0, 1])
              },
              nextPositions: {
                size: 3,
                constant: true,
                value: new Float32Array(3)
              },
              nextPositions64xyLow: {
                size: 2,
                constant: true,
                value: new Float32Array(2)
              }
            }
          }),
          uniforms: {
            isWireframe: false,
            isSideVertex: false
          },
          vertexCount: 0,
          isIndexed: true,
          shaderCache: this.context.shaderCache
        }));
      }

      if (extruded) {
        sideModel = new _luma.Model(gl, Object.assign({}, this.getShaders(), {
          id: "".concat(id, "-side"),
          geometry: new _luma.Geometry({
            drawMode: _constants.default.LINES,
            vertexCount: 4,
            attributes: {
              // top right - top left - bootom left - bottom right
              vertexPositions: {
                size: 2,
                value: new Float32Array([1, 1, 0, 1, 0, 0, 1, 0])
              }
            }
          }),
          uniforms: {
            isSideVertex: true
          },
          isInstanced: 1,
          shaderCache: this.context.shaderCache
        }));
      }

      return {
        models: [sideModel, topModel].filter(Boolean),
        topModel: topModel,
        sideModel: sideModel
      };
    }
  }, {
    key: "calculateIndices",
    value: function calculateIndices(attribute) {
      var polygonTesselator = this.state.polygonTesselator;
      attribute.bufferLayout = polygonTesselator.indexLayout;
      attribute.value = polygonTesselator.get('indices');
    }
  }, {
    key: "calculatePositions",
    value: function calculatePositions(attribute) {
      var polygonTesselator = this.state.polygonTesselator;
      attribute.bufferLayout = polygonTesselator.bufferLayout;
      attribute.value = polygonTesselator.get('positions');
    }
  }, {
    key: "calculatePositionsLow",
    value: function calculatePositionsLow(attribute) {
      var isFP64 = this.use64bitPositions();
      attribute.constant = !isFP64;

      if (!isFP64) {
        attribute.value = new Float32Array(2);
        return;
      }

      attribute.value = this.state.polygonTesselator.get('positions64xyLow');
    }
  }, {
    key: "calculateVertexValid",
    value: function calculateVertexValid(attribute) {
      attribute.value = this.state.polygonTesselator.get('vertexValid');
    }
  }, {
    key: "calculateElevations",
    value: function calculateElevations(attribute) {
      var polygonTesselator = this.state.polygonTesselator;
      attribute.bufferLayout = polygonTesselator.bufferLayout;
      var _this$props3 = this.props,
          extruded = _this$props3.extruded,
          getElevation = _this$props3.getElevation;

      if (extruded) {
        attribute.constant = false;
        attribute.value = polygonTesselator.get('elevations', attribute.value, getElevation);
      } else {
        attribute.constant = true;
        attribute.value = new Float32Array(1);
      }
    }
  }, {
    key: "calculateFillColors",
    value: function calculateFillColors(attribute) {
      var polygonTesselator = this.state.polygonTesselator;
      attribute.bufferLayout = polygonTesselator.bufferLayout;
      attribute.value = polygonTesselator.get('colors', attribute.value, this.props.getFillColor);
    }
  }, {
    key: "calculateLineColors",
    value: function calculateLineColors(attribute) {
      var polygonTesselator = this.state.polygonTesselator;
      attribute.bufferLayout = polygonTesselator.bufferLayout;
      attribute.value = polygonTesselator.get('colors', attribute.value, this.props.getLineColor);
    } // Override the default picking colors calculation

  }, {
    key: "calculatePickingColors",
    value: function calculatePickingColors(attribute) {
      var _this = this;

      var pickingColor = [];
      attribute.value = this.state.polygonTesselator.get('pickingColors', attribute.value, function (index) {
        return _this.encodePickingColor(index, pickingColor);
      });
    }
  }, {
    key: "clearPickingColor",
    value: function clearPickingColor(color) {
      var pickedPolygonIndex = this.decodePickingColor(color);
      var bufferLayout = this.state.polygonTesselator.bufferLayout;
      var numVertices = bufferLayout[pickedPolygonIndex];
      var startInstanceIndex = 0;

      for (var polygonIndex = 0; polygonIndex < pickedPolygonIndex; polygonIndex++) {
        startInstanceIndex += bufferLayout[polygonIndex];
      }

      var pickingColors = this.getAttributeManager().attributes.pickingColors;
      var value = pickingColors.value;
      var endInstanceIndex = startInstanceIndex + numVertices;
      value.fill(0, startInstanceIndex * 3, endInstanceIndex * 3);
      pickingColors.update({
        value: value
      });
    }
  }]);

  return SolidPolygonLayer;
}(_core.Layer);

exports.default = SolidPolygonLayer;
SolidPolygonLayer.layerName = 'SolidPolygonLayer';
SolidPolygonLayer.defaultProps = defaultProps;
},{"@deck.gl/core":"Tk4X","luma.gl/constants":"lMsC","luma.gl":"GAQa","./polygon-tesselator":"TqB0","./solid-polygon-layer-vertex.glsl":"bhpf","./solid-polygon-layer-fragment.glsl":"xORQ"}],"NzqK":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _core = require("@deck.gl/core");

var _solidPolygonLayer = _interopRequireDefault(require("../solid-polygon-layer/solid-polygon-layer"));

var _pathLayer = _interopRequireDefault(require("../path-layer/path-layer"));

var Polygon = _interopRequireWildcard(require("../solid-polygon-layer/polygon"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.


var defaultLineColor = [0, 0, 0, 255];
var defaultFillColor = [0, 0, 0, 255];
var defaultProps = {
  stroked: true,
  filled: true,
  extruded: false,
  elevationScale: 1,
  wireframe: false,
  lineWidthScale: 1,
  lineWidthMinPixels: 0,
  lineWidthMaxPixels: Number.MAX_SAFE_INTEGER,
  lineJointRounded: false,
  lineMiterLimit: 4,
  lineDashJustified: false,
  fp64: false,
  getPolygon: {
    type: 'accessor',
    value: function value(f) {
      return f.polygon;
    }
  },
  // Polygon fill color
  getFillColor: {
    type: 'accessor',
    value: defaultFillColor
  },
  // Point, line and polygon outline color
  getLineColor: {
    type: 'accessor',
    value: defaultLineColor
  },
  // Line and polygon outline accessors
  getLineWidth: {
    type: 'accessor',
    value: 1
  },
  // Line dash array accessor
  getLineDashArray: {
    type: 'accessor',
    value: [0, 0]
  },
  // Polygon extrusion accessor
  getElevation: {
    type: 'accessor',
    value: 1000
  },
  // Optional settings for 'lighting' shader module
  lightSettings: {}
};

var PolygonLayer =
/*#__PURE__*/
function (_CompositeLayer) {
  _inherits(PolygonLayer, _CompositeLayer);

  function PolygonLayer() {
    _classCallCheck(this, PolygonLayer);

    return _possibleConstructorReturn(this, _getPrototypeOf(PolygonLayer).apply(this, arguments));
  }

  _createClass(PolygonLayer, [{
    key: "initializeState",
    value: function initializeState() {
      this.state = {
        paths: []
      };
    }
  }, {
    key: "updateState",
    value: function updateState(_ref) {
      var oldProps = _ref.oldProps,
          props = _ref.props,
          changeFlags = _ref.changeFlags;
      var geometryChanged = changeFlags.dataChanged || changeFlags.updateTriggersChanged && (changeFlags.updateTriggersChanged.all || changeFlags.updateTriggersChanged.getPolygon);

      if (geometryChanged) {
        this.state.paths = this._getPaths(props);
      }
    }
  }, {
    key: "getPickingInfo",
    value: function getPickingInfo(_ref2) {
      var info = _ref2.info;
      return Object.assign(info, {
        // override object with picked data
        object: info.object && info.object.object || info.object
      });
    }
  }, {
    key: "_getPaths",
    value: function _getPaths(_ref3) {
      var data = _ref3.data,
          getPolygon = _ref3.getPolygon,
          positionFormat = _ref3.positionFormat;
      var paths = [];
      var positionSize = positionFormat === 'XY' ? 2 : 3;
      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = data[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var object = _step.value;

          var _Polygon$normalize = Polygon.normalize(getPolygon(object), positionSize),
              positions = _Polygon$normalize.positions,
              holeIndices = _Polygon$normalize.holeIndices;

          if (holeIndices) {
            // split the positions array into `holeIndices.length + 1` rings
            // holeIndices[-1] falls back to 0
            // holeIndices[holeIndices.length] falls back to positions.length
            for (var i = 0; i <= holeIndices.length; i++) {
              var path = positions.subarray(holeIndices[i - 1] || 0, holeIndices[i] || positions.length);
              paths.push({
                path: path,
                object: object
              });
            }
          } else {
            paths.push({
              path: positions,
              object: object
            });
          }
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return != null) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }

      return paths;
    }
  }, {
    key: "_getAccessor",
    value: function _getAccessor(accessor) {
      if (typeof accessor === 'function') {
        return function (x) {
          return accessor(x.object);
        };
      }

      return accessor;
    }
    /* eslint-disable complexity */

  }, {
    key: "renderLayers",
    value: function renderLayers() {
      // Layer composition props
      var _this$props = this.props,
          data = _this$props.data,
          stroked = _this$props.stroked,
          filled = _this$props.filled,
          extruded = _this$props.extruded,
          wireframe = _this$props.wireframe,
          elevationScale = _this$props.elevationScale,
          transitions = _this$props.transitions; // Rendering props underlying layer

      var _this$props2 = this.props,
          lineWidthScale = _this$props2.lineWidthScale,
          lineWidthMinPixels = _this$props2.lineWidthMinPixels,
          lineWidthMaxPixels = _this$props2.lineWidthMaxPixels,
          lineJointRounded = _this$props2.lineJointRounded,
          lineMiterLimit = _this$props2.lineMiterLimit,
          lineDashJustified = _this$props2.lineDashJustified,
          fp64 = _this$props2.fp64; // Accessor props for underlying layers

      var _this$props3 = this.props,
          getFillColor = _this$props3.getFillColor,
          getLineColor = _this$props3.getLineColor,
          getLineWidth = _this$props3.getLineWidth,
          getLineDashArray = _this$props3.getLineDashArray,
          getElevation = _this$props3.getElevation,
          getPolygon = _this$props3.getPolygon,
          updateTriggers = _this$props3.updateTriggers,
          lightSettings = _this$props3.lightSettings;
      var paths = this.state.paths;
      var FillLayer = this.getSubLayerClass('fill', _solidPolygonLayer.default);
      var StrokeLayer = this.getSubLayerClass('stroke', _pathLayer.default); // Filled Polygon Layer

      var polygonLayer = this.shouldRenderSubLayer('fill', paths) && new FillLayer({
        extruded: extruded,
        elevationScale: elevationScale,
        fp64: fp64,
        filled: filled,
        wireframe: wireframe,
        getElevation: getElevation,
        getFillColor: getFillColor,
        getLineColor: getLineColor,
        lightSettings: lightSettings,
        transitions: transitions
      }, this.getSubLayerProps({
        id: 'fill',
        updateTriggers: {
          getPolygon: updateTriggers.getPolygon,
          getElevation: updateTriggers.getElevation,
          getFillColor: updateTriggers.getFillColor,
          getLineColor: updateTriggers.getLineColor
        }
      }), {
        data: data,
        getPolygon: getPolygon
      }); // Polygon line layer

      var polygonLineLayer = !extruded && stroked && this.shouldRenderSubLayer('stroke', paths) && new StrokeLayer({
        fp64: fp64,
        widthScale: lineWidthScale,
        widthMinPixels: lineWidthMinPixels,
        widthMaxPixels: lineWidthMaxPixels,
        rounded: lineJointRounded,
        miterLimit: lineMiterLimit,
        dashJustified: lineDashJustified,
        transitions: transitions && {
          getWidth: transitions.getLineWidth,
          getColor: transitions.getLineColor,
          getPath: transitions.getPolygon
        },
        getColor: this._getAccessor(getLineColor),
        getWidth: this._getAccessor(getLineWidth),
        getDashArray: this._getAccessor(getLineDashArray)
      }, this.getSubLayerProps({
        id: 'stroke',
        updateTriggers: {
          getWidth: updateTriggers.getLineWidth,
          getColor: updateTriggers.getLineColor,
          getDashArray: updateTriggers.getLineDashArray
        }
      }), {
        data: paths,
        getPath: function getPath(x) {
          return x.path;
        }
      });
      return [// If not extruded: flat fill layer is drawn below outlines
      !extruded && polygonLayer, polygonLineLayer, // If extruded: draw fill layer last for correct blending behavior
      extruded && polygonLayer];
    }
    /* eslint-enable complexity */

  }]);

  return PolygonLayer;
}(_core.CompositeLayer);

exports.default = PolygonLayer;
PolygonLayer.layerName = 'PolygonLayer';
PolygonLayer.defaultProps = defaultProps;
},{"@deck.gl/core":"Tk4X","../solid-polygon-layer/solid-polygon-layer":"JyaK","../path-layer/path-layer":"H5W6","../solid-polygon-layer/polygon":"X9W4"}],"chCy":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = assert;
exports.getGeojsonFeatures = getGeojsonFeatures;
exports.separateGeojsonFeatures = separateGeojsonFeatures;
exports.unwrapSourceFeature = unwrapSourceFeature;
exports.unwrapSourceFeatureIndex = unwrapSourceFeatureIndex;

// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
// Replacement for the external assert method to reduce bundle size
// Since GeoJSON format issues are common to users we do show messages in
// this case
function assert(condition, message) {
  if (!condition) {
    throw new Error("deck.gl: ".concat(message));
  }
}
/**
 * "Normalizes" complete or partial GeoJSON data into iterable list of features
 * Can accept GeoJSON geometry or "Feature", "FeatureCollection" in addition
 * to plain arrays and iterables.
 * Works by extracting the feature array or wrapping single objects in an array,
 * so that subsequent code can simply iterate over features.
 *
 * @param {object} geojson - geojson data
 * @param {Object|Array} data - geojson object (FeatureCollection, Feature or
 *  Geometry) or array of features
 * @return {Array|"iteratable"} - iterable list of features
 */


function getGeojsonFeatures(geojson) {
  // If array, assume this is a list of features
  if (Array.isArray(geojson)) {
    return geojson;
  }

  assert(geojson.type, 'GeoJSON does not have type');

  switch (geojson.type) {
    case 'Feature':
      // Wrap the feature in a 'Features' array
      return [geojson];

    case 'FeatureCollection':
      // Just return the 'Features' array from the collection
      assert(Array.isArray(geojson.features), 'GeoJSON does not have features array');
      return geojson.features;

    default:
      // Assume it's a geometry, we'll check type in separateGeojsonFeatures
      // Wrap the geometry object in a 'Feature' object and wrap in an array
      return [{
        geometry: geojson
      }];
  }
} // Linearize


function separateGeojsonFeatures(features) {
  var separated = {
    pointFeatures: [],
    lineFeatures: [],
    polygonFeatures: [],
    polygonOutlineFeatures: []
  };

  for (var featureIndex = 0; featureIndex < features.length; featureIndex++) {
    var feature = features[featureIndex];
    assert(feature && feature.geometry, 'GeoJSON does not have geometry');
    var geometry = feature.geometry;
    var sourceFeature = {
      feature: feature,
      index: featureIndex
    };

    if (geometry.type === 'GeometryCollection') {
      assert(Array.isArray(geometry.geometries), 'GeoJSON does not have geometries array');
      var geometries = geometry.geometries;

      for (var i = 0; i < geometries.length; i++) {
        var subGeometry = geometries[i];
        separateGeometry(subGeometry, separated, sourceFeature);
      }
    } else {
      separateGeometry(geometry, separated, sourceFeature);
    }
  }

  return separated;
}

function separateGeometry(geometry, separated, sourceFeature) {
  var type = geometry.type,
      coordinates = geometry.coordinates;
  var pointFeatures = separated.pointFeatures,
      lineFeatures = separated.lineFeatures,
      polygonFeatures = separated.polygonFeatures,
      polygonOutlineFeatures = separated.polygonOutlineFeatures;
  checkCoordinates(type, coordinates); // Split each feature, but keep track of the source feature and index (for Multi* geometries)

  switch (type) {
    case 'Point':
      pointFeatures.push({
        geometry: geometry,
        sourceFeature: sourceFeature
      });
      break;

    case 'MultiPoint':
      coordinates.forEach(function (point) {
        pointFeatures.push({
          geometry: {
            type: 'Point',
            coordinates: point
          },
          sourceFeature: sourceFeature
        });
      });
      break;

    case 'LineString':
      lineFeatures.push({
        geometry: geometry,
        sourceFeature: sourceFeature
      });
      break;

    case 'MultiLineString':
      // Break multilinestrings into multiple lines
      coordinates.forEach(function (path) {
        lineFeatures.push({
          geometry: {
            type: 'LineString',
            coordinates: path
          },
          sourceFeature: sourceFeature
        });
      });
      break;

    case 'Polygon':
      polygonFeatures.push({
        geometry: geometry,
        sourceFeature: sourceFeature
      }); // Break polygon into multiple lines

      coordinates.forEach(function (path) {
        polygonOutlineFeatures.push({
          geometry: {
            type: 'LineString',
            coordinates: path
          },
          sourceFeature: sourceFeature
        });
      });
      break;

    case 'MultiPolygon':
      // Break multipolygons into multiple polygons
      coordinates.forEach(function (polygon) {
        polygonFeatures.push({
          geometry: {
            type: 'Polygon',
            coordinates: polygon
          },
          sourceFeature: sourceFeature
        }); // Break polygon into multiple lines

        polygon.forEach(function (path) {
          polygonOutlineFeatures.push({
            geometry: {
              type: 'LineString',
              coordinates: path
            },
            sourceFeature: sourceFeature
          });
        });
      });
      break;

    default:
  }
}
/**
 * Returns the source feature that was passed to `separateGeojsonFeatures`
 */


function unwrapSourceFeature(wrappedFeature) {
  // The feature provided by the user is under `sourceFeature.feature`
  return wrappedFeature.sourceFeature.feature;
}
/**
 * Returns the index of the source feature that was passed to `separateGeojsonFeatures`
 */


function unwrapSourceFeatureIndex(wrappedFeature) {
  // The index of the feature provided by the user is under `sourceFeature.index`
  return wrappedFeature.sourceFeature.index;
}
/**
 * Simple GeoJSON validation util. For perf reasons we do not validate against the full spec,
 * only the following:
   - geometry.type is supported
   - geometry.coordinate has correct nesting level
 */


var COORDINATE_NEST_LEVEL = {
  Point: 1,
  MultiPoint: 2,
  LineString: 2,
  MultiLineString: 3,
  Polygon: 3,
  MultiPolygon: 4
};

function checkCoordinates(type, coordinates) {
  var nestLevel = COORDINATE_NEST_LEVEL[type];
  assert(nestLevel, "Unknown GeoJSON type ".concat(type));

  while (coordinates && --nestLevel > 0) {
    coordinates = coordinates[0];
  }

  assert(coordinates && Number.isFinite(coordinates[0]), "".concat(type, " coordinates are malformed"));
}
},{}],"h8vv":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _core = require("@deck.gl/core");

var _scatterplotLayer = _interopRequireDefault(require("../scatterplot-layer/scatterplot-layer"));

var _pathLayer = _interopRequireDefault(require("../path-layer/path-layer"));

var _solidPolygonLayer = _interopRequireDefault(require("../solid-polygon-layer/solid-polygon-layer"));

var _geojson = require("./geojson");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.


var defaultLineColor = [0, 0, 0, 255];
var defaultFillColor = [0, 0, 0, 255];
var defaultProps = {
  stroked: true,
  filled: true,
  extruded: false,
  wireframe: false,
  lineWidthScale: 1,
  lineWidthMinPixels: 0,
  lineWidthMaxPixels: Number.MAX_SAFE_INTEGER,
  lineJointRounded: false,
  lineMiterLimit: 4,
  elevationScale: 1,
  pointRadiusScale: 1,
  pointRadiusMinPixels: 0,
  //  min point radius in pixels
  pointRadiusMaxPixels: Number.MAX_SAFE_INTEGER,
  // max point radius in pixels
  lineDashJustified: false,
  fp64: false,
  // Line and polygon outline color
  getLineColor: {
    type: 'accessor',
    value: defaultLineColor
  },
  // Point and polygon fill color
  getFillColor: {
    type: 'accessor',
    value: defaultFillColor
  },
  // Point radius
  getRadius: {
    type: 'accessor',
    value: 1
  },
  // Line and polygon outline accessors
  getLineWidth: {
    type: 'accessor',
    value: 1
  },
  // Line dash array accessor
  getLineDashArray: {
    type: 'accessor',
    value: [0, 0]
  },
  // Polygon extrusion accessor
  getElevation: {
    type: 'accessor',
    value: 1000
  },
  // Optional settings for 'lighting' shader module
  lightSettings: {}
};

function getCoordinates(f) {
  return f.geometry.coordinates;
}
/**
 * Unwraps the real source feature passed into props and passes as the argument to `accessor`.
 */


function unwrappingAccessor(accessor) {
  if (typeof accessor !== 'function') return accessor;
  return function (feature) {
    return accessor((0, _geojson.unwrapSourceFeature)(feature));
  };
}

var GeoJsonLayer =
/*#__PURE__*/
function (_CompositeLayer) {
  _inherits(GeoJsonLayer, _CompositeLayer);

  function GeoJsonLayer() {
    _classCallCheck(this, GeoJsonLayer);

    return _possibleConstructorReturn(this, _getPrototypeOf(GeoJsonLayer).apply(this, arguments));
  }

  _createClass(GeoJsonLayer, [{
    key: "initializeState",
    value: function initializeState() {
      this.state = {
        features: {}
      };
    }
  }, {
    key: "updateState",
    value: function updateState(_ref) {
      var oldProps = _ref.oldProps,
          props = _ref.props,
          changeFlags = _ref.changeFlags;

      if (changeFlags.dataChanged) {
        var data = props.data;
        var features = (0, _geojson.getGeojsonFeatures)(data);
        this.state.features = (0, _geojson.separateGeojsonFeatures)(features);
      }
    }
  }, {
    key: "getPickingInfo",
    value: function getPickingInfo(_ref2) {
      var info = _ref2.info,
          sourceLayer = _ref2.sourceLayer; // `info.index` is the index within the particular sub-layer
      // We want to expose the index of the feature the user provided

      return Object.assign(info, {
        // override object with picked feature
        object: info.object ? (0, _geojson.unwrapSourceFeature)(info.object) : info.object,
        index: info.object ? (0, _geojson.unwrapSourceFeatureIndex)(info.object) : info.index
      });
    }
    /* eslint-disable complexity */

  }, {
    key: "renderLayers",
    value: function renderLayers() {
      var features = this.state.features;
      var pointFeatures = features.pointFeatures,
          lineFeatures = features.lineFeatures,
          polygonFeatures = features.polygonFeatures,
          polygonOutlineFeatures = features.polygonOutlineFeatures; // Layer composition props

      var _this$props = this.props,
          stroked = _this$props.stroked,
          filled = _this$props.filled,
          extruded = _this$props.extruded,
          wireframe = _this$props.wireframe,
          lightSettings = _this$props.lightSettings,
          transitions = _this$props.transitions; // Rendering props underlying layer

      var _this$props2 = this.props,
          lineWidthScale = _this$props2.lineWidthScale,
          lineWidthMinPixels = _this$props2.lineWidthMinPixels,
          lineWidthMaxPixels = _this$props2.lineWidthMaxPixels,
          lineJointRounded = _this$props2.lineJointRounded,
          lineMiterLimit = _this$props2.lineMiterLimit,
          pointRadiusScale = _this$props2.pointRadiusScale,
          pointRadiusMinPixels = _this$props2.pointRadiusMinPixels,
          pointRadiusMaxPixels = _this$props2.pointRadiusMaxPixels,
          elevationScale = _this$props2.elevationScale,
          lineDashJustified = _this$props2.lineDashJustified,
          fp64 = _this$props2.fp64; // Accessor props for underlying layers

      var _this$props3 = this.props,
          getLineColor = _this$props3.getLineColor,
          getFillColor = _this$props3.getFillColor,
          getRadius = _this$props3.getRadius,
          getLineWidth = _this$props3.getLineWidth,
          getLineDashArray = _this$props3.getLineDashArray,
          getElevation = _this$props3.getElevation,
          updateTriggers = _this$props3.updateTriggers;
      var PolygonFillLayer = this.getSubLayerClass('polygons-fill', _solidPolygonLayer.default);
      var PolygonStrokeLayer = this.getSubLayerClass('polygons-stroke', _pathLayer.default);
      var LineStringsLayer = this.getSubLayerClass('line-strings', _pathLayer.default);
      var PointsLayer = this.getSubLayerClass('points', _scatterplotLayer.default); // Filled Polygon Layer

      var polygonFillLayer = this.shouldRenderSubLayer('polygons-fill', polygonFeatures) && new PolygonFillLayer({
        fp64: fp64,
        extruded: extruded,
        elevationScale: elevationScale,
        filled: filled,
        wireframe: wireframe,
        lightSettings: lightSettings,
        getElevation: unwrappingAccessor(getElevation),
        getFillColor: unwrappingAccessor(getFillColor),
        getLineColor: unwrappingAccessor(getLineColor),
        transitions: transitions && {
          getPolygon: transitions.geometry,
          getElevation: transitions.getElevation,
          getFillColor: transitions.getFillColor,
          getLineColor: transitions.getLineColor
        }
      }, this.getSubLayerProps({
        id: 'polygons-fill',
        updateTriggers: {
          getElevation: updateTriggers.getElevation,
          getFillColor: updateTriggers.getFillColor,
          getLineColor: updateTriggers.getLineColor
        }
      }), {
        data: polygonFeatures,
        getPolygon: getCoordinates
      });
      var polygonLineLayer = !extruded && stroked && this.shouldRenderSubLayer('polygons-stroke', polygonOutlineFeatures) && new PolygonStrokeLayer({
        fp64: fp64,
        widthScale: lineWidthScale,
        widthMinPixels: lineWidthMinPixels,
        widthMaxPixels: lineWidthMaxPixels,
        rounded: lineJointRounded,
        miterLimit: lineMiterLimit,
        dashJustified: lineDashJustified,
        getColor: unwrappingAccessor(getLineColor),
        getWidth: unwrappingAccessor(getLineWidth),
        getDashArray: unwrappingAccessor(getLineDashArray),
        transitions: transitions && {
          getPath: transitions.geometry,
          getColor: transitions.getLineColor,
          getWidth: transitions.getLineWidth
        }
      }, this.getSubLayerProps({
        id: 'polygons-stroke',
        updateTriggers: {
          getColor: updateTriggers.getLineColor,
          getWidth: updateTriggers.getLineWidth,
          getDashArray: updateTriggers.getLineDashArray
        }
      }), {
        data: polygonOutlineFeatures,
        getPath: getCoordinates
      });
      var pathLayer = this.shouldRenderSubLayer('linestrings', lineFeatures) && new LineStringsLayer({
        fp64: fp64,
        widthScale: lineWidthScale,
        widthMinPixels: lineWidthMinPixels,
        widthMaxPixels: lineWidthMaxPixels,
        rounded: lineJointRounded,
        miterLimit: lineMiterLimit,
        dashJustified: lineDashJustified,
        getColor: unwrappingAccessor(getLineColor),
        getWidth: unwrappingAccessor(getLineWidth),
        getDashArray: unwrappingAccessor(getLineDashArray),
        transitions: transitions && {
          getPath: transitions.geometry,
          getColor: transitions.getLineColor,
          getWidth: transitions.getLineWidth
        }
      }, this.getSubLayerProps({
        id: 'line-strings',
        updateTriggers: {
          getColor: updateTriggers.getLineColor,
          getWidth: updateTriggers.getLineWidth,
          getDashArray: updateTriggers.getLineDashArray
        }
      }), {
        data: lineFeatures,
        getPath: getCoordinates
      });
      var pointLayer = this.shouldRenderSubLayer('points', pointFeatures) && new PointsLayer({
        fp64: fp64,
        stroked: stroked,
        filled: filled,
        radiusScale: pointRadiusScale,
        radiusMinPixels: pointRadiusMinPixels,
        radiusMaxPixels: pointRadiusMaxPixels,
        lineWidthScale: lineWidthScale,
        lineWidthMinPixels: lineWidthMinPixels,
        lineWidthMaxPixels: lineWidthMaxPixels,
        getFillColor: unwrappingAccessor(getFillColor),
        getLineColor: unwrappingAccessor(getLineColor),
        getRadius: unwrappingAccessor(getRadius),
        getLineWidth: unwrappingAccessor(getLineWidth),
        transitions: transitions && {
          getPosition: transitions.geometry,
          getFillColor: transitions.getFillColor,
          getLineColor: transitions.getLineColor,
          getRadius: transitions.getRadius,
          getLineWidth: transitions.getLineWidth
        }
      }, this.getSubLayerProps({
        id: 'points',
        updateTriggers: {
          getFillColor: updateTriggers.getFillColor,
          getLineColor: updateTriggers.getLineColor,
          getRadius: updateTriggers.getRadius,
          getLineWidth: updateTriggers.getLineWidth
        }
      }), {
        data: pointFeatures,
        getPosition: getCoordinates
      });
      return [// If not extruded: flat fill layer is drawn below outlines
      !extruded && polygonFillLayer, polygonLineLayer, pathLayer, pointLayer, // If extruded: draw fill layer last for correct blending behavior
      extruded && polygonFillLayer];
    }
    /* eslint-enable complexity */

  }]);

  return GeoJsonLayer;
}(_core.CompositeLayer);

exports.default = GeoJsonLayer;
GeoJsonLayer.layerName = 'GeoJsonLayer';
GeoJsonLayer.defaultProps = defaultProps;
},{"@deck.gl/core":"Tk4X","../scatterplot-layer/scatterplot-layer":"QcVn","../path-layer/path-layer":"H5W6","../solid-polygon-layer/solid-polygon-layer":"JyaK","./geojson":"chCy"}],"WQa7":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var _default = "#define SHADER_NAME multi-icon-layer-vertex-shader\n\nattribute vec2 positions;\n\nattribute vec3 instancePositions;\nattribute vec2 instancePositions64xyLow;\nattribute float instanceSizes;\nattribute float instanceAngles;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\nattribute vec4 instanceIconFrames;\nattribute float instanceColorModes;\nattribute vec2 instanceOffsets;\n\n// the following three attributes are for the multi-icon layer\nattribute vec2 instancePixelOffset;\n\nuniform float sizeScale;\nuniform vec2 iconsTextureDim;\nuniform float gamma;\nuniform float opacity;\n\nvarying float vColorMode;\nvarying vec4 vColor;\nvarying vec2 vTextureCoords;\nvarying float vGamma;\n\nvec2 rotate_by_angle(vec2 vertex, float angle) {\n  float angle_radian = angle * PI / 180.0;\n  float cos_angle = cos(angle_radian);\n  float sin_angle = sin(angle_radian);\n  mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle);\n  return rotationMatrix * vertex;\n}\n\nvoid main(void) {\n  vec2 iconSize = instanceIconFrames.zw;\n  // scale icon height to match instanceSize\n  float instanceScale = iconSize.y == 0.0 ? 0.0 : instanceSizes / iconSize.y;\n\n  // scale and rotate vertex in \"pixel\" value and convert back to fraction in clipspace\n  vec2 pixelOffset = positions / 2.0 * iconSize + instanceOffsets;\n\n  pixelOffset = rotate_by_angle(pixelOffset, instanceAngles) * sizeScale * instanceScale;\n  pixelOffset += instancePixelOffset;\n  pixelOffset.y *= -1.0;\n\n  gl_Position = project_position_to_clipspace(instancePositions, instancePositions64xyLow, vec3(0.0));\n  gl_Position += project_pixel_to_clipspace(pixelOffset);\n\n  vTextureCoords = mix(\n    instanceIconFrames.xy,\n    instanceIconFrames.xy + iconSize,\n    (positions.xy + 1.0) / 2.0\n  ) / iconsTextureDim;\n\n  vTextureCoords.y = 1.0 - vTextureCoords.y;\n\n  vColor = vec4(instanceColors.rgb, instanceColors.a * opacity) / 255.;\n  picking_setPickingColor(instancePickingColors);\n\n  vGamma = gamma / (sizeScale * iconSize.y);\n}\n";
exports.default = _default;
},{}],"taRj":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var _default = "#define SHADER_NAME multi-icon-layer-fragment-shader\n\nprecision highp float;\n\nuniform sampler2D iconsTexture;\nuniform float buffer;\nuniform bool sdf;\n\nvarying vec4 vColor;\nvarying vec2 vTextureCoords;\nvarying float vGamma;\n\nconst float MIN_ALPHA = 0.05;\n\nvoid main(void) {\n  vec4 texColor = texture2D(iconsTexture, vTextureCoords);\n  \n  float alpha = texColor.a;\n  // if enable sdf (signed distance fields)\n  if (sdf) {\n    float distance = texture2D(iconsTexture, vTextureCoords).a;\n    alpha = smoothstep(buffer - vGamma, buffer + vGamma, distance);\n  }\n\n  // Take the global opacity and the alpha from vColor into account for the alpha component\n  float a = alpha * vColor.a;\n\n  if (a < MIN_ALPHA) {\n    discard;\n  }\n\n  gl_FragColor = vec4(vColor.rgb, a);\n\n  // use highlight color if this fragment belongs to the selected object.\n  gl_FragColor = picking_filterHighlightColor(gl_FragColor);\n\n  // use picking color if rendering to picking FBO.\n  gl_FragColor = picking_filterPickingColor(gl_FragColor);\n}\n";
exports.default = _default;
},{}],"s2GF":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _iconLayer = _interopRequireDefault(require("../../icon-layer/icon-layer"));

var _multiIconLayerVertex = _interopRequireDefault(require("./multi-icon-layer-vertex.glsl"));

var _multiIconLayerFragment = _interopRequireDefault(require("./multi-icon-layer-fragment.glsl"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _get(target, property, receiver) {
  if (typeof Reflect !== "undefined" && Reflect.get) {
    _get = Reflect.get;
  } else {
    _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(target, property, receiver || target);
}

function _superPropBase(object, property) {
  while (!Object.prototype.hasOwnProperty.call(object, property)) {
    object = _getPrototypeOf(object);
    if (object === null) break;
  }

  return object;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.


// TODO expose as layer properties
var DEFAULT_GAMMA = 0.2;
var DEFAULT_BUFFER = 192.0 / 256;
var defaultProps = {
  getShiftInQueue: {
    type: 'accessor',
    value: function value(x) {
      return x.shift || 0;
    }
  },
  getLengthOfQueue: {
    type: 'accessor',
    value: function value(x) {
      return x.len || 1;
    }
  },
  // 1: left, 0: middle, -1: right
  getAnchorX: {
    type: 'accessor',
    value: function value(x) {
      return x.anchorX || 0;
    }
  },
  // 1: top, 0: center, -1: bottom
  getAnchorY: {
    type: 'accessor',
    value: function value(x) {
      return x.anchorY || 0;
    }
  },
  getPixelOffset: {
    type: 'accessor',
    value: [0, 0]
  },
  // object with the same pickingIndex will be picked when any one of them is being picked
  getPickingIndex: {
    type: 'accessor',
    value: function value(x) {
      return x.objectIndex;
    }
  }
};

var MultiIconLayer =
/*#__PURE__*/
function (_IconLayer) {
  _inherits(MultiIconLayer, _IconLayer);

  function MultiIconLayer() {
    _classCallCheck(this, MultiIconLayer);

    return _possibleConstructorReturn(this, _getPrototypeOf(MultiIconLayer).apply(this, arguments));
  }

  _createClass(MultiIconLayer, [{
    key: "getShaders",
    value: function getShaders() {
      return Object.assign({}, _get(_getPrototypeOf(MultiIconLayer.prototype), "getShaders", this).call(this), {
        vs: _multiIconLayerVertex.default,
        fs: _multiIconLayerFragment.default
      });
    }
  }, {
    key: "initializeState",
    value: function initializeState() {
      _get(_getPrototypeOf(MultiIconLayer.prototype), "initializeState", this).call(this);

      var attributeManager = this.getAttributeManager();
      attributeManager.addInstanced({
        instancePixelOffset: {
          size: 2,
          transition: true,
          accessor: 'getPixelOffset'
        }
      });
    }
  }, {
    key: "updateState",
    value: function updateState(updateParams) {
      _get(_getPrototypeOf(MultiIconLayer.prototype), "updateState", this).call(this, updateParams);

      var changeFlags = updateParams.changeFlags;

      if (changeFlags.updateTriggersChanged && (changeFlags.updateTriggersChanged.getAnchorX || changeFlags.updateTriggersChanged.getAnchorY)) {
        this.getAttributeManager().invalidate('instanceOffsets');
      }
    }
  }, {
    key: "draw",
    value: function draw(_ref) {
      var uniforms = _ref.uniforms;
      var sdf = this.props.sdf;

      _get(_getPrototypeOf(MultiIconLayer.prototype), "draw", this).call(this, {
        uniforms: Object.assign({}, uniforms, {
          // Refer the following doc about gamma and buffer
          // https://blog.mapbox.com/drawing-text-with-signed-distance-fields-in-mapbox-gl-b0933af6f817
          buffer: DEFAULT_BUFFER,
          gamma: DEFAULT_GAMMA,
          sdf: Boolean(sdf)
        })
      });
    }
  }, {
    key: "calculateInstanceOffsets",
    value: function calculateInstanceOffsets(attribute) {
      var _this$props = this.props,
          data = _this$props.data,
          iconMapping = _this$props.iconMapping,
          getIcon = _this$props.getIcon,
          getAnchorX = _this$props.getAnchorX,
          getAnchorY = _this$props.getAnchorY,
          getLengthOfQueue = _this$props.getLengthOfQueue,
          getShiftInQueue = _this$props.getShiftInQueue;
      var value = attribute.value;
      var i = 0;
      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = data[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var object = _step.value;
          var icon = getIcon(object);
          var rect = iconMapping[icon] || {};
          var len = getLengthOfQueue(object);
          var shiftX = getShiftInQueue(object);
          value[i++] = (getAnchorX(object) - 1) * len / 2 + rect.width / 2 + shiftX || 0;
          value[i++] = rect.height / 2 * getAnchorY(object) || 0;
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return != null) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }
    }
  }, {
    key: "calculateInstancePickingColors",
    value: function calculateInstancePickingColors(attribute) {
      var _this$props2 = this.props,
          data = _this$props2.data,
          getPickingIndex = _this$props2.getPickingIndex;
      var value = attribute.value;
      var i = 0;
      var pickingColor = [];
      var _iteratorNormalCompletion2 = true;
      var _didIteratorError2 = false;
      var _iteratorError2 = undefined;

      try {
        for (var _iterator2 = data[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
          var point = _step2.value;
          var index = getPickingIndex(point);
          this.encodePickingColor(index, pickingColor);
          value[i++] = pickingColor[0];
          value[i++] = pickingColor[1];
          value[i++] = pickingColor[2];
        }
      } catch (err) {
        _didIteratorError2 = true;
        _iteratorError2 = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
            _iterator2.return();
          }
        } finally {
          if (_didIteratorError2) {
            throw _iteratorError2;
          }
        }
      }
    }
  }]);

  return MultiIconLayer;
}(_iconLayer.default);

exports.default = MultiIconLayer;
MultiIconLayer.layerName = 'MultiIconLayer';
MultiIconLayer.defaultProps = defaultProps;
},{"../../icon-layer/icon-layer":"gBB5","./multi-icon-layer-vertex.glsl":"WQa7","./multi-icon-layer-fragment.glsl":"taRj"}],"jEqp":[function(require,module,exports) {
'use strict';

module.exports = TinySDF;
module.exports.default = TinySDF;

var INF = 1e20;

function TinySDF(fontSize, buffer, radius, cutoff, fontFamily, fontWeight) {
    this.fontSize = fontSize || 24;
    this.buffer = buffer === undefined ? 3 : buffer;
    this.cutoff = cutoff || 0.25;
    this.fontFamily = fontFamily || 'sans-serif';
    this.fontWeight = fontWeight || 'normal';
    this.radius = radius || 8;
    var size = this.size = this.fontSize + this.buffer * 2;

    this.canvas = document.createElement('canvas');
    this.canvas.width = this.canvas.height = size;

    this.ctx = this.canvas.getContext('2d');
    this.ctx.font = this.fontWeight + ' ' + this.fontSize + 'px ' + this.fontFamily;
    this.ctx.textBaseline = 'middle';
    this.ctx.fillStyle = 'black';

    // temporary arrays for the distance transform
    this.gridOuter = new Float64Array(size * size);
    this.gridInner = new Float64Array(size * size);
    this.f = new Float64Array(size);
    this.d = new Float64Array(size);
    this.z = new Float64Array(size + 1);
    this.v = new Int16Array(size);

    // hack around https://bugzilla.mozilla.org/show_bug.cgi?id=737852
    this.middle = Math.round((size / 2) * (navigator.userAgent.indexOf('Gecko/') >= 0 ? 1.2 : 1));
}

TinySDF.prototype.draw = function (char) {
    this.ctx.clearRect(0, 0, this.size, this.size);
    this.ctx.fillText(char, this.buffer, this.middle);

    var imgData = this.ctx.getImageData(0, 0, this.size, this.size);
    var alphaChannel = new Uint8ClampedArray(this.size * this.size);

    for (var i = 0; i < this.size * this.size; i++) {
        var a = imgData.data[i * 4 + 3] / 255; // alpha value
        this.gridOuter[i] = a === 1 ? 0 : a === 0 ? INF : Math.pow(Math.max(0, 0.5 - a), 2);
        this.gridInner[i] = a === 1 ? INF : a === 0 ? 0 : Math.pow(Math.max(0, a - 0.5), 2);
    }

    edt(this.gridOuter, this.size, this.size, this.f, this.d, this.v, this.z);
    edt(this.gridInner, this.size, this.size, this.f, this.d, this.v, this.z);

    for (i = 0; i < this.size * this.size; i++) {
        var d = this.gridOuter[i] - this.gridInner[i];
        alphaChannel[i] = Math.max(0, Math.min(255, Math.round(255 - 255 * (d / this.radius + this.cutoff))));
    }

    return alphaChannel;
};

// 2D Euclidean distance transform by Felzenszwalb & Huttenlocher https://cs.brown.edu/~pff/papers/dt-final.pdf
function edt(data, width, height, f, d, v, z) {
    for (var x = 0; x < width; x++) {
        for (var y = 0; y < height; y++) {
            f[y] = data[y * width + x];
        }
        edt1d(f, d, v, z, height);
        for (y = 0; y < height; y++) {
            data[y * width + x] = d[y];
        }
    }
    for (y = 0; y < height; y++) {
        for (x = 0; x < width; x++) {
            f[x] = data[y * width + x];
        }
        edt1d(f, d, v, z, width);
        for (x = 0; x < width; x++) {
            data[y * width + x] = Math.sqrt(d[x]);
        }
    }
}

// 1D squared distance transform
function edt1d(f, d, v, z, n) {
    v[0] = 0;
    z[0] = -INF;
    z[1] = +INF;

    for (var q = 1, k = 0; q < n; q++) {
        var s = ((f[q] + q * q) - (f[v[k]] + v[k] * v[k])) / (2 * q - 2 * v[k]);
        while (s <= z[k]) {
            k--;
            s = ((f[q] + q * q) - (f[v[k]] + v[k] * v[k])) / (2 * q - 2 * v[k]);
        }
        k++;
        v[k] = q;
        z[k] = s;
        z[k + 1] = +INF;
    }

    for (q = 0, k = 0; q < n; q++) {
        while (z[k + 1] < q) k++;
        d[q] = (q - v[k]) * (q - v[k]) + f[v[k]];
    }
}

},{}],"Ai8F":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.makeFontAtlas = makeFontAtlas;
exports.DEFAULT_FONT_SETTINGS = exports.DEFAULT_FONT_WEIGHT = exports.DEFAULT_FONT_FAMILY = exports.DEFAULT_CHAR_SET = void 0;

var _luma = require("luma.gl");

var _tinySdf = _interopRequireDefault(require("@mapbox/tiny-sdf"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

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;
}
/* global document */


var GL_TEXTURE_WRAP_S = 0x2802;
var GL_TEXTURE_WRAP_T = 0x2803;
var GL_CLAMP_TO_EDGE = 0x812f;
var MAX_CANVAS_WIDTH = 1024;
var BASELINE_SCALE = 0.9;
var HEIGHT_SCALE = 1.2;

function getDefaultCharacterSet() {
  var charSet = [];

  for (var i = 32; i < 128; i++) {
    charSet.push(String.fromCharCode(i));
  }

  return charSet;
}

var DEFAULT_CHAR_SET = getDefaultCharacterSet();
exports.DEFAULT_CHAR_SET = DEFAULT_CHAR_SET;
var DEFAULT_FONT_FAMILY = 'Monaco, monospace';
exports.DEFAULT_FONT_FAMILY = DEFAULT_FONT_FAMILY;
var DEFAULT_FONT_WEIGHT = 'normal';
exports.DEFAULT_FONT_WEIGHT = DEFAULT_FONT_WEIGHT;
var DEFAULT_FONT_SETTINGS = {
  fontSize: 64,
  buffer: 2,
  sdf: false,
  cutoff: 0.25,
  radius: 3
};
exports.DEFAULT_FONT_SETTINGS = DEFAULT_FONT_SETTINGS;

function populateAlphaChannel(alphaChannel, imageData) {
  // populate distance value from tinySDF to image alpha channel
  for (var i = 0; i < alphaChannel.length; i++) {
    imageData.data[4 * i + 3] = alphaChannel[i];
  }
}

function setTextStyle(ctx, fontFamily, fontSize, fontWeight) {
  ctx.font = "".concat(fontWeight, " ").concat(fontSize, "px ").concat(fontFamily);
  ctx.fillStyle = '#000';
  ctx.textBaseline = 'baseline';
  ctx.textAlign = 'left';
}

function buildMapping(_ref) {
  var ctx = _ref.ctx,
      fontHeight = _ref.fontHeight,
      buffer = _ref.buffer,
      characterSet = _ref.characterSet,
      maxCanvasWidth = _ref.maxCanvasWidth;
  var mapping = {};
  var row = 0;
  var x = 0;
  Array.from(characterSet).forEach(function (char) {
    // measure texts
    // TODO - use Advanced text metrics when they are adopted:
    // https://developer.mozilla.org/en-US/docs/Web/API/TextMetrics
    var _ctx$measureText = ctx.measureText(char),
        width = _ctx$measureText.width;

    if (x + width + buffer * 2 > maxCanvasWidth) {
      x = 0;
      row++;
    }

    mapping[char] = {
      x: x + buffer,
      y: row * (fontHeight + buffer * 2) + buffer,
      width: width,
      height: fontHeight,
      mask: true
    };
    x += width + buffer * 2;
  });
  var canvasHeight = (row + 1) * (fontHeight + buffer * 2);
  return {
    mapping: mapping,
    canvasHeight: canvasHeight
  };
}

function makeFontAtlas(gl, fontSettings) {
  var _parameters;

  var mergedFontSettings = Object.assign({
    fontFamily: DEFAULT_FONT_FAMILY,
    fontWeight: DEFAULT_FONT_WEIGHT,
    characterSet: DEFAULT_CHAR_SET
  }, DEFAULT_FONT_SETTINGS, fontSettings);
  var fontFamily = mergedFontSettings.fontFamily,
      fontWeight = mergedFontSettings.fontWeight,
      characterSet = mergedFontSettings.characterSet,
      fontSize = mergedFontSettings.fontSize,
      buffer = mergedFontSettings.buffer,
      sdf = mergedFontSettings.sdf,
      radius = mergedFontSettings.radius,
      cutoff = mergedFontSettings.cutoff;
  var canvas = document.createElement('canvas');
  var ctx = canvas.getContext('2d'); // build mapping

  setTextStyle(ctx, fontFamily, fontSize, fontWeight);
  var fontHeight = fontSize * HEIGHT_SCALE;

  var _buildMapping = buildMapping({
    ctx: ctx,
    fontHeight: fontHeight,
    buffer: buffer,
    characterSet: characterSet,
    maxCanvasWidth: MAX_CANVAS_WIDTH
  }),
      canvasHeight = _buildMapping.canvasHeight,
      mapping = _buildMapping.mapping;

  canvas.width = MAX_CANVAS_WIDTH;
  canvas.height = canvasHeight;
  setTextStyle(ctx, fontFamily, fontSize, fontWeight); // layout characters

  if (sdf) {
    var tinySDF = new _tinySdf.default(fontSize, buffer, radius, cutoff, fontFamily, fontWeight); // used to store distance values from tinySDF

    var imageData = ctx.createImageData(tinySDF.size, tinySDF.size);
    var _iteratorNormalCompletion = true;
    var _didIteratorError = false;
    var _iteratorError = undefined;

    try {
      for (var _iterator = characterSet[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
        var char = _step.value;
        populateAlphaChannel(tinySDF.draw(char), imageData);
        ctx.putImageData(imageData, mapping[char].x - buffer, mapping[char].y - buffer);
      }
    } catch (err) {
      _didIteratorError = true;
      _iteratorError = err;
    } finally {
      try {
        if (!_iteratorNormalCompletion && _iterator.return != null) {
          _iterator.return();
        }
      } finally {
        if (_didIteratorError) {
          throw _iteratorError;
        }
      }
    }
  } else {
    var _iteratorNormalCompletion2 = true;
    var _didIteratorError2 = false;
    var _iteratorError2 = undefined;

    try {
      for (var _iterator2 = characterSet[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
        var _char = _step2.value;
        ctx.fillText(_char, mapping[_char].x, mapping[_char].y + fontSize * BASELINE_SCALE);
      }
    } catch (err) {
      _didIteratorError2 = true;
      _iteratorError2 = err;
    } finally {
      try {
        if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
          _iterator2.return();
        }
      } finally {
        if (_didIteratorError2) {
          throw _iteratorError2;
        }
      }
    }
  }

  return {
    scale: HEIGHT_SCALE,
    mapping: mapping,
    texture: new _luma.Texture2D(gl, {
      pixels: canvas,
      // padding is added only between the characters but not for borders
      // enforce CLAMP_TO_EDGE to avoid any artifacts.
      parameters: (_parameters = {}, _defineProperty(_parameters, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE), _defineProperty(_parameters, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE), _parameters)
    })
  };
}
},{"luma.gl":"GAQa","@mapbox/tiny-sdf":"jEqp"}],"Gctc":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _core = require("@deck.gl/core");

var _multiIconLayer = _interopRequireDefault(require("./multi-icon-layer/multi-icon-layer"));

var _fontAtlas = require("./font-atlas");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
} // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.


var TEXT_ANCHOR = {
  start: 1,
  middle: 0,
  end: -1
};
var ALIGNMENT_BASELINE = {
  top: 1,
  center: 0,
  bottom: -1
};
var DEFAULT_COLOR = [0, 0, 0, 255];
var MISSING_CHAR_WIDTH = 32;
var FONT_SETTINGS_PROPS = ['fontSize', 'buffer', 'sdf', 'radius', 'cutoff'];
var defaultProps = {
  fp64: false,
  sizeScale: 1,
  characterSet: _fontAtlas.DEFAULT_CHAR_SET,
  fontFamily: _fontAtlas.DEFAULT_FONT_FAMILY,
  fontWeight: _fontAtlas.DEFAULT_FONT_WEIGHT,
  fontSettings: {},
  getText: {
    type: 'accessor',
    value: function value(x) {
      return x.text;
    }
  },
  getPosition: {
    type: 'accessor',
    value: function value(x) {
      return x.position;
    }
  },
  getColor: {
    type: 'accessor',
    value: DEFAULT_COLOR
  },
  getSize: {
    type: 'accessor',
    value: 32
  },
  getAngle: {
    type: 'accessor',
    value: 0
  },
  getTextAnchor: {
    type: 'accessor',
    value: 'middle'
  },
  getAlignmentBaseline: {
    type: 'accessor',
    value: 'center'
  },
  getPixelOffset: {
    type: 'accessor',
    value: [0, 0]
  }
};

var TextLayer =
/*#__PURE__*/
function (_CompositeLayer) {
  _inherits(TextLayer, _CompositeLayer);

  function TextLayer() {
    _classCallCheck(this, TextLayer);

    return _possibleConstructorReturn(this, _getPrototypeOf(TextLayer).apply(this, arguments));
  }

  _createClass(TextLayer, [{
    key: "updateState",
    value: function updateState(_ref) {
      var props = _ref.props,
          oldProps = _ref.oldProps,
          changeFlags = _ref.changeFlags;
      var fontChanged = this.fontChanged(oldProps, props);

      if (fontChanged) {
        this.updateFontAtlas();
      }

      if (changeFlags.dataChanged || fontChanged || changeFlags.updateTriggersChanged && (changeFlags.updateTriggersChanged.all || changeFlags.updateTriggersChanged.getText)) {
        this.transformStringToLetters();
      }
    }
  }, {
    key: "updateFontAtlas",
    value: function updateFontAtlas() {
      var gl = this.context.gl;
      var _this$props = this.props,
          fontSettings = _this$props.fontSettings,
          fontFamily = _this$props.fontFamily,
          fontWeight = _this$props.fontWeight,
          characterSet = _this$props.characterSet;
      var mergedFontSettings = Object.assign({}, _fontAtlas.DEFAULT_FONT_SETTINGS, fontSettings, {
        fontFamily: fontFamily,
        fontWeight: fontWeight,
        characterSet: characterSet
      });

      var _makeFontAtlas = (0, _fontAtlas.makeFontAtlas)(gl, mergedFontSettings),
          scale = _makeFontAtlas.scale,
          mapping = _makeFontAtlas.mapping,
          texture = _makeFontAtlas.texture;

      this.setState({
        scale: scale,
        iconAtlas: texture,
        iconMapping: mapping
      });
    }
  }, {
    key: "fontChanged",
    value: function fontChanged(oldProps, props) {
      if (oldProps.fontFamily !== props.fontFamily || oldProps.characterSet !== props.characterSet || oldProps.fontWeight !== props.fontWeight) {
        return true;
      }

      if (oldProps.fontSettings === props.fontSettings) {
        return false;
      }

      var oldFontSettings = oldProps.fontSettings || {};
      var fontSettings = props.fontSettings || {};
      return FONT_SETTINGS_PROPS.some(function (prop) {
        return oldFontSettings[prop] !== fontSettings[prop];
      });
    }
  }, {
    key: "getPickingInfo",
    value: function getPickingInfo(_ref2) {
      var info = _ref2.info; // because `TextLayer` assign the same pickingInfoIndex for one text label,
      // here info.index refers the index of text label in props.data

      return Object.assign(info, {
        // override object with original data
        object: info.index >= 0 ? this.props.data[info.index] : null
      });
    }
    /* eslint-disable no-loop-func */

  }, {
    key: "transformStringToLetters",
    value: function transformStringToLetters() {
      var _this$props2 = this.props,
          data = _this$props2.data,
          getText = _this$props2.getText;
      var iconMapping = this.state.iconMapping;
      var transformedData = [];
      var objectIndex = 0;
      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        var _loop = function _loop() {
          var val = _step.value;
          var text = getText(val);

          if (text) {
            var letters = Array.from(text);
            var offsets = [0];
            var offsetLeft = 0;
            letters.forEach(function (letter, i) {
              var datum = {
                text: letter,
                index: i,
                offsets: offsets,
                len: text.length,
                // reference of original object and object index
                object: val,
                objectIndex: objectIndex
              };
              var frame = iconMapping[letter];

              if (frame) {
                offsetLeft += frame.width;
              } else {
                _core.log.warn("Missing character: ".concat(letter))();

                offsetLeft += MISSING_CHAR_WIDTH;
              }

              offsets.push(offsetLeft);
              transformedData.push(datum);
            });
          }

          objectIndex++;
        };

        for (var _iterator = data[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          _loop();
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return != null) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }

      this.setState({
        data: transformedData
      });
    }
    /* eslint-enable no-loop-func */

  }, {
    key: "getLetterOffset",
    value: function getLetterOffset(datum) {
      return datum.offsets[datum.index];
    }
  }, {
    key: "getTextLength",
    value: function getTextLength(datum) {
      return datum.offsets[datum.offsets.length - 1];
    }
  }, {
    key: "_getAccessor",
    value: function _getAccessor(accessor) {
      if (typeof accessor === 'function') {
        return function (x) {
          return accessor(x.object);
        };
      }

      return accessor;
    }
  }, {
    key: "getAnchorXFromTextAnchor",
    value: function getAnchorXFromTextAnchor(getTextAnchor) {
      return function (x) {
        var textAnchor = typeof getTextAnchor === 'function' ? getTextAnchor(x.object) : getTextAnchor;

        if (!TEXT_ANCHOR.hasOwnProperty(textAnchor)) {
          throw new Error("Invalid text anchor parameter: ".concat(textAnchor));
        }

        return TEXT_ANCHOR[textAnchor];
      };
    }
  }, {
    key: "getAnchorYFromAlignmentBaseline",
    value: function getAnchorYFromAlignmentBaseline(getAlignmentBaseline) {
      return function (x) {
        var alignmentBaseline = typeof getAlignmentBaseline === 'function' ? getAlignmentBaseline(x.object) : getAlignmentBaseline;

        if (!ALIGNMENT_BASELINE.hasOwnProperty(alignmentBaseline)) {
          throw new Error("Invalid alignment baseline parameter: ".concat(alignmentBaseline));
        }

        return ALIGNMENT_BASELINE[alignmentBaseline];
      };
    }
  }, {
    key: "renderLayers",
    value: function renderLayers() {
      var _this = this;

      var _this$state = this.state,
          data = _this$state.data,
          scale = _this$state.scale,
          iconAtlas = _this$state.iconAtlas,
          iconMapping = _this$state.iconMapping;
      var _this$props3 = this.props,
          _getPosition = _this$props3.getPosition,
          getColor = _this$props3.getColor,
          getSize = _this$props3.getSize,
          getAngle = _this$props3.getAngle,
          getTextAnchor = _this$props3.getTextAnchor,
          getAlignmentBaseline = _this$props3.getAlignmentBaseline,
          getPixelOffset = _this$props3.getPixelOffset,
          fp64 = _this$props3.fp64,
          sdf = _this$props3.sdf,
          sizeScale = _this$props3.sizeScale,
          transitions = _this$props3.transitions,
          updateTriggers = _this$props3.updateTriggers;
      var SubLayerClass = this.getSubLayerClass('characters', _multiIconLayer.default);
      return new SubLayerClass({
        sdf: sdf,
        iconAtlas: iconAtlas,
        iconMapping: iconMapping,
        getPosition: function getPosition(d) {
          return _getPosition(d.object);
        },
        getColor: this._getAccessor(getColor),
        getSize: this._getAccessor(getSize),
        getAngle: this._getAccessor(getAngle),
        getAnchorX: this.getAnchorXFromTextAnchor(getTextAnchor),
        getAnchorY: this.getAnchorYFromAlignmentBaseline(getAlignmentBaseline),
        getPixelOffset: this._getAccessor(getPixelOffset),
        fp64: fp64,
        sizeScale: sizeScale * scale,
        transitions: transitions && {
          getPosition: transitions.getPosition,
          getAngle: transitions.getAngle,
          getColor: transitions.getColor,
          getSize: transitions.getSize,
          getPixelOffset: updateTriggers.getPixelOffset
        }
      }, this.getSubLayerProps({
        id: 'characters',
        updateTriggers: {
          getPosition: updateTriggers.getPosition,
          getAngle: updateTriggers.getAngle,
          getColor: updateTriggers.getColor,
          getSize: updateTriggers.getSize,
          getPixelOffset: updateTriggers.getPixelOffset,
          getAnchorX: updateTriggers.getTextAnchor,
          getAnchorY: updateTriggers.getAlignmentBaseline
        }
      }), {
        data: data,
        getIcon: function getIcon(d) {
          return d.text;
        },
        getShiftInQueue: function getShiftInQueue(d) {
          return _this.getLetterOffset(d);
        },
        getLengthOfQueue: function getLengthOfQueue(d) {
          return _this.getTextLength(d);
        }
      });
    }
  }]);

  return TextLayer;
}(_core.CompositeLayer);

exports.default = TextLayer;
TextLayer.layerName = 'TextLayer';
TextLayer.defaultProps = defaultProps;
},{"@deck.gl/core":"Tk4X","./multi-icon-layer/multi-icon-layer":"s2GF","./font-atlas":"Ai8F"}],"MRjK":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ISOBANDS_CODE_OFFSET_MAP = exports.ISOLINES_CODE_OFFSET_MAP = void 0;

var _ISOBANDS_CODE_OFFSET;

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;
} // Code to Offsets Map needed to implement Marching Squres algorithm
// Ref: https://en.wikipedia.org/wiki/Marching_squares
// Table to map code to the intersection offsets
// All offsets are relative to the center of marching cell (which is top right corner of grid-cell, and center of marching-square)


var HALF = 0.5;
var ONE6TH = 1 / 6;
var OFFSET = {
  N: [0, HALF],
  // NORTH
  E: [HALF, 0],
  // EAST
  S: [0, -HALF],
  // SOUTH
  W: [-HALF, 0],
  // WEST
  // CORNERS
  NE: [HALF, HALF],
  NW: [-HALF, HALF],
  SE: [HALF, -HALF],
  SW: [-HALF, -HALF]
}; // NOTE: vertices are ordered in CCW direction, starting from NW corner
// Triangles

var SW_TRIANGLE = [OFFSET.W, OFFSET.SW, OFFSET.S];
var SE_TRIANGLE = [OFFSET.S, OFFSET.SE, OFFSET.E];
var NE_TRIANGLE = [OFFSET.E, OFFSET.NE, OFFSET.N];
var NW_TRIANGLE = [OFFSET.NW, OFFSET.W, OFFSET.N]; // Trapezoids

var SW_TRAPEZOID = [[-HALF, ONE6TH], [-HALF, -ONE6TH], [-ONE6TH, -HALF], [ONE6TH, -HALF]];
var SE_TRAPEZOID = [[-ONE6TH, -HALF], [ONE6TH, -HALF], [HALF, -ONE6TH], [HALF, ONE6TH]];
var NE_TRAPEZOID = [[HALF, -ONE6TH], [HALF, ONE6TH], [ONE6TH, HALF], [-ONE6TH, HALF]];
var NW_TRAPEZOID = [[-HALF, ONE6TH], [-HALF, -ONE6TH], [ONE6TH, HALF], [-ONE6TH, HALF]]; // Rectangles

var S_RECTANGLE = [OFFSET.W, OFFSET.SW, OFFSET.SE, OFFSET.E];
var E_RECTANGLE = [OFFSET.S, OFFSET.SE, OFFSET.NE, OFFSET.N];
var N_RECTANGLE = [OFFSET.NW, OFFSET.W, OFFSET.E, OFFSET.NE];
var W_RECTANGLE = [OFFSET.NW, OFFSET.SW, OFFSET.S, OFFSET.N];
var EW_RECTANGEL = [[-HALF, ONE6TH], [-HALF, -ONE6TH], [HALF, -ONE6TH], [HALF, ONE6TH]];
var SN_RECTANGEL = [[-ONE6TH, -HALF], [ONE6TH, -HALF], [ONE6TH, HALF], [-ONE6TH, HALF]]; // Square

var SQUARE = [OFFSET.NW, OFFSET.SW, OFFSET.SE, OFFSET.NE]; // Pentagons

var SW_PENTAGON = [OFFSET.NW, OFFSET.SW, OFFSET.SE, OFFSET.E, OFFSET.N];
var SE_PENTAGON = [OFFSET.W, OFFSET.SW, OFFSET.SE, OFFSET.NE, OFFSET.N];
var NE_PENTAGON = [OFFSET.NW, OFFSET.W, OFFSET.S, OFFSET.SE, OFFSET.NE];
var NW_PENTAGON = [OFFSET.NW, OFFSET.SW, OFFSET.S, OFFSET.E, OFFSET.NE];
var NW_N_PENTAGON = [OFFSET.NW, OFFSET.W, [HALF, -ONE6TH], [HALF, ONE6TH], OFFSET.N];
var NE_E_PENTAGON = [[-ONE6TH, -HALF], [ONE6TH, -HALF], OFFSET.E, OFFSET.NE, OFFSET.N];
var SE_S_PENTAGON = [[-HALF, ONE6TH], [-HALF, -ONE6TH], OFFSET.S, OFFSET.SE, OFFSET.E];
var SW_W_PENTAGON = [OFFSET.W, OFFSET.SW, OFFSET.S, [ONE6TH, HALF], [-ONE6TH, HALF]];
var NW_W_PENTAGON = [OFFSET.NW, OFFSET.W, [-ONE6TH, -HALF], [ONE6TH, -HALF], OFFSET.N];
var NE_N_PENTAGON = [[-HALF, ONE6TH], [-HALF, -ONE6TH], OFFSET.E, OFFSET.NE, OFFSET.N];
var SE_E_PENTAGON = [OFFSET.S, OFFSET.SE, OFFSET.E, [ONE6TH, HALF], [-ONE6TH, HALF]];
var SW_S_PENTAGON = [OFFSET.W, OFFSET.SW, OFFSET.S, [HALF, -ONE6TH], [HALF, ONE6TH]]; // Hexagon

var S_HEXAGON = [OFFSET.W, OFFSET.SW, OFFSET.SE, OFFSET.E, [ONE6TH, HALF], [-ONE6TH, HALF]];
var E_HEXAGON = [[-HALF, ONE6TH], [-HALF, -ONE6TH], OFFSET.S, OFFSET.SE, OFFSET.NE, OFFSET.N];
var N_HEXAGON = [OFFSET.NW, OFFSET.W, [-ONE6TH, -HALF], [ONE6TH, -HALF], OFFSET.E, OFFSET.NE];
var W_HEXAGON = [OFFSET.NW, OFFSET.SW, OFFSET.S, [HALF, -ONE6TH], [HALF, ONE6TH], OFFSET.N];
var SW_NE_HEXAGON = [OFFSET.W, OFFSET.SW, OFFSET.S, OFFSET.E, OFFSET.NE, OFFSET.N];
var NW_SE_HEXAGON = [OFFSET.NW, OFFSET.W, OFFSET.S, OFFSET.SE, OFFSET.E, OFFSET.N]; // Heptagon (7-sided)

var NE_HEPTAGON = [[-HALF, ONE6TH], [-HALF, -ONE6TH], [-ONE6TH, -HALF], [ONE6TH, -HALF], OFFSET.E, OFFSET.NE, OFFSET.N];
var SW_HEPTAGON = [OFFSET.W, OFFSET.SW, OFFSET.S, [HALF, -ONE6TH], [HALF, ONE6TH], [ONE6TH, HALF], [-ONE6TH, HALF]];
var NW_HEPTAGON = [OFFSET.NW, OFFSET.W, [-ONE6TH, -HALF], [ONE6TH, -HALF], [HALF, -ONE6TH], [HALF, ONE6TH], OFFSET.N];
var SE_HEPTAGON = [[-HALF, ONE6TH], [-HALF, -ONE6TH], OFFSET.S, OFFSET.SE, OFFSET.E, [ONE6TH, HALF], [-ONE6TH, HALF]]; // Octagon

var OCTAGON = [[-HALF, ONE6TH], [-HALF, -ONE6TH], [-ONE6TH, -HALF], [ONE6TH, -HALF], [HALF, -ONE6TH], [HALF, ONE6TH], [ONE6TH, HALF], [-ONE6TH, HALF]]; // Note: above wiki page invertes white/black dots for generating the code, we don't

var ISOLINES_CODE_OFFSET_MAP = {
  // key is equal to the code of 4 vertices (invert the code specified in wiki)
  // value can be an array or an Object
  // Array : [line] or [line, line], where each line is [start-point, end-point], and each point is [x, y]
  // Object : to handle saddle cases, whos output depends on mean value of all 4 corners
  //  key: code of mean value (0 or 1)
  //  value: Array , as above defines one or two line segments
  0: [],
  1: [[OFFSET.W, OFFSET.S]],
  2: [[OFFSET.S, OFFSET.E]],
  3: [[OFFSET.W, OFFSET.E]],
  4: [[OFFSET.N, OFFSET.E]],
  5: {
    0: [[OFFSET.W, OFFSET.S], [OFFSET.N, OFFSET.E]],
    1: [[OFFSET.W, OFFSET.N], [OFFSET.S, OFFSET.E]]
  },
  6: [[OFFSET.N, OFFSET.S]],
  7: [[OFFSET.W, OFFSET.N]],
  8: [[OFFSET.W, OFFSET.N]],
  9: [[OFFSET.N, OFFSET.S]],
  10: {
    0: [[OFFSET.W, OFFSET.N], [OFFSET.S, OFFSET.E]],
    1: [[OFFSET.W, OFFSET.S], [OFFSET.N, OFFSET.E]]
  },
  11: [[OFFSET.N, OFFSET.E]],
  12: [[OFFSET.W, OFFSET.E]],
  13: [[OFFSET.S, OFFSET.E]],
  14: [[OFFSET.W, OFFSET.S]],
  15: []
};
exports.ISOLINES_CODE_OFFSET_MAP = ISOLINES_CODE_OFFSET_MAP;

function ternaryToIndex(ternary) {
  return parseInt(ternary, 4);
}

var ISOBANDS_CODE_OFFSET_MAP = (_ISOBANDS_CODE_OFFSET = {}, _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('0000'), []), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('2222'), []), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('2221'), [SW_TRIANGLE]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('2212'), [SE_TRIANGLE]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('2122'), [NE_TRIANGLE]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('1222'), [NW_TRIANGLE]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('0001'), [SW_TRIANGLE]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('0010'), [SE_TRIANGLE]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('0100'), [NE_TRIANGLE]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('1000'), [NW_TRIANGLE]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('2220'), [SW_TRAPEZOID]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('2202'), [SE_TRAPEZOID]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('2022'), [NE_TRAPEZOID]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('0222'), [NW_TRAPEZOID]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('0002'), [SW_TRAPEZOID]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('0020'), [SE_TRAPEZOID]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('0200'), [NE_TRAPEZOID]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('2000'), [NW_TRAPEZOID]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('0011'), [S_RECTANGLE]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('0110'), [E_RECTANGLE]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('1100'), [N_RECTANGLE]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('1001'), [W_RECTANGLE]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('2211'), [S_RECTANGLE]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('2112'), [E_RECTANGLE]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('1122'), [N_RECTANGLE]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('1221'), [W_RECTANGLE]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('2200'), [EW_RECTANGEL]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('2002'), [SN_RECTANGEL]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('0022'), [EW_RECTANGEL]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('0220'), [SN_RECTANGEL]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('1111'), [SQUARE]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('1211'), [SW_PENTAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('2111'), [SE_PENTAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('1112'), [NE_PENTAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('1121'), [NW_PENTAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('1011'), [SW_PENTAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('0111'), [SE_PENTAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('1110'), [NE_PENTAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('1101'), [NW_PENTAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('1200'), [NW_N_PENTAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('0120'), [NE_E_PENTAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('0012'), [SE_S_PENTAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('2001'), [SW_W_PENTAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('1022'), [NW_N_PENTAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('2102'), [NE_E_PENTAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('2210'), [SE_S_PENTAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('0221'), [SW_W_PENTAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('1002'), [NW_W_PENTAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('2100'), [NE_N_PENTAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('0210'), [SE_E_PENTAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('0021'), [SW_S_PENTAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('1220'), [NW_W_PENTAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('0122'), [NE_N_PENTAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('2012'), [SE_E_PENTAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('2201'), [SW_S_PENTAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('0211'), [S_HEXAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('2110'), [E_HEXAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('1102'), [N_HEXAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('1021'), [W_HEXAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('2011'), [S_HEXAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('0112'), [E_HEXAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('1120'), [N_HEXAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('1201'), [W_HEXAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('2101'), [SW_NE_HEXAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('0121'), [SW_NE_HEXAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('1012'), [NW_SE_HEXAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('1210'), [NW_SE_HEXAGON]), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('0101'), {
  0: [SW_TRIANGLE, NE_TRIANGLE],
  1: [SW_NE_HEXAGON],
  2: [SW_NE_HEXAGON]
}), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('1010'), {
  0: [NW_TRIANGLE, SE_TRIANGLE],
  1: [NW_SE_HEXAGON],
  2: [NW_SE_HEXAGON]
}), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('2121'), {
  0: [SW_NE_HEXAGON],
  1: [SW_NE_HEXAGON],
  2: [SW_TRIANGLE, NE_TRIANGLE]
}), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('1212'), {
  0: [NW_SE_HEXAGON],
  1: [NW_SE_HEXAGON],
  2: [NW_TRIANGLE, SE_TRIANGLE]
}), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('2120'), {
  0: [NE_HEPTAGON],
  1: [NE_HEPTAGON],
  2: [SW_TRAPEZOID, NE_TRIANGLE]
}), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('2021'), {
  0: [SW_HEPTAGON],
  1: [SW_HEPTAGON],
  2: [SW_TRIANGLE, NE_TRAPEZOID]
}), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('1202'), {
  0: [NW_HEPTAGON],
  1: [NW_HEPTAGON],
  2: [NW_TRIANGLE, SE_TRAPEZOID]
}), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('0212'), {
  0: [SE_HEPTAGON],
  1: [SE_HEPTAGON],
  2: [SE_TRIANGLE, NW_TRAPEZOID]
}), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('0102'), {
  0: [SW_TRAPEZOID, NE_TRIANGLE],
  1: [NE_HEPTAGON],
  2: [NE_HEPTAGON]
}), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('0201'), {
  0: [SW_TRIANGLE, NE_TRAPEZOID],
  1: [SW_HEPTAGON],
  2: [SW_HEPTAGON]
}), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('1020'), {
  0: [NW_TRIANGLE, SE_TRAPEZOID],
  1: [NW_HEPTAGON],
  2: [NW_HEPTAGON]
}), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('2010'), {
  0: [SE_TRIANGLE, NW_TRAPEZOID],
  1: [SE_HEPTAGON],
  2: [SE_HEPTAGON]
}), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('2020'), {
  0: [NW_TRAPEZOID, SE_TRAPEZOID],
  1: [OCTAGON],
  2: [SW_TRAPEZOID, NE_TRAPEZOID]
}), _defineProperty(_ISOBANDS_CODE_OFFSET, ternaryToIndex('0202'), {
  0: [NE_TRAPEZOID, SW_TRAPEZOID],
  1: [OCTAGON],
  2: [NW_TRAPEZOID, SE_TRAPEZOID]
}), _ISOBANDS_CODE_OFFSET);
exports.ISOBANDS_CODE_OFFSET_MAP = ISOBANDS_CODE_OFFSET_MAP;
},{}],"CkF0":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getCode = getCode;
exports.getVertices = getVertices;
exports.CONTOUR_TYPE = void 0;

var _core = require("@deck.gl/core");

var _marchingSquaresCodes = require("./marching-squares-codes");

// All utility mehtods needed to implement Marching Squres algorithm
// Ref: https://en.wikipedia.org/wiki/Marching_squares
var CONTOUR_TYPE = {
  ISO_LINES: 1,
  ISO_BANDS: 2
};
exports.CONTOUR_TYPE = CONTOUR_TYPE;
var Z_OFFSET = 0.002;
var DEFAULT_THRESHOLD_DATA = {
  zIndex: 0,
  zOffsetScale: 1
}; // Utility methods

function getVertexCode(weight, threshold) {
  // threshold must be a single value or a range (array of size 2)
  // Iso-bands
  if (Array.isArray(threshold)) {
    if (weight < threshold[0]) {
      return 0;
    }

    return weight < threshold[1] ? 1 : 2;
  } // Iso-lines


  return weight >= threshold ? 1 : 0;
} // Returns marching square code for given cell

/* eslint-disable complexity, max-statements*/


function getCode(opts) {
  // Assumptions
  // Origin is on bottom-left , and X increase to right, Y to top
  // When processing one cell, we process 4 cells, by extending row to top and on column to right
  // to create a 2X2 cell grid
  var cellWeights = opts.cellWeights,
      x = opts.x,
      y = opts.y,
      width = opts.width,
      height = opts.height;
  var threshold = opts.threshold;

  if (opts.thresholdValue) {
    _core.log.deprecated('thresholdValue', 'threshold')();

    threshold = opts.thresholdValue;
  }

  var isLeftBoundary = x < 0;
  var isRightBoundary = x >= width - 1;
  var isBottomBoundary = y < 0;
  var isTopBoundary = y >= height - 1;
  var isBoundary = isLeftBoundary || isRightBoundary || isBottomBoundary || isTopBoundary;
  var weights = {};
  var codes = {}; // TOP

  if (isLeftBoundary || isTopBoundary) {
    codes.top = 0;
  } else {
    weights.top = cellWeights[(y + 1) * width + x];
    codes.top = getVertexCode(weights.top, threshold);
  } // TOP-RIGHT


  if (isRightBoundary || isTopBoundary) {
    codes.topRight = 0;
  } else {
    weights.topRight = cellWeights[(y + 1) * width + x + 1];
    codes.topRight = getVertexCode(weights.topRight, threshold);
  } // RIGHT


  if (isRightBoundary || isBottomBoundary) {
    codes.right = 0;
  } else {
    weights.right = cellWeights[y * width + x + 1];
    codes.right = getVertexCode(weights.right, threshold);
  } // CURRENT


  if (isLeftBoundary || isBottomBoundary) {
    codes.current = 0;
  } else {
    weights.current = cellWeights[y * width + x];
    codes.current = getVertexCode(weights.current, threshold);
  }

  var top = codes.top,
      topRight = codes.topRight,
      right = codes.right,
      current = codes.current;
  var code = -1;

  if (Number.isFinite(threshold)) {
    code = top << 3 | topRight << 2 | right << 1 | current;
  }

  if (Array.isArray(threshold)) {
    code = top << 6 | topRight << 4 | right << 2 | current;
  }

  var meanCode = 0; // meanCode is only needed for saddle cases, and they should
  // only occur when we are not processing a cell on boundary
  // because when on a boundary either, bottom-row, top-row, left-column or right-column will have both 0 codes

  if (!isBoundary) {
    meanCode = getVertexCode((weights.top + weights.topRight + weights.right + weights.current) / 4, threshold);
  }

  return {
    code: code,
    meanCode: meanCode
  };
}
/* eslint-enable complexity, max-statements*/
// Returns intersection vertices for given cellindex
// [x, y] refers current marchng cell, reference vertex is always top-right corner


function getVertices(opts) {
  var gridOrigin = opts.gridOrigin,
      cellSize = opts.cellSize,
      x = opts.x,
      y = opts.y,
      code = opts.code,
      meanCode = opts.meanCode,
      _opts$type = opts.type,
      type = _opts$type === void 0 ? CONTOUR_TYPE.ISO_LINES : _opts$type;
  var thresholdData = Object.assign({}, DEFAULT_THRESHOLD_DATA, opts.thresholdData);
  var offsets = type === CONTOUR_TYPE.ISO_BANDS ? _marchingSquaresCodes.ISOBANDS_CODE_OFFSET_MAP[code] : _marchingSquaresCodes.ISOLINES_CODE_OFFSET_MAP[code]; // handle saddle cases

  if (!Array.isArray(offsets)) {
    offsets = offsets[meanCode];
  } // Reference vertex is at top-right move to top-right corner


  var vZ = thresholdData.zIndex * Z_OFFSET * thresholdData.zOffsetScale;
  var rX = (x + 1) * cellSize[0];
  var rY = (y + 1) * cellSize[1];
  var refVertexX = gridOrigin[0] + rX;
  var refVertexY = gridOrigin[1] + rY; // offsets format
  // ISO_LINES: [[1A, 1B], [2A, 2B]],
  // ISO_BANDS: [[1A, 1B, 1C, ...], [2A, 2B, 2C, ...]],
  // vertices format
  // ISO_LINES: [[x1A, y1A], [x1B, y1B], [x2A, x2B], ...],
  // ISO_BANDS:  => confirms to SolidPolygonLayer's simple polygon format
  //      [
  //        [[x1A, y1A], [x1B, y1B], [x1C, y1C] ... ],
  //        ...
  //      ]

  if (type === CONTOUR_TYPE.ISO_BANDS) {
    var polygons = [];
    offsets.forEach(function (polygonOffsets) {
      var polygon = [];
      polygonOffsets.forEach(function (xyOffset) {
        var vX = refVertexX + xyOffset[0] * cellSize[0];
        var vY = refVertexY + xyOffset[1] * cellSize[1];
        polygon.push([vX, vY, vZ]);
      });
      polygons.push(polygon);
    });
    return polygons;
  } // default case is ISO_LINES


  var lines = [];
  offsets.forEach(function (xyOffsets) {
    xyOffsets.forEach(function (offset) {
      var vX = refVertexX + offset[0] * cellSize[0];
      var vY = refVertexY + offset[1] * cellSize[1];
      lines.push([vX, vY, vZ]);
    });
  });
  return lines;
}
},{"@deck.gl/core":"Tk4X","./marching-squares-codes":"MRjK"}],"ittV":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.generateContours = generateContours;

var _marchingSquares = require("./marching-squares");

// Given all the cell weights, generates contours for each threshold.

/* eslint-disable max-depth */
function generateContours(_ref) {
  var thresholdData = _ref.thresholdData,
      colors = _ref.colors,
      cellWeights = _ref.cellWeights,
      gridSize = _ref.gridSize,
      gridOrigin = _ref.gridOrigin,
      cellSize = _ref.cellSize;
  var contourSegments = [];
  var contourPolygons = [];
  var width = gridSize[0];
  var height = gridSize[1];
  thresholdData.forEach(function (data, index) {
    var threshold = data.threshold;

    for (var x = -1; x < width; x++) {
      for (var y = -1; y < height; y++) {
        // Get the MarchingSquares code based on neighbor cell weights.
        var _getCode = (0, _marchingSquares.getCode)({
          cellWeights: cellWeights,
          threshold: threshold,
          x: x,
          y: y,
          width: width,
          height: height
        }),
            code = _getCode.code,
            meanCode = _getCode.meanCode;

        var opts = {
          gridOrigin: gridOrigin,
          cellSize: cellSize,
          x: x,
          y: y,
          width: width,
          height: height,
          code: code,
          meanCode: meanCode,
          thresholdData: data
        };

        if (Array.isArray(threshold)) {
          opts.type = _marchingSquares.CONTOUR_TYPE.ISO_BANDS;
          var polygons = (0, _marchingSquares.getVertices)(opts);
          polygons.forEach(function (polygon) {
            contourPolygons.push({
              vertices: polygon,
              threshold: threshold
            });
          });
        } else {
          // Get the intersection vertices based on MarchingSquares code.
          opts.type = _marchingSquares.CONTOUR_TYPE.ISO_LINES;
          var vertices = (0, _marchingSquares.getVertices)(opts);

          for (var i = 0; i < vertices.length; i += 2) {
            contourSegments.push({
              start: vertices[i],
              end: vertices[i + 1],
              threshold: threshold
            });
          }
        }
      }
    }
  });
  return {
    contourSegments: contourSegments,
    contourPolygons: contourPolygons
  };
}
/* eslint-enable max-depth */
},{"./marching-squares":"CkF0"}],"rMsv":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _math = require("math.gl");

var _core = require("@deck.gl/core");

var _lineLayer = _interopRequireDefault(require("../line-layer/line-layer"));

var _solidPolygonLayer = _interopRequireDefault(require("../solid-polygon-layer/solid-polygon-layer"));

var _contourUtils = require("./contour-utils");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) {
  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);
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

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;
}

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return _assertThisInitialized(self);
}

function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

function _get(target, property, receiver) {
  if (typeof Reflect !== "undefined" && Reflect.get) {
    _get = Reflect.get;
  } else {
    _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(target, property, receiver || target);
}

function _superPropBase(object, property) {
  while (!Object.prototype.hasOwnProperty.call(object, property)) {
    object = _getPrototypeOf(object);
    if (object === null) break;
  }

  return object;
}

function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

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);
}

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
} // Copyright (c) 2015 - 2018 Uber Technologies, Inc.
//
// 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.


var DEFAULT_COLOR = [255, 255, 255, 255];
var DEFAULT_STROKE_WIDTH = 1;
var DEFAULT_THRESHOLD = 1;
var defaultProps = {
  // grid aggregation
  cellSize: {
    type: 'number',
    min: 1,
    max: 1000,
    value: 1000
  },
  getPosition: {
    type: 'accessor',
    value: function value(x) {
      return x.position;
    }
  },
  getWeight: {
    type: 'accessor',
    value: function value(x) {
      return 1;
    }
  },
  // contour lines
  contours: [{
    threshold: DEFAULT_THRESHOLD
  }],
  fp64: false,
  zOffsetScale: 1
};

var ContourLayer =
/*#__PURE__*/
function (_CompositeLayer) {
  _inherits(ContourLayer, _CompositeLayer);

  function ContourLayer() {
    _classCallCheck(this, ContourLayer);

    return _possibleConstructorReturn(this, _getPrototypeOf(ContourLayer).apply(this, arguments));
  }

  _createClass(ContourLayer, [{
    key: "initializeState",
    value: function initializeState() {
      var gl = this.context.gl;
      var options = {
        id: "".concat(this.id, "-gpu-aggregator"),
        shaderCache: this.context.shaderCache
      };
      this.state = {
        contourData: {},
        gridAggregator: new _core._GPUGridAggregator(gl, options),
        colorTrigger: 0,
        strokeWidthTrigger: 0
      };
    }
  }, {
    key: "updateState",
    value: function updateState(_ref) {
      var oldProps = _ref.oldProps,
          props = _ref.props,
          changeFlags = _ref.changeFlags;
      var dataChanged = false;
      var contoursChanged = false;

      var aggregationFlags = this._getAggregationFlags({
        oldProps: oldProps,
        props: props,
        changeFlags: changeFlags
      });

      if (aggregationFlags) {
        dataChanged = true; // Clear countsData cache

        this.setState({
          countsData: null
        });

        this._aggregateData(aggregationFlags);
      }

      if (this._shouldRebuildContours({
        oldProps: oldProps,
        props: props
      })) {
        contoursChanged = true;

        this._updateThresholdData(props);
      }

      if (dataChanged || contoursChanged) {
        this._generateContours();
      } else {
        // data for sublayers not changed check if color or strokeWidth need to be updated
        this._updateSubLayerTriggers(oldProps, props);
      }
    }
  }, {
    key: "renderLayers",
    value: function renderLayers() {
      var _this$state$contourDa = this.state.contourData,
          contourSegments = _this$state$contourDa.contourSegments,
          contourPolygons = _this$state$contourDa.contourPolygons;
      var hasIsolines = contourSegments && contourSegments.length > 0;
      var hasIsobands = contourPolygons && contourPolygons.length > 0;
      var lineLayer = hasIsolines && new _lineLayer.default(this._getLineLayerProps());
      var solidPolygonLayer = hasIsobands && new _solidPolygonLayer.default(this._getSolidPolygonLayerProps());
      return [lineLayer, solidPolygonLayer];
    } // Private

  }, {
    key: "_aggregateData",
    value: function _aggregateData(aggregationFlags) {
      var _this$props = this.props,
          data = _this$props.data,
          cellSizeMeters = _this$props.cellSize,
          getPosition = _this$props.getPosition,
          getWeight = _this$props.getWeight,
          gpuAggregation = _this$props.gpuAggregation,
          fp64 = _this$props.fp64,
          coordinateSystem = _this$props.coordinateSystem;

      var _pointToDensityGridDa = (0, _core._pointToDensityGridData)({
        data: data,
        cellSizeMeters: cellSizeMeters,
        getPosition: getPosition,
        getWeight: getWeight,
        gpuAggregation: gpuAggregation,
        gpuGridAggregator: this.state.gridAggregator,
        fp64: fp64,
        coordinateSystem: coordinateSystem,
        viewport: this.context.viewport,
        boundingBox: this.state.boundingBox,
        // avoid parsing data when it is not changed.
        aggregationFlags: aggregationFlags
      }),
          countsData = _pointToDensityGridDa.countsData,
          countsBuffer = _pointToDensityGridDa.countsBuffer,
          gridSize = _pointToDensityGridDa.gridSize,
          gridOrigin = _pointToDensityGridDa.gridOrigin,
          cellSize = _pointToDensityGridDa.cellSize,
          boundingBox = _pointToDensityGridDa.boundingBox;

      this.setState({
        countsData: countsData,
        countsBuffer: countsBuffer,
        gridSize: gridSize,
        gridOrigin: gridOrigin,
        cellSize: cellSize,
        boundingBox: boundingBox
      });
    }
  }, {
    key: "_generateContours",
    value: function _generateContours() {
      var _this$state = this.state,
          gridSize = _this$state.gridSize,
          gridOrigin = _this$state.gridOrigin,
          cellSize = _this$state.cellSize,
          thresholdData = _this$state.thresholdData;
      var countsData = this.state.countsData;

      if (!countsData) {
        var countsBuffer = this.state.countsBuffer;
        countsData = countsBuffer.getData();
        this.setState({
          countsData: countsData
        });
      }

      var _GPUGridAggregator$ge = _core._GPUGridAggregator.getCellData({
        countsData: countsData
      }),
          cellWeights = _GPUGridAggregator$ge.cellWeights; // const thresholds = this.props.contours.map(x => x.threshold);


      var contourData = (0, _contourUtils.generateContours)({
        thresholdData: thresholdData,
        cellWeights: cellWeights,
        gridSize: gridSize,
        gridOrigin: gridOrigin,
        cellSize: cellSize
      }); // contourData contains both iso-lines and iso-bands if requested.

      this.setState({
        contourData: contourData
      });
    }
  }, {
    key: "_getAggregationFlags",
    value: function _getAggregationFlags(_ref2) {
      var oldProps = _ref2.oldProps,
          props = _ref2.props,
          changeFlags = _ref2.changeFlags;
      var aggregationFlags = null;

      if (changeFlags.dataChanged || oldProps.gpuAggregation !== props.gpuAggregation || changeFlags.updateTriggersChanged && (changeFlags.updateTriggersChanged.all || changeFlags.updateTriggersChanged.getPosition)) {
        aggregationFlags = Object.assign({}, aggregationFlags, {
          dataChanged: true
        });
      }

      if (oldProps.cellSize !== props.cellSize) {
        aggregationFlags = Object.assign({}, aggregationFlags, {
          cellSizeChanged: true
        });
      }

      return aggregationFlags;
    }
  }, {
    key: "_getLineLayerProps",
    value: function _getLineLayerProps() {
      var fp64 = this.props.fp64;
      var _this$state2 = this.state,
          colorTrigger = _this$state2.colorTrigger,
          strokeWidthTrigger = _this$state2.strokeWidthTrigger;
      return _get(_getPrototypeOf(ContourLayer.prototype), "getSubLayerProps", this).call(this, {
        id: 'contour-line-layer',
        data: this.state.contourData.contourSegments,
        fp64: fp64,
        getSourcePosition: function getSourcePosition(d) {
          return d.start;
        },
        getTargetPosition: function getTargetPosition(d) {
          return d.end;
        },
        getColor: this._onGetSublayerColor.bind(this),
        getStrokeWidth: this._onGetSublayerStrokeWidth.bind(this),
        colorTrigger: colorTrigger,
        strokeWidthTrigger: strokeWidthTrigger,
        updateTriggers: {
          getColor: colorTrigger,
          getStrokeWidth: strokeWidthTrigger
        }
      });
    }
  }, {
    key: "_getSolidPolygonLayerProps",
    value: function _getSolidPolygonLayerProps() {
      var fp64 = this.props.fp64;
      var colorTrigger = this.state.colorTrigger;
      return _get(_getPrototypeOf(ContourLayer.prototype), "getSubLayerProps", this).call(this, {
        id: 'contour-solid-polygon-layer',
        data: this.state.contourData.contourPolygons,
        fp64: fp64,
        getPolygon: function getPolygon(d) {
          return d.vertices;
        },
        getFillColor: this._onGetSublayerColor.bind(this),
        colorTrigger: colorTrigger,
        updateTriggers: {
          getFillColor: colorTrigger
        }
      });
    }
  }, {
    key: "_onGetSublayerColor",
    value: function _onGetSublayerColor(element) {
      // element is either a line segment or polygon
      var contours = this.props.contours;
      var color = DEFAULT_COLOR;
      contours.forEach(function (data) {
        if ((0, _math.equals)(data.threshold, element.threshold)) {
          color = data.color || DEFAULT_COLOR;
        }
      });
      return color;
    }
  }, {
    key: "_onGetSublayerStrokeWidth",
    value: function _onGetSublayerStrokeWidth(segment) {
      var contours = this.props.contours;
      var strokeWidth = DEFAULT_STROKE_WIDTH; // Linearly searches the contours, but there should only be few contours

      contours.some(function (contour) {
        if (contour.threshold === segment.threshold) {
          strokeWidth = contour.strokeWidth || DEFAULT_STROKE_WIDTH;
          return true;
        }

        return false;
      });
      return strokeWidth;
    }
  }, {
    key: "_shouldRebuildContours",
    value: function _shouldRebuildContours(_ref3) {
      var oldProps = _ref3.oldProps,
          props = _ref3.props;

      if (!oldProps.contours || !oldProps.zOffsetScale || oldProps.contours.length !== props.contours.length || oldProps.zOffsetScale !== props.zOffsetScale) {
        return true;
      }

      var oldThresholds = oldProps.contours.map(function (x) {
        return x.threshold;
      });
      var thresholds = props.contours.map(function (x) {
        return x.threshold;
      });
      return thresholds.some(function (_, i) {
        return !(0, _math.equals)(thresholds[i], oldThresholds[i]);
      });
    }
  }, {
    key: "_updateSubLayerTriggers",
    value: function _updateSubLayerTriggers(oldProps, props) {
      if (oldProps && oldProps.contours && props && props.contours) {
        // threshold value change or count change will trigger data change for sublayers
        // those cases are not handled here.
        var oldColors = [];
        var newColors = [];
        var oldStrokeWidths = [];
        var newStrokeWidths = [];
        oldProps.contours.forEach(function (contour) {
          oldColors = oldColors.concat(contour.color);
          oldStrokeWidths.push(contour.strokeWidth || DEFAULT_STROKE_WIDTH);
        });
        props.contours.forEach(function (contour) {
          newColors = newColors.concat(contour.color);
          newStrokeWidths.push(contour.strokeWidth || DEFAULT_STROKE_WIDTH);
        });

        if (!(0, _math.equals)(oldColors, newColors)) {
          this.state.colorTrigger++;
        }

        if (!(0, _math.equals)(oldStrokeWidths, newStrokeWidths)) {
          this.state.strokeWidthTrigger++;
        }
      }
    }
  }, {
    key: "_updateThresholdData",
    value: function _updateThresholdData(props) {
      var thresholdData = props.contours.map(function (x, index) {
        return {
          threshold: x.threshold,
          zIndex: x.zIndex || index,
          zOffsetScale: props.zOffsetScale
        };
      });
      this.setState({
        thresholdData: thresholdData
      });
    }
  }]);

  return ContourLayer;
}(_core.CompositeLayer);

exports.default = ContourLayer;
ContourLayer.layerName = 'ContourLayer';
ContourLayer.defaultProps = defaultProps;
},{"math.gl":"dl2t","@deck.gl/core":"Tk4X","../line-layer/line-layer":"A8ZW","../solid-polygon-layer/solid-polygon-layer":"JyaK","./contour-utils":"ittV"}],"MZ59":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "ArcLayer", {
  enumerable: true,
  get: function () {
    return _arcLayer.default;
  }
});
Object.defineProperty(exports, "IconLayer", {
  enumerable: true,
  get: function () {
    return _iconLayer.default;
  }
});
Object.defineProperty(exports, "LineLayer", {
  enumerable: true,
  get: function () {
    return _lineLayer.default;
  }
});
Object.defineProperty(exports, "PointCloudLayer", {
  enumerable: true,
  get: function () {
    return _pointCloudLayer.default;
  }
});
Object.defineProperty(exports, "ScatterplotLayer", {
  enumerable: true,
  get: function () {
    return _scatterplotLayer.default;
  }
});
Object.defineProperty(exports, "ScreenGridLayer", {
  enumerable: true,
  get: function () {
    return _screenGridLayer.default;
  }
});
Object.defineProperty(exports, "GridLayer", {
  enumerable: true,
  get: function () {
    return _gridLayer.default;
  }
});
Object.defineProperty(exports, "GridCellLayer", {
  enumerable: true,
  get: function () {
    return _gridCellLayer.default;
  }
});
Object.defineProperty(exports, "HexagonLayer", {
  enumerable: true,
  get: function () {
    return _hexagonLayer.default;
  }
});
Object.defineProperty(exports, "HexagonCellLayer", {
  enumerable: true,
  get: function () {
    return _hexagonCellLayer.default;
  }
});
Object.defineProperty(exports, "PathLayer", {
  enumerable: true,
  get: function () {
    return _pathLayer.default;
  }
});
Object.defineProperty(exports, "PolygonLayer", {
  enumerable: true,
  get: function () {
    return _polygonLayer.default;
  }
});
Object.defineProperty(exports, "GeoJsonLayer", {
  enumerable: true,
  get: function () {
    return _geojsonLayer.default;
  }
});
Object.defineProperty(exports, "TextLayer", {
  enumerable: true,
  get: function () {
    return _textLayer.default;
  }
});
Object.defineProperty(exports, "ContourLayer", {
  enumerable: true,
  get: function () {
    return _contourLayer.default;
  }
});
Object.defineProperty(exports, "_SolidPolygonLayer", {
  enumerable: true,
  get: function () {
    return _solidPolygonLayer.default;
  }
});
Object.defineProperty(exports, "_MultiIconLayer", {
  enumerable: true,
  get: function () {
    return _multiIconLayer.default;
  }
});

var _arcLayer = _interopRequireDefault(require("./arc-layer/arc-layer"));

var _iconLayer = _interopRequireDefault(require("./icon-layer/icon-layer"));

var _lineLayer = _interopRequireDefault(require("./line-layer/line-layer"));

var _pointCloudLayer = _interopRequireDefault(require("./point-cloud-layer/point-cloud-layer"));

var _scatterplotLayer = _interopRequireDefault(require("./scatterplot-layer/scatterplot-layer"));

var _screenGridLayer = _interopRequireDefault(require("./screen-grid-layer/screen-grid-layer"));

var _gridLayer = _interopRequireDefault(require("./grid-layer/grid-layer"));

var _gridCellLayer = _interopRequireDefault(require("./grid-cell-layer/grid-cell-layer"));

var _hexagonLayer = _interopRequireDefault(require("./hexagon-layer/hexagon-layer"));

var _hexagonCellLayer = _interopRequireDefault(require("./hexagon-cell-layer/hexagon-cell-layer"));

var _pathLayer = _interopRequireDefault(require("./path-layer/path-layer"));

var _polygonLayer = _interopRequireDefault(require("./polygon-layer/polygon-layer"));

var _geojsonLayer = _interopRequireDefault(require("./geojson-layer/geojson-layer"));

var _textLayer = _interopRequireDefault(require("./text-layer/text-layer"));

var _contourLayer = _interopRequireDefault(require("./contour-layer/contour-layer"));

var _solidPolygonLayer = _interopRequireDefault(require("./solid-polygon-layer/solid-polygon-layer"));

var _multiIconLayer = _interopRequireDefault(require("./text-layer/multi-icon-layer/multi-icon-layer"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./arc-layer/arc-layer":"gGfz","./icon-layer/icon-layer":"gBB5","./line-layer/line-layer":"A8ZW","./point-cloud-layer/point-cloud-layer":"G23C","./scatterplot-layer/scatterplot-layer":"QcVn","./screen-grid-layer/screen-grid-layer":"eQFN","./grid-layer/grid-layer":"gCd7","./grid-cell-layer/grid-cell-layer":"GmiV","./hexagon-layer/hexagon-layer":"I7RZ","./hexagon-cell-layer/hexagon-cell-layer":"XDGA","./path-layer/path-layer":"H5W6","./polygon-layer/polygon-layer":"NzqK","./geojson-layer/geojson-layer":"h8vv","./text-layer/text-layer":"Gctc","./contour-layer/contour-layer":"rMsv","./solid-polygon-layer/solid-polygon-layer":"JyaK","./text-layer/multi-icon-layer/multi-icon-layer":"s2GF"}],"mpTF":[function(require,module,exports) {
module.exports = React;
},{}],"J77C":[function(require,module,exports) {
module.exports = ReactDOM;
},{}],"lE7J":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ColorScaleNone = exports.Other = exports.BarChartSignalNames = exports.BarChartScaleNames = exports.SignalNames = exports.ScaleNames = exports.DataNames = exports.FieldNames = void 0;
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const FieldNames = {
  Active: '__SandDance__Active',
  Collapsed: '__SandDance__Collapsed',
  Selected: '__SandDance__Selected',
  Top: '__SandDance__Top',
  TopIndex: '__SandDance__TopIndex',
  Index: '__SandDance__Index',
  PowerBISelectionId: '__SandDance__PowerBISelectionId',
  BarChartBin0: '__SandDance__BarChartBin0',
  BarChartBin1: '__SandDance__BarChartBin1',
  BarChartStack0: '__SandDance__BarChartStack0',
  BarChartStack1: '__SandDance__BarChartStack1',
  DensityCount: '__SandDance__DensityCount',
  DensityRow: '__SandDance__DensityRow',
  DensityXBin0: '__SandDance__DensityXBin0',
  DensityXBin1: '__SandDance__DensityXBin1',
  DensityYBin0: '__SandDance__DensityYBin0',
  DensityYBin1: '__SandDance__DensityYBin1',
  FacetBin0: '__SandDance__FacetBin0',
  FacetBin1: '__SandDance__FacetBin1',
  GridIndex: '__SandDance__GridIndex',
  StacksLatBin0: '__SandDance__StacksLatBin0',
  StacksLatBin1: '__SandDance__StacksLatBin1',
  StacksLongBin0: '__SandDance__StacksLongBin0',
  StacksLongBin1: '__SandDance__StacksLongBin1',
  StacksStart: '__SandDance__StacksStart',
  StacksEnd: '__SandDance__StacksEnd',
  TreemapStackChildren: '__SandDance__TreemapStackChildren',
  TreemapStackDepth: '__SandDance__TreemapStackDepth',
  TreemapStackX0: '__SandDance__TreemapStackX0',
  TreemapStackX1: '__SandDance__TreemapStackX1',
  TreemapStackY0: '__SandDance__TreemapStackY0',
  TreemapStackY1: '__SandDance__TreemapStackY1'
};
exports.FieldNames = FieldNames;
const DataNames = {
  Pre: 'PreData',
  Main: 'MainData',
  EmptyBin: 'EmptyBinsData',
  TopLookup: 'TopData',
  Legend: 'LegendData',
  FacetGroupCell: 'FacetGroupCellData',
  FacetCellTitles: 'FacetCellTitlesData',
  QuantitativeData: 'QuantitativeData'
};
exports.DataNames = DataNames;
const ScaleNames = {
  Color: 'ColorScale',
  X: 'MainXScale',
  Y: 'MainYScale',
  Z: 'MainZScale'
}; //Signal names

exports.ScaleNames = ScaleNames;
const SignalNames = {
  ColorBinCount: 'RoleColor_BinCountSignal',
  ColorReverse: 'RoleColor_ReverseSignal',
  FacetColumns: 'RoleFacet_ColumnsSignal',
  FacetRows: 'RoleFacet_RowsSignal',
  InnerPadding: 'Chart_InnerPadding',
  OuterPadding: 'Chart_OuterPadding',
  MarkOpacity: 'Mark_OpacitySignal',
  PointSize: 'Chart_PointSizeSignal',
  TextAngleX: 'Text_AngleXSignal',
  TextAngleY: 'Text_AngleYSignal',
  TextScale: 'Text_ScaleSignal',
  TextSize: 'Text_SizeSignal',
  TextTitleSize: 'Text_TitleSizeSignal',
  TreeMapMethod: 'Chart_TreeMapMethodSignal',
  XDomain: 'RoleX_DomainSignal',
  XBins: 'RoleX_BinsSignal',
  XGridSize: 'Chart_XGridSize',
  YBins: 'RoleY_BinsSignal',
  YDomain: 'RoleY_DomainSignal',
  YGridSize: 'Chart_YGridSize',
  ZHeight: 'RoleZ_HeightSignal',
  ZProportion: 'RoleZ_ProportionSignal'
};
exports.SignalNames = SignalNames;
const BarChartScaleNames = {
  bucketScale: 'bucketScale',
  levelScale: 'levelScale',
  compartmentScale: 'compartmentScale'
};
exports.BarChartScaleNames = BarChartScaleNames;
const BarChartSignalNames = {
  aspectRatioSignal: 'aspectRatioSignal',
  compartmentsPerLevelSignal: 'compartmentsPerLevelSignal',
  compartmentHeightSignal: 'compartmentHeightSignal',
  compartmentWidthSignal: 'compartmentWidthSignal',
  levelExtentSignal: 'levelExtentSignal',
  quantitativeBinSignal: 'quantitativeBinSignal'
}; //These are special formulaic data values

exports.BarChartSignalNames = BarChartSignalNames;
const Other = '__Other'; //name of the "no-color" palette

exports.Other = Other;
const ColorScaleNone = 'none';
exports.ColorScaleNone = ColorScaleNone;
},{}],"X4RB":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "ColorScaleNone", {
  enumerable: true,
  get: function () {
    return _constants.ColorScaleNone;
  }
});
Object.defineProperty(exports, "FieldNames", {
  enumerable: true,
  get: function () {
    return _constants.FieldNames;
  }
});
Object.defineProperty(exports, "ScaleNames", {
  enumerable: true,
  get: function () {
    return _constants.ScaleNames;
  }
});
Object.defineProperty(exports, "SignalNames", {
  enumerable: true,
  get: function () {
    return _constants.SignalNames;
  }
});

var _constants = require("./specs/constants");
},{"./specs/constants":"lE7J"}],"DYlx":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.isSearchExpressionGroup = isSearchExpressionGroup;
exports.createGroupFromExpression = createGroupFromExpression;
exports.ensureSearchExpressionGroupArray = ensureSearchExpressionGroupArray;

function isSearchExpressionGroup(search) {
  if (!search) {
    return false;
  }

  return !!search.expressions;
}

function createGroupFromExpression(input) {
  const output = {
    expressions: [input]
  };
  return output;
}

function ensureSearchExpressionGroupArray(search) {
  if (Array.isArray(search)) {
    return [...search];
  } else if (isSearchExpressionGroup(search)) {
    return [search];
  } else {
    return [createGroupFromExpression(search)];
  }
}
},{}],"qE9Q":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.compareExpression = compareExpression;
exports.compareGroup = compareGroup;
exports.compare = compare;
exports.startsWith = startsWith;

var _group = require("./group");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const expressionKeys = Object.keys({
  clause: null,
  name: null,
  operator: null,
  value: null
});

function compareExpression(a, b) {
  if (a && b) {
    for (let k = 0; k < expressionKeys.length; k++) {
      let key = expressionKeys[k];
      if (a[key] != b[key]) return false;
    }
  } else {
    return !a && !b;
  }

  return true;
}

const groupKeys = Object.keys({
  clause: null
});

function compareGroup(a, b) {
  for (let k = 0; k < groupKeys.length; k++) {
    let key = groupKeys[k];
    if (a[key] != b[key]) return false;
  }

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

  for (let i = 0; i < a.expressions.length; i++) {
    if (!compareExpression(a.expressions[i], b.expressions[i])) return false;
  }

  return true;
}

function compare(a, b) {
  if (a == b) return true;
  if (!a || !b) return false;
  let arrs = [a, b].map(_group.ensureSearchExpressionGroupArray);
  let [arrA, arrB] = arrs;
  if (arrA.length != arrB.length) return false;

  for (let i = 0; i < arrA.length; i++) {
    if (!compareGroup(arrA[i], arrB[i])) return false;
  }

  return true;
}

function startsWith(whole, part) {
  if (!part) return true;
  let arrs = [whole, part].map(_group.ensureSearchExpressionGroupArray);
  let [wholeArray, partArray] = arrs;
  if (partArray.length > wholeArray.length) return false;

  for (let i = 0; i < partArray.length; i++) {
    if (!compareGroup(wholeArray[i], partArray[i])) return false;
  }

  return true;
}
},{"./group":"DYlx"}],"c1x6":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.invert = invert;

var _group = require("./group");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function invertSearchExpressionGroup(input) {
  //this only works if all expressions in this group have the same clause
  const output = {
    expressions: input.expressions.map(invertSearchExpression)
  };

  if (input.clause) {
    output.clause = invertedClauses[input.clause];
  }

  return output;
}

const invertedOperators = {
  '!=': '==',
  '==': '!=',
  '<': '>=',
  '>=': '<',
  '<=': '>',
  '>': '<=',
  '!contains': 'contains',
  'contains': '!contains',
  '!isnullorEmpty': 'isnullorEmpty',
  'isnullorEmpty': '!isnullorEmpty',
  '!starts': 'starts',
  'starts': '!starts'
};
const invertedClauses = {
  '&&': '||',
  '||': '&&'
};

function invertSearchExpression(input) {
  const operator = invertedOperators[input.operator];
  const output = Object.assign(Object.assign({}, input), {
    operator
  });

  if (input.clause) {
    output.clause = invertedClauses[input.clause];
  }

  return output;
}

function invert(search) {
  if (Array.isArray(search)) {
    return search.map(invertSearchExpressionGroup);
  } else if ((0, _group.isSearchExpressionGroup)(search)) {
    return invertSearchExpressionGroup(search);
  } else {
    return invertSearchExpression(search);
  }
}
},{"./group":"DYlx"}],"JXBM":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.narrow = narrow;

var _group = require("./group");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function narrow(a, b) {
  if (!a) {
    return b;
  }

  let arrs = [a, b].map(_group.ensureSearchExpressionGroupArray);
  let [arrA, arrB] = arrs;
  arrB[0].clause = '&&';
  return arrA.concat(arrB);
}
},{"./group":"DYlx"}],"AwjT":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _compare = require("./compare");

Object.keys(_compare).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _compare[key];
    }
  });
});

var _invert = require("./invert");

Object.keys(_invert).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _invert[key];
    }
  });
});

var _narrow = require("./narrow");

Object.keys(_narrow).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _narrow[key];
    }
  });
});
},{"./compare":"qE9Q","./invert":"c1x6","./narrow":"JXBM"}],"KliF":[function(require,module,exports) {

},{}],"aLsw":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.layerNames = exports.GL_ORDINAL = void 0;
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const GL_ORDINAL = 'GL_ORDINAL';
exports.GL_ORDINAL = GL_ORDINAL;
const layerNames = {
  cubes: 'LAYER_CUBES',
  lines: 'LAYER_LINES',
  text: 'LAYER_TEXT'
};
exports.layerNames = layerNames;
},{}],"u2A8":[function(require,module,exports) {
var global = arguments[3];
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
/*!
 * XRegExp 4.0.0
 * <xregexp.com>
 * Steven Levithan (c) 2007-2017 MIT License
 */

/**
 * XRegExp provides augmented, extensible regular expressions. You get additional regex syntax and
 * flags, beyond what browsers support natively. XRegExp is also a regex utility belt with tools to
 * make your client-side grepping simpler and more powerful, while freeing you from related
 * cross-browser inconsistencies.
 */

// ==--------------------------==
// Private stuff
// ==--------------------------==

// Property name used for extended regex instance data
var REGEX_DATA = 'xregexp';
// Optional features that can be installed and uninstalled
var features = {
    astral: false
};
// Native methods to use and restore ('native' is an ES3 reserved keyword)
var nativ = {
    exec: RegExp.prototype.exec,
    test: RegExp.prototype.test,
    match: String.prototype.match,
    replace: String.prototype.replace,
    split: String.prototype.split
};
// Storage for fixed/extended native methods
var fixed = {};
// Storage for regexes cached by `XRegExp.cache`
var regexCache = {};
// Storage for pattern details cached by the `XRegExp` constructor
var patternCache = {};
// Storage for regex syntax tokens added internally or by `XRegExp.addToken`
var tokens = [];
// Token scopes
var defaultScope = 'default';
var classScope = 'class';
// Regexes that match native regex syntax, including octals
var nativeTokens = {
    // Any native multicharacter token in default scope, or any single character
    'default': /\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9]\d*|x[\dA-Fa-f]{2}|u(?:[\dA-Fa-f]{4}|{[\dA-Fa-f]+})|c[A-Za-z]|[\s\S])|\(\?(?:[:=!]|<[=!])|[?*+]\?|{\d+(?:,\d*)?}\??|[\s\S]/,
    // Any native multicharacter token in character class scope, or any single character
    'class': /\\(?:[0-3][0-7]{0,2}|[4-7][0-7]?|x[\dA-Fa-f]{2}|u(?:[\dA-Fa-f]{4}|{[\dA-Fa-f]+})|c[A-Za-z]|[\s\S])|[\s\S]/
};
// Any backreference or dollar-prefixed character in replacement strings
var replacementToken = /\$(?:{([\w$]+)}|<([\w$]+)>|(\d\d?|[\s\S]))/g;
// Check for correct `exec` handling of nonparticipating capturing groups
var correctExecNpcg = nativ.exec.call(/()??/, '')[1] === undefined;
// Check for ES6 `flags` prop support
var hasFlagsProp = /x/.flags !== undefined;
// Shortcut to `Object.prototype.toString`
var toString = {}.toString;

function hasNativeFlag(flag) {
    // Can't check based on the presence of properties/getters since browsers might support such
    // properties even when they don't support the corresponding flag in regex construction (tested
    // in Chrome 48, where `'unicode' in /x/` is true but trying to construct a regex with flag `u`
    // throws an error)
    var isSupported = true;
    try {
        // Can't use regex literals for testing even in a `try` because regex literals with
        // unsupported flags cause a compilation error in IE
        new RegExp('', flag);
    } catch (exception) {
        isSupported = false;
    }
    return isSupported;
}
// Check for ES6 `u` flag support
var hasNativeU = hasNativeFlag('u');
// Check for ES6 `y` flag support
var hasNativeY = hasNativeFlag('y');
// Tracker for known flags, including addon flags
var registeredFlags = {
    g: true,
    i: true,
    m: true,
    u: hasNativeU,
    y: hasNativeY
};

/**
 * Attaches extended data and `XRegExp.prototype` properties to a regex object.
 *
 * @private
 * @param {RegExp} regex Regex to augment.
 * @param {Array} captureNames Array with capture names, or `null`.
 * @param {String} xSource XRegExp pattern used to generate `regex`, or `null` if N/A.
 * @param {String} xFlags XRegExp flags used to generate `regex`, or `null` if N/A.
 * @param {Boolean} [isInternalOnly=false] Whether the regex will be used only for internal
 *   operations, and never exposed to users. For internal-only regexes, we can improve perf by
 *   skipping some operations like attaching `XRegExp.prototype` properties.
 * @returns {RegExp} Augmented regex.
 */
function augment(regex, captureNames, xSource, xFlags, isInternalOnly) {
    var p = void 0;

    regex[REGEX_DATA] = {
        captureNames: captureNames
    };

    if (isInternalOnly) {
        return regex;
    }

    // Can't auto-inherit these since the XRegExp constructor returns a nonprimitive value
    if (regex.__proto__) {
        regex.__proto__ = XRegExp.prototype;
    } else {
        for (p in XRegExp.prototype) {
            // An `XRegExp.prototype.hasOwnProperty(p)` check wouldn't be worth it here, since this
            // is performance sensitive, and enumerable `Object.prototype` or `RegExp.prototype`
            // extensions exist on `regex.prototype` anyway
            regex[p] = XRegExp.prototype[p];
        }
    }

    regex[REGEX_DATA].source = xSource;
    // Emulate the ES6 `flags` prop by ensuring flags are in alphabetical order
    regex[REGEX_DATA].flags = xFlags ? xFlags.split('').sort().join('') : xFlags;

    return regex;
}

/**
 * Removes any duplicate characters from the provided string.
 *
 * @private
 * @param {String} str String to remove duplicate characters from.
 * @returns {String} String with any duplicate characters removed.
 */
function clipDuplicates(str) {
    return nativ.replace.call(str, /([\s\S])(?=[\s\S]*\1)/g, '');
}

/**
 * Copies a regex object while preserving extended data and augmenting with `XRegExp.prototype`
 * properties. The copy has a fresh `lastIndex` property (set to zero). Allows adding and removing
 * flags g and y while copying the regex.
 *
 * @private
 * @param {RegExp} regex Regex to copy.
 * @param {Object} [options] Options object with optional properties:
 *   - `addG` {Boolean} Add flag g while copying the regex.
 *   - `addY` {Boolean} Add flag y while copying the regex.
 *   - `removeG` {Boolean} Remove flag g while copying the regex.
 *   - `removeY` {Boolean} Remove flag y while copying the regex.
 *   - `isInternalOnly` {Boolean} Whether the copied regex will be used only for internal
 *     operations, and never exposed to users. For internal-only regexes, we can improve perf by
 *     skipping some operations like attaching `XRegExp.prototype` properties.
 *   - `source` {String} Overrides `<regex>.source`, for special cases.
 * @returns {RegExp} Copy of the provided regex, possibly with modified flags.
 */
function copyRegex(regex, options) {
    if (!XRegExp.isRegExp(regex)) {
        throw new TypeError('Type RegExp expected');
    }

    var xData = regex[REGEX_DATA] || {};
    var flags = getNativeFlags(regex);
    var flagsToAdd = '';
    var flagsToRemove = '';
    var xregexpSource = null;
    var xregexpFlags = null;

    options = options || {};

    if (options.removeG) {
        flagsToRemove += 'g';
    }
    if (options.removeY) {
        flagsToRemove += 'y';
    }
    if (flagsToRemove) {
        flags = nativ.replace.call(flags, new RegExp('[' + flagsToRemove + ']+', 'g'), '');
    }

    if (options.addG) {
        flagsToAdd += 'g';
    }
    if (options.addY) {
        flagsToAdd += 'y';
    }
    if (flagsToAdd) {
        flags = clipDuplicates(flags + flagsToAdd);
    }

    if (!options.isInternalOnly) {
        if (xData.source !== undefined) {
            xregexpSource = xData.source;
        }
        // null or undefined; don't want to add to `flags` if the previous value was null, since
        // that indicates we're not tracking original precompilation flags
        if (xData.flags != null) {
            // Flags are only added for non-internal regexes by `XRegExp.globalize`. Flags are never
            // removed for non-internal regexes, so don't need to handle it
            xregexpFlags = flagsToAdd ? clipDuplicates(xData.flags + flagsToAdd) : xData.flags;
        }
    }

    // Augment with `XRegExp.prototype` properties, but use the native `RegExp` constructor to avoid
    // searching for special tokens. That would be wrong for regexes constructed by `RegExp`, and
    // unnecessary for regexes constructed by `XRegExp` because the regex has already undergone the
    // translation to native regex syntax
    regex = augment(new RegExp(options.source || regex.source, flags), hasNamedCapture(regex) ? xData.captureNames.slice(0) : null, xregexpSource, xregexpFlags, options.isInternalOnly);

    return regex;
}

/**
 * Converts hexadecimal to decimal.
 *
 * @private
 * @param {String} hex
 * @returns {Number}
 */
function dec(hex) {
    return parseInt(hex, 16);
}

/**
 * Returns a pattern that can be used in a native RegExp in place of an ignorable token such as an
 * inline comment or whitespace with flag x. This is used directly as a token handler function
 * passed to `XRegExp.addToken`.
 *
 * @private
 * @param {String} match Match arg of `XRegExp.addToken` handler
 * @param {String} scope Scope arg of `XRegExp.addToken` handler
 * @param {String} flags Flags arg of `XRegExp.addToken` handler
 * @returns {String} Either '' or '(?:)', depending on which is needed in the context of the match.
 */
function getContextualTokenSeparator(match, scope, flags) {
    if (
    // No need to separate tokens if at the beginning or end of a group
    match.input[match.index - 1] === '(' || match.input[match.index + match[0].length] === ')' ||
    // Avoid separating tokens when the following token is a quantifier
    isQuantifierNext(match.input, match.index + match[0].length, flags)) {
        return '';
    }
    // Keep tokens separated. This avoids e.g. inadvertedly changing `\1 1` or `\1(?#)1` to `\11`.
    // This also ensures all tokens remain as discrete atoms, e.g. it avoids converting the syntax
    // error `(? :` into `(?:`.
    return '(?:)';
}

/**
 * Returns native `RegExp` flags used by a regex object.
 *
 * @private
 * @param {RegExp} regex Regex to check.
 * @returns {String} Native flags in use.
 */
function getNativeFlags(regex) {
    return hasFlagsProp ? regex.flags :
    // Explicitly using `RegExp.prototype.toString` (rather than e.g. `String` or concatenation
    // with an empty string) allows this to continue working predictably when
    // `XRegExp.proptotype.toString` is overridden
    nativ.exec.call(/\/([a-z]*)$/i, RegExp.prototype.toString.call(regex))[1];
}

/**
 * Determines whether a regex has extended instance data used to track capture names.
 *
 * @private
 * @param {RegExp} regex Regex to check.
 * @returns {Boolean} Whether the regex uses named capture.
 */
function hasNamedCapture(regex) {
    return !!(regex[REGEX_DATA] && regex[REGEX_DATA].captureNames);
}

/**
 * Converts decimal to hexadecimal.
 *
 * @private
 * @param {Number|String} dec
 * @returns {String}
 */
function hex(dec) {
    return parseInt(dec, 10).toString(16);
}

/**
 * Checks whether the next nonignorable token after the specified position is a quantifier.
 *
 * @private
 * @param {String} pattern Pattern to search within.
 * @param {Number} pos Index in `pattern` to search at.
 * @param {String} flags Flags used by the pattern.
 * @returns {Boolean} Whether the next nonignorable token is a quantifier.
 */
function isQuantifierNext(pattern, pos, flags) {
    var inlineCommentPattern = '\\(\\?#[^)]*\\)';
    var lineCommentPattern = '#[^#\\n]*';
    var quantifierPattern = '[?*+]|{\\d+(?:,\\d*)?}';
    return nativ.test.call(flags.indexOf('x') !== -1 ?
    // Ignore any leading whitespace, line comments, and inline comments
    /^(?:\s|#[^#\n]*|\(\?#[^)]*\))*(?:[?*+]|{\d+(?:,\d*)?})/ :
    // Ignore any leading inline comments
    /^(?:\(\?#[^)]*\))*(?:[?*+]|{\d+(?:,\d*)?})/, pattern.slice(pos));
}

/**
 * Determines whether a value is of the specified type, by resolving its internal [[Class]].
 *
 * @private
 * @param {*} value Object to check.
 * @param {String} type Type to check for, in TitleCase.
 * @returns {Boolean} Whether the object matches the type.
 */
function isType(value, type) {
    return toString.call(value) === '[object ' + type + ']';
}

/**
 * Adds leading zeros if shorter than four characters. Used for fixed-length hexadecimal values.
 *
 * @private
 * @param {String} str
 * @returns {String}
 */
function pad4(str) {
    while (str.length < 4) {
        str = '0' + str;
    }
    return str;
}

/**
 * Checks for flag-related errors, and strips/applies flags in a leading mode modifier. Offloads
 * the flag preparation logic from the `XRegExp` constructor.
 *
 * @private
 * @param {String} pattern Regex pattern, possibly with a leading mode modifier.
 * @param {String} flags Any combination of flags.
 * @returns {Object} Object with properties `pattern` and `flags`.
 */
function prepareFlags(pattern, flags) {
    var i = void 0;

    // Recent browsers throw on duplicate flags, so copy this behavior for nonnative flags
    if (clipDuplicates(flags) !== flags) {
        throw new SyntaxError('Invalid duplicate regex flag ' + flags);
    }

    // Strip and apply a leading mode modifier with any combination of flags except g or y
    pattern = nativ.replace.call(pattern, /^\(\?([\w$]+)\)/, function ($0, $1) {
        if (nativ.test.call(/[gy]/, $1)) {
            throw new SyntaxError('Cannot use flag g or y in mode modifier ' + $0);
        }
        // Allow duplicate flags within the mode modifier
        flags = clipDuplicates(flags + $1);
        return '';
    });

    // Throw on unknown native or nonnative flags
    for (i = 0; i < flags.length; ++i) {
        if (!registeredFlags[flags[i]]) {
            throw new SyntaxError('Unknown regex flag ' + flags[i]);
        }
    }

    return {
        pattern: pattern,
        flags: flags
    };
}

/**
 * Prepares an options object from the given value.
 *
 * @private
 * @param {String|Object} value Value to convert to an options object.
 * @returns {Object} Options object.
 */
function prepareOptions(value) {
    var options = {};

    if (isType(value, 'String')) {
        XRegExp.forEach(value, /[^\s,]+/, function (match) {
            options[match] = true;
        });

        return options;
    }

    return value;
}

/**
 * Registers a flag so it doesn't throw an 'unknown flag' error.
 *
 * @private
 * @param {String} flag Single-character flag to register.
 */
function registerFlag(flag) {
    if (!/^[\w$]$/.test(flag)) {
        throw new Error('Flag must be a single character A-Za-z0-9_$');
    }

    registeredFlags[flag] = true;
}

/**
 * Runs built-in and custom regex syntax tokens in reverse insertion order at the specified
 * position, until a match is found.
 *
 * @private
 * @param {String} pattern Original pattern from which an XRegExp object is being built.
 * @param {String} flags Flags being used to construct the regex.
 * @param {Number} pos Position to search for tokens within `pattern`.
 * @param {Number} scope Regex scope to apply: 'default' or 'class'.
 * @param {Object} context Context object to use for token handler functions.
 * @returns {Object} Object with properties `matchLength`, `output`, and `reparse`; or `null`.
 */
function runTokens(pattern, flags, pos, scope, context) {
    var i = tokens.length;
    var leadChar = pattern[pos];
    var result = null;
    var match = void 0;
    var t = void 0;

    // Run in reverse insertion order
    while (i--) {
        t = tokens[i];
        if (t.leadChar && t.leadChar !== leadChar || t.scope !== scope && t.scope !== 'all' || t.flag && !(flags.indexOf(t.flag) !== -1)) {
            continue;
        }

        match = XRegExp.exec(pattern, t.regex, pos, 'sticky');
        if (match) {
            result = {
                matchLength: match[0].length,
                output: t.handler.call(context, match, scope, flags),
                reparse: t.reparse
            };
            // Finished with token tests
            break;
        }
    }

    return result;
}

/**
 * Enables or disables implicit astral mode opt-in. When enabled, flag A is automatically added to
 * all new regexes created by XRegExp. This causes an error to be thrown when creating regexes if
 * the Unicode Base addon is not available, since flag A is registered by that addon.
 *
 * @private
 * @param {Boolean} on `true` to enable; `false` to disable.
 */
function setAstral(on) {
    features.astral = on;
}

/**
 * Returns the object, or throws an error if it is `null` or `undefined`. This is used to follow
 * the ES5 abstract operation `ToObject`.
 *
 * @private
 * @param {*} value Object to check and return.
 * @returns {*} The provided object.
 */
function toObject(value) {
    // null or undefined
    if (value == null) {
        throw new TypeError('Cannot convert null or undefined to object');
    }

    return value;
}

// ==--------------------------==
// Constructor
// ==--------------------------==

/**
 * Creates an extended regular expression object for matching text with a pattern. Differs from a
 * native regular expression in that additional syntax and flags are supported. The returned object
 * is in fact a native `RegExp` and works with all native methods.
 *
 * @class XRegExp
 * @constructor
 * @param {String|RegExp} pattern Regex pattern string, or an existing regex object to copy.
 * @param {String} [flags] Any combination of flags.
 *   Native flags:
 *     - `g` - global
 *     - `i` - ignore case
 *     - `m` - multiline anchors
 *     - `u` - unicode (ES6)
 *     - `y` - sticky (Firefox 3+, ES6)
 *   Additional XRegExp flags:
 *     - `n` - explicit capture
 *     - `s` - dot matches all (aka singleline)
 *     - `x` - free-spacing and line comments (aka extended)
 *     - `A` - astral (requires the Unicode Base addon)
 *   Flags cannot be provided when constructing one `RegExp` from another.
 * @returns {RegExp} Extended regular expression object.
 * @example
 *
 * // With named capture and flag x
 * XRegExp(`(?<year>  [0-9]{4} ) -?  # year
 *          (?<month> [0-9]{2} ) -?  # month
 *          (?<day>   [0-9]{2} )     # day`, 'x');
 *
 * // Providing a regex object copies it. Native regexes are recompiled using native (not XRegExp)
 * // syntax. Copies maintain extended data, are augmented with `XRegExp.prototype` properties, and
 * // have fresh `lastIndex` properties (set to zero).
 * XRegExp(/regex/);
 */
function XRegExp(pattern, flags) {
    if (XRegExp.isRegExp(pattern)) {
        if (flags !== undefined) {
            throw new TypeError('Cannot supply flags when copying a RegExp');
        }
        return copyRegex(pattern);
    }

    // Copy the argument behavior of `RegExp`
    pattern = pattern === undefined ? '' : String(pattern);
    flags = flags === undefined ? '' : String(flags);

    if (XRegExp.isInstalled('astral') && !(flags.indexOf('A') !== -1)) {
        // This causes an error to be thrown if the Unicode Base addon is not available
        flags += 'A';
    }

    if (!patternCache[pattern]) {
        patternCache[pattern] = {};
    }

    if (!patternCache[pattern][flags]) {
        var context = {
            hasNamedCapture: false,
            captureNames: []
        };
        var scope = defaultScope;
        var output = '';
        var pos = 0;
        var result = void 0;

        // Check for flag-related errors, and strip/apply flags in a leading mode modifier
        var applied = prepareFlags(pattern, flags);
        var appliedPattern = applied.pattern;
        var appliedFlags = applied.flags;

        // Use XRegExp's tokens to translate the pattern to a native regex pattern.
        // `appliedPattern.length` may change on each iteration if tokens use `reparse`
        while (pos < appliedPattern.length) {
            do {
                // Check for custom tokens at the current position
                result = runTokens(appliedPattern, appliedFlags, pos, scope, context);
                // If the matched token used the `reparse` option, splice its output into the
                // pattern before running tokens again at the same position
                if (result && result.reparse) {
                    appliedPattern = appliedPattern.slice(0, pos) + result.output + appliedPattern.slice(pos + result.matchLength);
                }
            } while (result && result.reparse);

            if (result) {
                output += result.output;
                pos += result.matchLength || 1;
            } else {
                // Get the native token at the current position
                var token = XRegExp.exec(appliedPattern, nativeTokens[scope], pos, 'sticky')[0];
                output += token;
                pos += token.length;
                if (token === '[' && scope === defaultScope) {
                    scope = classScope;
                } else if (token === ']' && scope === classScope) {
                    scope = defaultScope;
                }
            }
        }

        patternCache[pattern][flags] = {
            // Use basic cleanup to collapse repeated empty groups like `(?:)(?:)` to `(?:)`. Empty
            // groups are sometimes inserted during regex transpilation in order to keep tokens
            // separated. However, more than one empty group in a row is never needed.
            pattern: nativ.replace.call(output, /(?:\(\?:\))+/g, '(?:)'),
            // Strip all but native flags
            flags: nativ.replace.call(appliedFlags, /[^gimuy]+/g, ''),
            // `context.captureNames` has an item for each capturing group, even if unnamed
            captures: context.hasNamedCapture ? context.captureNames : null
        };
    }

    var generated = patternCache[pattern][flags];
    return augment(new RegExp(generated.pattern, generated.flags), generated.captures, pattern, flags);
}

// Add `RegExp.prototype` to the prototype chain
XRegExp.prototype = /(?:)/;

// ==--------------------------==
// Public properties
// ==--------------------------==

/**
 * The XRegExp version number as a string containing three dot-separated parts. For example,
 * '2.0.0-beta-3'.
 *
 * @static
 * @memberOf XRegExp
 * @type String
 */
XRegExp.version = '4.0.0';

// ==--------------------------==
// Public methods
// ==--------------------------==

// Intentionally undocumented; used in tests and addons
XRegExp._clipDuplicates = clipDuplicates;
XRegExp._hasNativeFlag = hasNativeFlag;
XRegExp._dec = dec;
XRegExp._hex = hex;
XRegExp._pad4 = pad4;

/**
 * Extends XRegExp syntax and allows custom flags. This is used internally and can be used to
 * create XRegExp addons. If more than one token can match the same string, the last added wins.
 *
 * @memberOf XRegExp
 * @param {RegExp} regex Regex object that matches the new token.
 * @param {Function} handler Function that returns a new pattern string (using native regex syntax)
 *   to replace the matched token within all future XRegExp regexes. Has access to persistent
 *   properties of the regex being built, through `this`. Invoked with three arguments:
 *   - The match array, with named backreference properties.
 *   - The regex scope where the match was found: 'default' or 'class'.
 *   - The flags used by the regex, including any flags in a leading mode modifier.
 *   The handler function becomes part of the XRegExp construction process, so be careful not to
 *   construct XRegExps within the function or you will trigger infinite recursion.
 * @param {Object} [options] Options object with optional properties:
 *   - `scope` {String} Scope where the token applies: 'default', 'class', or 'all'.
 *   - `flag` {String} Single-character flag that triggers the token. This also registers the
 *     flag, which prevents XRegExp from throwing an 'unknown flag' error when the flag is used.
 *   - `optionalFlags` {String} Any custom flags checked for within the token `handler` that are
 *     not required to trigger the token. This registers the flags, to prevent XRegExp from
 *     throwing an 'unknown flag' error when any of the flags are used.
 *   - `reparse` {Boolean} Whether the `handler` function's output should not be treated as
 *     final, and instead be reparseable by other tokens (including the current token). Allows
 *     token chaining or deferring.
 *   - `leadChar` {String} Single character that occurs at the beginning of any successful match
 *     of the token (not always applicable). This doesn't change the behavior of the token unless
 *     you provide an erroneous value. However, providing it can increase the token's performance
 *     since the token can be skipped at any positions where this character doesn't appear.
 * @example
 *
 * // Basic usage: Add \a for the ALERT control code
 * XRegExp.addToken(
 *   /\\a/,
 *   () => '\\x07',
 *   {scope: 'all'}
 * );
 * XRegExp('\\a[\\a-\\n]+').test('\x07\n\x07'); // -> true
 *
 * // Add the U (ungreedy) flag from PCRE and RE2, which reverses greedy and lazy quantifiers.
 * // Since `scope` is not specified, it uses 'default' (i.e., transformations apply outside of
 * // character classes only)
 * XRegExp.addToken(
 *   /([?*+]|{\d+(?:,\d*)?})(\??)/,
 *   (match) => `${match[1]}${match[2] ? '' : '?'}`,
 *   {flag: 'U'}
 * );
 * XRegExp('a+', 'U').exec('aaa')[0]; // -> 'a'
 * XRegExp('a+?', 'U').exec('aaa')[0]; // -> 'aaa'
 */
XRegExp.addToken = function (regex, handler, options) {
    options = options || {};
    var optionalFlags = options.optionalFlags;
    var i = void 0;

    if (options.flag) {
        registerFlag(options.flag);
    }

    if (optionalFlags) {
        optionalFlags = nativ.split.call(optionalFlags, '');
        for (i = 0; i < optionalFlags.length; ++i) {
            registerFlag(optionalFlags[i]);
        }
    }

    // Add to the private list of syntax tokens
    tokens.push({
        regex: copyRegex(regex, {
            addG: true,
            addY: hasNativeY,
            isInternalOnly: true
        }),
        handler: handler,
        scope: options.scope || defaultScope,
        flag: options.flag,
        reparse: options.reparse,
        leadChar: options.leadChar
    });

    // Reset the pattern cache used by the `XRegExp` constructor, since the same pattern and flags
    // might now produce different results
    XRegExp.cache.flush('patterns');
};

/**
 * Caches and returns the result of calling `XRegExp(pattern, flags)`. On any subsequent call with
 * the same pattern and flag combination, the cached copy of the regex is returned.
 *
 * @memberOf XRegExp
 * @param {String} pattern Regex pattern string.
 * @param {String} [flags] Any combination of XRegExp flags.
 * @returns {RegExp} Cached XRegExp object.
 * @example
 *
 * while (match = XRegExp.cache('.', 'gs').exec(str)) {
 *   // The regex is compiled once only
 * }
 */
XRegExp.cache = function (pattern, flags) {
    if (!regexCache[pattern]) {
        regexCache[pattern] = {};
    }
    return regexCache[pattern][flags] || (regexCache[pattern][flags] = XRegExp(pattern, flags));
};

// Intentionally undocumented; used in tests
XRegExp.cache.flush = function (cacheName) {
    if (cacheName === 'patterns') {
        // Flush the pattern cache used by the `XRegExp` constructor
        patternCache = {};
    } else {
        // Flush the regex cache populated by `XRegExp.cache`
        regexCache = {};
    }
};

/**
 * Escapes any regular expression metacharacters, for use when matching literal strings. The result
 * can safely be used at any point within a regex that uses any flags.
 *
 * @memberOf XRegExp
 * @param {String} str String to escape.
 * @returns {String} String with regex metacharacters escaped.
 * @example
 *
 * XRegExp.escape('Escaped? <.>');
 * // -> 'Escaped\?\ <\.>'
 */
XRegExp.escape = function (str) {
    return nativ.replace.call(toObject(str), /[-\[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
};

/**
 * Executes a regex search in a specified string. Returns a match array or `null`. If the provided
 * regex uses named capture, named backreference properties are included on the match array.
 * Optional `pos` and `sticky` arguments specify the search start position, and whether the match
 * must start at the specified position only. The `lastIndex` property of the provided regex is not
 * used, but is updated for compatibility. Also fixes browser bugs compared to the native
 * `RegExp.prototype.exec` and can be used reliably cross-browser.
 *
 * @memberOf XRegExp
 * @param {String} str String to search.
 * @param {RegExp} regex Regex to search with.
 * @param {Number} [pos=0] Zero-based index at which to start the search.
 * @param {Boolean|String} [sticky=false] Whether the match must start at the specified position
 *   only. The string `'sticky'` is accepted as an alternative to `true`.
 * @returns {Array} Match array with named backreference properties, or `null`.
 * @example
 *
 * // Basic use, with named backreference
 * let match = XRegExp.exec('U+2620', XRegExp('U\\+(?<hex>[0-9A-F]{4})'));
 * match.hex; // -> '2620'
 *
 * // With pos and sticky, in a loop
 * let pos = 2, result = [], match;
 * while (match = XRegExp.exec('<1><2><3><4>5<6>', /<(\d)>/, pos, 'sticky')) {
 *   result.push(match[1]);
 *   pos = match.index + match[0].length;
 * }
 * // result -> ['2', '3', '4']
 */
XRegExp.exec = function (str, regex, pos, sticky) {
    var cacheKey = 'g';
    var addY = false;
    var fakeY = false;
    var match = void 0;

    addY = hasNativeY && !!(sticky || regex.sticky && sticky !== false);
    if (addY) {
        cacheKey += 'y';
    } else if (sticky) {
        // Simulate sticky matching by appending an empty capture to the original regex. The
        // resulting regex will succeed no matter what at the current index (set with `lastIndex`),
        // and will not search the rest of the subject string. We'll know that the original regex
        // has failed if that last capture is `''` rather than `undefined` (i.e., if that last
        // capture participated in the match).
        fakeY = true;
        cacheKey += 'FakeY';
    }

    regex[REGEX_DATA] = regex[REGEX_DATA] || {};

    // Shares cached copies with `XRegExp.match`/`replace`
    var r2 = regex[REGEX_DATA][cacheKey] || (regex[REGEX_DATA][cacheKey] = copyRegex(regex, {
        addG: true,
        addY: addY,
        source: fakeY ? regex.source + '|()' : undefined,
        removeY: sticky === false,
        isInternalOnly: true
    }));

    pos = pos || 0;
    r2.lastIndex = pos;

    // Fixed `exec` required for `lastIndex` fix, named backreferences, etc.
    match = fixed.exec.call(r2, str);

    // Get rid of the capture added by the pseudo-sticky matcher if needed. An empty string means
    // the original regexp failed (see above).
    if (fakeY && match && match.pop() === '') {
        match = null;
    }

    if (regex.global) {
        regex.lastIndex = match ? r2.lastIndex : 0;
    }

    return match;
};

/**
 * Executes a provided function once per regex match. Searches always start at the beginning of the
 * string and continue until the end, regardless of the state of the regex's `global` property and
 * initial `lastIndex`.
 *
 * @memberOf XRegExp
 * @param {String} str String to search.
 * @param {RegExp} regex Regex to search with.
 * @param {Function} callback Function to execute for each match. Invoked with four arguments:
 *   - The match array, with named backreference properties.
 *   - The zero-based match index.
 *   - The string being traversed.
 *   - The regex object being used to traverse the string.
 * @example
 *
 * // Extracts every other digit from a string
 * const evens = [];
 * XRegExp.forEach('1a2345', /\d/, (match, i) => {
 *   if (i % 2) evens.push(+match[0]);
 * });
 * // evens -> [2, 4]
 */
XRegExp.forEach = function (str, regex, callback) {
    var pos = 0;
    var i = -1;
    var match = void 0;

    while (match = XRegExp.exec(str, regex, pos)) {
        // Because `regex` is provided to `callback`, the function could use the deprecated/
        // nonstandard `RegExp.prototype.compile` to mutate the regex. However, since `XRegExp.exec`
        // doesn't use `lastIndex` to set the search position, this can't lead to an infinite loop,
        // at least. Actually, because of the way `XRegExp.exec` caches globalized versions of
        // regexes, mutating the regex will not have any effect on the iteration or matched strings,
        // which is a nice side effect that brings extra safety.
        callback(match, ++i, str, regex);

        pos = match.index + (match[0].length || 1);
    }
};

/**
 * Copies a regex object and adds flag `g`. The copy maintains extended data, is augmented with
 * `XRegExp.prototype` properties, and has a fresh `lastIndex` property (set to zero). Native
 * regexes are not recompiled using XRegExp syntax.
 *
 * @memberOf XRegExp
 * @param {RegExp} regex Regex to globalize.
 * @returns {RegExp} Copy of the provided regex with flag `g` added.
 * @example
 *
 * const globalCopy = XRegExp.globalize(/regex/);
 * globalCopy.global; // -> true
 */
XRegExp.globalize = function (regex) {
    return copyRegex(regex, { addG: true });
};

/**
 * Installs optional features according to the specified options. Can be undone using
 * `XRegExp.uninstall`.
 *
 * @memberOf XRegExp
 * @param {Object|String} options Options object or string.
 * @example
 *
 * // With an options object
 * XRegExp.install({
 *   // Enables support for astral code points in Unicode addons (implicitly sets flag A)
 *   astral: true
 * });
 *
 * // With an options string
 * XRegExp.install('astral');
 */
XRegExp.install = function (options) {
    options = prepareOptions(options);

    if (!features.astral && options.astral) {
        setAstral(true);
    }
};

/**
 * Checks whether an individual optional feature is installed.
 *
 * @memberOf XRegExp
 * @param {String} feature Name of the feature to check. One of:
 *   - `astral`
 * @returns {Boolean} Whether the feature is installed.
 * @example
 *
 * XRegExp.isInstalled('astral');
 */
XRegExp.isInstalled = function (feature) {
    return !!features[feature];
};

/**
 * Returns `true` if an object is a regex; `false` if it isn't. This works correctly for regexes
 * created in another frame, when `instanceof` and `constructor` checks would fail.
 *
 * @memberOf XRegExp
 * @param {*} value Object to check.
 * @returns {Boolean} Whether the object is a `RegExp` object.
 * @example
 *
 * XRegExp.isRegExp('string'); // -> false
 * XRegExp.isRegExp(/regex/i); // -> true
 * XRegExp.isRegExp(RegExp('^', 'm')); // -> true
 * XRegExp.isRegExp(XRegExp('(?s).')); // -> true
 */
XRegExp.isRegExp = function (value) {
    return toString.call(value) === '[object RegExp]';
}; // isType(value, 'RegExp');

/**
 * Returns the first matched string, or in global mode, an array containing all matched strings.
 * This is essentially a more convenient re-implementation of `String.prototype.match` that gives
 * the result types you actually want (string instead of `exec`-style array in match-first mode,
 * and an empty array instead of `null` when no matches are found in match-all mode). It also lets
 * you override flag g and ignore `lastIndex`, and fixes browser bugs.
 *
 * @memberOf XRegExp
 * @param {String} str String to search.
 * @param {RegExp} regex Regex to search with.
 * @param {String} [scope='one'] Use 'one' to return the first match as a string. Use 'all' to
 *   return an array of all matched strings. If not explicitly specified and `regex` uses flag g,
 *   `scope` is 'all'.
 * @returns {String|Array} In match-first mode: First match as a string, or `null`. In match-all
 *   mode: Array of all matched strings, or an empty array.
 * @example
 *
 * // Match first
 * XRegExp.match('abc', /\w/); // -> 'a'
 * XRegExp.match('abc', /\w/g, 'one'); // -> 'a'
 * XRegExp.match('abc', /x/g, 'one'); // -> null
 *
 * // Match all
 * XRegExp.match('abc', /\w/g); // -> ['a', 'b', 'c']
 * XRegExp.match('abc', /\w/, 'all'); // -> ['a', 'b', 'c']
 * XRegExp.match('abc', /x/, 'all'); // -> []
 */
XRegExp.match = function (str, regex, scope) {
    var global = regex.global && scope !== 'one' || scope === 'all';
    var cacheKey = (global ? 'g' : '') + (regex.sticky ? 'y' : '') || 'noGY';

    regex[REGEX_DATA] = regex[REGEX_DATA] || {};

    // Shares cached copies with `XRegExp.exec`/`replace`
    var r2 = regex[REGEX_DATA][cacheKey] || (regex[REGEX_DATA][cacheKey] = copyRegex(regex, {
        addG: !!global,
        removeG: scope === 'one',
        isInternalOnly: true
    }));

    var result = nativ.match.call(toObject(str), r2);

    if (regex.global) {
        regex.lastIndex = scope === 'one' && result ?
        // Can't use `r2.lastIndex` since `r2` is nonglobal in this case
        result.index + result[0].length : 0;
    }

    return global ? result || [] : result && result[0];
};

/**
 * Retrieves the matches from searching a string using a chain of regexes that successively search
 * within previous matches. The provided `chain` array can contain regexes and or objects with
 * `regex` and `backref` properties. When a backreference is specified, the named or numbered
 * backreference is passed forward to the next regex or returned.
 *
 * @memberOf XRegExp
 * @param {String} str String to search.
 * @param {Array} chain Regexes that each search for matches within preceding results.
 * @returns {Array} Matches by the last regex in the chain, or an empty array.
 * @example
 *
 * // Basic usage; matches numbers within <b> tags
 * XRegExp.matchChain('1 <b>2</b> 3 <b>4 a 56</b>', [
 *   XRegExp('(?is)<b>.*?</b>'),
 *   /\d+/
 * ]);
 * // -> ['2', '4', '56']
 *
 * // Passing forward and returning specific backreferences
 * html = '<a href="http://xregexp.com/api/">XRegExp</a>\
 *         <a href="http://www.google.com/">Google</a>';
 * XRegExp.matchChain(html, [
 *   {regex: /<a href="([^"]+)">/i, backref: 1},
 *   {regex: XRegExp('(?i)^https?://(?<domain>[^/?#]+)'), backref: 'domain'}
 * ]);
 * // -> ['xregexp.com', 'www.google.com']
 */
XRegExp.matchChain = function (str, chain) {
    return function recurseChain(values, level) {
        var item = chain[level].regex ? chain[level] : { regex: chain[level] };
        var matches = [];

        function addMatch(match) {
            if (item.backref) {
                // Safari 4.0.5 (but not 5.0.5+) inappropriately uses sparse arrays to hold the
                // `undefined`s for backreferences to nonparticipating capturing groups. In such
                // cases, a `hasOwnProperty` or `in` check on its own would inappropriately throw
                // the exception, so also check if the backreference is a number that is within the
                // bounds of the array.
                if (!(match.hasOwnProperty(item.backref) || +item.backref < match.length)) {
                    throw new ReferenceError('Backreference to undefined group: ' + item.backref);
                }

                matches.push(match[item.backref] || '');
            } else {
                matches.push(match[0]);
            }
        }

        for (var i = 0; i < values.length; ++i) {
            XRegExp.forEach(values[i], item.regex, addMatch);
        }

        return level === chain.length - 1 || !matches.length ? matches : recurseChain(matches, level + 1);
    }([str], 0);
};

/**
 * Returns a new string with one or all matches of a pattern replaced. The pattern can be a string
 * or regex, and the replacement can be a string or a function to be called for each match. To
 * perform a global search and replace, use the optional `scope` argument or include flag g if using
 * a regex. Replacement strings can use `${n}` or `$<n>` for named and numbered backreferences.
 * Replacement functions can use named backreferences via `arguments[0].name`. Also fixes browser
 * bugs compared to the native `String.prototype.replace` and can be used reliably cross-browser.
 *
 * @memberOf XRegExp
 * @param {String} str String to search.
 * @param {RegExp|String} search Search pattern to be replaced.
 * @param {String|Function} replacement Replacement string or a function invoked to create it.
 *   Replacement strings can include special replacement syntax:
 *     - $$ - Inserts a literal $ character.
 *     - $&, $0 - Inserts the matched substring.
 *     - $` - Inserts the string that precedes the matched substring (left context).
 *     - $' - Inserts the string that follows the matched substring (right context).
 *     - $n, $nn - Where n/nn are digits referencing an existent capturing group, inserts
 *       backreference n/nn.
 *     - ${n}, $<n> - Where n is a name or any number of digits that reference an existent capturing
 *       group, inserts backreference n.
 *   Replacement functions are invoked with three or more arguments:
 *     - The matched substring (corresponds to $& above). Named backreferences are accessible as
 *       properties of this first argument.
 *     - 0..n arguments, one for each backreference (corresponding to $1, $2, etc. above).
 *     - The zero-based index of the match within the total search string.
 *     - The total string being searched.
 * @param {String} [scope='one'] Use 'one' to replace the first match only, or 'all'. If not
 *   explicitly specified and using a regex with flag g, `scope` is 'all'.
 * @returns {String} New string with one or all matches replaced.
 * @example
 *
 * // Regex search, using named backreferences in replacement string
 * const name = XRegExp('(?<first>\\w+) (?<last>\\w+)');
 * XRegExp.replace('John Smith', name, '$<last>, $<first>');
 * // -> 'Smith, John'
 *
 * // Regex search, using named backreferences in replacement function
 * XRegExp.replace('John Smith', name, (match) => `${match.last}, ${match.first}`);
 * // -> 'Smith, John'
 *
 * // String search, with replace-all
 * XRegExp.replace('RegExp builds RegExps', 'RegExp', 'XRegExp', 'all');
 * // -> 'XRegExp builds XRegExps'
 */
XRegExp.replace = function (str, search, replacement, scope) {
    var isRegex = XRegExp.isRegExp(search);
    var global = search.global && scope !== 'one' || scope === 'all';
    var cacheKey = (global ? 'g' : '') + (search.sticky ? 'y' : '') || 'noGY';
    var s2 = search;

    if (isRegex) {
        search[REGEX_DATA] = search[REGEX_DATA] || {};

        // Shares cached copies with `XRegExp.exec`/`match`. Since a copy is used, `search`'s
        // `lastIndex` isn't updated *during* replacement iterations
        s2 = search[REGEX_DATA][cacheKey] || (search[REGEX_DATA][cacheKey] = copyRegex(search, {
            addG: !!global,
            removeG: scope === 'one',
            isInternalOnly: true
        }));
    } else if (global) {
        s2 = new RegExp(XRegExp.escape(String(search)), 'g');
    }

    // Fixed `replace` required for named backreferences, etc.
    var result = fixed.replace.call(toObject(str), s2, replacement);

    if (isRegex && search.global) {
        // Fixes IE, Safari bug (last tested IE 9, Safari 5.1)
        search.lastIndex = 0;
    }

    return result;
};

/**
 * Performs batch processing of string replacements. Used like `XRegExp.replace`, but accepts an
 * array of replacement details. Later replacements operate on the output of earlier replacements.
 * Replacement details are accepted as an array with a regex or string to search for, the
 * replacement string or function, and an optional scope of 'one' or 'all'. Uses the XRegExp
 * replacement text syntax, which supports named backreference properties via `${name}` or
 * `$<name>`.
 *
 * @memberOf XRegExp
 * @param {String} str String to search.
 * @param {Array} replacements Array of replacement detail arrays.
 * @returns {String} New string with all replacements.
 * @example
 *
 * str = XRegExp.replaceEach(str, [
 *   [XRegExp('(?<name>a)'), 'z${name}'],
 *   [/b/gi, 'y'],
 *   [/c/g, 'x', 'one'], // scope 'one' overrides /g
 *   [/d/, 'w', 'all'],  // scope 'all' overrides lack of /g
 *   ['e', 'v', 'all'],  // scope 'all' allows replace-all for strings
 *   [/f/g, ($0) => $0.toUpperCase()]
 * ]);
 */
XRegExp.replaceEach = function (str, replacements) {
    var i = void 0;
    var r = void 0;

    for (i = 0; i < replacements.length; ++i) {
        r = replacements[i];
        str = XRegExp.replace(str, r[0], r[1], r[2]);
    }

    return str;
};

/**
 * Splits a string into an array of strings using a regex or string separator. Matches of the
 * separator are not included in the result array. However, if `separator` is a regex that contains
 * capturing groups, backreferences are spliced into the result each time `separator` is matched.
 * Fixes browser bugs compared to the native `String.prototype.split` and can be used reliably
 * cross-browser.
 *
 * @memberOf XRegExp
 * @param {String} str String to split.
 * @param {RegExp|String} separator Regex or string to use for separating the string.
 * @param {Number} [limit] Maximum number of items to include in the result array.
 * @returns {Array} Array of substrings.
 * @example
 *
 * // Basic use
 * XRegExp.split('a b c', ' ');
 * // -> ['a', 'b', 'c']
 *
 * // With limit
 * XRegExp.split('a b c', ' ', 2);
 * // -> ['a', 'b']
 *
 * // Backreferences in result array
 * XRegExp.split('..word1..', /([a-z]+)(\d+)/i);
 * // -> ['..', 'word', '1', '..']
 */
XRegExp.split = function (str, separator, limit) {
    return fixed.split.call(toObject(str), separator, limit);
};

/**
 * Executes a regex search in a specified string. Returns `true` or `false`. Optional `pos` and
 * `sticky` arguments specify the search start position, and whether the match must start at the
 * specified position only. The `lastIndex` property of the provided regex is not used, but is
 * updated for compatibility. Also fixes browser bugs compared to the native
 * `RegExp.prototype.test` and can be used reliably cross-browser.
 *
 * @memberOf XRegExp
 * @param {String} str String to search.
 * @param {RegExp} regex Regex to search with.
 * @param {Number} [pos=0] Zero-based index at which to start the search.
 * @param {Boolean|String} [sticky=false] Whether the match must start at the specified position
 *   only. The string `'sticky'` is accepted as an alternative to `true`.
 * @returns {Boolean} Whether the regex matched the provided value.
 * @example
 *
 * // Basic use
 * XRegExp.test('abc', /c/); // -> true
 *
 * // With pos and sticky
 * XRegExp.test('abc', /c/, 0, 'sticky'); // -> false
 * XRegExp.test('abc', /c/, 2, 'sticky'); // -> true
 */
// Do this the easy way :-)
XRegExp.test = function (str, regex, pos, sticky) {
    return !!XRegExp.exec(str, regex, pos, sticky);
};

/**
 * Uninstalls optional features according to the specified options. All optional features start out
 * uninstalled, so this is used to undo the actions of `XRegExp.install`.
 *
 * @memberOf XRegExp
 * @param {Object|String} options Options object or string.
 * @example
 *
 * // With an options object
 * XRegExp.uninstall({
 *   // Disables support for astral code points in Unicode addons
 *   astral: true
 * });
 *
 * // With an options string
 * XRegExp.uninstall('astral');
 */
XRegExp.uninstall = function (options) {
    options = prepareOptions(options);

    if (features.astral && options.astral) {
        setAstral(false);
    }
};

/**
 * Returns an XRegExp object that is the union of the given patterns. Patterns can be provided as
 * regex objects or strings. Metacharacters are escaped in patterns provided as strings.
 * Backreferences in provided regex objects are automatically renumbered to work correctly within
 * the larger combined pattern. Native flags used by provided regexes are ignored in favor of the
 * `flags` argument.
 *
 * @memberOf XRegExp
 * @param {Array} patterns Regexes and strings to combine.
 * @param {String} [flags] Any combination of XRegExp flags.
 * @param {Object} [options] Options object with optional properties:
 *   - `conjunction` {String} Type of conjunction to use: 'or' (default) or 'none'.
 * @returns {RegExp} Union of the provided regexes and strings.
 * @example
 *
 * XRegExp.union(['a+b*c', /(dogs)\1/, /(cats)\1/], 'i');
 * // -> /a\+b\*c|(dogs)\1|(cats)\2/i
 *
 * XRegExp.union([/man/, /bear/, /pig/], 'i', {conjunction: 'none'});
 * // -> /manbearpig/i
 */
XRegExp.union = function (patterns, flags, options) {
    options = options || {};
    var conjunction = options.conjunction || 'or';
    var numCaptures = 0;
    var numPriorCaptures = void 0;
    var captureNames = void 0;

    function rewrite(match, paren, backref) {
        var name = captureNames[numCaptures - numPriorCaptures];

        // Capturing group
        if (paren) {
            ++numCaptures;
            // If the current capture has a name, preserve the name
            if (name) {
                return '(?<' + name + '>';
            }
            // Backreference
        } else if (backref) {
            // Rewrite the backreference
            return '\\' + (+backref + numPriorCaptures);
        }

        return match;
    }

    if (!(isType(patterns, 'Array') && patterns.length)) {
        throw new TypeError('Must provide a nonempty array of patterns to merge');
    }

    var parts = /(\()(?!\?)|\\([1-9]\d*)|\\[\s\S]|\[(?:[^\\\]]|\\[\s\S])*\]/g;
    var output = [];
    var pattern = void 0;
    for (var i = 0; i < patterns.length; ++i) {
        pattern = patterns[i];

        if (XRegExp.isRegExp(pattern)) {
            numPriorCaptures = numCaptures;
            captureNames = pattern[REGEX_DATA] && pattern[REGEX_DATA].captureNames || [];

            // Rewrite backreferences. Passing to XRegExp dies on octals and ensures patterns are
            // independently valid; helps keep this simple. Named captures are put back
            output.push(nativ.replace.call(XRegExp(pattern.source).source, parts, rewrite));
        } else {
            output.push(XRegExp.escape(pattern));
        }
    }

    var separator = conjunction === 'none' ? '' : '|';
    return XRegExp(output.join(separator), flags);
};

// ==--------------------------==
// Fixed/extended native methods
// ==--------------------------==

/**
 * Adds named capture support (with backreferences returned as `result.name`), and fixes browser
 * bugs in the native `RegExp.prototype.exec`. Use via `XRegExp.exec`.
 *
 * @memberOf RegExp
 * @param {String} str String to search.
 * @returns {Array} Match array with named backreference properties, or `null`.
 */
fixed.exec = function (str) {
    var origLastIndex = this.lastIndex;
    var match = nativ.exec.apply(this, arguments);

    if (match) {
        // Fix browsers whose `exec` methods don't return `undefined` for nonparticipating capturing
        // groups. This fixes IE 5.5-8, but not IE 9's quirks mode or emulation of older IEs. IE 9
        // in standards mode follows the spec.
        if (!correctExecNpcg && match.length > 1 && match.indexOf('') !== -1) {
            var r2 = copyRegex(this, {
                removeG: true,
                isInternalOnly: true
            });
            // Using `str.slice(match.index)` rather than `match[0]` in case lookahead allowed
            // matching due to characters outside the match
            nativ.replace.call(String(str).slice(match.index), r2, function () {
                for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
                    args[_key] = arguments[_key];
                }

                var len = args.length;
                // Skip index 0 and the last 2
                for (var i = 1; i < len - 2; ++i) {
                    if (args[i] === undefined) {
                        match[i] = undefined;
                    }
                }
            });
        }

        // Attach named capture properties
        if (this[REGEX_DATA] && this[REGEX_DATA].captureNames) {
            // Skip index 0
            for (var i = 1; i < match.length; ++i) {
                var name = this[REGEX_DATA].captureNames[i - 1];
                if (name) {
                    match[name] = match[i];
                }
            }
        }

        // Fix browsers that increment `lastIndex` after zero-length matches
        if (this.global && !match[0].length && this.lastIndex > match.index) {
            this.lastIndex = match.index;
        }
    }

    if (!this.global) {
        // Fixes IE, Opera bug (last tested IE 9, Opera 11.6)
        this.lastIndex = origLastIndex;
    }

    return match;
};

/**
 * Fixes browser bugs in the native `RegExp.prototype.test`.
 *
 * @memberOf RegExp
 * @param {String} str String to search.
 * @returns {Boolean} Whether the regex matched the provided value.
 */
fixed.test = function (str) {
    // Do this the easy way :-)
    return !!fixed.exec.call(this, str);
};

/**
 * Adds named capture support (with backreferences returned as `result.name`), and fixes browser
 * bugs in the native `String.prototype.match`.
 *
 * @memberOf String
 * @param {RegExp|*} regex Regex to search with. If not a regex object, it is passed to `RegExp`.
 * @returns {Array} If `regex` uses flag g, an array of match strings or `null`. Without flag g,
 *   the result of calling `regex.exec(this)`.
 */
fixed.match = function (regex) {
    if (!XRegExp.isRegExp(regex)) {
        // Use the native `RegExp` rather than `XRegExp`
        regex = new RegExp(regex);
    } else if (regex.global) {
        var result = nativ.match.apply(this, arguments);
        // Fixes IE bug
        regex.lastIndex = 0;

        return result;
    }

    return fixed.exec.call(regex, toObject(this));
};

/**
 * Adds support for `${n}` (or `$<n>`) tokens for named and numbered backreferences in replacement
 * text, and provides named backreferences to replacement functions as `arguments[0].name`. Also
 * fixes browser bugs in replacement text syntax when performing a replacement using a nonregex
 * search value, and the value of a replacement regex's `lastIndex` property during replacement
 * iterations and upon completion. Note that this doesn't support SpiderMonkey's proprietary third
 * (`flags`) argument. Use via `XRegExp.replace`.
 *
 * @memberOf String
 * @param {RegExp|String} search Search pattern to be replaced.
 * @param {String|Function} replacement Replacement string or a function invoked to create it.
 * @returns {String} New string with one or all matches replaced.
 */
fixed.replace = function (search, replacement) {
    var isRegex = XRegExp.isRegExp(search);
    var origLastIndex = void 0;
    var captureNames = void 0;
    var result = void 0;

    if (isRegex) {
        if (search[REGEX_DATA]) {
            captureNames = search[REGEX_DATA].captureNames;
        }
        // Only needed if `search` is nonglobal
        origLastIndex = search.lastIndex;
    } else {
        search += ''; // Type-convert
    }

    // Don't use `typeof`; some older browsers return 'function' for regex objects
    if (isType(replacement, 'Function')) {
        // Stringifying `this` fixes a bug in IE < 9 where the last argument in replacement
        // functions isn't type-converted to a string
        result = nativ.replace.call(String(this), search, function () {
            for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
                args[_key2] = arguments[_key2];
            }

            if (captureNames) {
                // Change the `args[0]` string primitive to a `String` object that can store
                // properties. This really does need to use `String` as a constructor
                args[0] = new String(args[0]);
                // Store named backreferences on the first argument
                for (var i = 0; i < captureNames.length; ++i) {
                    if (captureNames[i]) {
                        args[0][captureNames[i]] = args[i + 1];
                    }
                }
            }
            // Update `lastIndex` before calling `replacement`. Fixes IE, Chrome, Firefox, Safari
            // bug (last tested IE 9, Chrome 17, Firefox 11, Safari 5.1)
            if (isRegex && search.global) {
                search.lastIndex = args[args.length - 2] + args[0].length;
            }
            // ES6 specs the context for replacement functions as `undefined`
            return replacement.apply(undefined, args);
        });
    } else {
        // Ensure that the last value of `args` will be a string when given nonstring `this`,
        // while still throwing on null or undefined context
        result = nativ.replace.call(this == null ? this : String(this), search, function () {
            for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
                args[_key3] = arguments[_key3];
            }

            return nativ.replace.call(String(replacement), replacementToken, replacer);

            function replacer($0, bracketed, angled, dollarToken) {
                bracketed = bracketed || angled;
                // Named or numbered backreference with curly or angled braces
                if (bracketed) {
                    // XRegExp behavior for `${n}` or `$<n>`:
                    // 1. Backreference to numbered capture, if `n` is an integer. Use `0` for the
                    //    entire match. Any number of leading zeros may be used.
                    // 2. Backreference to named capture `n`, if it exists and is not an integer
                    //    overridden by numbered capture. In practice, this does not overlap with
                    //    numbered capture since XRegExp does not allow named capture to use a bare
                    //    integer as the name.
                    // 3. If the name or number does not refer to an existing capturing group, it's
                    //    an error.
                    var n = +bracketed; // Type-convert; drop leading zeros
                    if (n <= args.length - 3) {
                        return args[n] || '';
                    }
                    // Groups with the same name is an error, else would need `lastIndexOf`
                    n = captureNames ? captureNames.indexOf(bracketed) : -1;
                    if (n < 0) {
                        throw new SyntaxError('Backreference to undefined group ' + $0);
                    }
                    return args[n + 1] || '';
                }
                // Else, special variable or numbered backreference without curly braces
                if (dollarToken === '$') {
                    // $$
                    return '$';
                }
                if (dollarToken === '&' || +dollarToken === 0) {
                    // $&, $0 (not followed by 1-9), $00
                    return args[0];
                }
                if (dollarToken === '`') {
                    // $` (left context)
                    return args[args.length - 1].slice(0, args[args.length - 2]);
                }
                if (dollarToken === "'") {
                    // $' (right context)
                    return args[args.length - 1].slice(args[args.length - 2] + args[0].length);
                }
                // Else, numbered backreference without braces
                dollarToken = +dollarToken; // Type-convert; drop leading zero
                // XRegExp behavior for `$n` and `$nn`:
                // - Backrefs end after 1 or 2 digits. Use `${..}` or `$<..>` for more digits.
                // - `$1` is an error if no capturing groups.
                // - `$10` is an error if less than 10 capturing groups. Use `${1}0` or `$<1>0`
                //   instead.
                // - `$01` is `$1` if at least one capturing group, else it's an error.
                // - `$0` (not followed by 1-9) and `$00` are the entire match.
                // Native behavior, for comparison:
                // - Backrefs end after 1 or 2 digits. Cannot reference capturing group 100+.
                // - `$1` is a literal `$1` if no capturing groups.
                // - `$10` is `$1` followed by a literal `0` if less than 10 capturing groups.
                // - `$01` is `$1` if at least one capturing group, else it's a literal `$01`.
                // - `$0` is a literal `$0`.
                if (!isNaN(dollarToken)) {
                    if (dollarToken > args.length - 3) {
                        throw new SyntaxError('Backreference to undefined group ' + $0);
                    }
                    return args[dollarToken] || '';
                }
                // `$` followed by an unsupported char is an error, unlike native JS
                throw new SyntaxError('Invalid token ' + $0);
            }
        });
    }

    if (isRegex) {
        if (search.global) {
            // Fixes IE, Safari bug (last tested IE 9, Safari 5.1)
            search.lastIndex = 0;
        } else {
            // Fixes IE, Opera bug (last tested IE 9, Opera 11.6)
            search.lastIndex = origLastIndex;
        }
    }

    return result;
};

/**
 * Fixes browser bugs in the native `String.prototype.split`. Use via `XRegExp.split`.
 *
 * @memberOf String
 * @param {RegExp|String} separator Regex or string to use for separating the string.
 * @param {Number} [limit] Maximum number of items to include in the result array.
 * @returns {Array} Array of substrings.
 */
fixed.split = function (separator, limit) {
    if (!XRegExp.isRegExp(separator)) {
        // Browsers handle nonregex split correctly, so use the faster native method
        return nativ.split.apply(this, arguments);
    }

    var str = String(this);
    var output = [];
    var origLastIndex = separator.lastIndex;
    var lastLastIndex = 0;
    var lastLength = void 0;

    // Values for `limit`, per the spec:
    // If undefined: pow(2,32) - 1
    // If 0, Infinity, or NaN: 0
    // If positive number: limit = floor(limit); if (limit >= pow(2,32)) limit -= pow(2,32);
    // If negative number: pow(2,32) - floor(abs(limit))
    // If other: Type-convert, then use the above rules
    // This line fails in very strange ways for some values of `limit` in Opera 10.5-10.63, unless
    // Opera Dragonfly is open (go figure). It works in at least Opera 9.5-10.1 and 11+
    limit = (limit === undefined ? -1 : limit) >>> 0;

    XRegExp.forEach(str, separator, function (match) {
        // This condition is not the same as `if (match[0].length)`
        if (match.index + match[0].length > lastLastIndex) {
            output.push(str.slice(lastLastIndex, match.index));
            if (match.length > 1 && match.index < str.length) {
                Array.prototype.push.apply(output, match.slice(1));
            }
            lastLength = match[0].length;
            lastLastIndex = match.index + lastLength;
        }
    });

    if (lastLastIndex === str.length) {
        if (!nativ.test.call(separator, '') || lastLength) {
            output.push('');
        }
    } else {
        output.push(str.slice(lastLastIndex));
    }

    separator.lastIndex = origLastIndex;
    return output.length > limit ? output.slice(0, limit) : output;
};

// ==--------------------------==
// Built-in syntax/flag tokens
// ==--------------------------==

/*
 * Letter escapes that natively match literal characters: `\a`, `\A`, etc. These should be
 * SyntaxErrors but are allowed in web reality. XRegExp makes them errors for cross-browser
 * consistency and to reserve their syntax, but lets them be superseded by addons.
 */
XRegExp.addToken(/\\([ABCE-RTUVXYZaeg-mopqyz]|c(?![A-Za-z])|u(?![\dA-Fa-f]{4}|{[\dA-Fa-f]+})|x(?![\dA-Fa-f]{2}))/, function (match, scope) {
    // \B is allowed in default scope only
    if (match[1] === 'B' && scope === defaultScope) {
        return match[0];
    }
    throw new SyntaxError('Invalid escape ' + match[0]);
}, {
    scope: 'all',
    leadChar: '\\'
});

/*
 * Unicode code point escape with curly braces: `\u{N..}`. `N..` is any one or more digit
 * hexadecimal number from 0-10FFFF, and can include leading zeros. Requires the native ES6 `u` flag
 * to support code points greater than U+FFFF. Avoids converting code points above U+FFFF to
 * surrogate pairs (which could be done without flag `u`), since that could lead to broken behavior
 * if you follow a `\u{N..}` token that references a code point above U+FFFF with a quantifier, or
 * if you use the same in a character class.
 */
XRegExp.addToken(/\\u{([\dA-Fa-f]+)}/, function (match, scope, flags) {
    var code = dec(match[1]);
    if (code > 0x10FFFF) {
        throw new SyntaxError('Invalid Unicode code point ' + match[0]);
    }
    if (code <= 0xFFFF) {
        // Converting to \uNNNN avoids needing to escape the literal character and keep it
        // separate from preceding tokens
        return '\\u' + pad4(hex(code));
    }
    // If `code` is between 0xFFFF and 0x10FFFF, require and defer to native handling
    if (hasNativeU && flags.indexOf('u') !== -1) {
        return match[0];
    }
    throw new SyntaxError('Cannot use Unicode code point above \\u{FFFF} without flag u');
}, {
    scope: 'all',
    leadChar: '\\'
});

/*
 * Empty character class: `[]` or `[^]`. This fixes a critical cross-browser syntax inconsistency.
 * Unless this is standardized (per the ES spec), regex syntax can't be accurately parsed because
 * character class endings can't be determined.
 */
XRegExp.addToken(/\[(\^?)\]/,
// For cross-browser compatibility with ES3, convert [] to \b\B and [^] to [\s\S].
// (?!) should work like \b\B, but is unreliable in some versions of Firefox
/* eslint-disable no-confusing-arrow */
function (match) {
    return match[1] ? '[\\s\\S]' : '\\b\\B';
},
/* eslint-enable no-confusing-arrow */
{ leadChar: '[' });

/*
 * Comment pattern: `(?# )`. Inline comments are an alternative to the line comments allowed in
 * free-spacing mode (flag x).
 */
XRegExp.addToken(/\(\?#[^)]*\)/, getContextualTokenSeparator, { leadChar: '(' });

/*
 * Whitespace and line comments, in free-spacing mode (aka extended mode, flag x) only.
 */
XRegExp.addToken(/\s+|#[^\n]*\n?/, getContextualTokenSeparator, { flag: 'x' });

/*
 * Dot, in dotall mode (aka singleline mode, flag s) only.
 */
XRegExp.addToken(/\./, function () {
    return '[\\s\\S]';
}, {
    flag: 's',
    leadChar: '.'
});

/*
 * Named backreference: `\k<name>`. Backreference names can use the characters A-Z, a-z, 0-9, _,
 * and $ only. Also allows numbered backreferences as `\k<n>`.
 */
XRegExp.addToken(/\\k<([\w$]+)>/, function (match) {
    // Groups with the same name is an error, else would need `lastIndexOf`
    var index = isNaN(match[1]) ? this.captureNames.indexOf(match[1]) + 1 : +match[1];
    var endIndex = match.index + match[0].length;
    if (!index || index > this.captureNames.length) {
        throw new SyntaxError('Backreference to undefined group ' + match[0]);
    }
    // Keep backreferences separate from subsequent literal numbers. This avoids e.g.
    // inadvertedly changing `(?<n>)\k<n>1` to `()\11`.
    return '\\' + index + (endIndex === match.input.length || isNaN(match.input[endIndex]) ? '' : '(?:)');
}, { leadChar: '\\' });

/*
 * Numbered backreference or octal, plus any following digits: `\0`, `\11`, etc. Octals except `\0`
 * not followed by 0-9 and backreferences to unopened capture groups throw an error. Other matches
 * are returned unaltered. IE < 9 doesn't support backreferences above `\99` in regex syntax.
 */
XRegExp.addToken(/\\(\d+)/, function (match, scope) {
    if (!(scope === defaultScope && /^[1-9]/.test(match[1]) && +match[1] <= this.captureNames.length) && match[1] !== '0') {
        throw new SyntaxError('Cannot use octal escape or backreference to undefined group ' + match[0]);
    }
    return match[0];
}, {
    scope: 'all',
    leadChar: '\\'
});

/*
 * Named capturing group; match the opening delimiter only: `(?<name>`. Capture names can use the
 * characters A-Z, a-z, 0-9, _, and $ only. Names can't be integers. Supports Python-style
 * `(?P<name>` as an alternate syntax to avoid issues in some older versions of Opera which natively
 * supported the Python-style syntax. Otherwise, XRegExp might treat numbered backreferences to
 * Python-style named capture as octals.
 */
XRegExp.addToken(/\(\?P?<([\w$]+)>/, function (match) {
    // Disallow bare integers as names because named backreferences are added to match arrays
    // and therefore numeric properties may lead to incorrect lookups
    if (!isNaN(match[1])) {
        throw new SyntaxError('Cannot use integer as capture name ' + match[0]);
    }
    if (match[1] === 'length' || match[1] === '__proto__') {
        throw new SyntaxError('Cannot use reserved word as capture name ' + match[0]);
    }
    if (this.captureNames.indexOf(match[1]) !== -1) {
        throw new SyntaxError('Cannot use same name for multiple groups ' + match[0]);
    }
    this.captureNames.push(match[1]);
    this.hasNamedCapture = true;
    return '(';
}, { leadChar: '(' });

/*
 * Capturing group; match the opening parenthesis only. Required for support of named capturing
 * groups. Also adds explicit capture mode (flag n).
 */
XRegExp.addToken(/\((?!\?)/, function (match, scope, flags) {
    if (flags.indexOf('n') !== -1) {
        return '(?:';
    }
    this.captureNames.push(null);
    return '(';
}, {
    optionalFlags: 'n',
    leadChar: '('
});

exports.default = XRegExp;
module.exports = exports['default'];
},{}],"R9Tm":[function(require,module,exports) {
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

/*!
 * XRegExp.build 4.0.0
 * <xregexp.com>
 * Steven Levithan (c) 2012-2017 MIT License
 */

exports.default = function (XRegExp) {
    var REGEX_DATA = 'xregexp';
    var subParts = /(\()(?!\?)|\\([1-9]\d*)|\\[\s\S]|\[(?:[^\\\]]|\\[\s\S])*\]/g;
    var parts = XRegExp.union([/\({{([\w$]+)}}\)|{{([\w$]+)}}/, subParts], 'g', {
        conjunction: 'or'
    });

    /**
     * Strips a leading `^` and trailing unescaped `$`, if both are present.
     *
     * @private
     * @param {String} pattern Pattern to process.
     * @returns {String} Pattern with edge anchors removed.
     */
    function deanchor(pattern) {
        // Allow any number of empty noncapturing groups before/after anchors, because regexes
        // built/generated by XRegExp sometimes include them
        var leadingAnchor = /^(?:\(\?:\))*\^/;
        var trailingAnchor = /\$(?:\(\?:\))*$/;

        if (leadingAnchor.test(pattern) && trailingAnchor.test(pattern) &&
        // Ensure that the trailing `$` isn't escaped
        trailingAnchor.test(pattern.replace(/\\[\s\S]/g, ''))) {
            return pattern.replace(leadingAnchor, '').replace(trailingAnchor, '');
        }

        return pattern;
    }

    /**
     * Converts the provided value to an XRegExp. Native RegExp flags are not preserved.
     *
     * @private
     * @param {String|RegExp} value Value to convert.
     * @param {Boolean} [addFlagX] Whether to apply the `x` flag in cases when `value` is not
     *   already a regex generated by XRegExp
     * @returns {RegExp} XRegExp object with XRegExp syntax applied.
     */
    function asXRegExp(value, addFlagX) {
        var flags = addFlagX ? 'x' : '';
        return XRegExp.isRegExp(value) ? value[REGEX_DATA] && value[REGEX_DATA].captureNames ?
        // Don't recompile, to preserve capture names
        value :
        // Recompile as XRegExp
        XRegExp(value.source, flags) :
        // Compile string as XRegExp
        XRegExp(value, flags);
    }

    function interpolate(substitution) {
        return substitution instanceof RegExp ? substitution : XRegExp.escape(substitution);
    }

    function reduceToSubpatternsObject(subpatterns, interpolated, subpatternIndex) {
        subpatterns['subpattern' + subpatternIndex] = interpolated;
        return subpatterns;
    }

    function embedSubpatternAfter(raw, subpatternIndex, rawLiterals) {
        var hasSubpattern = subpatternIndex < rawLiterals.length - 1;
        return raw + (hasSubpattern ? '{{subpattern' + subpatternIndex + '}}' : '');
    }

    /**
     * Provides tagged template literals that create regexes with XRegExp syntax and flags. The
     * provided pattern is handled as a raw string, so backslashes don't need to be escaped.
     *
     * Interpolation of strings and regexes shares the features of `XRegExp.build`. Interpolated
     * patterns are treated as atomic units when quantified, interpolated strings have their special
     * characters escaped, a leading `^` and trailing unescaped `$` are stripped from interpolated
     * regexes if both are present, and any backreferences within an interpolated regex are
     * rewritten to work within the overall pattern.
     *
     * @memberOf XRegExp
     * @param {String} [flags] Any combination of XRegExp flags.
     * @returns {Function} Handler for template literals that construct regexes with XRegExp syntax.
     * @example
     *
     * const h12 = /1[0-2]|0?[1-9]/;
     * const h24 = /2[0-3]|[01][0-9]/;
     * const hours = XRegExp.tag('x')`${h12} : | ${h24}`;
     * const minutes = /^[0-5][0-9]$/;
     * // Note that explicitly naming the 'minutes' group is required for named backreferences
     * const time = XRegExp.tag('x')`^ ${hours} (?<minutes>${minutes}) $`;
     * time.test('10:59'); // -> true
     * XRegExp.exec('10:59', time).minutes; // -> '59'
     */
    XRegExp.tag = function (flags) {
        return function (literals) {
            for (var _len = arguments.length, substitutions = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
                substitutions[_key - 1] = arguments[_key];
            }

            var subpatterns = substitutions.map(interpolate).reduce(reduceToSubpatternsObject, {});
            var pattern = literals.raw.map(embedSubpatternAfter).join('');
            return XRegExp.build(pattern, subpatterns, flags);
        };
    };

    /**
     * Builds regexes using named subpatterns, for readability and pattern reuse. Backreferences in
     * the outer pattern and provided subpatterns are automatically renumbered to work correctly.
     * Native flags used by provided subpatterns are ignored in favor of the `flags` argument.
     *
     * @memberOf XRegExp
     * @param {String} pattern XRegExp pattern using `{{name}}` for embedded subpatterns. Allows
     *   `({{name}})` as shorthand for `(?<name>{{name}})`. Patterns cannot be embedded within
     *   character classes.
     * @param {Object} subs Lookup object for named subpatterns. Values can be strings or regexes. A
     *   leading `^` and trailing unescaped `$` are stripped from subpatterns, if both are present.
     * @param {String} [flags] Any combination of XRegExp flags.
     * @returns {RegExp} Regex with interpolated subpatterns.
     * @example
     *
     * const time = XRegExp.build('(?x)^ {{hours}} ({{minutes}}) $', {
     *   hours: XRegExp.build('{{h12}} : | {{h24}}', {
     *     h12: /1[0-2]|0?[1-9]/,
     *     h24: /2[0-3]|[01][0-9]/
     *   }, 'x'),
     *   minutes: /^[0-5][0-9]$/
     * });
     * time.test('10:59'); // -> true
     * XRegExp.exec('10:59', time).minutes; // -> '59'
     */
    XRegExp.build = function (pattern, subs, flags) {
        flags = flags || '';
        // Used with `asXRegExp` calls for `pattern` and subpatterns in `subs`, to work around how
        // some browsers convert `RegExp('\n')` to a regex that contains the literal characters `\`
        // and `n`. See more details at <https://github.com/slevithan/xregexp/pull/163>.
        var addFlagX = flags.indexOf('x') !== -1;
        var inlineFlags = /^\(\?([\w$]+)\)/.exec(pattern);
        // Add flags within a leading mode modifier to the overall pattern's flags
        if (inlineFlags) {
            flags = XRegExp._clipDuplicates(flags + inlineFlags[1]);
        }

        var data = {};
        for (var p in subs) {
            if (subs.hasOwnProperty(p)) {
                // Passing to XRegExp enables extended syntax and ensures independent validity,
                // lest an unescaped `(`, `)`, `[`, or trailing `\` breaks the `(?:)` wrapper. For
                // subpatterns provided as native regexes, it dies on octals and adds the property
                // used to hold extended regex instance data, for simplicity.
                var sub = asXRegExp(subs[p], addFlagX);
                data[p] = {
                    // Deanchoring allows embedding independently useful anchored regexes. If you
                    // really need to keep your anchors, double them (i.e., `^^...$$`).
                    pattern: deanchor(sub.source),
                    names: sub[REGEX_DATA].captureNames || []
                };
            }
        }

        // Passing to XRegExp dies on octals and ensures the outer pattern is independently valid;
        // helps keep this simple. Named captures will be put back.
        var patternAsRegex = asXRegExp(pattern, addFlagX);

        // 'Caps' is short for 'captures'
        var numCaps = 0;
        var numPriorCaps = void 0;
        var numOuterCaps = 0;
        var outerCapsMap = [0];
        var outerCapNames = patternAsRegex[REGEX_DATA].captureNames || [];
        var output = patternAsRegex.source.replace(parts, function ($0, $1, $2, $3, $4) {
            var subName = $1 || $2;
            var capName = void 0;
            var intro = void 0;
            var localCapIndex = void 0;
            // Named subpattern
            if (subName) {
                if (!data.hasOwnProperty(subName)) {
                    throw new ReferenceError('Undefined property ' + $0);
                }
                // Named subpattern was wrapped in a capturing group
                if ($1) {
                    capName = outerCapNames[numOuterCaps];
                    outerCapsMap[++numOuterCaps] = ++numCaps;
                    // If it's a named group, preserve the name. Otherwise, use the subpattern name
                    // as the capture name
                    intro = '(?<' + (capName || subName) + '>';
                } else {
                    intro = '(?:';
                }
                numPriorCaps = numCaps;
                var rewrittenSubpattern = data[subName].pattern.replace(subParts, function (match, paren, backref) {
                    // Capturing group
                    if (paren) {
                        capName = data[subName].names[numCaps - numPriorCaps];
                        ++numCaps;
                        // If the current capture has a name, preserve the name
                        if (capName) {
                            return '(?<' + capName + '>';
                        }
                        // Backreference
                    } else if (backref) {
                        localCapIndex = +backref - 1;
                        // Rewrite the backreference
                        return data[subName].names[localCapIndex] ?
                        // Need to preserve the backreference name in case using flag `n`
                        '\\k<' + data[subName].names[localCapIndex] + '>' : '\\' + (+backref + numPriorCaps);
                    }
                    return match;
                });
                return '' + intro + rewrittenSubpattern + ')';
            }
            // Capturing group
            if ($3) {
                capName = outerCapNames[numOuterCaps];
                outerCapsMap[++numOuterCaps] = ++numCaps;
                // If the current capture has a name, preserve the name
                if (capName) {
                    return '(?<' + capName + '>';
                }
                // Backreference
            } else if ($4) {
                localCapIndex = +$4 - 1;
                // Rewrite the backreference
                return outerCapNames[localCapIndex] ?
                // Need to preserve the backreference name in case using flag `n`
                '\\k<' + outerCapNames[localCapIndex] + '>' : '\\' + outerCapsMap[+$4];
            }
            return $0;
        });

        return XRegExp(output, flags);
    };
};

module.exports = exports['default'];
},{}],"YS0V":[function(require,module,exports) {
var global = arguments[3];
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

/*!
 * XRegExp.matchRecursive 4.0.0
 * <xregexp.com>
 * Steven Levithan (c) 2009-2017 MIT License
 */

exports.default = function (XRegExp) {

    /**
     * Returns a match detail object composed of the provided values.
     *
     * @private
     */
    function row(name, value, start, end) {
        return {
            name: name,
            value: value,
            start: start,
            end: end
        };
    }

    /**
     * Returns an array of match strings between outermost left and right delimiters, or an array of
     * objects with detailed match parts and position data. An error is thrown if delimiters are
     * unbalanced within the data.
     *
     * @memberOf XRegExp
     * @param {String} str String to search.
     * @param {String} left Left delimiter as an XRegExp pattern.
     * @param {String} right Right delimiter as an XRegExp pattern.
     * @param {String} [flags] Any native or XRegExp flags, used for the left and right delimiters.
     * @param {Object} [options] Lets you specify `valueNames` and `escapeChar` options.
     * @returns {Array} Array of matches, or an empty array.
     * @example
     *
     * // Basic usage
     * let str = '(t((e))s)t()(ing)';
     * XRegExp.matchRecursive(str, '\\(', '\\)', 'g');
     * // -> ['t((e))s', '', 'ing']
     *
     * // Extended information mode with valueNames
     * str = 'Here is <div> <div>an</div></div> example';
     * XRegExp.matchRecursive(str, '<div\\s*>', '</div>', 'gi', {
     *   valueNames: ['between', 'left', 'match', 'right']
     * });
     * // -> [
     * // {name: 'between', value: 'Here is ',       start: 0,  end: 8},
     * // {name: 'left',    value: '<div>',          start: 8,  end: 13},
     * // {name: 'match',   value: ' <div>an</div>', start: 13, end: 27},
     * // {name: 'right',   value: '</div>',         start: 27, end: 33},
     * // {name: 'between', value: ' example',       start: 33, end: 41}
     * // ]
     *
     * // Omitting unneeded parts with null valueNames, and using escapeChar
     * str = '...{1}.\\{{function(x,y){return {y:x}}}';
     * XRegExp.matchRecursive(str, '{', '}', 'g', {
     *   valueNames: ['literal', null, 'value', null],
     *   escapeChar: '\\'
     * });
     * // -> [
     * // {name: 'literal', value: '...',  start: 0, end: 3},
     * // {name: 'value',   value: '1',    start: 4, end: 5},
     * // {name: 'literal', value: '.\\{', start: 6, end: 9},
     * // {name: 'value',   value: 'function(x,y){return {y:x}}', start: 10, end: 37}
     * // ]
     *
     * // Sticky mode via flag y
     * str = '<1><<<2>>><3>4<5>';
     * XRegExp.matchRecursive(str, '<', '>', 'gy');
     * // -> ['1', '<<2>>', '3']
     */
    XRegExp.matchRecursive = function (str, left, right, flags, options) {
        flags = flags || '';
        options = options || {};
        var global = flags.indexOf('g') !== -1;
        var sticky = flags.indexOf('y') !== -1;
        // Flag `y` is controlled internally
        var basicFlags = flags.replace(/y/g, '');
        var escapeChar = options.escapeChar;
        var vN = options.valueNames;
        var output = [];
        var openTokens = 0;
        var delimStart = 0;
        var delimEnd = 0;
        var lastOuterEnd = 0;
        var outerStart = void 0;
        var innerStart = void 0;
        var leftMatch = void 0;
        var rightMatch = void 0;
        var esc = void 0;
        left = XRegExp(left, basicFlags);
        right = XRegExp(right, basicFlags);

        if (escapeChar) {
            if (escapeChar.length > 1) {
                throw new Error('Cannot use more than one escape character');
            }
            escapeChar = XRegExp.escape(escapeChar);
            // Example of concatenated `esc` regex:
            // `escapeChar`: '%'
            // `left`: '<'
            // `right`: '>'
            // Regex is: /(?:%[\S\s]|(?:(?!<|>)[^%])+)+/
            esc = new RegExp('(?:' + escapeChar + '[\\S\\s]|(?:(?!' +
            // Using `XRegExp.union` safely rewrites backreferences in `left` and `right`.
            // Intentionally not passing `basicFlags` to `XRegExp.union` since any syntax
            // transformation resulting from those flags was already applied to `left` and
            // `right` when they were passed through the XRegExp constructor above.
            XRegExp.union([left, right], '', { conjunction: 'or' }).source + ')[^' + escapeChar + '])+)+',
            // Flags `gy` not needed here
            flags.replace(/[^imu]+/g, ''));
        }

        while (true) {
            // If using an escape character, advance to the delimiter's next starting position,
            // skipping any escaped characters in between
            if (escapeChar) {
                delimEnd += (XRegExp.exec(str, esc, delimEnd, 'sticky') || [''])[0].length;
            }
            leftMatch = XRegExp.exec(str, left, delimEnd);
            rightMatch = XRegExp.exec(str, right, delimEnd);
            // Keep the leftmost match only
            if (leftMatch && rightMatch) {
                if (leftMatch.index <= rightMatch.index) {
                    rightMatch = null;
                } else {
                    leftMatch = null;
                }
            }
            // Paths (LM: leftMatch, RM: rightMatch, OT: openTokens):
            // LM | RM | OT | Result
            // 1  | 0  | 1  | loop
            // 1  | 0  | 0  | loop
            // 0  | 1  | 1  | loop
            // 0  | 1  | 0  | throw
            // 0  | 0  | 1  | throw
            // 0  | 0  | 0  | break
            // The paths above don't include the sticky mode special case. The loop ends after the
            // first completed match if not `global`.
            if (leftMatch || rightMatch) {
                delimStart = (leftMatch || rightMatch).index;
                delimEnd = delimStart + (leftMatch || rightMatch)[0].length;
            } else if (!openTokens) {
                break;
            }
            if (sticky && !openTokens && delimStart > lastOuterEnd) {
                break;
            }
            if (leftMatch) {
                if (!openTokens) {
                    outerStart = delimStart;
                    innerStart = delimEnd;
                }
                ++openTokens;
            } else if (rightMatch && openTokens) {
                if (! --openTokens) {
                    if (vN) {
                        if (vN[0] && outerStart > lastOuterEnd) {
                            output.push(row(vN[0], str.slice(lastOuterEnd, outerStart), lastOuterEnd, outerStart));
                        }
                        if (vN[1]) {
                            output.push(row(vN[1], str.slice(outerStart, innerStart), outerStart, innerStart));
                        }
                        if (vN[2]) {
                            output.push(row(vN[2], str.slice(innerStart, delimStart), innerStart, delimStart));
                        }
                        if (vN[3]) {
                            output.push(row(vN[3], str.slice(delimStart, delimEnd), delimStart, delimEnd));
                        }
                    } else {
                        output.push(str.slice(innerStart, delimStart));
                    }
                    lastOuterEnd = delimEnd;
                    if (!global) {
                        break;
                    }
                }
            } else {
                throw new Error('Unbalanced delimiter found in string');
            }
            // If the delimiter matched an empty string, avoid an infinite loop
            if (delimStart === delimEnd) {
                ++delimEnd;
            }
        }

        if (global && !sticky && vN && vN[0] && str.length > lastOuterEnd) {
            output.push(row(vN[0], str.slice(lastOuterEnd), lastOuterEnd, str.length));
        }

        return output;
    };
};

module.exports = exports['default'];
},{}],"d64b":[function(require,module,exports) {
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

/*!
 * XRegExp Unicode Base 4.0.0
 * <xregexp.com>
 * Steven Levithan (c) 2008-2017 MIT License
 */

exports.default = function (XRegExp) {

    /**
     * Adds base support for Unicode matching:
     * - Adds syntax `\p{..}` for matching Unicode tokens. Tokens can be inverted using `\P{..}` or
     *   `\p{^..}`. Token names ignore case, spaces, hyphens, and underscores. You can omit the
     *   braces for token names that are a single letter (e.g. `\pL` or `PL`).
     * - Adds flag A (astral), which enables 21-bit Unicode support.
     * - Adds the `XRegExp.addUnicodeData` method used by other addons to provide character data.
     *
     * Unicode Base relies on externally provided Unicode character data. Official addons are
     * available to provide data for Unicode categories, scripts, blocks, and properties.
     *
     * @requires XRegExp
     */

    // ==--------------------------==
    // Private stuff
    // ==--------------------------==

    // Storage for Unicode data
    var unicode = {};

    // Reuse utils
    var dec = XRegExp._dec;
    var hex = XRegExp._hex;
    var pad4 = XRegExp._pad4;

    // Generates a token lookup name: lowercase, with hyphens, spaces, and underscores removed
    function normalize(name) {
        return name.replace(/[- _]+/g, '').toLowerCase();
    }

    // Gets the decimal code of a literal code unit, \xHH, \uHHHH, or a backslash-escaped literal
    function charCode(chr) {
        var esc = /^\\[xu](.+)/.exec(chr);
        return esc ? dec(esc[1]) : chr.charCodeAt(chr[0] === '\\' ? 1 : 0);
    }

    // Inverts a list of ordered BMP characters and ranges
    function invertBmp(range) {
        var output = '';
        var lastEnd = -1;

        XRegExp.forEach(range, /(\\x..|\\u....|\\?[\s\S])(?:-(\\x..|\\u....|\\?[\s\S]))?/, function (m) {
            var start = charCode(m[1]);
            if (start > lastEnd + 1) {
                output += '\\u' + pad4(hex(lastEnd + 1));
                if (start > lastEnd + 2) {
                    output += '-\\u' + pad4(hex(start - 1));
                }
            }
            lastEnd = charCode(m[2] || m[1]);
        });

        if (lastEnd < 0xFFFF) {
            output += '\\u' + pad4(hex(lastEnd + 1));
            if (lastEnd < 0xFFFE) {
                output += '-\\uFFFF';
            }
        }

        return output;
    }

    // Generates an inverted BMP range on first use
    function cacheInvertedBmp(slug) {
        var prop = 'b!';
        return unicode[slug][prop] || (unicode[slug][prop] = invertBmp(unicode[slug].bmp));
    }

    // Combines and optionally negates BMP and astral data
    function buildAstral(slug, isNegated) {
        var item = unicode[slug];
        var combined = '';

        if (item.bmp && !item.isBmpLast) {
            combined = '[' + item.bmp + ']' + (item.astral ? '|' : '');
        }
        if (item.astral) {
            combined += item.astral;
        }
        if (item.isBmpLast && item.bmp) {
            combined += (item.astral ? '|' : '') + '[' + item.bmp + ']';
        }

        // Astral Unicode tokens always match a code point, never a code unit
        return isNegated ? '(?:(?!' + combined + ')(?:[\uD800-\uDBFF][\uDC00-\uDFFF]|[\0-\uFFFF]))' : '(?:' + combined + ')';
    }

    // Builds a complete astral pattern on first use
    function cacheAstral(slug, isNegated) {
        var prop = isNegated ? 'a!' : 'a=';
        return unicode[slug][prop] || (unicode[slug][prop] = buildAstral(slug, isNegated));
    }

    // ==--------------------------==
    // Core functionality
    // ==--------------------------==

    /*
     * Add astral mode (flag A) and Unicode token syntax: `\p{..}`, `\P{..}`, `\p{^..}`, `\pC`.
     */
    XRegExp.addToken(
    // Use `*` instead of `+` to avoid capturing `^` as the token name in `\p{^}`
    /\\([pP])(?:{(\^?)([^}]*)}|([A-Za-z]))/, function (match, scope, flags) {
        var ERR_DOUBLE_NEG = 'Invalid double negation ';
        var ERR_UNKNOWN_NAME = 'Unknown Unicode token ';
        var ERR_UNKNOWN_REF = 'Unicode token missing data ';
        var ERR_ASTRAL_ONLY = 'Astral mode required for Unicode token ';
        var ERR_ASTRAL_IN_CLASS = 'Astral mode does not support Unicode tokens within character classes';
        // Negated via \P{..} or \p{^..}
        var isNegated = match[1] === 'P' || !!match[2];
        // Switch from BMP (0-FFFF) to astral (0-10FFFF) mode via flag A
        var isAstralMode = flags.indexOf('A') !== -1;
        // Token lookup name. Check `[4]` first to avoid passing `undefined` via `\p{}`
        var slug = normalize(match[4] || match[3]);
        // Token data object
        var item = unicode[slug];

        if (match[1] === 'P' && match[2]) {
            throw new SyntaxError(ERR_DOUBLE_NEG + match[0]);
        }
        if (!unicode.hasOwnProperty(slug)) {
            throw new SyntaxError(ERR_UNKNOWN_NAME + match[0]);
        }

        // Switch to the negated form of the referenced Unicode token
        if (item.inverseOf) {
            slug = normalize(item.inverseOf);
            if (!unicode.hasOwnProperty(slug)) {
                throw new ReferenceError(ERR_UNKNOWN_REF + match[0] + ' -> ' + item.inverseOf);
            }
            item = unicode[slug];
            isNegated = !isNegated;
        }

        if (!(item.bmp || isAstralMode)) {
            throw new SyntaxError(ERR_ASTRAL_ONLY + match[0]);
        }
        if (isAstralMode) {
            if (scope === 'class') {
                throw new SyntaxError(ERR_ASTRAL_IN_CLASS);
            }

            return cacheAstral(slug, isNegated);
        }

        return scope === 'class' ? isNegated ? cacheInvertedBmp(slug) : item.bmp : (isNegated ? '[^' : '[') + item.bmp + ']';
    }, {
        scope: 'all',
        optionalFlags: 'A',
        leadChar: '\\'
    });

    /**
     * Adds to the list of Unicode tokens that XRegExp regexes can match via `\p` or `\P`.
     *
     * @memberOf XRegExp
     * @param {Array} data Objects with named character ranges. Each object may have properties
     *   `name`, `alias`, `isBmpLast`, `inverseOf`, `bmp`, and `astral`. All but `name` are
     *   optional, although one of `bmp` or `astral` is required (unless `inverseOf` is set). If
     *   `astral` is absent, the `bmp` data is used for BMP and astral modes. If `bmp` is absent,
     *   the name errors in BMP mode but works in astral mode. If both `bmp` and `astral` are
     *   provided, the `bmp` data only is used in BMP mode, and the combination of `bmp` and
     *   `astral` data is used in astral mode. `isBmpLast` is needed when a token matches orphan
     *   high surrogates *and* uses surrogate pairs to match astral code points. The `bmp` and
     *   `astral` data should be a combination of literal characters and `\xHH` or `\uHHHH` escape
     *   sequences, with hyphens to create ranges. Any regex metacharacters in the data should be
     *   escaped, apart from range-creating hyphens. The `astral` data can additionally use
     *   character classes and alternation, and should use surrogate pairs to represent astral code
     *   points. `inverseOf` can be used to avoid duplicating character data if a Unicode token is
     *   defined as the exact inverse of another token.
     * @example
     *
     * // Basic use
     * XRegExp.addUnicodeData([{
     *   name: 'XDigit',
     *   alias: 'Hexadecimal',
     *   bmp: '0-9A-Fa-f'
     * }]);
     * XRegExp('\\p{XDigit}:\\p{Hexadecimal}+').test('0:3D'); // -> true
     */
    XRegExp.addUnicodeData = function (data) {
        var ERR_NO_NAME = 'Unicode token requires name';
        var ERR_NO_DATA = 'Unicode token has no character data ';
        var item = void 0;

        for (var i = 0; i < data.length; ++i) {
            item = data[i];
            if (!item.name) {
                throw new Error(ERR_NO_NAME);
            }
            if (!(item.inverseOf || item.bmp || item.astral)) {
                throw new Error(ERR_NO_DATA + item.name);
            }
            unicode[normalize(item.name)] = item;
            if (item.alias) {
                unicode[normalize(item.alias)] = item;
            }
        }

        // Reset the pattern cache used by the `XRegExp` constructor, since the same pattern and
        // flags might now produce different results
        XRegExp.cache.flush('patterns');
    };

    /**
     * @ignore
     *
     * Return a reference to the internal Unicode definition structure for the given Unicode
     * Property if the given name is a legal Unicode Property for use in XRegExp `\p` or `\P` regex
     * constructs.
     *
     * @memberOf XRegExp
     * @param {String} name Name by which the Unicode Property may be recognized (case-insensitive),
     *   e.g. `'N'` or `'Number'`. The given name is matched against all registered Unicode
     *   Properties and Property Aliases.
     * @returns {Object} Reference to definition structure when the name matches a Unicode Property.
     *
     * @note
     * For more info on Unicode Properties, see also http://unicode.org/reports/tr18/#Categories.
     *
     * @note
     * This method is *not* part of the officially documented API and may change or be removed in
     * the future. It is meant for userland code that wishes to reuse the (large) internal Unicode
     * structures set up by XRegExp.
     */
    XRegExp._getUnicodeProperty = function (name) {
        var slug = normalize(name);
        return unicode[slug];
    };
};

module.exports = exports['default'];
},{}],"n813":[function(require,module,exports) {
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

/*!
 * XRegExp Unicode Blocks 4.0.0
 * <xregexp.com>
 * Steven Levithan (c) 2010-2017 MIT License
 * Unicode data by Mathias Bynens <mathiasbynens.be>
 */

exports.default = function (XRegExp) {

    /**
     * Adds support for all Unicode blocks. Block names use the prefix 'In'. E.g.,
     * `\p{InBasicLatin}`. Token names are case insensitive, and any spaces, hyphens, and
     * underscores are ignored.
     *
     * Uses Unicode 9.0.0.
     *
     * @requires XRegExp, Unicode Base
     */

    if (!XRegExp.addUnicodeData) {
        throw new ReferenceError('Unicode Base must be loaded before Unicode Blocks');
    }

    XRegExp.addUnicodeData([{
        name: 'InAdlam',
        astral: '\uD83A[\uDD00-\uDD5F]'
    }, {
        name: 'InAegean_Numbers',
        astral: '\uD800[\uDD00-\uDD3F]'
    }, {
        name: 'InAhom',
        astral: '\uD805[\uDF00-\uDF3F]'
    }, {
        name: 'InAlchemical_Symbols',
        astral: '\uD83D[\uDF00-\uDF7F]'
    }, {
        name: 'InAlphabetic_Presentation_Forms',
        bmp: '\uFB00-\uFB4F'
    }, {
        name: 'InAnatolian_Hieroglyphs',
        astral: '\uD811[\uDC00-\uDE7F]'
    }, {
        name: 'InAncient_Greek_Musical_Notation',
        astral: '\uD834[\uDE00-\uDE4F]'
    }, {
        name: 'InAncient_Greek_Numbers',
        astral: '\uD800[\uDD40-\uDD8F]'
    }, {
        name: 'InAncient_Symbols',
        astral: '\uD800[\uDD90-\uDDCF]'
    }, {
        name: 'InArabic',
        bmp: '\u0600-\u06FF'
    }, {
        name: 'InArabic_Extended_A',
        bmp: '\u08A0-\u08FF'
    }, {
        name: 'InArabic_Mathematical_Alphabetic_Symbols',
        astral: '\uD83B[\uDE00-\uDEFF]'
    }, {
        name: 'InArabic_Presentation_Forms_A',
        bmp: '\uFB50-\uFDFF'
    }, {
        name: 'InArabic_Presentation_Forms_B',
        bmp: '\uFE70-\uFEFF'
    }, {
        name: 'InArabic_Supplement',
        bmp: '\u0750-\u077F'
    }, {
        name: 'InArmenian',
        bmp: '\u0530-\u058F'
    }, {
        name: 'InArrows',
        bmp: '\u2190-\u21FF'
    }, {
        name: 'InAvestan',
        astral: '\uD802[\uDF00-\uDF3F]'
    }, {
        name: 'InBalinese',
        bmp: '\u1B00-\u1B7F'
    }, {
        name: 'InBamum',
        bmp: '\uA6A0-\uA6FF'
    }, {
        name: 'InBamum_Supplement',
        astral: '\uD81A[\uDC00-\uDE3F]'
    }, {
        name: 'InBasic_Latin',
        bmp: '\0-\x7F'
    }, {
        name: 'InBassa_Vah',
        astral: '\uD81A[\uDED0-\uDEFF]'
    }, {
        name: 'InBatak',
        bmp: '\u1BC0-\u1BFF'
    }, {
        name: 'InBengali',
        bmp: '\u0980-\u09FF'
    }, {
        name: 'InBhaiksuki',
        astral: '\uD807[\uDC00-\uDC6F]'
    }, {
        name: 'InBlock_Elements',
        bmp: '\u2580-\u259F'
    }, {
        name: 'InBopomofo',
        bmp: '\u3100-\u312F'
    }, {
        name: 'InBopomofo_Extended',
        bmp: '\u31A0-\u31BF'
    }, {
        name: 'InBox_Drawing',
        bmp: '\u2500-\u257F'
    }, {
        name: 'InBrahmi',
        astral: '\uD804[\uDC00-\uDC7F]'
    }, {
        name: 'InBraille_Patterns',
        bmp: '\u2800-\u28FF'
    }, {
        name: 'InBuginese',
        bmp: '\u1A00-\u1A1F'
    }, {
        name: 'InBuhid',
        bmp: '\u1740-\u175F'
    }, {
        name: 'InByzantine_Musical_Symbols',
        astral: '\uD834[\uDC00-\uDCFF]'
    }, {
        name: 'InCJK_Compatibility',
        bmp: '\u3300-\u33FF'
    }, {
        name: 'InCJK_Compatibility_Forms',
        bmp: '\uFE30-\uFE4F'
    }, {
        name: 'InCJK_Compatibility_Ideographs',
        bmp: '\uF900-\uFAFF'
    }, {
        name: 'InCJK_Compatibility_Ideographs_Supplement',
        astral: '\uD87E[\uDC00-\uDE1F]'
    }, {
        name: 'InCJK_Radicals_Supplement',
        bmp: '\u2E80-\u2EFF'
    }, {
        name: 'InCJK_Strokes',
        bmp: '\u31C0-\u31EF'
    }, {
        name: 'InCJK_Symbols_and_Punctuation',
        bmp: '\u3000-\u303F'
    }, {
        name: 'InCJK_Unified_Ideographs',
        bmp: '\u4E00-\u9FFF'
    }, {
        name: 'InCJK_Unified_Ideographs_Extension_A',
        bmp: '\u3400-\u4DBF'
    }, {
        name: 'InCJK_Unified_Ideographs_Extension_B',
        astral: '[\uD840-\uD868][\uDC00-\uDFFF]|\uD869[\uDC00-\uDEDF]'
    }, {
        name: 'InCJK_Unified_Ideographs_Extension_C',
        astral: '\uD869[\uDF00-\uDFFF]|[\uD86A-\uD86C][\uDC00-\uDFFF]|\uD86D[\uDC00-\uDF3F]'
    }, {
        name: 'InCJK_Unified_Ideographs_Extension_D',
        astral: '\uD86D[\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1F]'
    }, {
        name: 'InCJK_Unified_Ideographs_Extension_E',
        astral: '\uD86E[\uDC20-\uDFFF]|[\uD86F-\uD872][\uDC00-\uDFFF]|\uD873[\uDC00-\uDEAF]'
    }, {
        name: 'InCarian',
        astral: '\uD800[\uDEA0-\uDEDF]'
    }, {
        name: 'InCaucasian_Albanian',
        astral: '\uD801[\uDD30-\uDD6F]'
    }, {
        name: 'InChakma',
        astral: '\uD804[\uDD00-\uDD4F]'
    }, {
        name: 'InCham',
        bmp: '\uAA00-\uAA5F'
    }, {
        name: 'InCherokee',
        bmp: '\u13A0-\u13FF'
    }, {
        name: 'InCherokee_Supplement',
        bmp: '\uAB70-\uABBF'
    }, {
        name: 'InCombining_Diacritical_Marks',
        bmp: '\u0300-\u036F'
    }, {
        name: 'InCombining_Diacritical_Marks_Extended',
        bmp: '\u1AB0-\u1AFF'
    }, {
        name: 'InCombining_Diacritical_Marks_Supplement',
        bmp: '\u1DC0-\u1DFF'
    }, {
        name: 'InCombining_Diacritical_Marks_for_Symbols',
        bmp: '\u20D0-\u20FF'
    }, {
        name: 'InCombining_Half_Marks',
        bmp: '\uFE20-\uFE2F'
    }, {
        name: 'InCommon_Indic_Number_Forms',
        bmp: '\uA830-\uA83F'
    }, {
        name: 'InControl_Pictures',
        bmp: '\u2400-\u243F'
    }, {
        name: 'InCoptic',
        bmp: '\u2C80-\u2CFF'
    }, {
        name: 'InCoptic_Epact_Numbers',
        astral: '\uD800[\uDEE0-\uDEFF]'
    }, {
        name: 'InCounting_Rod_Numerals',
        astral: '\uD834[\uDF60-\uDF7F]'
    }, {
        name: 'InCuneiform',
        astral: '\uD808[\uDC00-\uDFFF]'
    }, {
        name: 'InCuneiform_Numbers_and_Punctuation',
        astral: '\uD809[\uDC00-\uDC7F]'
    }, {
        name: 'InCurrency_Symbols',
        bmp: '\u20A0-\u20CF'
    }, {
        name: 'InCypriot_Syllabary',
        astral: '\uD802[\uDC00-\uDC3F]'
    }, {
        name: 'InCyrillic',
        bmp: '\u0400-\u04FF'
    }, {
        name: 'InCyrillic_Extended_A',
        bmp: '\u2DE0-\u2DFF'
    }, {
        name: 'InCyrillic_Extended_B',
        bmp: '\uA640-\uA69F'
    }, {
        name: 'InCyrillic_Extended_C',
        bmp: '\u1C80-\u1C8F'
    }, {
        name: 'InCyrillic_Supplement',
        bmp: '\u0500-\u052F'
    }, {
        name: 'InDeseret',
        astral: '\uD801[\uDC00-\uDC4F]'
    }, {
        name: 'InDevanagari',
        bmp: '\u0900-\u097F'
    }, {
        name: 'InDevanagari_Extended',
        bmp: '\uA8E0-\uA8FF'
    }, {
        name: 'InDingbats',
        bmp: '\u2700-\u27BF'
    }, {
        name: 'InDomino_Tiles',
        astral: '\uD83C[\uDC30-\uDC9F]'
    }, {
        name: 'InDuployan',
        astral: '\uD82F[\uDC00-\uDC9F]'
    }, {
        name: 'InEarly_Dynastic_Cuneiform',
        astral: '\uD809[\uDC80-\uDD4F]'
    }, {
        name: 'InEgyptian_Hieroglyphs',
        astral: '\uD80C[\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F]'
    }, {
        name: 'InElbasan',
        astral: '\uD801[\uDD00-\uDD2F]'
    }, {
        name: 'InEmoticons',
        astral: '\uD83D[\uDE00-\uDE4F]'
    }, {
        name: 'InEnclosed_Alphanumeric_Supplement',
        astral: '\uD83C[\uDD00-\uDDFF]'
    }, {
        name: 'InEnclosed_Alphanumerics',
        bmp: '\u2460-\u24FF'
    }, {
        name: 'InEnclosed_CJK_Letters_and_Months',
        bmp: '\u3200-\u32FF'
    }, {
        name: 'InEnclosed_Ideographic_Supplement',
        astral: '\uD83C[\uDE00-\uDEFF]'
    }, {
        name: 'InEthiopic',
        bmp: '\u1200-\u137F'
    }, {
        name: 'InEthiopic_Extended',
        bmp: '\u2D80-\u2DDF'
    }, {
        name: 'InEthiopic_Extended_A',
        bmp: '\uAB00-\uAB2F'
    }, {
        name: 'InEthiopic_Supplement',
        bmp: '\u1380-\u139F'
    }, {
        name: 'InGeneral_Punctuation',
        bmp: '\u2000-\u206F'
    }, {
        name: 'InGeometric_Shapes',
        bmp: '\u25A0-\u25FF'
    }, {
        name: 'InGeometric_Shapes_Extended',
        astral: '\uD83D[\uDF80-\uDFFF]'
    }, {
        name: 'InGeorgian',
        bmp: '\u10A0-\u10FF'
    }, {
        name: 'InGeorgian_Supplement',
        bmp: '\u2D00-\u2D2F'
    }, {
        name: 'InGlagolitic',
        bmp: '\u2C00-\u2C5F'
    }, {
        name: 'InGlagolitic_Supplement',
        astral: '\uD838[\uDC00-\uDC2F]'
    }, {
        name: 'InGothic',
        astral: '\uD800[\uDF30-\uDF4F]'
    }, {
        name: 'InGrantha',
        astral: '\uD804[\uDF00-\uDF7F]'
    }, {
        name: 'InGreek_Extended',
        bmp: '\u1F00-\u1FFF'
    }, {
        name: 'InGreek_and_Coptic',
        bmp: '\u0370-\u03FF'
    }, {
        name: 'InGujarati',
        bmp: '\u0A80-\u0AFF'
    }, {
        name: 'InGurmukhi',
        bmp: '\u0A00-\u0A7F'
    }, {
        name: 'InHalfwidth_and_Fullwidth_Forms',
        bmp: '\uFF00-\uFFEF'
    }, {
        name: 'InHangul_Compatibility_Jamo',
        bmp: '\u3130-\u318F'
    }, {
        name: 'InHangul_Jamo',
        bmp: '\u1100-\u11FF'
    }, {
        name: 'InHangul_Jamo_Extended_A',
        bmp: '\uA960-\uA97F'
    }, {
        name: 'InHangul_Jamo_Extended_B',
        bmp: '\uD7B0-\uD7FF'
    }, {
        name: 'InHangul_Syllables',
        bmp: '\uAC00-\uD7AF'
    }, {
        name: 'InHanunoo',
        bmp: '\u1720-\u173F'
    }, {
        name: 'InHatran',
        astral: '\uD802[\uDCE0-\uDCFF]'
    }, {
        name: 'InHebrew',
        bmp: '\u0590-\u05FF'
    }, {
        name: 'InHigh_Private_Use_Surrogates',
        bmp: '\uDB80-\uDBFF'
    }, {
        name: 'InHigh_Surrogates',
        bmp: '\uD800-\uDB7F'
    }, {
        name: 'InHiragana',
        bmp: '\u3040-\u309F'
    }, {
        name: 'InIPA_Extensions',
        bmp: '\u0250-\u02AF'
    }, {
        name: 'InIdeographic_Description_Characters',
        bmp: '\u2FF0-\u2FFF'
    }, {
        name: 'InIdeographic_Symbols_and_Punctuation',
        astral: '\uD81B[\uDFE0-\uDFFF]'
    }, {
        name: 'InImperial_Aramaic',
        astral: '\uD802[\uDC40-\uDC5F]'
    }, {
        name: 'InInscriptional_Pahlavi',
        astral: '\uD802[\uDF60-\uDF7F]'
    }, {
        name: 'InInscriptional_Parthian',
        astral: '\uD802[\uDF40-\uDF5F]'
    }, {
        name: 'InJavanese',
        bmp: '\uA980-\uA9DF'
    }, {
        name: 'InKaithi',
        astral: '\uD804[\uDC80-\uDCCF]'
    }, {
        name: 'InKana_Supplement',
        astral: '\uD82C[\uDC00-\uDCFF]'
    }, {
        name: 'InKanbun',
        bmp: '\u3190-\u319F'
    }, {
        name: 'InKangxi_Radicals',
        bmp: '\u2F00-\u2FDF'
    }, {
        name: 'InKannada',
        bmp: '\u0C80-\u0CFF'
    }, {
        name: 'InKatakana',
        bmp: '\u30A0-\u30FF'
    }, {
        name: 'InKatakana_Phonetic_Extensions',
        bmp: '\u31F0-\u31FF'
    }, {
        name: 'InKayah_Li',
        bmp: '\uA900-\uA92F'
    }, {
        name: 'InKharoshthi',
        astral: '\uD802[\uDE00-\uDE5F]'
    }, {
        name: 'InKhmer',
        bmp: '\u1780-\u17FF'
    }, {
        name: 'InKhmer_Symbols',
        bmp: '\u19E0-\u19FF'
    }, {
        name: 'InKhojki',
        astral: '\uD804[\uDE00-\uDE4F]'
    }, {
        name: 'InKhudawadi',
        astral: '\uD804[\uDEB0-\uDEFF]'
    }, {
        name: 'InLao',
        bmp: '\u0E80-\u0EFF'
    }, {
        name: 'InLatin_Extended_Additional',
        bmp: '\u1E00-\u1EFF'
    }, {
        name: 'InLatin_Extended_A',
        bmp: '\u0100-\u017F'
    }, {
        name: 'InLatin_Extended_B',
        bmp: '\u0180-\u024F'
    }, {
        name: 'InLatin_Extended_C',
        bmp: '\u2C60-\u2C7F'
    }, {
        name: 'InLatin_Extended_D',
        bmp: '\uA720-\uA7FF'
    }, {
        name: 'InLatin_Extended_E',
        bmp: '\uAB30-\uAB6F'
    }, {
        name: 'InLatin_1_Supplement',
        bmp: '\x80-\xFF'
    }, {
        name: 'InLepcha',
        bmp: '\u1C00-\u1C4F'
    }, {
        name: 'InLetterlike_Symbols',
        bmp: '\u2100-\u214F'
    }, {
        name: 'InLimbu',
        bmp: '\u1900-\u194F'
    }, {
        name: 'InLinear_A',
        astral: '\uD801[\uDE00-\uDF7F]'
    }, {
        name: 'InLinear_B_Ideograms',
        astral: '\uD800[\uDC80-\uDCFF]'
    }, {
        name: 'InLinear_B_Syllabary',
        astral: '\uD800[\uDC00-\uDC7F]'
    }, {
        name: 'InLisu',
        bmp: '\uA4D0-\uA4FF'
    }, {
        name: 'InLow_Surrogates',
        bmp: '\uDC00-\uDFFF'
    }, {
        name: 'InLycian',
        astral: '\uD800[\uDE80-\uDE9F]'
    }, {
        name: 'InLydian',
        astral: '\uD802[\uDD20-\uDD3F]'
    }, {
        name: 'InMahajani',
        astral: '\uD804[\uDD50-\uDD7F]'
    }, {
        name: 'InMahjong_Tiles',
        astral: '\uD83C[\uDC00-\uDC2F]'
    }, {
        name: 'InMalayalam',
        bmp: '\u0D00-\u0D7F'
    }, {
        name: 'InMandaic',
        bmp: '\u0840-\u085F'
    }, {
        name: 'InManichaean',
        astral: '\uD802[\uDEC0-\uDEFF]'
    }, {
        name: 'InMarchen',
        astral: '\uD807[\uDC70-\uDCBF]'
    }, {
        name: 'InMathematical_Alphanumeric_Symbols',
        astral: '\uD835[\uDC00-\uDFFF]'
    }, {
        name: 'InMathematical_Operators',
        bmp: '\u2200-\u22FF'
    }, {
        name: 'InMeetei_Mayek',
        bmp: '\uABC0-\uABFF'
    }, {
        name: 'InMeetei_Mayek_Extensions',
        bmp: '\uAAE0-\uAAFF'
    }, {
        name: 'InMende_Kikakui',
        astral: '\uD83A[\uDC00-\uDCDF]'
    }, {
        name: 'InMeroitic_Cursive',
        astral: '\uD802[\uDDA0-\uDDFF]'
    }, {
        name: 'InMeroitic_Hieroglyphs',
        astral: '\uD802[\uDD80-\uDD9F]'
    }, {
        name: 'InMiao',
        astral: '\uD81B[\uDF00-\uDF9F]'
    }, {
        name: 'InMiscellaneous_Mathematical_Symbols_A',
        bmp: '\u27C0-\u27EF'
    }, {
        name: 'InMiscellaneous_Mathematical_Symbols_B',
        bmp: '\u2980-\u29FF'
    }, {
        name: 'InMiscellaneous_Symbols',
        bmp: '\u2600-\u26FF'
    }, {
        name: 'InMiscellaneous_Symbols_and_Arrows',
        bmp: '\u2B00-\u2BFF'
    }, {
        name: 'InMiscellaneous_Symbols_and_Pictographs',
        astral: '\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDDFF]'
    }, {
        name: 'InMiscellaneous_Technical',
        bmp: '\u2300-\u23FF'
    }, {
        name: 'InModi',
        astral: '\uD805[\uDE00-\uDE5F]'
    }, {
        name: 'InModifier_Tone_Letters',
        bmp: '\uA700-\uA71F'
    }, {
        name: 'InMongolian',
        bmp: '\u1800-\u18AF'
    }, {
        name: 'InMongolian_Supplement',
        astral: '\uD805[\uDE60-\uDE7F]'
    }, {
        name: 'InMro',
        astral: '\uD81A[\uDE40-\uDE6F]'
    }, {
        name: 'InMultani',
        astral: '\uD804[\uDE80-\uDEAF]'
    }, {
        name: 'InMusical_Symbols',
        astral: '\uD834[\uDD00-\uDDFF]'
    }, {
        name: 'InMyanmar',
        bmp: '\u1000-\u109F'
    }, {
        name: 'InMyanmar_Extended_A',
        bmp: '\uAA60-\uAA7F'
    }, {
        name: 'InMyanmar_Extended_B',
        bmp: '\uA9E0-\uA9FF'
    }, {
        name: 'InNKo',
        bmp: '\u07C0-\u07FF'
    }, {
        name: 'InNabataean',
        astral: '\uD802[\uDC80-\uDCAF]'
    }, {
        name: 'InNew_Tai_Lue',
        bmp: '\u1980-\u19DF'
    }, {
        name: 'InNewa',
        astral: '\uD805[\uDC00-\uDC7F]'
    }, {
        name: 'InNumber_Forms',
        bmp: '\u2150-\u218F'
    }, {
        name: 'InOgham',
        bmp: '\u1680-\u169F'
    }, {
        name: 'InOl_Chiki',
        bmp: '\u1C50-\u1C7F'
    }, {
        name: 'InOld_Hungarian',
        astral: '\uD803[\uDC80-\uDCFF]'
    }, {
        name: 'InOld_Italic',
        astral: '\uD800[\uDF00-\uDF2F]'
    }, {
        name: 'InOld_North_Arabian',
        astral: '\uD802[\uDE80-\uDE9F]'
    }, {
        name: 'InOld_Permic',
        astral: '\uD800[\uDF50-\uDF7F]'
    }, {
        name: 'InOld_Persian',
        astral: '\uD800[\uDFA0-\uDFDF]'
    }, {
        name: 'InOld_South_Arabian',
        astral: '\uD802[\uDE60-\uDE7F]'
    }, {
        name: 'InOld_Turkic',
        astral: '\uD803[\uDC00-\uDC4F]'
    }, {
        name: 'InOptical_Character_Recognition',
        bmp: '\u2440-\u245F'
    }, {
        name: 'InOriya',
        bmp: '\u0B00-\u0B7F'
    }, {
        name: 'InOrnamental_Dingbats',
        astral: '\uD83D[\uDE50-\uDE7F]'
    }, {
        name: 'InOsage',
        astral: '\uD801[\uDCB0-\uDCFF]'
    }, {
        name: 'InOsmanya',
        astral: '\uD801[\uDC80-\uDCAF]'
    }, {
        name: 'InPahawh_Hmong',
        astral: '\uD81A[\uDF00-\uDF8F]'
    }, {
        name: 'InPalmyrene',
        astral: '\uD802[\uDC60-\uDC7F]'
    }, {
        name: 'InPau_Cin_Hau',
        astral: '\uD806[\uDEC0-\uDEFF]'
    }, {
        name: 'InPhags_pa',
        bmp: '\uA840-\uA87F'
    }, {
        name: 'InPhaistos_Disc',
        astral: '\uD800[\uDDD0-\uDDFF]'
    }, {
        name: 'InPhoenician',
        astral: '\uD802[\uDD00-\uDD1F]'
    }, {
        name: 'InPhonetic_Extensions',
        bmp: '\u1D00-\u1D7F'
    }, {
        name: 'InPhonetic_Extensions_Supplement',
        bmp: '\u1D80-\u1DBF'
    }, {
        name: 'InPlaying_Cards',
        astral: '\uD83C[\uDCA0-\uDCFF]'
    }, {
        name: 'InPrivate_Use_Area',
        bmp: '\uE000-\uF8FF'
    }, {
        name: 'InPsalter_Pahlavi',
        astral: '\uD802[\uDF80-\uDFAF]'
    }, {
        name: 'InRejang',
        bmp: '\uA930-\uA95F'
    }, {
        name: 'InRumi_Numeral_Symbols',
        astral: '\uD803[\uDE60-\uDE7F]'
    }, {
        name: 'InRunic',
        bmp: '\u16A0-\u16FF'
    }, {
        name: 'InSamaritan',
        bmp: '\u0800-\u083F'
    }, {
        name: 'InSaurashtra',
        bmp: '\uA880-\uA8DF'
    }, {
        name: 'InSharada',
        astral: '\uD804[\uDD80-\uDDDF]'
    }, {
        name: 'InShavian',
        astral: '\uD801[\uDC50-\uDC7F]'
    }, {
        name: 'InShorthand_Format_Controls',
        astral: '\uD82F[\uDCA0-\uDCAF]'
    }, {
        name: 'InSiddham',
        astral: '\uD805[\uDD80-\uDDFF]'
    }, {
        name: 'InSinhala',
        bmp: '\u0D80-\u0DFF'
    }, {
        name: 'InSinhala_Archaic_Numbers',
        astral: '\uD804[\uDDE0-\uDDFF]'
    }, {
        name: 'InSmall_Form_Variants',
        bmp: '\uFE50-\uFE6F'
    }, {
        name: 'InSora_Sompeng',
        astral: '\uD804[\uDCD0-\uDCFF]'
    }, {
        name: 'InSpacing_Modifier_Letters',
        bmp: '\u02B0-\u02FF'
    }, {
        name: 'InSpecials',
        bmp: '\uFFF0-\uFFFF'
    }, {
        name: 'InSundanese',
        bmp: '\u1B80-\u1BBF'
    }, {
        name: 'InSundanese_Supplement',
        bmp: '\u1CC0-\u1CCF'
    }, {
        name: 'InSuperscripts_and_Subscripts',
        bmp: '\u2070-\u209F'
    }, {
        name: 'InSupplemental_Arrows_A',
        bmp: '\u27F0-\u27FF'
    }, {
        name: 'InSupplemental_Arrows_B',
        bmp: '\u2900-\u297F'
    }, {
        name: 'InSupplemental_Arrows_C',
        astral: '\uD83E[\uDC00-\uDCFF]'
    }, {
        name: 'InSupplemental_Mathematical_Operators',
        bmp: '\u2A00-\u2AFF'
    }, {
        name: 'InSupplemental_Punctuation',
        bmp: '\u2E00-\u2E7F'
    }, {
        name: 'InSupplemental_Symbols_and_Pictographs',
        astral: '\uD83E[\uDD00-\uDDFF]'
    }, {
        name: 'InSupplementary_Private_Use_Area_A',
        astral: '[\uDB80-\uDBBF][\uDC00-\uDFFF]'
    }, {
        name: 'InSupplementary_Private_Use_Area_B',
        astral: '[\uDBC0-\uDBFF][\uDC00-\uDFFF]'
    }, {
        name: 'InSutton_SignWriting',
        astral: '\uD836[\uDC00-\uDEAF]'
    }, {
        name: 'InSyloti_Nagri',
        bmp: '\uA800-\uA82F'
    }, {
        name: 'InSyriac',
        bmp: '\u0700-\u074F'
    }, {
        name: 'InTagalog',
        bmp: '\u1700-\u171F'
    }, {
        name: 'InTagbanwa',
        bmp: '\u1760-\u177F'
    }, {
        name: 'InTags',
        astral: '\uDB40[\uDC00-\uDC7F]'
    }, {
        name: 'InTai_Le',
        bmp: '\u1950-\u197F'
    }, {
        name: 'InTai_Tham',
        bmp: '\u1A20-\u1AAF'
    }, {
        name: 'InTai_Viet',
        bmp: '\uAA80-\uAADF'
    }, {
        name: 'InTai_Xuan_Jing_Symbols',
        astral: '\uD834[\uDF00-\uDF5F]'
    }, {
        name: 'InTakri',
        astral: '\uD805[\uDE80-\uDECF]'
    }, {
        name: 'InTamil',
        bmp: '\u0B80-\u0BFF'
    }, {
        name: 'InTangut',
        astral: '[\uD81C-\uD821][\uDC00-\uDFFF]'
    }, {
        name: 'InTangut_Components',
        astral: '\uD822[\uDC00-\uDEFF]'
    }, {
        name: 'InTelugu',
        bmp: '\u0C00-\u0C7F'
    }, {
        name: 'InThaana',
        bmp: '\u0780-\u07BF'
    }, {
        name: 'InThai',
        bmp: '\u0E00-\u0E7F'
    }, {
        name: 'InTibetan',
        bmp: '\u0F00-\u0FFF'
    }, {
        name: 'InTifinagh',
        bmp: '\u2D30-\u2D7F'
    }, {
        name: 'InTirhuta',
        astral: '\uD805[\uDC80-\uDCDF]'
    }, {
        name: 'InTransport_and_Map_Symbols',
        astral: '\uD83D[\uDE80-\uDEFF]'
    }, {
        name: 'InUgaritic',
        astral: '\uD800[\uDF80-\uDF9F]'
    }, {
        name: 'InUnified_Canadian_Aboriginal_Syllabics',
        bmp: '\u1400-\u167F'
    }, {
        name: 'InUnified_Canadian_Aboriginal_Syllabics_Extended',
        bmp: '\u18B0-\u18FF'
    }, {
        name: 'InVai',
        bmp: '\uA500-\uA63F'
    }, {
        name: 'InVariation_Selectors',
        bmp: '\uFE00-\uFE0F'
    }, {
        name: 'InVariation_Selectors_Supplement',
        astral: '\uDB40[\uDD00-\uDDEF]'
    }, {
        name: 'InVedic_Extensions',
        bmp: '\u1CD0-\u1CFF'
    }, {
        name: 'InVertical_Forms',
        bmp: '\uFE10-\uFE1F'
    }, {
        name: 'InWarang_Citi',
        astral: '\uD806[\uDCA0-\uDCFF]'
    }, {
        name: 'InYi_Radicals',
        bmp: '\uA490-\uA4CF'
    }, {
        name: 'InYi_Syllables',
        bmp: '\uA000-\uA48F'
    }, {
        name: 'InYijing_Hexagram_Symbols',
        bmp: '\u4DC0-\u4DFF'
    }]);
};

module.exports = exports['default'];
},{}],"IOa4":[function(require,module,exports) {
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

/*!
 * XRegExp Unicode Categories 4.0.0
 * <xregexp.com>
 * Steven Levithan (c) 2010-2017 MIT License
 * Unicode data by Mathias Bynens <mathiasbynens.be>
 */

exports.default = function (XRegExp) {

    /**
     * Adds support for Unicode's general categories. E.g., `\p{Lu}` or `\p{Uppercase Letter}`. See
     * category descriptions in UAX #44 <http://unicode.org/reports/tr44/#GC_Values_Table>. Token
     * names are case insensitive, and any spaces, hyphens, and underscores are ignored.
     *
     * Uses Unicode 9.0.0.
     *
     * @requires XRegExp, Unicode Base
     */

    if (!XRegExp.addUnicodeData) {
        throw new ReferenceError('Unicode Base must be loaded before Unicode Categories');
    }

    XRegExp.addUnicodeData([{
        name: 'C',
        alias: 'Other',
        isBmpLast: true,
        bmp: '\0-\x1F\x7F-\x9F\xAD\u0378\u0379\u0380-\u0383\u038B\u038D\u03A2\u0530\u0557\u0558\u0560\u0588\u058B\u058C\u0590\u05C8-\u05CF\u05EB-\u05EF\u05F5-\u0605\u061C\u061D\u06DD\u070E\u070F\u074B\u074C\u07B2-\u07BF\u07FB-\u07FF\u082E\u082F\u083F\u085C\u085D\u085F-\u089F\u08B5\u08BE-\u08D3\u08E2\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09FC-\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF2-\u0AF8\u0AFA-\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B55\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B78-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BFB-\u0BFF\u0C04\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B-\u0C5F\u0C64\u0C65\u0C70-\u0C77\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0D00\u0D04\u0D0D\u0D11\u0D3B\u0D3C\u0D45\u0D49\u0D50-\u0D53\u0D64\u0D65\u0D80\u0D81\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF5-\u0E00\u0E3B-\u0E3E\u0E5C-\u0E80\u0E83\u0E85\u0E86\u0E89\u0E8B\u0E8C\u0E8E-\u0E93\u0E98\u0EA0\u0EA4\u0EA6\u0EA8\u0EA9\u0EAC\u0EBA\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F48\u0F6D-\u0F70\u0F98\u0FBD\u0FCD\u0FDB-\u0FFF\u10C6\u10C8-\u10CC\u10CE\u10CF\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u137D-\u137F\u139A-\u139F\u13F6\u13F7\u13FE\u13FF\u169D-\u169F\u16F9-\u16FF\u170D\u1715-\u171F\u1737-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17DE\u17DF\u17EA-\u17EF\u17FA-\u17FF\u180E\u180F\u181A-\u181F\u1878-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u193F\u1941-\u1943\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DB-\u19DD\u1A1C\u1A1D\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1A9F\u1AAE\u1AAF\u1ABF-\u1AFF\u1B4C-\u1B4F\u1B7D-\u1B7F\u1BF4-\u1BFB\u1C38-\u1C3A\u1C4A-\u1C4C\u1C89-\u1CBF\u1CC8-\u1CCF\u1CF7\u1CFA-\u1CFF\u1DF6-\u1DFA\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FC5\u1FD4\u1FD5\u1FDC\u1FF0\u1FF1\u1FF5\u1FFF\u200B-\u200F\u202A-\u202E\u2060-\u206F\u2072\u2073\u208F\u209D-\u209F\u20BF-\u20CF\u20F1-\u20FF\u218C-\u218F\u23FF\u2427-\u243F\u244B-\u245F\u2B74\u2B75\u2B96\u2B97\u2BBA-\u2BBC\u2BC9\u2BD2-\u2BEB\u2BF0-\u2BFF\u2C2F\u2C5F\u2CF4-\u2CF8\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D71-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E45-\u2E7F\u2E9A\u2EF4-\u2EFF\u2FD6-\u2FEF\u2FFC-\u2FFF\u3040\u3097\u3098\u3100-\u3104\u312E-\u3130\u318F\u31BB-\u31BF\u31E4-\u31EF\u321F\u32FF\u4DB6-\u4DBF\u9FD6-\u9FFF\uA48D-\uA48F\uA4C7-\uA4CF\uA62C-\uA63F\uA6F8-\uA6FF\uA7AF\uA7B8-\uA7F6\uA82C-\uA82F\uA83A-\uA83F\uA878-\uA87F\uA8C6-\uA8CD\uA8DA-\uA8DF\uA8FE\uA8FF\uA954-\uA95E\uA97D-\uA97F\uA9CE\uA9DA-\uA9DD\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A\uAA5B\uAAC3-\uAADA\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB66-\uAB6F\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBC2-\uFBD2\uFD40-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFE\uFDFF\uFE1A-\uFE1F\uFE53\uFE67\uFE6C-\uFE6F\uFE75\uFEFD-\uFF00\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFDF\uFFE7\uFFEF-\uFFFB\uFFFE\uFFFF',
        astral: '\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDCFF\uDD03-\uDD06\uDD34-\uDD36\uDD8F\uDD9C-\uDD9F\uDDA1-\uDDCF\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEFC-\uDEFF\uDF24-\uDF2F\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDFC4-\uDFC7\uDFD6-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDD6E\uDD70-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56\uDC9F-\uDCA6\uDCB0-\uDCDF\uDCF3\uDCF6-\uDCFA\uDD1C-\uDD1E\uDD3A-\uDD3E\uDD40-\uDD7F\uDDB8-\uDDBB\uDDD0\uDDD1\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE34-\uDE37\uDE3B-\uDE3E\uDE48-\uDE4F\uDE59-\uDE5F\uDEA0-\uDEBF\uDEE7-\uDEEA\uDEF7-\uDEFF\uDF36-\uDF38\uDF56\uDF57\uDF73-\uDF77\uDF92-\uDF98\uDF9D-\uDFA8\uDFB0-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCF9\uDD00-\uDE5F\uDE7F-\uDFFF]|\uD804[\uDC4E-\uDC51\uDC70-\uDC7E\uDCBD\uDCC2-\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD44-\uDD4F\uDD77-\uDD7F\uDDCE\uDDCF\uDDE0\uDDF5-\uDDFF\uDE12\uDE3F-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEAA-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF3B\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD805[\uDC5A\uDC5C\uDC5E-\uDC7F\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDDE-\uDDFF\uDE45-\uDE4F\uDE5A-\uDE5F\uDE6D-\uDE7F\uDEB8-\uDEBF\uDECA-\uDEFF\uDF1A-\uDF1C\uDF2C-\uDF2F\uDF40-\uDFFF]|\uD806[\uDC00-\uDC9F\uDCF3-\uDCFE\uDD00-\uDEBF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC37\uDC46-\uDC4F\uDC6D-\uDC6F\uDC90\uDC91\uDCA8\uDCB7-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC6F\uDC75-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80B\uD80E-\uD810\uD812-\uD819\uD823-\uD82B\uD82D\uD82E\uD830-\uD833\uD837\uD839\uD83F\uD874-\uD87D\uD87F-\uDB3F\uDB41-\uDBFF][\uDC00-\uDFFF]|\uD80D[\uDC2F-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDE6D\uDE70-\uDECF\uDEEE\uDEEF\uDEF6-\uDEFF\uDF46-\uDF4F\uDF5A\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDEFF\uDF45-\uDF4F\uDF7F-\uDF8E\uDFA0-\uDFDF\uDFE1-\uDFFF]|\uD821[\uDFED-\uDFFF]|\uD822[\uDEF3-\uDFFF]|\uD82C[\uDC02-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A\uDC9B\uDCA0-\uDFFF]|\uD834[\uDCF6-\uDCFF\uDD27\uDD28\uDD73-\uDD7A\uDDE9-\uDDFF\uDE46-\uDEFF\uDF57-\uDF5F\uDF72-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDFCC\uDFCD]|\uD836[\uDE8C-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDFFF]|\uD83A[\uDCC5\uDCC6\uDCD7-\uDCFF\uDD4B-\uDD4F\uDD5A-\uDD5D\uDD60-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDEEF\uDEF2-\uDFFF]|\uD83C[\uDC2C-\uDC2F\uDC94-\uDC9F\uDCAF\uDCB0\uDCC0\uDCD0\uDCF6-\uDCFF\uDD0D-\uDD0F\uDD2F\uDD6C-\uDD6F\uDDAD-\uDDE5\uDE03-\uDE0F\uDE3C-\uDE3F\uDE49-\uDE4F\uDE52-\uDEFF]|\uD83D[\uDED3-\uDEDF\uDEED-\uDEEF\uDEF7-\uDEFF\uDF74-\uDF7F\uDFD5-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE-\uDD0F\uDD1F\uDD28-\uDD2F\uDD31\uDD32\uDD3F\uDD4C-\uDD4F\uDD5F-\uDD7F\uDD92-\uDDBF\uDDC1-\uDFFF]|\uD869[\uDED7-\uDEFF]|\uD86D[\uDF35-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uDB40[\uDC00-\uDCFF\uDDF0-\uDFFF]'
    }, {
        name: 'Cc',
        alias: 'Control',
        bmp: '\0-\x1F\x7F-\x9F'
    }, {
        name: 'Cf',
        alias: 'Format',
        bmp: '\xAD\u0600-\u0605\u061C\u06DD\u070F\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB',
        astral: '\uD804\uDCBD|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]'
    }, {
        name: 'Cn',
        alias: 'Unassigned',
        bmp: '\u0378\u0379\u0380-\u0383\u038B\u038D\u03A2\u0530\u0557\u0558\u0560\u0588\u058B\u058C\u0590\u05C8-\u05CF\u05EB-\u05EF\u05F5-\u05FF\u061D\u070E\u074B\u074C\u07B2-\u07BF\u07FB-\u07FF\u082E\u082F\u083F\u085C\u085D\u085F-\u089F\u08B5\u08BE-\u08D3\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09FC-\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF2-\u0AF8\u0AFA-\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B55\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B78-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BFB-\u0BFF\u0C04\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B-\u0C5F\u0C64\u0C65\u0C70-\u0C77\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0D00\u0D04\u0D0D\u0D11\u0D3B\u0D3C\u0D45\u0D49\u0D50-\u0D53\u0D64\u0D65\u0D80\u0D81\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF5-\u0E00\u0E3B-\u0E3E\u0E5C-\u0E80\u0E83\u0E85\u0E86\u0E89\u0E8B\u0E8C\u0E8E-\u0E93\u0E98\u0EA0\u0EA4\u0EA6\u0EA8\u0EA9\u0EAC\u0EBA\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F48\u0F6D-\u0F70\u0F98\u0FBD\u0FCD\u0FDB-\u0FFF\u10C6\u10C8-\u10CC\u10CE\u10CF\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u137D-\u137F\u139A-\u139F\u13F6\u13F7\u13FE\u13FF\u169D-\u169F\u16F9-\u16FF\u170D\u1715-\u171F\u1737-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17DE\u17DF\u17EA-\u17EF\u17FA-\u17FF\u180F\u181A-\u181F\u1878-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u193F\u1941-\u1943\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DB-\u19DD\u1A1C\u1A1D\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1A9F\u1AAE\u1AAF\u1ABF-\u1AFF\u1B4C-\u1B4F\u1B7D-\u1B7F\u1BF4-\u1BFB\u1C38-\u1C3A\u1C4A-\u1C4C\u1C89-\u1CBF\u1CC8-\u1CCF\u1CF7\u1CFA-\u1CFF\u1DF6-\u1DFA\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FC5\u1FD4\u1FD5\u1FDC\u1FF0\u1FF1\u1FF5\u1FFF\u2065\u2072\u2073\u208F\u209D-\u209F\u20BF-\u20CF\u20F1-\u20FF\u218C-\u218F\u23FF\u2427-\u243F\u244B-\u245F\u2B74\u2B75\u2B96\u2B97\u2BBA-\u2BBC\u2BC9\u2BD2-\u2BEB\u2BF0-\u2BFF\u2C2F\u2C5F\u2CF4-\u2CF8\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D71-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E45-\u2E7F\u2E9A\u2EF4-\u2EFF\u2FD6-\u2FEF\u2FFC-\u2FFF\u3040\u3097\u3098\u3100-\u3104\u312E-\u3130\u318F\u31BB-\u31BF\u31E4-\u31EF\u321F\u32FF\u4DB6-\u4DBF\u9FD6-\u9FFF\uA48D-\uA48F\uA4C7-\uA4CF\uA62C-\uA63F\uA6F8-\uA6FF\uA7AF\uA7B8-\uA7F6\uA82C-\uA82F\uA83A-\uA83F\uA878-\uA87F\uA8C6-\uA8CD\uA8DA-\uA8DF\uA8FE\uA8FF\uA954-\uA95E\uA97D-\uA97F\uA9CE\uA9DA-\uA9DD\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A\uAA5B\uAAC3-\uAADA\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB66-\uAB6F\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBC2-\uFBD2\uFD40-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFE\uFDFF\uFE1A-\uFE1F\uFE53\uFE67\uFE6C-\uFE6F\uFE75\uFEFD\uFEFE\uFF00\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFDF\uFFE7\uFFEF-\uFFF8\uFFFE\uFFFF',
        astral: '\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDCFF\uDD03-\uDD06\uDD34-\uDD36\uDD8F\uDD9C-\uDD9F\uDDA1-\uDDCF\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEFC-\uDEFF\uDF24-\uDF2F\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDFC4-\uDFC7\uDFD6-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDD6E\uDD70-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56\uDC9F-\uDCA6\uDCB0-\uDCDF\uDCF3\uDCF6-\uDCFA\uDD1C-\uDD1E\uDD3A-\uDD3E\uDD40-\uDD7F\uDDB8-\uDDBB\uDDD0\uDDD1\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE34-\uDE37\uDE3B-\uDE3E\uDE48-\uDE4F\uDE59-\uDE5F\uDEA0-\uDEBF\uDEE7-\uDEEA\uDEF7-\uDEFF\uDF36-\uDF38\uDF56\uDF57\uDF73-\uDF77\uDF92-\uDF98\uDF9D-\uDFA8\uDFB0-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCF9\uDD00-\uDE5F\uDE7F-\uDFFF]|\uD804[\uDC4E-\uDC51\uDC70-\uDC7E\uDCC2-\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD44-\uDD4F\uDD77-\uDD7F\uDDCE\uDDCF\uDDE0\uDDF5-\uDDFF\uDE12\uDE3F-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEAA-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF3B\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD805[\uDC5A\uDC5C\uDC5E-\uDC7F\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDDE-\uDDFF\uDE45-\uDE4F\uDE5A-\uDE5F\uDE6D-\uDE7F\uDEB8-\uDEBF\uDECA-\uDEFF\uDF1A-\uDF1C\uDF2C-\uDF2F\uDF40-\uDFFF]|\uD806[\uDC00-\uDC9F\uDCF3-\uDCFE\uDD00-\uDEBF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC37\uDC46-\uDC4F\uDC6D-\uDC6F\uDC90\uDC91\uDCA8\uDCB7-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC6F\uDC75-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80B\uD80E-\uD810\uD812-\uD819\uD823-\uD82B\uD82D\uD82E\uD830-\uD833\uD837\uD839\uD83F\uD874-\uD87D\uD87F-\uDB3F\uDB41-\uDB7F][\uDC00-\uDFFF]|\uD80D[\uDC2F-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDE6D\uDE70-\uDECF\uDEEE\uDEEF\uDEF6-\uDEFF\uDF46-\uDF4F\uDF5A\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDEFF\uDF45-\uDF4F\uDF7F-\uDF8E\uDFA0-\uDFDF\uDFE1-\uDFFF]|\uD821[\uDFED-\uDFFF]|\uD822[\uDEF3-\uDFFF]|\uD82C[\uDC02-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A\uDC9B\uDCA4-\uDFFF]|\uD834[\uDCF6-\uDCFF\uDD27\uDD28\uDDE9-\uDDFF\uDE46-\uDEFF\uDF57-\uDF5F\uDF72-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDFCC\uDFCD]|\uD836[\uDE8C-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDFFF]|\uD83A[\uDCC5\uDCC6\uDCD7-\uDCFF\uDD4B-\uDD4F\uDD5A-\uDD5D\uDD60-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDEEF\uDEF2-\uDFFF]|\uD83C[\uDC2C-\uDC2F\uDC94-\uDC9F\uDCAF\uDCB0\uDCC0\uDCD0\uDCF6-\uDCFF\uDD0D-\uDD0F\uDD2F\uDD6C-\uDD6F\uDDAD-\uDDE5\uDE03-\uDE0F\uDE3C-\uDE3F\uDE49-\uDE4F\uDE52-\uDEFF]|\uD83D[\uDED3-\uDEDF\uDEED-\uDEEF\uDEF7-\uDEFF\uDF74-\uDF7F\uDFD5-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE-\uDD0F\uDD1F\uDD28-\uDD2F\uDD31\uDD32\uDD3F\uDD4C-\uDD4F\uDD5F-\uDD7F\uDD92-\uDDBF\uDDC1-\uDFFF]|\uD869[\uDED7-\uDEFF]|\uD86D[\uDF35-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uDB40[\uDC00\uDC02-\uDC1F\uDC80-\uDCFF\uDDF0-\uDFFF]|[\uDBBF\uDBFF][\uDFFE\uDFFF]'
    }, {
        name: 'Co',
        alias: 'Private_Use',
        bmp: '\uE000-\uF8FF',
        astral: '[\uDB80-\uDBBE\uDBC0-\uDBFE][\uDC00-\uDFFF]|[\uDBBF\uDBFF][\uDC00-\uDFFD]'
    }, {
        name: 'Cs',
        alias: 'Surrogate',
        bmp: '\uD800-\uDFFF'
    }, {
        name: 'L',
        alias: 'Letter',
        bmp: 'A-Za-z\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-\u08B4\u08B6-\u08BD\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\u0AF9\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-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\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-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\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\u2183\u2184\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\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\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-\uAB65\uAB70-\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',
        astral: '\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]'
    }, {
        name: 'Ll',
        alias: 'Lowercase_Letter',
        bmp: 'a-z\xB5\xDF-\xF6\xF8-\xFF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0295-\u02AF\u0371\u0373\u0377\u037B-\u037D\u0390\u03AC-\u03CE\u03D0\u03D1\u03D5-\u03D7\u03D9\u03DB\u03DD\u03DF\u03E1\u03E3\u03E5\u03E7\u03E9\u03EB\u03ED\u03EF-\u03F3\u03F5\u03F8\u03FB\u03FC\u0430-\u045F\u0461\u0463\u0465\u0467\u0469\u046B\u046D\u046F\u0471\u0473\u0475\u0477\u0479\u047B\u047D\u047F\u0481\u048B\u048D\u048F\u0491\u0493\u0495\u0497\u0499\u049B\u049D\u049F\u04A1\u04A3\u04A5\u04A7\u04A9\u04AB\u04AD\u04AF\u04B1\u04B3\u04B5\u04B7\u04B9\u04BB\u04BD\u04BF\u04C2\u04C4\u04C6\u04C8\u04CA\u04CC\u04CE\u04CF\u04D1\u04D3\u04D5\u04D7\u04D9\u04DB\u04DD\u04DF\u04E1\u04E3\u04E5\u04E7\u04E9\u04EB\u04ED\u04EF\u04F1\u04F3\u04F5\u04F7\u04F9\u04FB\u04FD\u04FF\u0501\u0503\u0505\u0507\u0509\u050B\u050D\u050F\u0511\u0513\u0515\u0517\u0519\u051B\u051D\u051F\u0521\u0523\u0525\u0527\u0529\u052B\u052D\u052F\u0561-\u0587\u13F8-\u13FD\u1C80-\u1C88\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E01\u1E03\u1E05\u1E07\u1E09\u1E0B\u1E0D\u1E0F\u1E11\u1E13\u1E15\u1E17\u1E19\u1E1B\u1E1D\u1E1F\u1E21\u1E23\u1E25\u1E27\u1E29\u1E2B\u1E2D\u1E2F\u1E31\u1E33\u1E35\u1E37\u1E39\u1E3B\u1E3D\u1E3F\u1E41\u1E43\u1E45\u1E47\u1E49\u1E4B\u1E4D\u1E4F\u1E51\u1E53\u1E55\u1E57\u1E59\u1E5B\u1E5D\u1E5F\u1E61\u1E63\u1E65\u1E67\u1E69\u1E6B\u1E6D\u1E6F\u1E71\u1E73\u1E75\u1E77\u1E79\u1E7B\u1E7D\u1E7F\u1E81\u1E83\u1E85\u1E87\u1E89\u1E8B\u1E8D\u1E8F\u1E91\u1E93\u1E95-\u1E9D\u1E9F\u1EA1\u1EA3\u1EA5\u1EA7\u1EA9\u1EAB\u1EAD\u1EAF\u1EB1\u1EB3\u1EB5\u1EB7\u1EB9\u1EBB\u1EBD\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7\u1EC9\u1ECB\u1ECD\u1ECF\u1ED1\u1ED3\u1ED5\u1ED7\u1ED9\u1EDB\u1EDD\u1EDF\u1EE1\u1EE3\u1EE5\u1EE7\u1EE9\u1EEB\u1EED\u1EEF\u1EF1\u1EF3\u1EF5\u1EF7\u1EF9\u1EFB\u1EFD\u1EFF-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB0-\u1FB4\u1FB6\u1FB7\u1FBE\u1FC2-\u1FC4\u1FC6\u1FC7\u1FD0-\u1FD3\u1FD6\u1FD7\u1FE0-\u1FE7\u1FF2-\u1FF4\u1FF6\u1FF7\u210A\u210E\u210F\u2113\u212F\u2134\u2139\u213C\u213D\u2146-\u2149\u214E\u2184\u2C30-\u2C5E\u2C61\u2C65\u2C66\u2C68\u2C6A\u2C6C\u2C71\u2C73\u2C74\u2C76-\u2C7B\u2C81\u2C83\u2C85\u2C87\u2C89\u2C8B\u2C8D\u2C8F\u2C91\u2C93\u2C95\u2C97\u2C99\u2C9B\u2C9D\u2C9F\u2CA1\u2CA3\u2CA5\u2CA7\u2CA9\u2CAB\u2CAD\u2CAF\u2CB1\u2CB3\u2CB5\u2CB7\u2CB9\u2CBB\u2CBD\u2CBF\u2CC1\u2CC3\u2CC5\u2CC7\u2CC9\u2CCB\u2CCD\u2CCF\u2CD1\u2CD3\u2CD5\u2CD7\u2CD9\u2CDB\u2CDD\u2CDF\u2CE1\u2CE3\u2CE4\u2CEC\u2CEE\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA641\uA643\uA645\uA647\uA649\uA64B\uA64D\uA64F\uA651\uA653\uA655\uA657\uA659\uA65B\uA65D\uA65F\uA661\uA663\uA665\uA667\uA669\uA66B\uA66D\uA681\uA683\uA685\uA687\uA689\uA68B\uA68D\uA68F\uA691\uA693\uA695\uA697\uA699\uA69B\uA723\uA725\uA727\uA729\uA72B\uA72D\uA72F-\uA731\uA733\uA735\uA737\uA739\uA73B\uA73D\uA73F\uA741\uA743\uA745\uA747\uA749\uA74B\uA74D\uA74F\uA751\uA753\uA755\uA757\uA759\uA75B\uA75D\uA75F\uA761\uA763\uA765\uA767\uA769\uA76B\uA76D\uA76F\uA771-\uA778\uA77A\uA77C\uA77F\uA781\uA783\uA785\uA787\uA78C\uA78E\uA791\uA793-\uA795\uA797\uA799\uA79B\uA79D\uA79F\uA7A1\uA7A3\uA7A5\uA7A7\uA7A9\uA7B5\uA7B7\uA7FA\uAB30-\uAB5A\uAB60-\uAB65\uAB70-\uABBF\uFB00-\uFB06\uFB13-\uFB17\uFF41-\uFF5A',
        astral: '\uD801[\uDC28-\uDC4F\uDCD8-\uDCFB]|\uD803[\uDCC0-\uDCF2]|\uD806[\uDCC0-\uDCDF]|\uD835[\uDC1A-\uDC33\uDC4E-\uDC54\uDC56-\uDC67\uDC82-\uDC9B\uDCB6-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDCCF\uDCEA-\uDD03\uDD1E-\uDD37\uDD52-\uDD6B\uDD86-\uDD9F\uDDBA-\uDDD3\uDDEE-\uDE07\uDE22-\uDE3B\uDE56-\uDE6F\uDE8A-\uDEA5\uDEC2-\uDEDA\uDEDC-\uDEE1\uDEFC-\uDF14\uDF16-\uDF1B\uDF36-\uDF4E\uDF50-\uDF55\uDF70-\uDF88\uDF8A-\uDF8F\uDFAA-\uDFC2\uDFC4-\uDFC9\uDFCB]|\uD83A[\uDD22-\uDD43]'
    }, {
        name: 'Lm',
        alias: 'Modifier_Letter',
        bmp: '\u02B0-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0374\u037A\u0559\u0640\u06E5\u06E6\u07F4\u07F5\u07FA\u081A\u0824\u0828\u0971\u0E46\u0EC6\u10FC\u17D7\u1843\u1AA7\u1C78-\u1C7D\u1D2C-\u1D6A\u1D78\u1D9B-\u1DBF\u2071\u207F\u2090-\u209C\u2C7C\u2C7D\u2D6F\u2E2F\u3005\u3031-\u3035\u303B\u309D\u309E\u30FC-\u30FE\uA015\uA4F8-\uA4FD\uA60C\uA67F\uA69C\uA69D\uA717-\uA71F\uA770\uA788\uA7F8\uA7F9\uA9CF\uA9E6\uAA70\uAADD\uAAF3\uAAF4\uAB5C-\uAB5F\uFF70\uFF9E\uFF9F',
        astral: '\uD81A[\uDF40-\uDF43]|\uD81B[\uDF93-\uDF9F\uDFE0]'
    }, {
        name: 'Lo',
        alias: 'Other_Letter',
        bmp: '\xAA\xBA\u01BB\u01C0-\u01C3\u0294\u05D0-\u05EA\u05F0-\u05F2\u0620-\u063F\u0641-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u0800-\u0815\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0972-\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\u0AF9\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-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E45\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10D0-\u10FA\u10FD-\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\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17DC\u1820-\u1842\u1844-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C77\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u2135-\u2138\u2D30-\u2D67\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3006\u303C\u3041-\u3096\u309F\u30A1-\u30FA\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA014\uA016-\uA48C\uA4D0-\uA4F7\uA500-\uA60B\uA610-\uA61F\uA62A\uA62B\uA66E\uA6A0-\uA6E5\uA78F\uA7F7\uA7FB-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9E0-\uA9E4\uA9E7-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA6F\uAA71-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB\uAADC\uAAE0-\uAAEA\uAAF2\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\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\uFF66-\uFF6F\uFF71-\uFF9D\uFFA0-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC',
        astral: '\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC50-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]'
    }, {
        name: 'Lt',
        alias: 'Titlecase_Letter',
        bmp: '\u01C5\u01C8\u01CB\u01F2\u1F88-\u1F8F\u1F98-\u1F9F\u1FA8-\u1FAF\u1FBC\u1FCC\u1FFC'
    }, {
        name: 'Lu',
        alias: 'Uppercase_Letter',
        bmp: 'A-Z\xC0-\xD6\xD8-\xDE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u0179\u017B\u017D\u0181\u0182\u0184\u0186\u0187\u0189-\u018B\u018E-\u0191\u0193\u0194\u0196-\u0198\u019C\u019D\u019F\u01A0\u01A2\u01A4\u01A6\u01A7\u01A9\u01AC\u01AE\u01AF\u01B1-\u01B3\u01B5\u01B7\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A\u023B\u023D\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u037F\u0386\u0388-\u038A\u038C\u038E\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0528\u052A\u052C\u052E\u0531-\u0556\u10A0-\u10C5\u10C7\u10CD\u13A0-\u13F5\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1FB8-\u1FBB\u1FC8-\u1FCB\u1FD8-\u1FDB\u1FE8-\u1FEC\u1FF8-\u1FFB\u2102\u2107\u210B-\u210D\u2110-\u2112\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u2130-\u2133\u213E\u213F\u2145\u2183\u2C00-\u2C2E\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA698\uA69A\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA796\uA798\uA79A\uA79C\uA79E\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA-\uA7AE\uA7B0-\uA7B4\uA7B6\uFF21-\uFF3A',
        astral: '\uD801[\uDC00-\uDC27\uDCB0-\uDCD3]|\uD803[\uDC80-\uDCB2]|\uD806[\uDCA0-\uDCBF]|\uD835[\uDC00-\uDC19\uDC34-\uDC4D\uDC68-\uDC81\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB5\uDCD0-\uDCE9\uDD04\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD38\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD6C-\uDD85\uDDA0-\uDDB9\uDDD4-\uDDED\uDE08-\uDE21\uDE3C-\uDE55\uDE70-\uDE89\uDEA8-\uDEC0\uDEE2-\uDEFA\uDF1C-\uDF34\uDF56-\uDF6E\uDF90-\uDFA8\uDFCA]|\uD83A[\uDD00-\uDD21]'
    }, {
        name: 'M',
        alias: 'Mark',
        bmp: '\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D4-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F',
        astral: '\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC7F-\uDC82\uDCB0-\uDCBA\uDD00-\uDD02\uDD27-\uDD34\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDCA-\uDDCC\uDE2C-\uDE37\uDE3E\uDEDF-\uDEEA\uDF00-\uDF03\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC35-\uDC46\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDEAB-\uDEB7\uDF1D-\uDF2B]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC92-\uDCA7\uDCA9-\uDCB6]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF51-\uDF7E\uDF8F-\uDF92]|\uD82F[\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uDB40[\uDD00-\uDDEF]'
    }, {
        name: 'Mc',
        alias: 'Spacing_Mark',
        bmp: '\u0903\u093B\u093E-\u0940\u0949-\u094C\u094E\u094F\u0982\u0983\u09BE-\u09C0\u09C7\u09C8\u09CB\u09CC\u09D7\u0A03\u0A3E-\u0A40\u0A83\u0ABE-\u0AC0\u0AC9\u0ACB\u0ACC\u0B02\u0B03\u0B3E\u0B40\u0B47\u0B48\u0B4B\u0B4C\u0B57\u0BBE\u0BBF\u0BC1\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCC\u0BD7\u0C01-\u0C03\u0C41-\u0C44\u0C82\u0C83\u0CBE\u0CC0-\u0CC4\u0CC7\u0CC8\u0CCA\u0CCB\u0CD5\u0CD6\u0D02\u0D03\u0D3E-\u0D40\u0D46-\u0D48\u0D4A-\u0D4C\u0D57\u0D82\u0D83\u0DCF-\u0DD1\u0DD8-\u0DDF\u0DF2\u0DF3\u0F3E\u0F3F\u0F7F\u102B\u102C\u1031\u1038\u103B\u103C\u1056\u1057\u1062-\u1064\u1067-\u106D\u1083\u1084\u1087-\u108C\u108F\u109A-\u109C\u17B6\u17BE-\u17C5\u17C7\u17C8\u1923-\u1926\u1929-\u192B\u1930\u1931\u1933-\u1938\u1A19\u1A1A\u1A55\u1A57\u1A61\u1A63\u1A64\u1A6D-\u1A72\u1B04\u1B35\u1B3B\u1B3D-\u1B41\u1B43\u1B44\u1B82\u1BA1\u1BA6\u1BA7\u1BAA\u1BE7\u1BEA-\u1BEC\u1BEE\u1BF2\u1BF3\u1C24-\u1C2B\u1C34\u1C35\u1CE1\u1CF2\u1CF3\u302E\u302F\uA823\uA824\uA827\uA880\uA881\uA8B4-\uA8C3\uA952\uA953\uA983\uA9B4\uA9B5\uA9BA\uA9BB\uA9BD-\uA9C0\uAA2F\uAA30\uAA33\uAA34\uAA4D\uAA7B\uAA7D\uAAEB\uAAEE\uAAEF\uAAF5\uABE3\uABE4\uABE6\uABE7\uABE9\uABEA\uABEC',
        astral: '\uD804[\uDC00\uDC02\uDC82\uDCB0-\uDCB2\uDCB7\uDCB8\uDD2C\uDD82\uDDB3-\uDDB5\uDDBF\uDDC0\uDE2C-\uDE2E\uDE32\uDE33\uDE35\uDEE0-\uDEE2\uDF02\uDF03\uDF3E\uDF3F\uDF41-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63]|\uD805[\uDC35-\uDC37\uDC40\uDC41\uDC45\uDCB0-\uDCB2\uDCB9\uDCBB-\uDCBE\uDCC1\uDDAF-\uDDB1\uDDB8-\uDDBB\uDDBE\uDE30-\uDE32\uDE3B\uDE3C\uDE3E\uDEAC\uDEAE\uDEAF\uDEB6\uDF20\uDF21\uDF26]|\uD807[\uDC2F\uDC3E\uDCA9\uDCB1\uDCB4]|\uD81B[\uDF51-\uDF7E]|\uD834[\uDD65\uDD66\uDD6D-\uDD72]'
    }, {
        name: 'Me',
        alias: 'Enclosing_Mark',
        bmp: '\u0488\u0489\u1ABE\u20DD-\u20E0\u20E2-\u20E4\uA670-\uA672'
    }, {
        name: 'Mn',
        alias: 'Nonspacing_Mark',
        bmp: '\u0300-\u036F\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D4-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09C1-\u09C4\u09CD\u09E2\u09E3\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0B01\u0B3C\u0B3F\u0B41-\u0B44\u0B4D\u0B56\u0B62\u0B63\u0B82\u0BC0\u0BCD\u0C00\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CBF\u0CC6\u0CCC\u0CCD\u0CE2\u0CE3\u0D01\u0D41-\u0D44\u0D4D\u0D62\u0D63\u0DCA\u0DD2-\u0DD4\u0DD6\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ABD\u1B00-\u1B03\u1B34\u1B36-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFB-\u1DFF\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302D\u3099\u309A\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA8C4\uA8C5\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F',
        astral: '\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD804[\uDC01\uDC38-\uDC46\uDC7F-\uDC81\uDCB3-\uDCB6\uDCB9\uDCBA\uDD00-\uDD02\uDD27-\uDD2B\uDD2D-\uDD34\uDD73\uDD80\uDD81\uDDB6-\uDDBE\uDDCA-\uDDCC\uDE2F-\uDE31\uDE34\uDE36\uDE37\uDE3E\uDEDF\uDEE3-\uDEEA\uDF00\uDF01\uDF3C\uDF40\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC38-\uDC3F\uDC42-\uDC44\uDC46\uDCB3-\uDCB8\uDCBA\uDCBF\uDCC0\uDCC2\uDCC3\uDDB2-\uDDB5\uDDBC\uDDBD\uDDBF\uDDC0\uDDDC\uDDDD\uDE33-\uDE3A\uDE3D\uDE3F\uDE40\uDEAB\uDEAD\uDEB0-\uDEB5\uDEB7\uDF1D-\uDF1F\uDF22-\uDF25\uDF27-\uDF2B]|\uD807[\uDC30-\uDC36\uDC38-\uDC3D\uDC3F\uDC92-\uDCA7\uDCAA-\uDCB0\uDCB2\uDCB3\uDCB5\uDCB6]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF8F-\uDF92]|\uD82F[\uDC9D\uDC9E]|\uD834[\uDD67-\uDD69\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uDB40[\uDD00-\uDDEF]'
    }, {
        name: 'N',
        alias: 'Number',
        bmp: '0-9\xB2\xB3\xB9\xBC-\xBE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D58-\u0D5E\u0D66-\u0D78\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19',
        astral: '\uD800[\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDEE1-\uDEFB\uDF20-\uDF23\uDF41\uDF4A\uDFD1-\uDFD5]|\uD801[\uDCA0-\uDCA9]|\uD802[\uDC58-\uDC5F\uDC79-\uDC7F\uDCA7-\uDCAF\uDCFB-\uDCFF\uDD16-\uDD1B\uDDBC\uDDBD\uDDC0-\uDDCF\uDDD2-\uDDFF\uDE40-\uDE47\uDE7D\uDE7E\uDE9D-\uDE9F\uDEEB-\uDEEF\uDF58-\uDF5F\uDF78-\uDF7F\uDFA9-\uDFAF]|\uD803[\uDCFA-\uDCFF\uDE60-\uDE7E]|\uD804[\uDC52-\uDC6F\uDCF0-\uDCF9\uDD36-\uDD3F\uDDD0-\uDDD9\uDDE1-\uDDF4\uDEF0-\uDEF9]|\uD805[\uDC50-\uDC59\uDCD0-\uDCD9\uDE50-\uDE59\uDEC0-\uDEC9\uDF30-\uDF3B]|\uD806[\uDCE0-\uDCF2]|\uD807[\uDC50-\uDC6C]|\uD809[\uDC00-\uDC6E]|\uD81A[\uDE60-\uDE69\uDF50-\uDF59\uDF5B-\uDF61]|\uD834[\uDF60-\uDF71]|\uD835[\uDFCE-\uDFFF]|\uD83A[\uDCC7-\uDCCF\uDD50-\uDD59]|\uD83C[\uDD00-\uDD0C]'
    }, {
        name: 'Nd',
        alias: 'Decimal_Number',
        bmp: '0-9\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\uA620-\uA629\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19',
        astral: '\uD801[\uDCA0-\uDCA9]|\uD804[\uDC66-\uDC6F\uDCF0-\uDCF9\uDD36-\uDD3F\uDDD0-\uDDD9\uDEF0-\uDEF9]|\uD805[\uDC50-\uDC59\uDCD0-\uDCD9\uDE50-\uDE59\uDEC0-\uDEC9\uDF30-\uDF39]|\uD806[\uDCE0-\uDCE9]|\uD807[\uDC50-\uDC59]|\uD81A[\uDE60-\uDE69\uDF50-\uDF59]|\uD835[\uDFCE-\uDFFF]|\uD83A[\uDD50-\uDD59]'
    }, {
        name: 'Nl',
        alias: 'Letter_Number',
        bmp: '\u16EE-\u16F0\u2160-\u2182\u2185-\u2188\u3007\u3021-\u3029\u3038-\u303A\uA6E6-\uA6EF',
        astral: '\uD800[\uDD40-\uDD74\uDF41\uDF4A\uDFD1-\uDFD5]|\uD809[\uDC00-\uDC6E]'
    }, {
        name: 'No',
        alias: 'Other_Number',
        bmp: '\xB2\xB3\xB9\xBC-\xBE\u09F4-\u09F9\u0B72-\u0B77\u0BF0-\u0BF2\u0C78-\u0C7E\u0D58-\u0D5E\u0D70-\u0D78\u0F2A-\u0F33\u1369-\u137C\u17F0-\u17F9\u19DA\u2070\u2074-\u2079\u2080-\u2089\u2150-\u215F\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA830-\uA835',
        astral: '\uD800[\uDD07-\uDD33\uDD75-\uDD78\uDD8A\uDD8B\uDEE1-\uDEFB\uDF20-\uDF23]|\uD802[\uDC58-\uDC5F\uDC79-\uDC7F\uDCA7-\uDCAF\uDCFB-\uDCFF\uDD16-\uDD1B\uDDBC\uDDBD\uDDC0-\uDDCF\uDDD2-\uDDFF\uDE40-\uDE47\uDE7D\uDE7E\uDE9D-\uDE9F\uDEEB-\uDEEF\uDF58-\uDF5F\uDF78-\uDF7F\uDFA9-\uDFAF]|\uD803[\uDCFA-\uDCFF\uDE60-\uDE7E]|\uD804[\uDC52-\uDC65\uDDE1-\uDDF4]|\uD805[\uDF3A\uDF3B]|\uD806[\uDCEA-\uDCF2]|\uD807[\uDC5A-\uDC6C]|\uD81A[\uDF5B-\uDF61]|\uD834[\uDF60-\uDF71]|\uD83A[\uDCC7-\uDCCF]|\uD83C[\uDD00-\uDD0C]'
    }, {
        name: 'P',
        alias: 'Punctuation',
        bmp: '\x21-\x23\x25-\\x2A\x2C-\x2F\x3A\x3B\\x3F\x40\\x5B-\\x5D\x5F\\x7B\x7D\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E44\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65',
        astral: '\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD807[\uDC41-\uDC45\uDC70\uDC71]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]'
    }, {
        name: 'Pc',
        alias: 'Connector_Punctuation',
        bmp: '\x5F\u203F\u2040\u2054\uFE33\uFE34\uFE4D-\uFE4F\uFF3F'
    }, {
        name: 'Pd',
        alias: 'Dash_Punctuation',
        bmp: '\\x2D\u058A\u05BE\u1400\u1806\u2010-\u2015\u2E17\u2E1A\u2E3A\u2E3B\u2E40\u301C\u3030\u30A0\uFE31\uFE32\uFE58\uFE63\uFF0D'
    }, {
        name: 'Pe',
        alias: 'Close_Punctuation',
        bmp: '\\x29\\x5D\x7D\u0F3B\u0F3D\u169C\u2046\u207E\u208E\u2309\u230B\u232A\u2769\u276B\u276D\u276F\u2771\u2773\u2775\u27C6\u27E7\u27E9\u27EB\u27ED\u27EF\u2984\u2986\u2988\u298A\u298C\u298E\u2990\u2992\u2994\u2996\u2998\u29D9\u29DB\u29FD\u2E23\u2E25\u2E27\u2E29\u3009\u300B\u300D\u300F\u3011\u3015\u3017\u3019\u301B\u301E\u301F\uFD3E\uFE18\uFE36\uFE38\uFE3A\uFE3C\uFE3E\uFE40\uFE42\uFE44\uFE48\uFE5A\uFE5C\uFE5E\uFF09\uFF3D\uFF5D\uFF60\uFF63'
    }, {
        name: 'Pf',
        alias: 'Final_Punctuation',
        bmp: '\xBB\u2019\u201D\u203A\u2E03\u2E05\u2E0A\u2E0D\u2E1D\u2E21'
    }, {
        name: 'Pi',
        alias: 'Initial_Punctuation',
        bmp: '\xAB\u2018\u201B\u201C\u201F\u2039\u2E02\u2E04\u2E09\u2E0C\u2E1C\u2E20'
    }, {
        name: 'Po',
        alias: 'Other_Punctuation',
        bmp: '\x21-\x23\x25-\x27\\x2A\x2C\\x2E\x2F\x3A\x3B\\x3F\x40\\x5C\xA1\xA7\xB6\xB7\xBF\u037E\u0387\u055A-\u055F\u0589\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u166D\u166E\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u1805\u1807-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2016\u2017\u2020-\u2027\u2030-\u2038\u203B-\u203E\u2041-\u2043\u2047-\u2051\u2053\u2055-\u205E\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00\u2E01\u2E06-\u2E08\u2E0B\u2E0E-\u2E16\u2E18\u2E19\u2E1B\u2E1E\u2E1F\u2E2A-\u2E2E\u2E30-\u2E39\u2E3C-\u2E3F\u2E41\u2E43\u2E44\u3001-\u3003\u303D\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFE10-\uFE16\uFE19\uFE30\uFE45\uFE46\uFE49-\uFE4C\uFE50-\uFE52\uFE54-\uFE57\uFE5F-\uFE61\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF07\uFF0A\uFF0C\uFF0E\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3C\uFF61\uFF64\uFF65',
        astral: '\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD807[\uDC41-\uDC45\uDC70\uDC71]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]'
    }, {
        name: 'Ps',
        alias: 'Open_Punctuation',
        bmp: '\\x28\\x5B\\x7B\u0F3A\u0F3C\u169B\u201A\u201E\u2045\u207D\u208D\u2308\u230A\u2329\u2768\u276A\u276C\u276E\u2770\u2772\u2774\u27C5\u27E6\u27E8\u27EA\u27EC\u27EE\u2983\u2985\u2987\u2989\u298B\u298D\u298F\u2991\u2993\u2995\u2997\u29D8\u29DA\u29FC\u2E22\u2E24\u2E26\u2E28\u2E42\u3008\u300A\u300C\u300E\u3010\u3014\u3016\u3018\u301A\u301D\uFD3F\uFE17\uFE35\uFE37\uFE39\uFE3B\uFE3D\uFE3F\uFE41\uFE43\uFE47\uFE59\uFE5B\uFE5D\uFF08\uFF3B\uFF5B\uFF5F\uFF62'
    }, {
        name: 'S',
        alias: 'Symbol',
        bmp: '\\x24\\x2B\x3C-\x3E\\x5E\x60\\x7C\x7E\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20BE\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u23FE\u2400-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B98-\u2BB9\u2BBD-\u2BC8\u2BCA-\u2BD1\u2BEC-\u2BEF\u2CE5-\u2CEA\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u32FE\u3300-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uFB29\uFBB2-\uFBC1\uFDFC\uFDFD\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD',
        astral: '\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9B\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDE8\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD83B[\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD10-\uDD2E\uDD30-\uDD6B\uDD70-\uDDAC\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED2\uDEE0-\uDEEC\uDEF0-\uDEF6\uDF00-\uDF73\uDF80-\uDFD4]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDD10-\uDD1E\uDD20-\uDD27\uDD30\uDD33-\uDD3E\uDD40-\uDD4B\uDD50-\uDD5E\uDD80-\uDD91\uDDC0]'
    }, {
        name: 'Sc',
        alias: 'Currency_Symbol',
        bmp: '\\x24\xA2-\xA5\u058F\u060B\u09F2\u09F3\u09FB\u0AF1\u0BF9\u0E3F\u17DB\u20A0-\u20BE\uA838\uFDFC\uFE69\uFF04\uFFE0\uFFE1\uFFE5\uFFE6'
    }, {
        name: 'Sk',
        alias: 'Modifier_Symbol',
        bmp: '\\x5E\x60\xA8\xAF\xB4\xB8\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u309B\u309C\uA700-\uA716\uA720\uA721\uA789\uA78A\uAB5B\uFBB2-\uFBC1\uFF3E\uFF40\uFFE3',
        astral: '\uD83C[\uDFFB-\uDFFF]'
    }, {
        name: 'Sm',
        alias: 'Math_Symbol',
        bmp: '\\x2B\x3C-\x3E\\x7C\x7E\xAC\xB1\xD7\xF7\u03F6\u0606-\u0608\u2044\u2052\u207A-\u207C\u208A-\u208C\u2118\u2140-\u2144\u214B\u2190-\u2194\u219A\u219B\u21A0\u21A3\u21A6\u21AE\u21CE\u21CF\u21D2\u21D4\u21F4-\u22FF\u2320\u2321\u237C\u239B-\u23B3\u23DC-\u23E1\u25B7\u25C1\u25F8-\u25FF\u266F\u27C0-\u27C4\u27C7-\u27E5\u27F0-\u27FF\u2900-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2AFF\u2B30-\u2B44\u2B47-\u2B4C\uFB29\uFE62\uFE64-\uFE66\uFF0B\uFF1C-\uFF1E\uFF5C\uFF5E\uFFE2\uFFE9-\uFFEC',
        astral: '\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD83B[\uDEF0\uDEF1]'
    }, {
        name: 'So',
        alias: 'Other_Symbol',
        bmp: '\xA6\xA9\xAE\xB0\u0482\u058D\u058E\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u09FA\u0B70\u0BF3-\u0BF8\u0BFA\u0C7F\u0D4F\u0D79\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116\u2117\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u214A\u214C\u214D\u214F\u218A\u218B\u2195-\u2199\u219C-\u219F\u21A1\u21A2\u21A4\u21A5\u21A7-\u21AD\u21AF-\u21CD\u21D0\u21D1\u21D3\u21D5-\u21F3\u2300-\u2307\u230C-\u231F\u2322-\u2328\u232B-\u237B\u237D-\u239A\u23B4-\u23DB\u23E2-\u23FE\u2400-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u25B6\u25B8-\u25C0\u25C2-\u25F7\u2600-\u266E\u2670-\u2767\u2794-\u27BF\u2800-\u28FF\u2B00-\u2B2F\u2B45\u2B46\u2B4D-\u2B73\u2B76-\u2B95\u2B98-\u2BB9\u2BBD-\u2BC8\u2BCA-\u2BD1\u2BEC-\u2BEF\u2CE5-\u2CEA\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u32FE\u3300-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA828-\uA82B\uA836\uA837\uA839\uAA77-\uAA79\uFDFD\uFFE4\uFFE8\uFFED\uFFEE\uFFFC\uFFFD',
        astral: '\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9B\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDE8\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD10-\uDD2E\uDD30-\uDD6B\uDD70-\uDDAC\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDF00-\uDFFA]|\uD83D[\uDC00-\uDED2\uDEE0-\uDEEC\uDEF0-\uDEF6\uDF00-\uDF73\uDF80-\uDFD4]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDD10-\uDD1E\uDD20-\uDD27\uDD30\uDD33-\uDD3E\uDD40-\uDD4B\uDD50-\uDD5E\uDD80-\uDD91\uDDC0]'
    }, {
        name: 'Z',
        alias: 'Separator',
        bmp: '\x20\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000'
    }, {
        name: 'Zl',
        alias: 'Line_Separator',
        bmp: '\u2028'
    }, {
        name: 'Zp',
        alias: 'Paragraph_Separator',
        bmp: '\u2029'
    }, {
        name: 'Zs',
        alias: 'Space_Separator',
        bmp: '\x20\xA0\u1680\u2000-\u200A\u202F\u205F\u3000'
    }]);
};

module.exports = exports['default'];
},{}],"cRRZ":[function(require,module,exports) {
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

/*!
 * XRegExp Unicode Properties 4.0.0
 * <xregexp.com>
 * Steven Levithan (c) 2012-2017 MIT License
 * Unicode data by Mathias Bynens <mathiasbynens.be>
 */

exports.default = function (XRegExp) {

    /**
     * Adds properties to meet the UTS #18 Level 1 RL1.2 requirements for Unicode regex support. See
     * <http://unicode.org/reports/tr18/#RL1.2>. Following are definitions of these properties from
     * UAX #44 <http://unicode.org/reports/tr44/>:
     *
     * - Alphabetic
     *   Characters with the Alphabetic property. Generated from: Lowercase + Uppercase + Lt + Lm +
     *   Lo + Nl + Other_Alphabetic.
     *
     * - Default_Ignorable_Code_Point
     *   For programmatic determination of default ignorable code points. New characters that should
     *   be ignored in rendering (unless explicitly supported) will be assigned in these ranges,
     *   permitting programs to correctly handle the default rendering of such characters when not
     *   otherwise supported.
     *
     * - Lowercase
     *   Characters with the Lowercase property. Generated from: Ll + Other_Lowercase.
     *
     * - Noncharacter_Code_Point
     *   Code points permanently reserved for internal use.
     *
     * - Uppercase
     *   Characters with the Uppercase property. Generated from: Lu + Other_Uppercase.
     *
     * - White_Space
     *   Spaces, separator characters and other control characters which should be treated by
     *   programming languages as "white space" for the purpose of parsing elements.
     *
     * The properties ASCII, Any, and Assigned are also included but are not defined in UAX #44. UTS
     * #18 RL1.2 additionally requires support for Unicode scripts and general categories. These are
     * included in XRegExp's Unicode Categories and Unicode Scripts addons.
     *
     * Token names are case insensitive, and any spaces, hyphens, and underscores are ignored.
     *
     * Uses Unicode 9.0.0.
     *
     * @requires XRegExp, Unicode Base
     */

    if (!XRegExp.addUnicodeData) {
        throw new ReferenceError('Unicode Base must be loaded before Unicode Properties');
    }

    var unicodeData = [{
        name: 'ASCII',
        bmp: '\0-\x7F'
    }, {
        name: 'Alphabetic',
        bmp: 'A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0345\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05B0-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0657\u0659-\u065F\u066E-\u06D3\u06D5-\u06DC\u06E1-\u06E8\u06ED-\u06EF\u06FA-\u06FC\u06FF\u0710-\u073F\u074D-\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0817\u081A-\u082C\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08DF\u08E3-\u08E9\u08F0-\u093B\u093D-\u094C\u094E-\u0950\u0955-\u0963\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD-\u09C4\u09C7\u09C8\u09CB\u09CC\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09F0\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3E-\u0A42\u0A47\u0A48\u0A4B\u0A4C\u0A51\u0A59-\u0A5C\u0A5E\u0A70-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD-\u0AC5\u0AC7-\u0AC9\u0ACB\u0ACC\u0AD0\u0AE0-\u0AE3\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D-\u0B44\u0B47\u0B48\u0B4B\u0B4C\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\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-\u0BCC\u0BD0\u0BD7\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4C\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCC\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4C\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E46\u0E4D\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0ECD\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F71-\u0F81\u0F88-\u0F97\u0F99-\u0FBC\u1000-\u1036\u1038\u103B-\u103F\u1050-\u1062\u1065-\u1068\u106E-\u1086\u108E\u109C\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\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1713\u1720-\u1733\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17B3\u17B6-\u17C8\u17D7\u17DC\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u1938\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A1B\u1A20-\u1A5E\u1A61-\u1A74\u1AA7\u1B00-\u1B33\u1B35-\u1B43\u1B45-\u1B4B\u1B80-\u1BA9\u1BAC-\u1BAF\u1BBA-\u1BE5\u1BE7-\u1BF1\u1C00-\u1C35\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1D00-\u1DBF\u1DE7-\u1DF4\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\u24B6-\u24E9\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\u2DE0-\u2DFF\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-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA674-\uA67B\uA67F-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA827\uA840-\uA873\uA880-\uA8C3\uA8C5\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA92A\uA930-\uA952\uA960-\uA97C\uA980-\uA9B2\uA9B4-\uA9BF\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA60-\uAA76\uAA7A\uAA7E-\uAABE\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF5\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\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\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC',
        astral: '\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC45\uDC82-\uDCB8\uDCD0-\uDCE8\uDD00-\uDD32\uDD50-\uDD72\uDD76\uDD80-\uDDBF\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE34\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEE8\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D-\uDF44\uDF47\uDF48\uDF4B\uDF4C\uDF50\uDF57\uDF5D-\uDF63]|\uD805[\uDC00-\uDC41\uDC43-\uDC45\uDC47-\uDC4A\uDC80-\uDCC1\uDCC4\uDCC5\uDCC7\uDD80-\uDDB5\uDDB8-\uDDBE\uDDD8-\uDDDD\uDE00-\uDE3E\uDE40\uDE44\uDE80-\uDEB5\uDF00-\uDF19\uDF1D-\uDF2A]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC3E\uDC40\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF36\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF93-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9E]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD47]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD30-\uDD49\uDD50-\uDD69\uDD70-\uDD89]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]'
    }, {
        name: 'Any',
        isBmpLast: true,
        bmp: '\0-\uFFFF',
        astral: '[\uD800-\uDBFF][\uDC00-\uDFFF]'
    }, {
        name: 'Default_Ignorable_Code_Point',
        bmp: '\xAD\u034F\u061C\u115F\u1160\u17B4\u17B5\u180B-\u180E\u200B-\u200F\u202A-\u202E\u2060-\u206F\u3164\uFE00-\uFE0F\uFEFF\uFFA0\uFFF0-\uFFF8',
        astral: '\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|[\uDB40-\uDB43][\uDC00-\uDFFF]'
    }, {
        name: 'Lowercase',
        bmp: 'a-z\xAA\xB5\xBA\xDF-\xF6\xF8-\xFF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0295-\u02B8\u02C0\u02C1\u02E0-\u02E4\u0345\u0371\u0373\u0377\u037A-\u037D\u0390\u03AC-\u03CE\u03D0\u03D1\u03D5-\u03D7\u03D9\u03DB\u03DD\u03DF\u03E1\u03E3\u03E5\u03E7\u03E9\u03EB\u03ED\u03EF-\u03F3\u03F5\u03F8\u03FB\u03FC\u0430-\u045F\u0461\u0463\u0465\u0467\u0469\u046B\u046D\u046F\u0471\u0473\u0475\u0477\u0479\u047B\u047D\u047F\u0481\u048B\u048D\u048F\u0491\u0493\u0495\u0497\u0499\u049B\u049D\u049F\u04A1\u04A3\u04A5\u04A7\u04A9\u04AB\u04AD\u04AF\u04B1\u04B3\u04B5\u04B7\u04B9\u04BB\u04BD\u04BF\u04C2\u04C4\u04C6\u04C8\u04CA\u04CC\u04CE\u04CF\u04D1\u04D3\u04D5\u04D7\u04D9\u04DB\u04DD\u04DF\u04E1\u04E3\u04E5\u04E7\u04E9\u04EB\u04ED\u04EF\u04F1\u04F3\u04F5\u04F7\u04F9\u04FB\u04FD\u04FF\u0501\u0503\u0505\u0507\u0509\u050B\u050D\u050F\u0511\u0513\u0515\u0517\u0519\u051B\u051D\u051F\u0521\u0523\u0525\u0527\u0529\u052B\u052D\u052F\u0561-\u0587\u13F8-\u13FD\u1C80-\u1C88\u1D00-\u1DBF\u1E01\u1E03\u1E05\u1E07\u1E09\u1E0B\u1E0D\u1E0F\u1E11\u1E13\u1E15\u1E17\u1E19\u1E1B\u1E1D\u1E1F\u1E21\u1E23\u1E25\u1E27\u1E29\u1E2B\u1E2D\u1E2F\u1E31\u1E33\u1E35\u1E37\u1E39\u1E3B\u1E3D\u1E3F\u1E41\u1E43\u1E45\u1E47\u1E49\u1E4B\u1E4D\u1E4F\u1E51\u1E53\u1E55\u1E57\u1E59\u1E5B\u1E5D\u1E5F\u1E61\u1E63\u1E65\u1E67\u1E69\u1E6B\u1E6D\u1E6F\u1E71\u1E73\u1E75\u1E77\u1E79\u1E7B\u1E7D\u1E7F\u1E81\u1E83\u1E85\u1E87\u1E89\u1E8B\u1E8D\u1E8F\u1E91\u1E93\u1E95-\u1E9D\u1E9F\u1EA1\u1EA3\u1EA5\u1EA7\u1EA9\u1EAB\u1EAD\u1EAF\u1EB1\u1EB3\u1EB5\u1EB7\u1EB9\u1EBB\u1EBD\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7\u1EC9\u1ECB\u1ECD\u1ECF\u1ED1\u1ED3\u1ED5\u1ED7\u1ED9\u1EDB\u1EDD\u1EDF\u1EE1\u1EE3\u1EE5\u1EE7\u1EE9\u1EEB\u1EED\u1EEF\u1EF1\u1EF3\u1EF5\u1EF7\u1EF9\u1EFB\u1EFD\u1EFF-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB0-\u1FB4\u1FB6\u1FB7\u1FBE\u1FC2-\u1FC4\u1FC6\u1FC7\u1FD0-\u1FD3\u1FD6\u1FD7\u1FE0-\u1FE7\u1FF2-\u1FF4\u1FF6\u1FF7\u2071\u207F\u2090-\u209C\u210A\u210E\u210F\u2113\u212F\u2134\u2139\u213C\u213D\u2146-\u2149\u214E\u2170-\u217F\u2184\u24D0-\u24E9\u2C30-\u2C5E\u2C61\u2C65\u2C66\u2C68\u2C6A\u2C6C\u2C71\u2C73\u2C74\u2C76-\u2C7D\u2C81\u2C83\u2C85\u2C87\u2C89\u2C8B\u2C8D\u2C8F\u2C91\u2C93\u2C95\u2C97\u2C99\u2C9B\u2C9D\u2C9F\u2CA1\u2CA3\u2CA5\u2CA7\u2CA9\u2CAB\u2CAD\u2CAF\u2CB1\u2CB3\u2CB5\u2CB7\u2CB9\u2CBB\u2CBD\u2CBF\u2CC1\u2CC3\u2CC5\u2CC7\u2CC9\u2CCB\u2CCD\u2CCF\u2CD1\u2CD3\u2CD5\u2CD7\u2CD9\u2CDB\u2CDD\u2CDF\u2CE1\u2CE3\u2CE4\u2CEC\u2CEE\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA641\uA643\uA645\uA647\uA649\uA64B\uA64D\uA64F\uA651\uA653\uA655\uA657\uA659\uA65B\uA65D\uA65F\uA661\uA663\uA665\uA667\uA669\uA66B\uA66D\uA681\uA683\uA685\uA687\uA689\uA68B\uA68D\uA68F\uA691\uA693\uA695\uA697\uA699\uA69B-\uA69D\uA723\uA725\uA727\uA729\uA72B\uA72D\uA72F-\uA731\uA733\uA735\uA737\uA739\uA73B\uA73D\uA73F\uA741\uA743\uA745\uA747\uA749\uA74B\uA74D\uA74F\uA751\uA753\uA755\uA757\uA759\uA75B\uA75D\uA75F\uA761\uA763\uA765\uA767\uA769\uA76B\uA76D\uA76F-\uA778\uA77A\uA77C\uA77F\uA781\uA783\uA785\uA787\uA78C\uA78E\uA791\uA793-\uA795\uA797\uA799\uA79B\uA79D\uA79F\uA7A1\uA7A3\uA7A5\uA7A7\uA7A9\uA7B5\uA7B7\uA7F8-\uA7FA\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABBF\uFB00-\uFB06\uFB13-\uFB17\uFF41-\uFF5A',
        astral: '\uD801[\uDC28-\uDC4F\uDCD8-\uDCFB]|\uD803[\uDCC0-\uDCF2]|\uD806[\uDCC0-\uDCDF]|\uD835[\uDC1A-\uDC33\uDC4E-\uDC54\uDC56-\uDC67\uDC82-\uDC9B\uDCB6-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDCCF\uDCEA-\uDD03\uDD1E-\uDD37\uDD52-\uDD6B\uDD86-\uDD9F\uDDBA-\uDDD3\uDDEE-\uDE07\uDE22-\uDE3B\uDE56-\uDE6F\uDE8A-\uDEA5\uDEC2-\uDEDA\uDEDC-\uDEE1\uDEFC-\uDF14\uDF16-\uDF1B\uDF36-\uDF4E\uDF50-\uDF55\uDF70-\uDF88\uDF8A-\uDF8F\uDFAA-\uDFC2\uDFC4-\uDFC9\uDFCB]|\uD83A[\uDD22-\uDD43]'
    }, {
        name: 'Noncharacter_Code_Point',
        bmp: '\uFDD0-\uFDEF\uFFFE\uFFFF',
        astral: '[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDFFE\uDFFF]'
    }, {
        name: 'Uppercase',
        bmp: 'A-Z\xC0-\xD6\xD8-\xDE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u0179\u017B\u017D\u0181\u0182\u0184\u0186\u0187\u0189-\u018B\u018E-\u0191\u0193\u0194\u0196-\u0198\u019C\u019D\u019F\u01A0\u01A2\u01A4\u01A6\u01A7\u01A9\u01AC\u01AE\u01AF\u01B1-\u01B3\u01B5\u01B7\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A\u023B\u023D\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u037F\u0386\u0388-\u038A\u038C\u038E\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0528\u052A\u052C\u052E\u0531-\u0556\u10A0-\u10C5\u10C7\u10CD\u13A0-\u13F5\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1FB8-\u1FBB\u1FC8-\u1FCB\u1FD8-\u1FDB\u1FE8-\u1FEC\u1FF8-\u1FFB\u2102\u2107\u210B-\u210D\u2110-\u2112\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u2130-\u2133\u213E\u213F\u2145\u2160-\u216F\u2183\u24B6-\u24CF\u2C00-\u2C2E\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA698\uA69A\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA796\uA798\uA79A\uA79C\uA79E\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA-\uA7AE\uA7B0-\uA7B4\uA7B6\uFF21-\uFF3A',
        astral: '\uD801[\uDC00-\uDC27\uDCB0-\uDCD3]|\uD803[\uDC80-\uDCB2]|\uD806[\uDCA0-\uDCBF]|\uD835[\uDC00-\uDC19\uDC34-\uDC4D\uDC68-\uDC81\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB5\uDCD0-\uDCE9\uDD04\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD38\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD6C-\uDD85\uDDA0-\uDDB9\uDDD4-\uDDED\uDE08-\uDE21\uDE3C-\uDE55\uDE70-\uDE89\uDEA8-\uDEC0\uDEE2-\uDEFA\uDF1C-\uDF34\uDF56-\uDF6E\uDF90-\uDFA8\uDFCA]|\uD83A[\uDD00-\uDD21]|\uD83C[\uDD30-\uDD49\uDD50-\uDD69\uDD70-\uDD89]'
    }, {
        name: 'White_Space',
        bmp: '\x09-\x0D\x20\x85\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000'
    }];

    // Add non-generated data
    unicodeData.push({
        name: 'Assigned',
        // Since this is defined as the inverse of Unicode category Cn (Unassigned), the Unicode
        // Categories addon is required to use this property
        inverseOf: 'Cn'
    });

    XRegExp.addUnicodeData(unicodeData);
};

module.exports = exports['default'];
},{}],"A4yq":[function(require,module,exports) {
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

/*!
 * XRegExp Unicode Scripts 4.0.0
 * <xregexp.com>
 * Steven Levithan (c) 2010-2017 MIT License
 * Unicode data by Mathias Bynens <mathiasbynens.be>
 */

exports.default = function (XRegExp) {

    /**
     * Adds support for all Unicode scripts. E.g., `\p{Latin}`. Token names are case insensitive,
     * and any spaces, hyphens, and underscores are ignored.
     *
     * Uses Unicode 9.0.0.
     *
     * @requires XRegExp, Unicode Base
     */

    if (!XRegExp.addUnicodeData) {
        throw new ReferenceError('Unicode Base must be loaded before Unicode Scripts');
    }

    XRegExp.addUnicodeData([{
        name: 'Adlam',
        astral: '\uD83A[\uDD00-\uDD4A\uDD50-\uDD59\uDD5E\uDD5F]'
    }, {
        name: 'Ahom',
        astral: '\uD805[\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF3F]'
    }, {
        name: 'Anatolian_Hieroglyphs',
        astral: '\uD811[\uDC00-\uDE46]'
    }, {
        name: 'Arabic',
        bmp: '\u0600-\u0604\u0606-\u060B\u060D-\u061A\u061E\u0620-\u063F\u0641-\u064A\u0656-\u066F\u0671-\u06DC\u06DE-\u06FF\u0750-\u077F\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u08FF\uFB50-\uFBC1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFD\uFE70-\uFE74\uFE76-\uFEFC',
        astral: '\uD803[\uDE60-\uDE7E]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB\uDEF0\uDEF1]'
    }, {
        name: 'Armenian',
        bmp: '\u0531-\u0556\u0559-\u055F\u0561-\u0587\u058A\u058D-\u058F\uFB13-\uFB17'
    }, {
        name: 'Avestan',
        astral: '\uD802[\uDF00-\uDF35\uDF39-\uDF3F]'
    }, {
        name: 'Balinese',
        bmp: '\u1B00-\u1B4B\u1B50-\u1B7C'
    }, {
        name: 'Bamum',
        bmp: '\uA6A0-\uA6F7',
        astral: '\uD81A[\uDC00-\uDE38]'
    }, {
        name: 'Bassa_Vah',
        astral: '\uD81A[\uDED0-\uDEED\uDEF0-\uDEF5]'
    }, {
        name: 'Batak',
        bmp: '\u1BC0-\u1BF3\u1BFC-\u1BFF'
    }, {
        name: 'Bengali',
        bmp: '\u0980-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09FB'
    }, {
        name: 'Bhaiksuki',
        astral: '\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC45\uDC50-\uDC6C]'
    }, {
        name: 'Bopomofo',
        bmp: '\u02EA\u02EB\u3105-\u312D\u31A0-\u31BA'
    }, {
        name: 'Brahmi',
        astral: '\uD804[\uDC00-\uDC4D\uDC52-\uDC6F\uDC7F]'
    }, {
        name: 'Braille',
        bmp: '\u2800-\u28FF'
    }, {
        name: 'Buginese',
        bmp: '\u1A00-\u1A1B\u1A1E\u1A1F'
    }, {
        name: 'Buhid',
        bmp: '\u1740-\u1753'
    }, {
        name: 'Canadian_Aboriginal',
        bmp: '\u1400-\u167F\u18B0-\u18F5'
    }, {
        name: 'Carian',
        astral: '\uD800[\uDEA0-\uDED0]'
    }, {
        name: 'Caucasian_Albanian',
        astral: '\uD801[\uDD30-\uDD63\uDD6F]'
    }, {
        name: 'Chakma',
        astral: '\uD804[\uDD00-\uDD34\uDD36-\uDD43]'
    }, {
        name: 'Cham',
        bmp: '\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA5C-\uAA5F'
    }, {
        name: 'Cherokee',
        bmp: '\u13A0-\u13F5\u13F8-\u13FD\uAB70-\uABBF'
    }, {
        name: 'Common',
        bmp: '\0-\x40\\x5B-\x60\\x7B-\xA9\xAB-\xB9\xBB-\xBF\xD7\xF7\u02B9-\u02DF\u02E5-\u02E9\u02EC-\u02FF\u0374\u037E\u0385\u0387\u0589\u0605\u060C\u061B\u061C\u061F\u0640\u06DD\u08E2\u0964\u0965\u0E3F\u0FD5-\u0FD8\u10FB\u16EB-\u16ED\u1735\u1736\u1802\u1803\u1805\u1CD3\u1CE1\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u2000-\u200B\u200E-\u2064\u2066-\u2070\u2074-\u207E\u2080-\u208E\u20A0-\u20BE\u2100-\u2125\u2127-\u2129\u212C-\u2131\u2133-\u214D\u214F-\u215F\u2189-\u218B\u2190-\u23FE\u2400-\u2426\u2440-\u244A\u2460-\u27FF\u2900-\u2B73\u2B76-\u2B95\u2B98-\u2BB9\u2BBD-\u2BC8\u2BCA-\u2BD1\u2BEC-\u2BEF\u2E00-\u2E44\u2FF0-\u2FFB\u3000-\u3004\u3006\u3008-\u3020\u3030-\u3037\u303C-\u303F\u309B\u309C\u30A0\u30FB\u30FC\u3190-\u319F\u31C0-\u31E3\u3220-\u325F\u327F-\u32CF\u3358-\u33FF\u4DC0-\u4DFF\uA700-\uA721\uA788-\uA78A\uA830-\uA839\uA92E\uA9CF\uAB5B\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFEFF\uFF01-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFF70\uFF9E\uFF9F\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFF9-\uFFFD',
        astral: '\uD800[\uDD00-\uDD02\uDD07-\uDD33\uDD37-\uDD3F\uDD90-\uDD9B\uDDD0-\uDDFC\uDEE1-\uDEFB]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD66\uDD6A-\uDD7A\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDE8\uDF00-\uDF56\uDF60-\uDF71]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDFCB\uDFCE-\uDFFF]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD00-\uDD0C\uDD10-\uDD2E\uDD30-\uDD6B\uDD70-\uDDAC\uDDE6-\uDDFF\uDE01\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED2\uDEE0-\uDEEC\uDEF0-\uDEF6\uDF00-\uDF73\uDF80-\uDFD4]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDD10-\uDD1E\uDD20-\uDD27\uDD30\uDD33-\uDD3E\uDD40-\uDD4B\uDD50-\uDD5E\uDD80-\uDD91\uDDC0]|\uDB40[\uDC01\uDC20-\uDC7F]'
    }, {
        name: 'Coptic',
        bmp: '\u03E2-\u03EF\u2C80-\u2CF3\u2CF9-\u2CFF'
    }, {
        name: 'Cuneiform',
        astral: '\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC70-\uDC74\uDC80-\uDD43]'
    }, {
        name: 'Cypriot',
        astral: '\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F]'
    }, {
        name: 'Cyrillic',
        bmp: '\u0400-\u0484\u0487-\u052F\u1C80-\u1C88\u1D2B\u1D78\u2DE0-\u2DFF\uA640-\uA69F\uFE2E\uFE2F'
    }, {
        name: 'Deseret',
        astral: '\uD801[\uDC00-\uDC4F]'
    }, {
        name: 'Devanagari',
        bmp: '\u0900-\u0950\u0953-\u0963\u0966-\u097F\uA8E0-\uA8FD'
    }, {
        name: 'Duployan',
        astral: '\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9C-\uDC9F]'
    }, {
        name: 'Egyptian_Hieroglyphs',
        astral: '\uD80C[\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]'
    }, {
        name: 'Elbasan',
        astral: '\uD801[\uDD00-\uDD27]'
    }, {
        name: 'Ethiopic',
        bmp: '\u1200-\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-\u137C\u1380-\u1399\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E'
    }, {
        name: 'Georgian',
        bmp: '\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u10FF\u2D00-\u2D25\u2D27\u2D2D'
    }, {
        name: 'Glagolitic',
        bmp: '\u2C00-\u2C2E\u2C30-\u2C5E',
        astral: '\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]'
    }, {
        name: 'Gothic',
        astral: '\uD800[\uDF30-\uDF4A]'
    }, {
        name: 'Grantha',
        astral: '\uD804[\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]'
    }, {
        name: 'Greek',
        bmp: '\u0370-\u0373\u0375-\u0377\u037A-\u037D\u037F\u0384\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03E1\u03F0-\u03FF\u1D26-\u1D2A\u1D5D-\u1D61\u1D66-\u1D6A\u1DBF\u1F00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FC4\u1FC6-\u1FD3\u1FD6-\u1FDB\u1FDD-\u1FEF\u1FF2-\u1FF4\u1FF6-\u1FFE\u2126\uAB65',
        astral: '\uD800[\uDD40-\uDD8E\uDDA0]|\uD834[\uDE00-\uDE45]'
    }, {
        name: 'Gujarati',
        bmp: '\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AF1\u0AF9'
    }, {
        name: 'Gurmukhi',
        bmp: '\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'
    }, {
        name: 'Han',
        bmp: '\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u3005\u3007\u3021-\u3029\u3038-\u303B\u3400-\u4DB5\u4E00-\u9FD5\uF900-\uFA6D\uFA70-\uFAD9',
        astral: '[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]'
    }, {
        name: 'Hangul',
        bmp: '\u1100-\u11FF\u302E\u302F\u3131-\u318E\u3200-\u321E\u3260-\u327E\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uFFA0-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC'
    }, {
        name: 'Hanunoo',
        bmp: '\u1720-\u1734'
    }, {
        name: 'Hatran',
        astral: '\uD802[\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDCFF]'
    }, {
        name: 'Hebrew',
        bmp: '\u0591-\u05C7\u05D0-\u05EA\u05F0-\u05F4\uFB1D-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFB4F'
    }, {
        name: 'Hiragana',
        bmp: '\u3041-\u3096\u309D-\u309F',
        astral: '\uD82C\uDC01|\uD83C\uDE00'
    }, {
        name: 'Imperial_Aramaic',
        astral: '\uD802[\uDC40-\uDC55\uDC57-\uDC5F]'
    }, {
        name: 'Inherited',
        bmp: '\u0300-\u036F\u0485\u0486\u064B-\u0655\u0670\u0951\u0952\u1AB0-\u1ABE\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFB-\u1DFF\u200C\u200D\u20D0-\u20F0\u302A-\u302D\u3099\u309A\uFE00-\uFE0F\uFE20-\uFE2D',
        astral: '\uD800[\uDDFD\uDEE0]|\uD834[\uDD67-\uDD69\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD]|\uDB40[\uDD00-\uDDEF]'
    }, {
        name: 'Inscriptional_Pahlavi',
        astral: '\uD802[\uDF60-\uDF72\uDF78-\uDF7F]'
    }, {
        name: 'Inscriptional_Parthian',
        astral: '\uD802[\uDF40-\uDF55\uDF58-\uDF5F]'
    }, {
        name: 'Javanese',
        bmp: '\uA980-\uA9CD\uA9D0-\uA9D9\uA9DE\uA9DF'
    }, {
        name: 'Kaithi',
        astral: '\uD804[\uDC80-\uDCC1]'
    }, {
        name: 'Kannada',
        bmp: '\u0C80-\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'
    }, {
        name: 'Katakana',
        bmp: '\u30A1-\u30FA\u30FD-\u30FF\u31F0-\u31FF\u32D0-\u32FE\u3300-\u3357\uFF66-\uFF6F\uFF71-\uFF9D',
        astral: '\uD82C\uDC00'
    }, {
        name: 'Kayah_Li',
        bmp: '\uA900-\uA92D\uA92F'
    }, {
        name: 'Kharoshthi',
        astral: '\uD802[\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F-\uDE47\uDE50-\uDE58]'
    }, {
        name: 'Khmer',
        bmp: '\u1780-\u17DD\u17E0-\u17E9\u17F0-\u17F9\u19E0-\u19FF'
    }, {
        name: 'Khojki',
        astral: '\uD804[\uDE00-\uDE11\uDE13-\uDE3E]'
    }, {
        name: 'Khudawadi',
        astral: '\uD804[\uDEB0-\uDEEA\uDEF0-\uDEF9]'
    }, {
        name: 'Lao',
        bmp: '\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'
    }, {
        name: 'Latin',
        bmp: 'A-Za-z\xAA\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u02E0-\u02E4\u1D00-\u1D25\u1D2C-\u1D5C\u1D62-\u1D65\u1D6B-\u1D77\u1D79-\u1DBE\u1E00-\u1EFF\u2071\u207F\u2090-\u209C\u212A\u212B\u2132\u214E\u2160-\u2188\u2C60-\u2C7F\uA722-\uA787\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA7FF\uAB30-\uAB5A\uAB5C-\uAB64\uFB00-\uFB06\uFF21-\uFF3A\uFF41-\uFF5A'
    }, {
        name: 'Lepcha',
        bmp: '\u1C00-\u1C37\u1C3B-\u1C49\u1C4D-\u1C4F'
    }, {
        name: 'Limbu',
        bmp: '\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1940\u1944-\u194F'
    }, {
        name: 'Linear_A',
        astral: '\uD801[\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]'
    }, {
        name: 'Linear_B',
        astral: '\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA]'
    }, {
        name: 'Lisu',
        bmp: '\uA4D0-\uA4FF'
    }, {
        name: 'Lycian',
        astral: '\uD800[\uDE80-\uDE9C]'
    }, {
        name: 'Lydian',
        astral: '\uD802[\uDD20-\uDD39\uDD3F]'
    }, {
        name: 'Mahajani',
        astral: '\uD804[\uDD50-\uDD76]'
    }, {
        name: 'Malayalam',
        bmp: '\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4F\u0D54-\u0D63\u0D66-\u0D7F'
    }, {
        name: 'Mandaic',
        bmp: '\u0840-\u085B\u085E'
    }, {
        name: 'Manichaean',
        astral: '\uD802[\uDEC0-\uDEE6\uDEEB-\uDEF6]'
    }, {
        name: 'Marchen',
        astral: '\uD807[\uDC70-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6]'
    }, {
        name: 'Meetei_Mayek',
        bmp: '\uAAE0-\uAAF6\uABC0-\uABED\uABF0-\uABF9'
    }, {
        name: 'Mende_Kikakui',
        astral: '\uD83A[\uDC00-\uDCC4\uDCC7-\uDCD6]'
    }, {
        name: 'Meroitic_Cursive',
        astral: '\uD802[\uDDA0-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDDFF]'
    }, {
        name: 'Meroitic_Hieroglyphs',
        astral: '\uD802[\uDD80-\uDD9F]'
    }, {
        name: 'Miao',
        astral: '\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]'
    }, {
        name: 'Modi',
        astral: '\uD805[\uDE00-\uDE44\uDE50-\uDE59]'
    }, {
        name: 'Mongolian',
        bmp: '\u1800\u1801\u1804\u1806-\u180E\u1810-\u1819\u1820-\u1877\u1880-\u18AA',
        astral: '\uD805[\uDE60-\uDE6C]'
    }, {
        name: 'Mro',
        astral: '\uD81A[\uDE40-\uDE5E\uDE60-\uDE69\uDE6E\uDE6F]'
    }, {
        name: 'Multani',
        astral: '\uD804[\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA9]'
    }, {
        name: 'Myanmar',
        bmp: '\u1000-\u109F\uA9E0-\uA9FE\uAA60-\uAA7F'
    }, {
        name: 'Nabataean',
        astral: '\uD802[\uDC80-\uDC9E\uDCA7-\uDCAF]'
    }, {
        name: 'New_Tai_Lue',
        bmp: '\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u19DE\u19DF'
    }, {
        name: 'Newa',
        astral: '\uD805[\uDC00-\uDC59\uDC5B\uDC5D]'
    }, {
        name: 'Nko',
        bmp: '\u07C0-\u07FA'
    }, {
        name: 'Ogham',
        bmp: '\u1680-\u169C'
    }, {
        name: 'Ol_Chiki',
        bmp: '\u1C50-\u1C7F'
    }, {
        name: 'Old_Hungarian',
        astral: '\uD803[\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDCFF]'
    }, {
        name: 'Old_Italic',
        astral: '\uD800[\uDF00-\uDF23]'
    }, {
        name: 'Old_North_Arabian',
        astral: '\uD802[\uDE80-\uDE9F]'
    }, {
        name: 'Old_Permic',
        astral: '\uD800[\uDF50-\uDF7A]'
    }, {
        name: 'Old_Persian',
        astral: '\uD800[\uDFA0-\uDFC3\uDFC8-\uDFD5]'
    }, {
        name: 'Old_South_Arabian',
        astral: '\uD802[\uDE60-\uDE7F]'
    }, {
        name: 'Old_Turkic',
        astral: '\uD803[\uDC00-\uDC48]'
    }, {
        name: 'Oriya',
        bmp: '\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-\u0B77'
    }, {
        name: 'Osage',
        astral: '\uD801[\uDCB0-\uDCD3\uDCD8-\uDCFB]'
    }, {
        name: 'Osmanya',
        astral: '\uD801[\uDC80-\uDC9D\uDCA0-\uDCA9]'
    }, {
        name: 'Pahawh_Hmong',
        astral: '\uD81A[\uDF00-\uDF45\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]'
    }, {
        name: 'Palmyrene',
        astral: '\uD802[\uDC60-\uDC7F]'
    }, {
        name: 'Pau_Cin_Hau',
        astral: '\uD806[\uDEC0-\uDEF8]'
    }, {
        name: 'Phags_Pa',
        bmp: '\uA840-\uA877'
    }, {
        name: 'Phoenician',
        astral: '\uD802[\uDD00-\uDD1B\uDD1F]'
    }, {
        name: 'Psalter_Pahlavi',
        astral: '\uD802[\uDF80-\uDF91\uDF99-\uDF9C\uDFA9-\uDFAF]'
    }, {
        name: 'Rejang',
        bmp: '\uA930-\uA953\uA95F'
    }, {
        name: 'Runic',
        bmp: '\u16A0-\u16EA\u16EE-\u16F8'
    }, {
        name: 'Samaritan',
        bmp: '\u0800-\u082D\u0830-\u083E'
    }, {
        name: 'Saurashtra',
        bmp: '\uA880-\uA8C5\uA8CE-\uA8D9'
    }, {
        name: 'Sharada',
        astral: '\uD804[\uDD80-\uDDCD\uDDD0-\uDDDF]'
    }, {
        name: 'Shavian',
        astral: '\uD801[\uDC50-\uDC7F]'
    }, {
        name: 'Siddham',
        astral: '\uD805[\uDD80-\uDDB5\uDDB8-\uDDDD]'
    }, {
        name: 'SignWriting',
        astral: '\uD836[\uDC00-\uDE8B\uDE9B-\uDE9F\uDEA1-\uDEAF]'
    }, {
        name: 'Sinhala',
        bmp: '\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2-\u0DF4',
        astral: '\uD804[\uDDE1-\uDDF4]'
    }, {
        name: 'Sora_Sompeng',
        astral: '\uD804[\uDCD0-\uDCE8\uDCF0-\uDCF9]'
    }, {
        name: 'Sundanese',
        bmp: '\u1B80-\u1BBF\u1CC0-\u1CC7'
    }, {
        name: 'Syloti_Nagri',
        bmp: '\uA800-\uA82B'
    }, {
        name: 'Syriac',
        bmp: '\u0700-\u070D\u070F-\u074A\u074D-\u074F'
    }, {
        name: 'Tagalog',
        bmp: '\u1700-\u170C\u170E-\u1714'
    }, {
        name: 'Tagbanwa',
        bmp: '\u1760-\u176C\u176E-\u1770\u1772\u1773'
    }, {
        name: 'Tai_Le',
        bmp: '\u1950-\u196D\u1970-\u1974'
    }, {
        name: 'Tai_Tham',
        bmp: '\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA0-\u1AAD'
    }, {
        name: 'Tai_Viet',
        bmp: '\uAA80-\uAAC2\uAADB-\uAADF'
    }, {
        name: 'Takri',
        astral: '\uD805[\uDE80-\uDEB7\uDEC0-\uDEC9]'
    }, {
        name: 'Tamil',
        bmp: '\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-\u0BFA'
    }, {
        name: 'Tangut',
        astral: '\uD81B\uDFE0|[\uD81C-\uD820][\uDC00-\uDFFF]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]'
    }, {
        name: 'Telugu',
        bmp: '\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C78-\u0C7F'
    }, {
        name: 'Thaana',
        bmp: '\u0780-\u07B1'
    }, {
        name: 'Thai',
        bmp: '\u0E01-\u0E3A\u0E40-\u0E5B'
    }, {
        name: 'Tibetan',
        bmp: '\u0F00-\u0F47\u0F49-\u0F6C\u0F71-\u0F97\u0F99-\u0FBC\u0FBE-\u0FCC\u0FCE-\u0FD4\u0FD9\u0FDA'
    }, {
        name: 'Tifinagh',
        bmp: '\u2D30-\u2D67\u2D6F\u2D70\u2D7F'
    }, {
        name: 'Tirhuta',
        astral: '\uD805[\uDC80-\uDCC7\uDCD0-\uDCD9]'
    }, {
        name: 'Ugaritic',
        astral: '\uD800[\uDF80-\uDF9D\uDF9F]'
    }, {
        name: 'Vai',
        bmp: '\uA500-\uA62B'
    }, {
        name: 'Warang_Citi',
        astral: '\uD806[\uDCA0-\uDCF2\uDCFF]'
    }, {
        name: 'Yi',
        bmp: '\uA000-\uA48C\uA490-\uA4C6'
    }]);
};

module.exports = exports['default'];
},{}],"zNho":[function(require,module,exports) {
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _xregexp = require('./xregexp');

var _xregexp2 = _interopRequireDefault(_xregexp);

var _build = require('./addons/build');

var _build2 = _interopRequireDefault(_build);

var _matchrecursive = require('./addons/matchrecursive');

var _matchrecursive2 = _interopRequireDefault(_matchrecursive);

var _unicodeBase = require('./addons/unicode-base');

var _unicodeBase2 = _interopRequireDefault(_unicodeBase);

var _unicodeBlocks = require('./addons/unicode-blocks');

var _unicodeBlocks2 = _interopRequireDefault(_unicodeBlocks);

var _unicodeCategories = require('./addons/unicode-categories');

var _unicodeCategories2 = _interopRequireDefault(_unicodeCategories);

var _unicodeProperties = require('./addons/unicode-properties');

var _unicodeProperties2 = _interopRequireDefault(_unicodeProperties);

var _unicodeScripts = require('./addons/unicode-scripts');

var _unicodeScripts2 = _interopRequireDefault(_unicodeScripts);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

(0, _build2.default)(_xregexp2.default);
(0, _matchrecursive2.default)(_xregexp2.default);
(0, _unicodeBase2.default)(_xregexp2.default);
(0, _unicodeBlocks2.default)(_xregexp2.default);
(0, _unicodeCategories2.default)(_xregexp2.default);
(0, _unicodeProperties2.default)(_xregexp2.default);
(0, _unicodeScripts2.default)(_xregexp2.default);

exports.default = _xregexp2.default;
module.exports = exports['default'];
},{"./xregexp":"u2A8","./addons/build":"R9Tm","./addons/matchrecursive":"YS0V","./addons/unicode-base":"d64b","./addons/unicode-blocks":"n813","./addons/unicode-categories":"IOa4","./addons/unicode-properties":"cRRZ","./addons/unicode-scripts":"A4yq"}],"tTYm":[function(require,module,exports) {
'use strict';

const xRegExp = require('xregexp');

module.exports = (text, separator) => {
  if (typeof text !== 'string') {
    throw new TypeError('Expected a string');
  }

  separator = typeof separator === 'undefined' ? '_' : separator;
  const regex1 = xRegExp('([\\p{Ll}\\d])(\\p{Lu})', 'g');
  const regex2 = xRegExp('(\\p{Lu}+)(\\p{Lu}[\\p{Ll}\\d]+)', 'g');
  return text // TODO: Use this instead of `xregexp` when targeting Node.js 10:
  // .replace(/([\p{Lowercase_Letter}\d])(\p{Uppercase_Letter})/gu, `$1${separator}$2`)
  // .replace(/(\p{Lowercase_Letter}+)(\p{Uppercase_Letter}[\p{Lowercase_Letter}\d]+)/gu, `$1${separator}$2`)
  .replace(regex1, "$1".concat(separator, "$2")).replace(regex2, "$1".concat(separator, "$2")).toLowerCase();
};
},{"xregexp":"zNho"}],"fpJu":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.createElement = createElement;
exports.mount = mount;

var _decamelize = _interopRequireWildcard(require("decamelize"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

//handle es6 / bundling
const decamelize = _decamelize['default'] || _decamelize;

function createElement(tag, attrs, ...children) {
  if (typeof tag === 'function') {
    const fn = tag;
    const props = attrs;
    props.children = children;
    return fn(props);
  } else {
    const el = document.createElement(tag);
    const map = attrs;

    for (let name in map) {
      if (name && map.hasOwnProperty(name)) {
        let value = map[name];

        if (name === 'className' && value !== void 0) {
          el.setAttribute('class', value.toString());
        } else if (value === false || value === null || value === undefined) {
          continue;
        } else if (value === true) {
          el.setAttribute(name, name);
        } else if (typeof value === 'function') {
          el[name.toLowerCase()] = value;
        } else if (typeof value === 'object') {
          el.setAttribute(name, flatten(value));
        } else {
          el.setAttribute(name, value.toString());
        }
      }
    }

    if (children && children.length > 0) {
      appendChildren(el, children);
    }

    return el;
  }
}

function flatten(o) {
  const arr = [];

  for (let prop in o) arr.push(`${decamelize(prop, '-')}:${o[prop]}`);

  return arr.join(';');
}

function addChild(parentElement, child) {
  if (child === null || child === undefined || typeof child === "boolean") {
    return;
  } else if (Array.isArray(child)) {
    appendChildren(parentElement, child);
  } else if (isElement(child)) {
    parentElement.appendChild(child);
  } else {
    parentElement.appendChild(document.createTextNode(child.toString()));
  }
}

function appendChildren(parentElement, children) {
  children.forEach(child => addChild(parentElement, child));
}

function isElement(el) {
  //nodeType cannot be zero https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
  return !!el.nodeType;
}

function mount(element, container) {
  const activeChildPositions = getActiveChildPositions(container);
  container.innerHTML = '';

  if (element) {
    addChild(container, element);
    if (activeChildPositions) focusChildAtPosition(container, activeChildPositions);
  }
}

function focusChildAtPosition(element, childPositions) {
  while (element && childPositions.length) element = element.children.item(childPositions.shift());

  if (element) element.focus();
}

function getActiveChildPositions(containerElement) {
  var active = document.activeElement;
  var childPositions = [];

  while (active !== document.body && active !== containerElement) {
    childPositions.unshift(childPosition(active));
    active = active.parentElement;
  }

  if (active === containerElement && childPositions.length) return childPositions;
}

function childPosition(element) {
  let i = 0;

  while (element = element.previousElementSibling) i++;

  return i;
}
},{"decamelize":"tTYm"}],"wFdr":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Table = void 0;

var _tsxCreateElement = require("tsx-create-element");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const KeyCodes = {
  ENTER: 13
};

const Table = props => {
  return (0, _tsxCreateElement.createElement)("table", {
    className: props.className
  }, props.children, props.rows.map((row, i) => (0, _tsxCreateElement.createElement)("tr", {
    className: props.rowClassName || '',
    onClick: e => props.onRowClick && props.onRowClick(e, i),
    tabIndex: props.onRowClick ? 0 : -1,
    onKeyUp: e => {
      if (e.keyCode === KeyCodes.ENTER && props.onRowClick) {
        props.onRowClick(e, i);
      }
    }
  }, row.cells.map((cell, i) => (0, _tsxCreateElement.createElement)("td", {
    className: cell.className || '',
    title: cell.title || ''
  }, cell.content)))));
};

exports.Table = Table;
},{"tsx-create-element":"fpJu"}],"Fs2P":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "Table", {
  enumerable: true,
  get: function () {
    return _controls.Table;
  }
});

var _controls = require("../controls");
},{"../controls":"wFdr"}],"jLyM":[function(require,module,exports) {
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

},{}],"Ctqa":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.addEl = addEl;
exports.addDiv = addDiv;
exports.outerSize = outerSize;

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

/**
 * Create a new element as a child of another element.
 * @param tagName Tag name of the new tag to create.
 * @param parentElement Reference of the element to append to.
 * @returns new HTMLElement.
 */
function addEl(tagName, parentElement) {
  const el = document.createElement(tagName);
  parentElement.appendChild(el);
  return el;
}
/**
 * Create a new div HTMLElement as a child of another element.
 * @param parentElement Reference of the element to append to.
 * @param className Optional css class name to apply to the div.
 */


function addDiv(parentElement, className) {
  const div = addEl('div', parentElement);

  if (className) {
    div.className = className;
  }

  return div;
}
/**
 * Measure the outer height and width of an HTMLElement, including margin, padding and border.
 * @param el HTML Element to measure.
 */


function outerSize(el) {
  const cs = getComputedStyle(el);
  const height = parseFloat(cs.marginTop) + parseFloat(cs.paddingTop) + parseFloat(cs.borderTopWidth) + el.offsetHeight + parseFloat(cs.borderBottomWidth) + parseFloat(cs.paddingBottom) + parseFloat(cs.marginBottom);
  const width = parseFloat(cs.marginLeft) + parseFloat(cs.paddingLeft) + parseFloat(cs.borderLeftWidth) + el.offsetWidth + parseFloat(cs.borderRightWidth) + parseFloat(cs.paddingRight) + parseFloat(cs.marginRight);
  return {
    height,
    width
  };
}
},{}],"OZci":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var isMergeableObject = function isMergeableObject(value) {
  return isNonNullObject(value) && !isSpecial(value);
};

function isNonNullObject(value) {
  return !!value && typeof value === 'object';
}

function isSpecial(value) {
  var stringValue = Object.prototype.toString.call(value);
  return stringValue === '[object RegExp]' || stringValue === '[object Date]' || isReactElement(value);
} // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25


var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;

function isReactElement(value) {
  return value.$$typeof === REACT_ELEMENT_TYPE;
}

function emptyTarget(val) {
  return Array.isArray(val) ? [] : {};
}

function cloneUnlessOtherwiseSpecified(value, options) {
  return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
}

function defaultArrayMerge(target, source, options) {
  return target.concat(source).map(function (element) {
    return cloneUnlessOtherwiseSpecified(element, options);
  });
}

function mergeObject(target, source, options) {
  var destination = {};

  if (options.isMergeableObject(target)) {
    Object.keys(target).forEach(function (key) {
      destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
    });
  }

  Object.keys(source).forEach(function (key) {
    if (!options.isMergeableObject(source[key]) || !target[key]) {
      destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
    } else {
      destination[key] = deepmerge(target[key], source[key], options);
    }
  });
  return destination;
}

function deepmerge(target, source, options) {
  options = options || {};
  options.arrayMerge = options.arrayMerge || defaultArrayMerge;
  options.isMergeableObject = options.isMergeableObject || isMergeableObject;
  var sourceIsArray = Array.isArray(source);
  var targetIsArray = Array.isArray(target);
  var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;

  if (!sourceAndTargetTypesMatch) {
    return cloneUnlessOtherwiseSpecified(source, options);
  } else if (sourceIsArray) {
    return options.arrayMerge(target, source, options);
  } else {
    return mergeObject(target, source, options);
  }
}

deepmerge.all = function deepmergeAll(array, options) {
  if (!Array.isArray(array)) {
    throw new Error('first argument should be an array');
  }

  return array.reduce(function (prev, next) {
    return deepmerge(prev, next, options);
  }, {});
};

var deepmerge_1 = deepmerge;
var _default = deepmerge_1;
exports.default = _default;
},{}],"WXef":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.clone = clone;
exports.deepMerge = deepMerge;

var _deepmerge = _interopRequireWildcard(require("deepmerge"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const deepmerge = _deepmerge.default || _deepmerge;

function clone(objectToClone) {
  if (!objectToClone) return objectToClone;
  return deepmerge.all([objectToClone]);
}

const dontMerge = (destination, source) => source;

function deepMerge(...objectsToMerge) {
  const objects = objectsToMerge.filter(Boolean);
  return deepmerge.all(objects, {
    arrayMerge: dontMerge
  });
}
},{"deepmerge":"OZci"}],"Exky":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.extend = extend;

function _default(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;
}
},{}],"cAEx":[function(require,module,exports) {

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Color = Color;
exports.default = color;
exports.rgbConvert = rgbConvert;
exports.rgb = rgb;
exports.Rgb = Rgb;
exports.hslConvert = hslConvert;
exports.hsl = hsl;
exports.brighter = exports.darker = void 0;

var _define = _interopRequireWildcard(require("./define.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function Color() {}

var darker = 0.7;
exports.darker = darker;
var brighter = 1 / darker;
exports.brighter = brighter;
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
};
(0, _define.default)(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(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 ? new Rgb(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000
  : l === 4 ? new Rgb(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(o);
  if (!o) return new Rgb();
  o = o.rgb();
  return new Rgb(o.r, o.g, o.b, o.opacity);
}

function 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;
}

(0, _define.default)(Rgb, rgb, (0, _define.extend)(Color, {
  brighter: function (k) {
    k = k == null ? brighter : Math.pow(brighter, k);
    return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
  },
  darker: function (k) {
    k = k == null ? darker : Math.pow(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(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;
}

(0, _define.default)(Hsl, hsl, (0, _define.extend)(Color, {
  brighter: function (k) {
    k = k == null ? brighter : Math.pow(brighter, k);
    return new Hsl(this.h, this.s, this.l * k, this.opacity);
  },
  darker: function (k) {
    k = k == null ? darker : Math.pow(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;
}
},{"./define.js":"Exky"}],"oD7B":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.rad2deg = exports.deg2rad = void 0;
var deg2rad = Math.PI / 180;
exports.deg2rad = deg2rad;
var rad2deg = 180 / Math.PI;
exports.rad2deg = rad2deg;
},{}],"SPM6":[function(require,module,exports) {

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.gray = gray;
exports.default = lab;
exports.Lab = Lab;
exports.lch = lch;
exports.hcl = hcl;
exports.Hcl = Hcl;

var _define = _interopRequireWildcard(require("./define.js"));

var _color = require("./color.js");

var _math = require("./math.js");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// https://observablehq.com/@mbostock/lab-and-rgb
var K = 18,
    Xn = 0.96422,
    Yn = 1,
    Zn = 0.82521,
    t0 = 4 / 29,
    t1 = 6 / 29,
    t2 = 3 * t1 * t1,
    t3 = t1 * t1 * 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 _color.Rgb)) o = (0, _color.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;
}

(0, _define.default)(Lab, lab, (0, _define.extend)(_color.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 _color.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 / t2 + t0;
}

function lab2xyz(t) {
  return t > t1 ? t * t * t : t2 * (t - 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.rad2deg;

  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 * _math.deg2rad;
  return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);
}

(0, _define.default)(Hcl, hcl, (0, _define.extend)(_color.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();
  }
}));
},{"./define.js":"Exky","./color.js":"cAEx","./math.js":"oD7B"}],"fWAG":[function(require,module,exports) {

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = cubehelix;
exports.Cubehelix = Cubehelix;

var _define = _interopRequireWildcard(require("./define.js"));

var _color = require("./color.js");

var _math = require("./math.js");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var A = -0.14861,
    B = +1.78277,
    C = -0.29227,
    D = -0.90649,
    E = +1.97294,
    ED = E * D,
    EB = E * B,
    BC_DA = B * C - D * A;

function cubehelixConvert(o) {
  if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);
  if (!(o instanceof _color.Rgb)) o = (0, _color.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) / 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.rad2deg - 120 : NaN;
  return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);
}

function 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;
}

(0, _define.default)(Cubehelix, cubehelix, (0, _define.extend)(_color.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) * _math.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 * (A * cosh + B * sinh)), 255 * (l + a * (C * cosh + D * sinh)), 255 * (l + a * (E * cosh)), this.opacity);
  }
}));
},{"./define.js":"Exky","./color.js":"cAEx","./math.js":"oD7B"}],"xZq2":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "color", {
  enumerable: true,
  get: function () {
    return _color.default;
  }
});
Object.defineProperty(exports, "rgb", {
  enumerable: true,
  get: function () {
    return _color.rgb;
  }
});
Object.defineProperty(exports, "hsl", {
  enumerable: true,
  get: function () {
    return _color.hsl;
  }
});
Object.defineProperty(exports, "lab", {
  enumerable: true,
  get: function () {
    return _lab.default;
  }
});
Object.defineProperty(exports, "hcl", {
  enumerable: true,
  get: function () {
    return _lab.hcl;
  }
});
Object.defineProperty(exports, "lch", {
  enumerable: true,
  get: function () {
    return _lab.lch;
  }
});
Object.defineProperty(exports, "gray", {
  enumerable: true,
  get: function () {
    return _lab.gray;
  }
});
Object.defineProperty(exports, "cubehelix", {
  enumerable: true,
  get: function () {
    return _cubehelix.default;
  }
});

var _color = _interopRequireWildcard(require("./color.js"));

var _lab = _interopRequireWildcard(require("./lab.js"));

var _cubehelix = _interopRequireDefault(require("./cubehelix.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
},{"./color.js":"cAEx","./lab.js":"SPM6","./cubehelix.js":"fWAG"}],"cOXv":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.colorIsEqual = colorIsEqual;
exports.colorFromString = colorFromString;
exports.colorToString = colorToString;
exports.desaturate = desaturate;
exports.isColor = isColor;

var _d3Color = require("d3-color");

function rgbToDeckglColor(c) {
  return [c.r, c.g, c.b, c.opacity * 255];
}
/**
 * Compares 2 colors to see if they are equal.
 * @param a Color to compare
 * @param b Color to compare
 * @returns True if colors are equal.
 */


function colorIsEqual(a, b) {
  if (a.length !== b.length) return false;

  for (let i = 0; i < a.length; i++) {
    if (a[i] !== b[i]) return false;
  }

  return true;
}
/**
 * Convert a CSS color string to a Deck.gl Color array - (The rgba color of each object, in r, g, b, [a]. Each component is in the 0-255 range.).
 * @param cssColorSpecifier A CSS Color Module Level 3 specifier string.
 */


function colorFromString(cssColorSpecifier) {
  if (cssColorSpecifier) {
    const dc = (0, _d3Color.color)(cssColorSpecifier);

    if (dc) {
      const c = dc.rgb();
      return rgbToDeckglColor(c);
    }
  }
}
/**
 * Convert a Deck.gl color to a CSS rgba() string.
 * @param color A Deck.gl Color array - (The rgba color of each object, in r, g, b, [a]. Each component is in the 0-255 range.)
 */


function colorToString(color) {
  const c = [...color];

  if (c.length > 3) {
    c[3] /= 255;
  }

  return `rgba(${c.join(',')})`;
}

function desaturate(color, value) {
  const rgb = (0, _d3Color.rgb)(color[0], color[1], color[2], color[3] / 255);
  const hslColor = (0, _d3Color.hsl)(rgb);
  hslColor.s = value;
  const c = hslColor.rgb();
  return rgbToDeckglColor(c);
}

function isColor(cssColorSpecifier) {
  return !!(0, _d3Color.color)(cssColorSpecifier);
}
},{"d3-color":"xZq2"}],"QMMK":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.use = use;
exports.base = void 0;
let vega = {
  CanvasHandler: null,
  inferType: null,
  inferTypes: null,
  loader: null,
  parse: null,
  read: null,
  renderModule: null,
  Renderer: null,
  sceneVisit: null,
  scheme: null,
  View: null
};
let deck = {
  CompositeLayer: null,
  COORDINATE_SYSTEM: null,
  Deck: null,
  Layer: null,
  LinearInterpolator: null,
  OrbitView: null,
  _OrbitController: null
};
let layers = {
  IconLayer: null,
  LineLayer: null,
  PolygonLayer: null,
  TextLayer: null
};
let luma = {
  CubeGeometry: null,
  fp64: null,
  Model: null,
  Texture2D: null
};
/**
 * References to dependency libraries.
 */

const base = {
  deck,
  layers,
  luma,
  vega
};
/**
 * Specify the dependency libraries to use for rendering.
 * @param vega Vega library.
 * @param deck deck/core library.
 * @param layers deck/layers library.
 * @param luma luma.gl library.
 */

exports.base = base;

function use(vega, deck, layers, luma) {
  base.deck = deck;
  base.layers = layers;
  base.luma = luma;
  base.vega = vega;
}
},{}],"QfhO":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.makeFontAtlas = makeFontAtlas;
exports.DEFAULT_FONT_SETTINGS = exports.DEFAULT_FONT_WEIGHT = exports.DEFAULT_FONT_FAMILY = exports.DEFAULT_CHAR_SET = void 0;

var _tinySdf = _interopRequireDefault(require("@mapbox/tiny-sdf"));

var _base = require("../base");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

//from https://github.com/uber/deck.gl/blob/6.4-release/modules/layers/src/text-layer/font-atlas.js

/* global document */
const GL_TEXTURE_WRAP_S = 0x2802;
const GL_TEXTURE_WRAP_T = 0x2803;
const GL_CLAMP_TO_EDGE = 0x812f;
const MAX_CANVAS_WIDTH = 1024;
const BASELINE_SCALE = 0.9;
const HEIGHT_SCALE = 1.2;

function getDefaultCharacterSet() {
  const charSet = [];

  for (let i = 32; i < 128; i++) {
    charSet.push(String.fromCharCode(i));
  }

  return charSet;
}

const DEFAULT_CHAR_SET = getDefaultCharacterSet();
exports.DEFAULT_CHAR_SET = DEFAULT_CHAR_SET;
const DEFAULT_FONT_FAMILY = 'Monaco, monospace';
exports.DEFAULT_FONT_FAMILY = DEFAULT_FONT_FAMILY;
const DEFAULT_FONT_WEIGHT = 'normal';
exports.DEFAULT_FONT_WEIGHT = DEFAULT_FONT_WEIGHT;
const DEFAULT_FONT_SETTINGS = {
  fontSize: 64,
  buffer: 2,
  sdf: false,
  cutoff: 0.25,
  radius: 3
};
exports.DEFAULT_FONT_SETTINGS = DEFAULT_FONT_SETTINGS;

function populateAlphaChannel(alphaChannel, imageData) {
  // populate distance value from tinySDF to image alpha channel	
  for (let i = 0; i < alphaChannel.length; i++) {
    imageData.data[4 * i + 3] = alphaChannel[i];
  }
}

function setTextStyle(ctx, fontFamily, fontSize, fontWeight) {
  ctx.font = `${fontWeight} ${fontSize}px ${fontFamily}`;
  ctx.fillStyle = '#000';
  ctx.textBaseline = 'alphabetic';
  ctx.textAlign = 'left';
}

function buildMapping({
  ctx,
  fontHeight,
  buffer,
  characterSet,
  maxCanvasWidth
}) {
  const mapping = {};
  let row = 0;
  let x = 0;
  Array.from(characterSet).forEach(char => {
    // measure texts
    // TODO - use Advanced text metrics when they are adopted:
    // https://developer.mozilla.org/en-US/docs/Web/API/TextMetrics
    const {
      width
    } = ctx.measureText(char);

    if (x + width + buffer * 2 > maxCanvasWidth) {
      x = 0;
      row++;
    }

    mapping[char] = {
      x: x + buffer,
      y: row * (fontHeight + buffer * 2) + buffer,
      width,
      height: fontHeight,
      mask: true
    };
    x += width + buffer * 2;
  });
  const canvasHeight = (row + 1) * (fontHeight + buffer * 2);
  return {
    mapping,
    canvasHeight
  };
}

function makeFontAtlas(gl, fontSettings) {
  const mergedFontSettings = Object.assign({
    fontFamily: DEFAULT_FONT_FAMILY,
    fontWeight: DEFAULT_FONT_WEIGHT,
    characterSet: DEFAULT_CHAR_SET
  }, DEFAULT_FONT_SETTINGS, fontSettings);
  const {
    fontFamily,
    fontWeight,
    characterSet,
    fontSize,
    buffer,
    sdf,
    radius,
    cutoff
  } = mergedFontSettings;
  const canvas = document.createElement('canvas');
  const ctx = canvas.getContext('2d'); // build mapping

  setTextStyle(ctx, fontFamily, fontSize, fontWeight);
  const fontHeight = fontSize * HEIGHT_SCALE;
  const {
    canvasHeight,
    mapping
  } = buildMapping({
    ctx,
    fontHeight,
    buffer,
    characterSet,
    maxCanvasWidth: MAX_CANVAS_WIDTH
  });
  canvas.width = MAX_CANVAS_WIDTH;
  canvas.height = canvasHeight;
  setTextStyle(ctx, fontFamily, fontSize, fontWeight); // layout characters

  if (sdf) {
    const tinySDF = new _tinySdf.default(fontSize, buffer, radius, cutoff, fontFamily, fontWeight); // used to store distance values from tinySDF	

    const imageData = ctx.createImageData(tinySDF.size, tinySDF.size);

    for (const char of characterSet) {
      populateAlphaChannel(tinySDF.draw(char), imageData);
      ctx.putImageData(imageData, mapping[char].x - buffer, mapping[char].y - buffer);
    }
  } else {
    for (const char of characterSet) {
      ctx.fillText(char, mapping[char].x, mapping[char].y + fontSize * BASELINE_SCALE);
    }
  }

  return {
    scale: HEIGHT_SCALE,
    mapping,
    texture: new _base.base.luma.Texture2D(gl, {
      pixels: canvas,
      // padding is added only between the characters but not for borders
      // enforce CLAMP_TO_EDGE to avoid any artifacts.
      parameters: {
        [GL_TEXTURE_WRAP_S]: GL_CLAMP_TO_EDGE,
        [GL_TEXTURE_WRAP_T]: GL_CLAMP_TO_EDGE
      }
    })
  };
}
},{"@mapbox/tiny-sdf":"jEqp","../base":"QMMK"}],"vB7b":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
//adapted from https://github.com/uber/deck.gl/blob/6.4-release/modules/layers/src/text-layer/multi-icon-layer/multi-icon-layer-fragment.glsl.js
var _default = `\
#define SHADER_NAME multi-icon-layer-fragment-shader

precision highp float;

uniform sampler2D iconsTexture;
uniform float buffer;
uniform bool sdf;

varying vec4 vColor;
varying vec2 vTextureCoords;
varying float vGamma;
varying vec4 vHighlightColor;

const float MIN_ALPHA = 0.05;

void main(void) {
  vec4 texColor = texture2D(iconsTexture, vTextureCoords);
  
  float alpha = texColor.a;

  // if enable sdf (signed distance fields)	
  if (sdf) {	
    float distance = texture2D(iconsTexture, vTextureCoords).a;	
    alpha = smoothstep(buffer - vGamma, buffer + vGamma, distance);	
  }

  // Take the global opacity and the alpha from vColor into account for the alpha component
  float a = alpha * vColor.a;

  if (picking_uActive) {

    // use picking color for entire rectangle
    gl_FragColor = vec4(picking_vRGBcolor_Aselected.rgb, 1.0);
  
  } else {

    if (a < MIN_ALPHA) {
      discard;
    } else {

      gl_FragColor = vec4(vColor.rgb, a);

      // use highlight color if this fragment belongs to the selected object.
      bool selected = bool(picking_vRGBcolor_Aselected.a);
      if (selected) {
        gl_FragColor = vec4(vHighlightColor.rgb, a);
      }
    }
  }
}
`;
exports.default = _default;
},{}],"HTeb":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
//adapted from https://github.com/uber/deck.gl/blob/6.4-release/modules/layers/src/text-layer/multi-icon-layer/multi-icon-layer-vertex.glsl.js
var _default = `\
#define SHADER_NAME multi-icon-layer-vertex-shader

attribute vec2 positions;

attribute vec3 instancePositions;
attribute vec2 instancePositions64xyLow;
attribute float instanceSizes;
attribute float instanceAngles;
attribute vec4 instanceColors;
attribute vec3 instancePickingColors;
attribute vec4 instanceIconFrames;
attribute float instanceColorModes;
attribute vec2 instanceOffsets;

// the following three attributes are for the multi-icon layer
attribute vec2 instancePixelOffset;
attribute vec4 instanceHighlightColors;

uniform float sizeScale;
uniform vec2 iconsTextureDim;
uniform float gamma;
uniform float opacity;

varying float vColorMode;
varying vec4 vColor;
varying vec2 vTextureCoords;
varying float vGamma;
varying vec4 vHighlightColor;

vec2 rotate_by_angle(vec2 vertex, float angle) {
  float angle_radian = angle * PI / 180.0;
  float cos_angle = cos(angle_radian);
  float sin_angle = sin(angle_radian);
  mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle);
  return rotationMatrix * vertex;
}

void main(void) {
  vec2 iconSize = instanceIconFrames.zw;
  // scale icon height to match instanceSize
  float instanceScale = iconSize.y == 0.0 ? 0.0 : instanceSizes / iconSize.y;

  // scale and rotate vertex in "pixel" value and convert back to fraction in clipspace
  vec2 pixelOffset = positions / 2.0 * iconSize + instanceOffsets;

  pixelOffset = rotate_by_angle(pixelOffset, instanceAngles) * sizeScale * instanceScale;
  pixelOffset += instancePixelOffset;
  pixelOffset.y *= -1.0;

  gl_Position = project_position_to_clipspace(instancePositions, instancePositions64xyLow, vec3(0.0));
  gl_Position += project_pixel_to_clipspace(pixelOffset);

  vTextureCoords = mix(
    instanceIconFrames.xy,
    instanceIconFrames.xy + iconSize,
    (positions.xy + 1.0) / 2.0
  ) / iconsTextureDim;

  vTextureCoords.y = 1.0 - vTextureCoords.y;

  vColor = vec4(instanceColors.rgb, instanceColors.a * opacity) / 255.;
  vHighlightColor = vec4(instanceHighlightColors.rgb, instanceHighlightColors.a * opacity) / 255.;

  picking_setPickingColor(instancePickingColors);

  vGamma = gamma / (sizeScale * iconSize.y);
}
`;
exports.default = _default;
},{}],"h4ub":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.MultiIconLayer = void 0;

var _chromaticMultiIconLayerFragment = _interopRequireDefault(require("./chromatic-multi-icon-layer-fragment.glsl"));

var _chromaticMultiIconLayerVertex = _interopRequireDefault(require("./chromatic-multi-icon-layer-vertex.glsl"));

var _base = require("../../base");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
//adapted from https://github.com/uber/deck.gl/blob/6.4-release/modules/layers/src/text-layer/multi-icon-layer/multi-icon-layer.js
// TODO expose as layer properties
const DEFAULT_GAMMA = 0.2;
const DEFAULT_BUFFER = 192.0 / 256;
const defaultProps = {
  getShiftInQueue: {
    type: 'accessor',
    value: x => x.shift || 0
  },
  getLengthOfQueue: {
    type: 'accessor',
    value: x => x.len || 1
  },
  // 1: left, 0: middle, -1: right
  getAnchorX: {
    type: 'accessor',
    value: x => x.anchorX || 0
  },
  // 1: top, 0: center, -1: bottom
  getAnchorY: {
    type: 'accessor',
    value: x => x.anchorY || 0
  },
  getPixelOffset: {
    type: 'accessor',
    value: [0, 0]
  },
  // object with the same pickingIndex will be picked when any one of them is being picked
  getPickingIndex: {
    type: 'accessor',
    value: x => x.objectIndex
  }
}; //https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants

const UNSIGNED_BYTE = 0x1401;

function _MultiIconLayer(...props) {
  class __MultiIconLayer extends _base.base.layers.IconLayer {
    constructor(...props) {
      super(...arguments);
    }

    getShaders() {
      return Object.assign({}, super.getShaders(), {
        vs: _chromaticMultiIconLayerVertex.default,
        fs: _chromaticMultiIconLayerFragment.default
      });
    }

    initializeState() {
      super.initializeState();
      const attributeManager = this.getAttributeManager();
      attributeManager.addInstanced({
        instancePixelOffset: {
          size: 2,
          transition: true,
          accessor: 'getPixelOffset'
        },
        instanceHighlightColors: {
          size: 4,
          type: UNSIGNED_BYTE,
          transition: true,
          accessor: 'getHighlightColor',
          defaultValue: [0, 255, 0, 255]
        }
      });
    }

    updateState(updateParams) {
      super.updateState(updateParams);
      const {
        changeFlags
      } = updateParams;

      if (changeFlags.updateTriggersChanged && (changeFlags.updateTriggersChanged.getAnchorX || changeFlags.updateTriggersChanged.getAnchorY)) {
        this.getAttributeManager().invalidate('instanceOffsets');
      }
    }

    draw({
      uniforms
    }) {
      const {
        sdf
      } = this.props;
      super.draw({
        uniforms: Object.assign({}, uniforms, {
          // Refer the following doc about gamma and buffer
          // https://blog.mapbox.com/drawing-text-with-signed-distance-fields-in-mapbox-gl-b0933af6f817
          buffer: DEFAULT_BUFFER,
          gamma: DEFAULT_GAMMA,
          sdf: Boolean(sdf)
        })
      });
    }

    calculateInstanceOffsets(attribute) {
      const {
        data,
        iconMapping,
        getIcon,
        getAnchorX,
        getAnchorY,
        getLengthOfQueue,
        getShiftInQueue
      } = this.props;
      const {
        value
      } = attribute;
      let i = 0;

      for (const object of data) {
        const icon = getIcon(object);
        const rect = iconMapping[icon] || {};
        const len = getLengthOfQueue(object);
        const shiftX = getShiftInQueue(object);
        value[i++] = (getAnchorX(object) - 1) * len / 2 + rect.width / 2 + shiftX || 0;
        value[i++] = rect.height / 2 * getAnchorY(object) || 0;
      }
    }

    calculateInstancePickingColors(attribute) {
      const {
        data,
        getPickingIndex
      } = this.props;
      const {
        value
      } = attribute;
      let i = 0;
      const pickingColor = [];

      for (const point of data) {
        const index = getPickingIndex(point);
        this.encodePickingColor(index, pickingColor);
        value[i++] = pickingColor[0];
        value[i++] = pickingColor[1];
        value[i++] = pickingColor[2];
      }
    }

  }

  __MultiIconLayer.layerName = 'MultiIconLayer';
  __MultiIconLayer.defaultProps = defaultProps;
  const instance = new __MultiIconLayer(...arguments);
  return instance;
} //signature to allow this function to be used with the 'new' keyword.
//need to trick the compiler by casting to 'any'.

/**
 * CubeLayer - a Deck.gl layer to render cuboids.
 * This is instantiatable by calling `new MultiIconLayer()`.
 */


const MultiIconLayer = _MultiIconLayer;
exports.MultiIconLayer = MultiIconLayer;
},{"./chromatic-multi-icon-layer-fragment.glsl":"vB7b","./chromatic-multi-icon-layer-vertex.glsl":"HTeb","../../base":"QMMK"}],"myaz":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ChromaticTextLayer = void 0;

var _base = require("../base");

var _fontAtlas = require("./font-atlas");

var _chromaticMultiIconLayer = require("./chromatic-multi-icon-layer/chromatic-multi-icon-layer");

// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
//adapted from https://github.com/uber/deck.gl/blob/6.4-release/modules/layers/src/text-layer/text-layer.js
const TEXT_ANCHOR = {
  start: 1,
  middle: 0,
  end: -1
};
const ALIGNMENT_BASELINE = {
  top: 1,
  center: 0,
  bottom: -1
};
const DEFAULT_COLOR = [0, 0, 0, 255];
const MISSING_CHAR_WIDTH = 32;
const FONT_SETTINGS_PROPS = ['fontSize', 'buffer', 'sdf', 'radius', 'cutoff'];
const defaultProps = {
  fp64: false,
  sizeScale: 1,
  characterSet: _fontAtlas.DEFAULT_CHAR_SET,
  fontFamily: _fontAtlas.DEFAULT_FONT_FAMILY,
  fontWeight: _fontAtlas.DEFAULT_FONT_WEIGHT,
  fontSettings: {},
  getText: {
    type: 'accessor',
    value: x => x.text
  },
  getPosition: {
    type: 'accessor',
    value: x => x.position
  },
  getColor: {
    type: 'accessor',
    value: DEFAULT_COLOR
  },
  getSize: {
    type: 'accessor',
    value: 32
  },
  getAngle: {
    type: 'accessor',
    value: 0
  },
  getHighlightColor: {
    type: 'accessor',
    value: DEFAULT_COLOR
  },
  getTextAnchor: {
    type: 'accessor',
    value: 'middle'
  },
  getAlignmentBaseline: {
    type: 'accessor',
    value: 'center'
  },
  getPixelOffset: {
    type: 'accessor',
    value: [0, 0]
  }
};

function _ChromaticTextLayer(props) {
  class __ChromaticTextLayer extends _base.base.deck.CompositeLayer {
    updateState({
      props,
      oldProps,
      changeFlags
    }) {
      const fontChanged = this.fontChanged(oldProps, props);

      if (fontChanged) {
        this.updateFontAtlas();
      }

      if (changeFlags.dataChanged || fontChanged || changeFlags.updateTriggersChanged && (changeFlags.updateTriggersChanged.all || changeFlags.updateTriggersChanged.getText)) {
        this.transformStringToLetters();
      }
    }

    updateFontAtlas() {
      const {
        gl
      } = this.context;
      const {
        fontSettings,
        fontFamily,
        fontWeight,
        characterSet
      } = this.props;
      const mergedFontSettings = Object.assign({}, _fontAtlas.DEFAULT_FONT_SETTINGS, fontSettings, {
        fontFamily,
        fontWeight,
        characterSet
      });
      const {
        scale,
        mapping,
        texture
      } = (0, _fontAtlas.makeFontAtlas)(gl, mergedFontSettings);
      this.setState({
        scale,
        iconAtlas: texture,
        iconMapping: mapping
      });
    }

    fontChanged(oldProps, props) {
      if (oldProps.fontFamily !== props.fontFamily || oldProps.characterSet !== props.characterSet || oldProps.fontWeight !== props.fontWeight) {
        return true;
      }

      if (oldProps.fontSettings === props.fontSettings) {
        return false;
      }

      const oldFontSettings = oldProps.fontSettings || {};
      const fontSettings = props.fontSettings || {};
      return FONT_SETTINGS_PROPS.some(prop => oldFontSettings[prop] !== fontSettings[prop]);
    }

    getPickingInfo({
      info
    }) {
      // because `TextLayer` assign the same pickingInfoIndex for one text label,
      // here info.index refers the index of text label in props.data
      return Object.assign(info, {
        // override object with original data
        object: info.index >= 0 ? this.props.data[info.index] : null
      });
    }
    /* eslint-disable no-loop-func */


    transformStringToLetters() {
      const {
        data,
        getText
      } = this.props;
      const {
        iconMapping
      } = this.state;
      const transformedData = [];
      let objectIndex = 0;

      for (const val of data) {
        const text = getText(val);

        if (text) {
          const letters = Array.from(text);
          const offsets = [0];
          let offsetLeft = 0;
          letters.forEach((letter, i) => {
            const datum = {
              text: letter,
              index: i,
              offsets,
              len: text.length,
              // reference of original object and object index
              object: val,
              objectIndex
            };
            const frame = iconMapping[letter];

            if (frame) {
              offsetLeft += frame.width;
            } else {
              //log.warn(`Missing character: ${letter}`)();
              offsetLeft += MISSING_CHAR_WIDTH;
            }

            offsets.push(offsetLeft);
            transformedData.push(datum);
          });
        }

        objectIndex++;
      }

      this.setState({
        data: transformedData
      });
    }
    /* eslint-enable no-loop-func */


    getLetterOffset(datum) {
      return datum.offsets[datum.index];
    }

    getTextLength(datum) {
      return datum.offsets[datum.offsets.length - 1];
    }

    _getAccessor(accessor) {
      if (typeof accessor === 'function') {
        return x => accessor(x.object);
      }

      return accessor;
    }

    getAnchorXFromTextAnchor(getTextAnchor) {
      return x => {
        const textAnchor = typeof getTextAnchor === 'function' ? getTextAnchor(x.object) : getTextAnchor;

        if (!TEXT_ANCHOR.hasOwnProperty(textAnchor)) {
          throw new Error(`Invalid text anchor parameter: ${textAnchor}`);
        }

        return TEXT_ANCHOR[textAnchor];
      };
    }

    getAnchorYFromAlignmentBaseline(getAlignmentBaseline) {
      return x => {
        const alignmentBaseline = typeof getAlignmentBaseline === 'function' ? getAlignmentBaseline(x.object) : getAlignmentBaseline;

        if (!ALIGNMENT_BASELINE.hasOwnProperty(alignmentBaseline)) {
          throw new Error(`Invalid alignment baseline parameter: ${alignmentBaseline}`);
        }

        return ALIGNMENT_BASELINE[alignmentBaseline];
      };
    }

    renderLayers() {
      const {
        data,
        scale,
        iconAtlas,
        iconMapping
      } = this.state;
      const {
        getPosition,
        getColor,
        getSize,
        getAngle,
        getHighlightColor,
        getTextAnchor,
        getAlignmentBaseline,
        getPixelOffset,
        fp64,
        sdf,
        sizeScale,
        transitions,
        updateTriggers
      } = this.props;
      const SubLayerClass = this.getSubLayerClass('characters', _chromaticMultiIconLayer.MultiIconLayer);
      return new SubLayerClass({
        sdf,
        iconAtlas,
        iconMapping,
        getPosition: d => getPosition(d.object),
        getColor: this._getAccessor(getColor),
        getSize: this._getAccessor(getSize),
        getAngle: this._getAccessor(getAngle),
        getHighlightColor: this._getAccessor(getHighlightColor),
        getAnchorX: this.getAnchorXFromTextAnchor(getTextAnchor),
        getAnchorY: this.getAnchorYFromAlignmentBaseline(getAlignmentBaseline),
        getPixelOffset: this._getAccessor(getPixelOffset),
        fp64,
        sizeScale: sizeScale * scale,
        transitions: transitions && {
          getPosition: transitions.getPosition,
          getAngle: transitions.getAngle,
          getHighlightColor: transitions.getHighlightColor,
          getColor: transitions.getColor,
          getSize: transitions.getSize,
          getPixelOffset: updateTriggers.getPixelOffset
        }
      }, this.getSubLayerProps({
        id: 'characters',
        updateTriggers: {
          getPosition: updateTriggers.getPosition,
          getAngle: updateTriggers.getAngle,
          getHighlightColor: updateTriggers.getHighlightColor,
          getColor: updateTriggers.getColor,
          getSize: updateTriggers.getSize,
          getPixelOffset: updateTriggers.getPixelOffset,
          getAnchorX: updateTriggers.getTextAnchor,
          getAnchorY: updateTriggers.getAlignmentBaseline
        }
      }), {
        data,
        getIcon: d => d.text,
        getShiftInQueue: d => this.getLetterOffset(d),
        getLengthOfQueue: d => this.getTextLength(d)
      });
    }

  }

  __ChromaticTextLayer.layerName = 'TextLayer';
  __ChromaticTextLayer.defaultProps = defaultProps;
  const instance = new __ChromaticTextLayer(props);
  return instance;
} //signature to allow this function to be used with the 'new' keyword.
//need to trick the compiler by casting to 'any'.

/**
 * TextLayer - a modification of deck.gl's TextLayer.
 * This is instantiatable by calling `new TextLayer()`.
 */


const ChromaticTextLayer = _ChromaticTextLayer;
exports.ChromaticTextLayer = ChromaticTextLayer;
},{"../base":"QMMK","./font-atlas":"QfhO","./chromatic-multi-icon-layer/chromatic-multi-icon-layer":"h4ub"}],"RzyQ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.concat = concat;

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function concat(...args) {
  return args.reduce((p, c) => c ? p.concat(c) : p, []);
}
},{}],"ddfg":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var _default = `\
#define SHADER_NAME cube-layer-fragment-shader

precision highp float;

varying vec4 vColor;

void main(void) {
  gl_FragColor = vColor;

  // use highlight color if this fragment belongs to the selected object.
  gl_FragColor = picking_filterHighlightColor(gl_FragColor);

  // use picking color if rendering to picking FBO.
  gl_FragColor = picking_filterPickingColor(gl_FragColor);
}
`;
exports.default = _default;
},{}],"ll2T":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.createStage = createStage;
exports.minPixelSize = exports.min3dDepth = exports.defaultView = exports.lineZ = exports.groupStrokeWidth = exports.defaultPresenterConfig = exports.defaultPresenterStyle = exports.minWidth = exports.minHeight = void 0;
const minHeight = '100px';
exports.minHeight = minHeight;
const minWidth = '100px';
exports.minWidth = minWidth;
const lightSettings = {
  '2d': {},
  '3d': {
    lightsPosition: [-122.45, 37.66, 8000, -122.0, 38.0, 8000],
    ambientRatio: 0.3,
    diffuseRatio: 0.6,
    specularRatio: 0.4,
    lightsStrength: [0.3, 0.0, 0.8, 0.0],
    numberOfLights: 2
  }
};
const defaultPresenterStyle = {
  cssPrefix: 'vega-deckgl-',
  defaultCubeColor: [128, 128, 128, 255],
  highlightColor: [0, 0, 0, 255],
  lightSettings
};
exports.defaultPresenterStyle = defaultPresenterStyle;
const defaultPresenterConfig = {
  onCubeClick: (e, cube) => {},
  onCubeHover: (e, cube) => {},
  transitionDurations: {
    color: 100,
    position: 600,
    size: 600,
    view: 600
  }
};
exports.defaultPresenterConfig = defaultPresenterConfig;

function createStage(view) {
  const stage = {
    view,
    cubeData: [],
    axes: {
      x: [],
      y: []
    },
    gridLines: [],
    textData: [],
    legend: {
      rows: {}
    },
    facets: []
  };
  return stage;
}

const groupStrokeWidth = 1;
exports.groupStrokeWidth = groupStrokeWidth;
const lineZ = -1;
exports.lineZ = lineZ;
const defaultView = '2d';
exports.defaultView = defaultView;
const min3dDepth = 0.05;
exports.min3dDepth = min3dDepth;
const minPixelSize = 0.5;
exports.minPixelSize = minPixelSize;
},{}],"HCl0":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _defaults = require("../defaults");

// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
var _default = `\
#define SHADER_NAME cube-layer-vertex-shader

attribute vec3 positions;
attribute vec3 normals;

attribute vec3 instancePositions;
attribute vec2 instancePositions64xyLow;
attribute vec3 instanceSizes;
attribute vec4 instanceColors;
attribute vec3 instancePickingColors;

// Custom uniforms
uniform float lightingMix;

// Result
varying vec4 vColor;

void main(void) {

  float x = instanceSizes.x > 0.0 ? max(instanceSizes.x, ${_defaults.minPixelSize.toFixed(1)}) : 0.0;
  float y = instanceSizes.y > 0.0 ? max(instanceSizes.y, ${_defaults.minPixelSize.toFixed(1)}) : 0.0;

  // if alpha == 0.0, do not render element
  float noRender = float(instanceColors.a == 0.0);
  float finalXScale = project_scale(x) * mix(1.0, 0.0, noRender);
  float finalYScale = project_scale(y) * mix(1.0, 0.0, noRender);
  float finalZScale = project_scale(instanceSizes.z) * mix(1.0, 0.0, noRender);

  // cube geometry vertics are between -1 to 1, scale and transform it to between 0, 1
  vec3 offset = vec3(
    (positions.x + 1.0) / 2.0 * finalXScale,
    (positions.y + 1.0) / 2.0 * finalYScale,
    (positions.z + 1.0) / 2.0 * finalZScale);

  // extrude positions
  vec4 position_worldspace;
  gl_Position = project_position_to_clipspace(instancePositions, instancePositions64xyLow, offset, position_worldspace);

  float lightWeight = 1.0;
  
  //allow for a small amount of error around the min3dDepth 
  if (instanceSizes.z >= ${_defaults.min3dDepth.toFixed(4)} - 0.0001) {
    lightWeight = lighting_getLightWeight(
      position_worldspace.xyz, // the w component is always 1.0
      normals
    );
  }

  vec3 lightWeightedColor = lightWeight * instanceColors.rgb;
  vec3 mixedLight = mix(instanceColors.rgb, lightWeightedColor, lightingMix);
  vec4 color = vec4(mixedLight, instanceColors.a) / 255.0;
  vColor = color;

  // Set color to be rendered to picking fbo (also used to check for selection highlight).
  picking_setPickingColor(instancePickingColors);
}
`;
exports.default = _default;
},{"../defaults":"ll2T"}],"pY0s":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.CubeLayer = void 0;

var _cubeLayerFragment = _interopRequireDefault(require("./cube-layer-fragment.glsl"));

var _cubeLayerVertex = _interopRequireDefault(require("./cube-layer-vertex.glsl"));

var _base = require("../base");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// 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.
// Adapted from https://github.com/uber/deck.gl/blob/5.3-release/modules/layers/src/grid-cell-layer/grid-cell-layer.js
//https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants
const UNSIGNED_BYTE = 0x1401;
const DEFAULT_COLOR = [255, 0, 255, 255];
const defaultProps = {
  lightingMix: 0.5,
  fp64: false,
  getSize: x => x.size,
  getPosition: x => x.position,
  getColor: x => x.color
};

function _CubeLayer(props) {
  //dynamic superclass, since we don't know have deck.Layer in the declaration phase
  class __CubeLayer extends _base.base.deck.Layer {
    getShaders() {
      const projectModule = this.use64bitProjection() ? 'project64' : 'project32';
      return {
        vs: _cubeLayerVertex.default,
        fs: _cubeLayerFragment.default,
        modules: [projectModule, 'lighting', 'picking']
      };
    }

    initializeState() {
      const attributeManager = this.getAttributeManager();
      attributeManager.addInstanced({
        instancePositions: {
          size: 3,
          transition: true,
          accessor: 'getPosition'
        },
        instancePositions64xyLow: {
          size: 3,
          accessor: 'getPosition',
          update: this.calculateInstancePositions64xyLow
        },
        instanceSizes: {
          size: 3,
          transition: true,
          accessor: 'getSize'
        },
        instanceColors: {
          size: 4,
          type: UNSIGNED_BYTE,
          transition: true,
          accessor: 'getColor',
          defaultValue: DEFAULT_COLOR
        }
      });
    }

    updateState({
      props,
      oldProps,
      changeFlags
    }) {
      super.updateState({
        props,
        oldProps,
        changeFlags
      }); //TODO add parameter type to deck.gl-typings
      // Re-generate model if geometry changed

      if (props.fp64 !== oldProps.fp64) {
        const {
          gl
        } = this.context;

        if (this.state.model) {
          this.state.model.delete();
        }

        this.setState({
          model: this._getModel(gl)
        });
        this.getAttributeManager().invalidateAll();
      }
    }

    _getModel(gl) {
      return new _base.base.luma.Model(gl, Object.assign({}, this.getShaders(), {
        id: this.props.id,
        geometry: new _base.base.luma.CubeGeometry(),
        isInstanced: true,
        shaderCache: this.context.shaderCache
      }));
    }

    draw({
      uniforms
    }) {
      let {
        lightingMix
      } = this.props;

      if (this.props.interpolator && this.props.interpolator.layerInterpolatedProps) {
        lightingMix = this.props.interpolator.layerInterpolatedProps.lightingMix;
      }

      this.state.model.render(Object.assign({}, uniforms, {
        lightingMix
      }));
    }

    calculateInstancePositions64xyLow(attribute) {
      const isFP64 = this.use64bitPositions();
      attribute.constant = !isFP64;

      if (!isFP64) {
        attribute.value = new Float32Array(2);
        return;
      }

      const {
        data,
        getPosition
      } = this.props;
      const {
        value
      } = attribute;
      let i = 0;

      for (const point of data) {
        const position = getPosition(point);
        value[i++] = _base.base.luma.fp64.fp64LowPart(position[0]);
        value[i++] = _base.base.luma.fp64.fp64LowPart(position[1]);
      }
    }

  }

  __CubeLayer.layerName = 'CubeLayer';
  __CubeLayer.defaultProps = defaultProps;
  const instance = new __CubeLayer(props);
  return instance;
} //signature to allow this function to be used with the 'new' keyword.
//need to trick the compiler by casting to 'any'.

/**
 * CubeLayer - a Deck.gl layer to render cuboids.
 * This is instantiatable by calling `new CubeLayer()`.
 */


const CubeLayer = _CubeLayer;
exports.CubeLayer = CubeLayer;
},{"./cube-layer-fragment.glsl":"ddfg","./cube-layer-vertex.glsl":"HCl0","../base":"QMMK"}],"LpUO":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.linear = linear;

function linear(t) {
  return +t;
}
},{}],"WdHD":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.quadIn = quadIn;
exports.quadOut = quadOut;
exports.quadInOut = quadInOut;

function quadIn(t) {
  return t * t;
}

function quadOut(t) {
  return t * (2 - t);
}

function quadInOut(t) {
  return ((t *= 2) <= 1 ? t * t : --t * (2 - t) + 1) / 2;
}
},{}],"do4B":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.cubicIn = cubicIn;
exports.cubicOut = cubicOut;
exports.cubicInOut = cubicInOut;

function cubicIn(t) {
  return t * t * t;
}

function cubicOut(t) {
  return --t * t * t + 1;
}

function cubicInOut(t) {
  return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
}
},{}],"jbbK":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.polyInOut = exports.polyOut = exports.polyIn = void 0;
var exponent = 3;

var polyIn = function custom(e) {
  e = +e;

  function polyIn(t) {
    return Math.pow(t, e);
  }

  polyIn.exponent = custom;
  return polyIn;
}(exponent);

exports.polyIn = polyIn;

var polyOut = function custom(e) {
  e = +e;

  function polyOut(t) {
    return 1 - Math.pow(1 - t, e);
  }

  polyOut.exponent = custom;
  return polyOut;
}(exponent);

exports.polyOut = polyOut;

var polyInOut = function custom(e) {
  e = +e;

  function polyInOut(t) {
    return ((t *= 2) <= 1 ? Math.pow(t, e) : 2 - Math.pow(2 - t, e)) / 2;
  }

  polyInOut.exponent = custom;
  return polyInOut;
}(exponent);

exports.polyInOut = polyInOut;
},{}],"bG68":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.sinIn = sinIn;
exports.sinOut = sinOut;
exports.sinInOut = sinInOut;
var pi = Math.PI,
    halfPi = pi / 2;

function sinIn(t) {
  return 1 - Math.cos(t * halfPi);
}

function sinOut(t) {
  return Math.sin(t * halfPi);
}

function sinInOut(t) {
  return (1 - Math.cos(pi * t)) / 2;
}
},{}],"LfIG":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.expIn = expIn;
exports.expOut = expOut;
exports.expInOut = expInOut;

function expIn(t) {
  return Math.pow(2, 10 * t - 10);
}

function expOut(t) {
  return 1 - Math.pow(2, -10 * t);
}

function expInOut(t) {
  return ((t *= 2) <= 1 ? Math.pow(2, 10 * t - 10) : 2 - Math.pow(2, 10 - 10 * t)) / 2;
}
},{}],"meOs":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.circleIn = circleIn;
exports.circleOut = circleOut;
exports.circleInOut = circleInOut;

function circleIn(t) {
  return 1 - Math.sqrt(1 - t * t);
}

function circleOut(t) {
  return Math.sqrt(1 - --t * t);
}

function circleInOut(t) {
  return ((t *= 2) <= 1 ? 1 - Math.sqrt(1 - t * t) : Math.sqrt(1 - (t -= 2) * t) + 1) / 2;
}
},{}],"sWoK":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.bounceIn = bounceIn;
exports.bounceOut = bounceOut;
exports.bounceInOut = bounceInOut;
var b1 = 4 / 11,
    b2 = 6 / 11,
    b3 = 8 / 11,
    b4 = 3 / 4,
    b5 = 9 / 11,
    b6 = 10 / 11,
    b7 = 15 / 16,
    b8 = 21 / 22,
    b9 = 63 / 64,
    b0 = 1 / b1 / b1;

function bounceIn(t) {
  return 1 - bounceOut(1 - t);
}

function bounceOut(t) {
  return (t = +t) < b1 ? b0 * t * t : t < b3 ? b0 * (t -= b2) * t + b4 : t < b6 ? b0 * (t -= b5) * t + b7 : b0 * (t -= b8) * t + b9;
}

function bounceInOut(t) {
  return ((t *= 2) <= 1 ? 1 - bounceOut(1 - t) : bounceOut(t - 1) + 1) / 2;
}
},{}],"ndMW":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.backInOut = exports.backOut = exports.backIn = void 0;
var overshoot = 1.70158;

var backIn = function custom(s) {
  s = +s;

  function backIn(t) {
    return t * t * ((s + 1) * t - s);
  }

  backIn.overshoot = custom;
  return backIn;
}(overshoot);

exports.backIn = backIn;

var backOut = function custom(s) {
  s = +s;

  function backOut(t) {
    return --t * t * ((s + 1) * t + s) + 1;
  }

  backOut.overshoot = custom;
  return backOut;
}(overshoot);

exports.backOut = backOut;

var backInOut = function custom(s) {
  s = +s;

  function backInOut(t) {
    return ((t *= 2) < 1 ? t * t * ((s + 1) * t - s) : (t -= 2) * t * ((s + 1) * t + s) + 2) / 2;
  }

  backInOut.overshoot = custom;
  return backInOut;
}(overshoot);

exports.backInOut = backInOut;
},{}],"l3oD":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.elasticInOut = exports.elasticOut = exports.elasticIn = void 0;
var tau = 2 * Math.PI,
    amplitude = 1,
    period = 0.3;

var elasticIn = function custom(a, p) {
  var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);

  function elasticIn(t) {
    return a * Math.pow(2, 10 * --t) * Math.sin((s - t) / p);
  }

  elasticIn.amplitude = function (a) {
    return custom(a, p * tau);
  };

  elasticIn.period = function (p) {
    return custom(a, p);
  };

  return elasticIn;
}(amplitude, period);

exports.elasticIn = elasticIn;

var elasticOut = function custom(a, p) {
  var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);

  function elasticOut(t) {
    return 1 - a * Math.pow(2, -10 * (t = +t)) * Math.sin((t + s) / p);
  }

  elasticOut.amplitude = function (a) {
    return custom(a, p * tau);
  };

  elasticOut.period = function (p) {
    return custom(a, p);
  };

  return elasticOut;
}(amplitude, period);

exports.elasticOut = elasticOut;

var elasticInOut = function custom(a, p) {
  var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);

  function elasticInOut(t) {
    return ((t = t * 2 - 1) < 0 ? a * Math.pow(2, 10 * t) * Math.sin((s - t) / p) : 2 - a * Math.pow(2, -10 * t) * Math.sin((s + t) / p)) / 2;
  }

  elasticInOut.amplitude = function (a) {
    return custom(a, p * tau);
  };

  elasticInOut.period = function (p) {
    return custom(a, p);
  };

  return elasticInOut;
}(amplitude, period);

exports.elasticInOut = elasticInOut;
},{}],"sA9Z":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "easeLinear", {
  enumerable: true,
  get: function () {
    return _linear.linear;
  }
});
Object.defineProperty(exports, "easeQuad", {
  enumerable: true,
  get: function () {
    return _quad.quadInOut;
  }
});
Object.defineProperty(exports, "easeQuadIn", {
  enumerable: true,
  get: function () {
    return _quad.quadIn;
  }
});
Object.defineProperty(exports, "easeQuadOut", {
  enumerable: true,
  get: function () {
    return _quad.quadOut;
  }
});
Object.defineProperty(exports, "easeQuadInOut", {
  enumerable: true,
  get: function () {
    return _quad.quadInOut;
  }
});
Object.defineProperty(exports, "easeCubic", {
  enumerable: true,
  get: function () {
    return _cubic.cubicInOut;
  }
});
Object.defineProperty(exports, "easeCubicIn", {
  enumerable: true,
  get: function () {
    return _cubic.cubicIn;
  }
});
Object.defineProperty(exports, "easeCubicOut", {
  enumerable: true,
  get: function () {
    return _cubic.cubicOut;
  }
});
Object.defineProperty(exports, "easeCubicInOut", {
  enumerable: true,
  get: function () {
    return _cubic.cubicInOut;
  }
});
Object.defineProperty(exports, "easePoly", {
  enumerable: true,
  get: function () {
    return _poly.polyInOut;
  }
});
Object.defineProperty(exports, "easePolyIn", {
  enumerable: true,
  get: function () {
    return _poly.polyIn;
  }
});
Object.defineProperty(exports, "easePolyOut", {
  enumerable: true,
  get: function () {
    return _poly.polyOut;
  }
});
Object.defineProperty(exports, "easePolyInOut", {
  enumerable: true,
  get: function () {
    return _poly.polyInOut;
  }
});
Object.defineProperty(exports, "easeSin", {
  enumerable: true,
  get: function () {
    return _sin.sinInOut;
  }
});
Object.defineProperty(exports, "easeSinIn", {
  enumerable: true,
  get: function () {
    return _sin.sinIn;
  }
});
Object.defineProperty(exports, "easeSinOut", {
  enumerable: true,
  get: function () {
    return _sin.sinOut;
  }
});
Object.defineProperty(exports, "easeSinInOut", {
  enumerable: true,
  get: function () {
    return _sin.sinInOut;
  }
});
Object.defineProperty(exports, "easeExp", {
  enumerable: true,
  get: function () {
    return _exp.expInOut;
  }
});
Object.defineProperty(exports, "easeExpIn", {
  enumerable: true,
  get: function () {
    return _exp.expIn;
  }
});
Object.defineProperty(exports, "easeExpOut", {
  enumerable: true,
  get: function () {
    return _exp.expOut;
  }
});
Object.defineProperty(exports, "easeExpInOut", {
  enumerable: true,
  get: function () {
    return _exp.expInOut;
  }
});
Object.defineProperty(exports, "easeCircle", {
  enumerable: true,
  get: function () {
    return _circle.circleInOut;
  }
});
Object.defineProperty(exports, "easeCircleIn", {
  enumerable: true,
  get: function () {
    return _circle.circleIn;
  }
});
Object.defineProperty(exports, "easeCircleOut", {
  enumerable: true,
  get: function () {
    return _circle.circleOut;
  }
});
Object.defineProperty(exports, "easeCircleInOut", {
  enumerable: true,
  get: function () {
    return _circle.circleInOut;
  }
});
Object.defineProperty(exports, "easeBounce", {
  enumerable: true,
  get: function () {
    return _bounce.bounceOut;
  }
});
Object.defineProperty(exports, "easeBounceIn", {
  enumerable: true,
  get: function () {
    return _bounce.bounceIn;
  }
});
Object.defineProperty(exports, "easeBounceOut", {
  enumerable: true,
  get: function () {
    return _bounce.bounceOut;
  }
});
Object.defineProperty(exports, "easeBounceInOut", {
  enumerable: true,
  get: function () {
    return _bounce.bounceInOut;
  }
});
Object.defineProperty(exports, "easeBack", {
  enumerable: true,
  get: function () {
    return _back.backInOut;
  }
});
Object.defineProperty(exports, "easeBackIn", {
  enumerable: true,
  get: function () {
    return _back.backIn;
  }
});
Object.defineProperty(exports, "easeBackOut", {
  enumerable: true,
  get: function () {
    return _back.backOut;
  }
});
Object.defineProperty(exports, "easeBackInOut", {
  enumerable: true,
  get: function () {
    return _back.backInOut;
  }
});
Object.defineProperty(exports, "easeElastic", {
  enumerable: true,
  get: function () {
    return _elastic.elasticOut;
  }
});
Object.defineProperty(exports, "easeElasticIn", {
  enumerable: true,
  get: function () {
    return _elastic.elasticIn;
  }
});
Object.defineProperty(exports, "easeElasticOut", {
  enumerable: true,
  get: function () {
    return _elastic.elasticOut;
  }
});
Object.defineProperty(exports, "easeElasticInOut", {
  enumerable: true,
  get: function () {
    return _elastic.elasticInOut;
  }
});

var _linear = require("./linear.js");

var _quad = require("./quad.js");

var _cubic = require("./cubic.js");

var _poly = require("./poly.js");

var _sin = require("./sin.js");

var _exp = require("./exp.js");

var _circle = require("./circle.js");

var _bounce = require("./bounce.js");

var _back = require("./back.js");

var _elastic = require("./elastic.js");
},{"./linear.js":"LpUO","./quad.js":"WdHD","./cubic.js":"do4B","./poly.js":"jbbK","./sin.js":"bG68","./exp.js":"LfIG","./circle.js":"meOs","./bounce.js":"sWoK","./back.js":"ndMW","./elastic.js":"l3oD"}],"MPcW":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getLayers = getLayers;
exports.getCubeLayer = getCubeLayer;
exports.getCubes = getCubes;

var _base = require("./base");

var _chromaticTextLayer = require("./chromatic-text-layer/chromatic-text-layer");

var _array = require("./array");

var _cubeLayer = require("./cube-layer/cube-layer");

var _d3Ease = require("d3-ease");

var _constants = require("./constants");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function getLayers(presenter, config, stage, lightSettings, lightingMix, interpolator, guideLines) {
  const cubeLayer = newCubeLayer(presenter, config, stage.cubeData, presenter.style.highlightColor, lightSettings, lightingMix, interpolator);
  const {
    x,
    y
  } = stage.axes;
  const lines = (0, _array.concat)(stage.gridLines, guideLines);
  const texts = [...stage.textData];
  [x, y].forEach(axes => {
    axes.forEach(axis => {
      if (axis.domain) lines.push(axis.domain);
      if (axis.ticks) lines.push.apply(lines, axis.ticks);
      if (axis.tickText) texts.push.apply(texts, axis.tickText);
      if (axis.title) texts.push(axis.title);
    });
  });

  if (stage.facets) {
    stage.facets.forEach(f => {
      if (f.lines) lines.push.apply(lines, f.lines);
      if (f.facetTitle) texts.push(f.facetTitle);
    });
  }

  const lineLayer = newLineLayer(_constants.layerNames.lines, lines);
  const textLayer = newTextLayer(presenter, _constants.layerNames.text, texts, config, presenter.style.fontFamily);
  return [textLayer, cubeLayer, lineLayer];
}

function newCubeLayer(presenter, config, cubeData, highlightColor, lightSettings, lightingMix, interpolator) {
  const getPosition = getTiming(config.transitionDurations.position, _d3Ease.easeExpInOut);
  const getSize = getTiming(config.transitionDurations.size, _d3Ease.easeExpInOut);
  const getColor = getTiming(config.transitionDurations.color);
  const cubeLayerProps = {
    interpolator,
    lightingMix,
    id: _constants.layerNames.cubes,
    data: cubeData,
    coordinateSystem: _base.base.deck.COORDINATE_SYSTEM.IDENTITY,
    pickable: true,
    autoHighlight: true,
    highlightColor,
    onClick: (o, e) => {
      config.onCubeClick(e && e.srcEvent, o.object);
    },
    onHover: (o, e) => {
      if (o.index === -1) {
        presenter.deckgl.interactiveState.onCube = false;
        config.onCubeHover(e && e.srcEvent, null);
      } else {
        presenter.deckgl.interactiveState.onCube = true;
        config.onCubeHover(e && e.srcEvent, o.object);
      }
    },
    lightSettings,
    transitions: {
      getPosition,
      getColor,
      getSize
    }
  };
  return new _cubeLayer.CubeLayer(cubeLayerProps);
}

function newLineLayer(id, data) {
  return new _base.base.layers.LineLayer({
    id,
    data,
    coordinateSystem: _base.base.deck.COORDINATE_SYSTEM.IDENTITY,
    getColor: o => o.color,
    getStrokeWidth: o => o.strokeWidth
  });
}

function newTextLayer(presenter, id, data, config, fontFamily) {
  const props = {
    id,
    data,
    coordinateSystem: _base.base.deck.COORDINATE_SYSTEM.IDENTITY,
    autoHighlight: true,
    pickable: true,
    getHighlightColor: config.getTextHighlightColor || (o => o.color),
    onClick: (o, e) => {
      let pe = e && e.srcEvent; //handle iOS event

      if (e.center) {
        pe = {
          clientX: e.center.x,
          clientY: e.center.y
        };
      }

      config.onTextClick && config.onTextClick(pe, o.object);
    },
    onHover: (o, e) => {
      if (o.index === -1) {
        presenter.deckgl.interactiveState.onText = false;
      } else {
        presenter.deckgl.interactiveState.onText = config.onTextHover ? config.onTextHover(e && e.srcEvent, o.object) : true;
      }
    },
    getColor: config.getTextColor || (o => o.color),
    getTextAnchor: o => o.textAnchor,
    getSize: o => o.size,
    getAngle: o => o.angle,
    fontSettings: {
      sdf: true,
      fontSize: 128,
      buffer: 3
    }
  };

  if (fontFamily) {
    props.fontFamily = fontFamily;
  }

  return new _chromaticTextLayer.ChromaticTextLayer(props);
}

function getTiming(duration, easing) {
  let timing;

  if (duration) {
    timing = {
      duration
    };

    if (easing) {
      timing.easing = easing;
    }
  }

  return timing;
}

function getCubeLayer(deckProps) {
  return deckProps.layers.filter(layer => layer.id === _constants.layerNames.cubes)[0];
}

function getCubes(deckProps) {
  const cubeLayer = getCubeLayer(deckProps);
  if (!cubeLayer) return;
  const cubeLayerProps = cubeLayer.props;
  return cubeLayerProps.data;
}
},{"./base":"QMMK","./chromatic-text-layer/chromatic-text-layer":"myaz","./array":"RzyQ","./cube-layer/cube-layer":"pY0s","d3-ease":"sA9Z","./constants":"aLsw"}],"xL0e":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "addDiv", {
  enumerable: true,
  get: function () {
    return _htmlHelpers.addDiv;
  }
});
Object.defineProperty(exports, "addEl", {
  enumerable: true,
  get: function () {
    return _htmlHelpers.addEl;
  }
});
Object.defineProperty(exports, "outerSize", {
  enumerable: true,
  get: function () {
    return _htmlHelpers.outerSize;
  }
});
Object.defineProperty(exports, "clone", {
  enumerable: true,
  get: function () {
    return _clone.clone;
  }
});
Object.defineProperty(exports, "deepMerge", {
  enumerable: true,
  get: function () {
    return _clone.deepMerge;
  }
});
Object.defineProperty(exports, "colorFromString", {
  enumerable: true,
  get: function () {
    return _color.colorFromString;
  }
});
Object.defineProperty(exports, "colorIsEqual", {
  enumerable: true,
  get: function () {
    return _color.colorIsEqual;
  }
});
Object.defineProperty(exports, "colorToString", {
  enumerable: true,
  get: function () {
    return _color.colorToString;
  }
});
Object.defineProperty(exports, "desaturate", {
  enumerable: true,
  get: function () {
    return _color.desaturate;
  }
});
Object.defineProperty(exports, "isColor", {
  enumerable: true,
  get: function () {
    return _color.isColor;
  }
});
Object.defineProperty(exports, "getCubeLayer", {
  enumerable: true,
  get: function () {
    return _layers.getCubeLayer;
  }
});
Object.defineProperty(exports, "getCubes", {
  enumerable: true,
  get: function () {
    return _layers.getCubes;
  }
});

var _htmlHelpers = require("../htmlHelpers");

var _clone = require("../clone");

var _color = require("../color");

var _layers = require("../layers");
},{"../htmlHelpers":"Ctqa","../clone":"WXef","../color":"cOXv","../layers":"MPcW"}],"PKNM":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.box = box;
exports.default = void 0;

var _base = require("../base");

var _color = require("../color");

var _defaults = require("../defaults");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const markStager = (options, stage, scene, x, y, groupType) => {
  _base.base.vega.sceneVisit(scene, function (item) {
    var x1, y1, x2, y2;
    x1 = item.x || 0;
    y1 = item.y || 0;
    x2 = item.x2 != null ? item.x2 : x1;
    y2 = item.y2 != null ? item.y2 : y1;
    const lineItem = styledLine(x1 + x - options.offsetX, y1 + y - options.offsetY, x2 + x - options.offsetX, y2 + y - options.offsetY, item.stroke, item.strokeWidth);

    if (item.mark.role === 'axis-tick') {
      options.currAxis.ticks.push(lineItem);
    } else if (item.mark.role === 'axis-domain') {
      options.currAxis.domain = lineItem;
    } else {
      stage.gridLines.push(lineItem);
    }
  });
};

function styledLine(x1, y1, x2, y2, stroke, strokeWidth) {
  const line = {
    sourcePosition: [x1, -y1, _defaults.lineZ],
    targetPosition: [x2, -y2, _defaults.lineZ],
    color: (0, _color.colorFromString)(stroke),
    strokeWidth: strokeWidth * 10 //translate width to deck.gl

  };
  return line;
}

function box(gx, gy, height, width, stroke, strokeWidth, diagonals = false) {
  const lines = [styledLine(gx, gy, gx + width, gy, stroke, strokeWidth), styledLine(gx + width, gy, gx + width, gy + height, stroke, strokeWidth), styledLine(gx + width, gy + height, gx, gy + height, stroke, strokeWidth), styledLine(gx, gy + height, gx, gy, stroke, strokeWidth)];

  if (diagonals) {
    lines.push(styledLine(gx, gy, gx + width, gy + height, stroke, strokeWidth));
    lines.push(styledLine(gx, gy + height, gx + width, gy, stroke, strokeWidth));
  }

  return lines;
}

var _default = markStager;
exports.default = _default;
},{"../base":"QMMK","../color":"cOXv","../defaults":"ll2T"}],"oQnJ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.PresenterElement = void 0;
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

/**
 * HTML elements outputted by the presenter.
 */
var PresenterElement;
exports.PresenterElement = PresenterElement;

(function (PresenterElement) {
  PresenterElement[PresenterElement["root"] = 0] = "root";
  PresenterElement[PresenterElement["gl"] = 1] = "gl";
  PresenterElement[PresenterElement["panel"] = 2] = "panel";
  PresenterElement[PresenterElement["legend"] = 3] = "legend";
  PresenterElement[PresenterElement["vegaControls"] = 4] = "vegaControls";
})(PresenterElement || (exports.PresenterElement = PresenterElement = {}));
},{}],"uu24":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.initializePanel = initializePanel;
exports.className = className;

var _tsxCreateElement = require("tsx-create-element");

var _defaults = require("./defaults");

var _enums = require("./enums");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function initializePanel(presenter) {
  const rootDiv = (0, _tsxCreateElement.createElement)("div", {
    className: className(_enums.PresenterElement.root, presenter)
  }, (0, _tsxCreateElement.createElement)("div", {
    className: className(_enums.PresenterElement.gl, presenter),
    style: {
      minHeight: _defaults.minHeight,
      minWidth: _defaults.minWidth
    }
  }), (0, _tsxCreateElement.createElement)("div", {
    className: className(_enums.PresenterElement.panel, presenter)
  }, (0, _tsxCreateElement.createElement)("div", {
    className: className(_enums.PresenterElement.vegaControls, presenter)
  }), (0, _tsxCreateElement.createElement)("div", {
    className: className(_enums.PresenterElement.legend, presenter)
  })));
  (0, _tsxCreateElement.mount)(rootDiv, presenter.el);
}

function className(type, presenter) {
  return `${presenter.style.cssPrefix}${_enums.PresenterElement[type]}`;
}
},{"tsx-create-element":"fpJu","./defaults":"ll2T","./enums":"oQnJ"}],"AwIO":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.createOrbitControllerClass = createOrbitControllerClass;

var _base = require("../base");

function createOrbitControllerClass(factoryOptions) {
  function wrapper(props) {
    class OrbitControllerInternal extends _base.base.deck._OrbitController {
      constructor(props) {
        super(props);
        this.invertPan = true;
      }

      _onDoubleTap(event) {
        if (factoryOptions && factoryOptions.doubleClickHandler) {
          factoryOptions.doubleClickHandler(event, this);
        } else {
          super._onDoubleTap(event);
        }
      }

      _onPanRotate(event) {
        if (!this.dragRotate) {
          return false;
        }

        return this._onPanRotateStandard(event);
      }

    }

    const instance = new OrbitControllerInternal(props);
    return instance;
  }

  return wrapper;
}
},{"../base":"QMMK"}],"RLgC":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.createDeckGLClassesForPresenter = createDeckGLClassesForPresenter;

var _base = require("../base");

var _orbitController = require("./orbitController");

//adapted from https://github.com/uber/deck.gl/blob/5.3-release/modules/lite/src/deckgl.js
const CANVAS_STYLE = {
  position: 'absolute',
  left: 0,
  top: 0,
  width: '100%',
  height: '100%'
}; // Create canvas elements for map and deck

function createCanvas(props) {
  let {
    container = document.body
  } = props;

  if (typeof container === 'string') {
    container = document.getElementById(container);
  }

  if (!container) {
    throw Error('Deck: container not found');
  } // Add DOM elements


  const containerStyle = window.getComputedStyle(container);

  if (containerStyle.position === 'static') {
    container.style.position = 'relative';
  }

  const deckCanvas = document.createElement('canvas');
  container.appendChild(deckCanvas);
  Object.assign(deckCanvas.style, CANVAS_STYLE);
  return {
    container,
    deckCanvas
  };
}
/**
 * Creates Deck.gl classes for rendering WebGL.
 * DEck.gl is instantiatable by calling `new createDeckGLClassesForPresenter(controlleroptions)(deckProps)`.
 */


function createDeckGLClassesForPresenter(factoryOptions) {
  const OrbitControllerClass = (0, _orbitController.createOrbitControllerClass)(factoryOptions); //dynamic superclass lets us create a subclass at execution phase instead of declaration phase.
  //This allows us to retrieve Deck from either UMD or ES6 consumers of this class.

  function wrapper(props) {
    /**
     * @params container (Element) - DOM element to add deck.gl canvas to
     * @params controller (Object) - Controller class. Leave empty for auto detection
     */
    class DeckGLInternal extends _base.base.deck.Deck {
      constructor(props = {}) {
        if (typeof document === 'undefined') {
          // Not browser
          throw Error('Deck can only be used in the browser');
        }

        const {
          deckCanvas
        } = createCanvas(props);
        const viewState = props.initialViewState || props.viewState || {};
        super(Object.assign({}, props, {
          width: '100%',
          height: '100%',
          canvas: deckCanvas,
          controller: OrbitControllerClass,
          initialViewState: viewState
        })); // Callback for the controller

        this._updateViewState = params => {
          if (this.onViewStateChange) {
            this.onViewStateChange(params);
          }
        };
      }

      setProps(props) {
        // this._updateViewState must be bound to `this`
        // but we don't have access to the current instance before calling super().
        if ('onViewStateChange' in props && this._updateViewState) {
          // This is called at least once at _onRendererInitialized
          this.onViewStateChange = props.onViewStateChange;
          props.onViewStateChange = this._updateViewState;
        }

        super.setProps(props);
      }

    }

    const instance = new DeckGLInternal(props);
    return instance;
  }

  return {
    OrbitControllerClass,
    DeckGL_Class: wrapper
  };
}
},{"../base":"QMMK","./orbitController":"AwIO"}],"tuEN":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.LegendView = void 0;

var _tsxCreateElement = require("tsx-create-element");

var _controls = require("./controls");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const LegendView = props => {
  const rows = [];

  const addRow = (row, i) => {
    const fn = symbolMap[row.symbol.shape];
    let jsx;

    if (fn) {
      jsx = fn(row.symbol);
    } else {
      jsx = (0, _tsxCreateElement.createElement)("span", null, "x"); //console.log(`need to render ${row.symbol.shape} symbol shape`);
    }

    rows.push({
      cells: [{
        className: 'symbol',
        content: jsx
      }, {
        className: 'label',
        content: row.label,
        title: row.label
      }]
    });
  };

  var sorted = Object.keys(props.legend.rows).sort((a, b) => +a - +b);
  sorted.forEach(i => addRow(props.legend.rows[i], +i));

  if (sorted.length) {
    return (0, _tsxCreateElement.createElement)(_controls.Table, {
      rows: rows,
      rowClassName: "legend-row",
      onRowClick: (e, i) => props.onClick(e, props.legend, i)
    }, props.legend.title !== void 0 && (0, _tsxCreateElement.createElement)("tr", {
      onClick: e => props.onClick(e, props.legend, null)
    }, (0, _tsxCreateElement.createElement)("th", {
      colSpan: 2
    }, props.legend.title)));
  }
};

exports.LegendView = LegendView;
const symbolMap = {
  square: function (symbol) {
    return (0, _tsxCreateElement.createElement)("div", {
      style: {
        height: `${symbol.bounds.y2 - symbol.bounds.y1}px`,
        width: `${symbol.bounds.x2 - symbol.bounds.x1}px`,
        backgroundColor: symbol.fill,
        borderColor: symbol.fill
      }
    });
  }
};
},{"tsx-create-element":"fpJu","./controls":"wFdr"}],"x1fx":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.LinearInterpolator = void 0;

var _base = require("../base");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function wrapper(props) {
  class LinearInterpolatorInternal extends _base.base.deck.LinearInterpolator {
    constructor(transitionProps) {
      super(transitionProps);
    }

    interpolateProps(viewStateStartProps, viewStateEndProps, t) {
      if (this.layerStartProps && this.layerEndProps) {
        this.layerInterpolatedProps = super.interpolateProps(this.layerStartProps, this.layerEndProps, t);
      }

      return super.interpolateProps(viewStateStartProps, viewStateEndProps, t);
    }

  }

  const instance = new LinearInterpolatorInternal(props);
  return instance;
}

const LinearInterpolator = wrapper;
exports.LinearInterpolator = LinearInterpolator;
},{"../base":"QMMK"}],"TRuG":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.patchCubeArray = patchCubeArray;

function patchCubeArray(allocatedSize, empty, cubes) {
  const patched = new Array(allocatedSize);
  patched.fill(empty);
  cubes.forEach(cube => patched[cube.ordinal] = cube);
  return patched;
}
},{}],"X84i":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _base = require("../base");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const legendMap = {
  'legend-title': function (legend, textItem) {
    legend.title = textItem.text;
  },
  'legend-symbol': function (legend, symbol) {
    const {
      bounds,
      fill,
      shape
    } = symbol; //this object is safe for serialization

    const legendRowSymbol = {
      bounds,
      fill,
      shape
    };
    const i = symbol.datum.index;
    legend.rows[i] = legend.rows[i] || {};
    legend.rows[i].symbol = legendRowSymbol;
  },
  'legend-label': function (legend, label) {
    const i = label.datum.index;
    legend.rows[i] = legend.rows[i] || {};
    const row = legend.rows[i];
    row.label = label.text;
    row.value = label.datum.value;
  }
};

const markStager = (options, stage, scene, x, y, groupType) => {
  _base.base.vega.sceneVisit(scene, function (item) {
    const fn = legendMap[item.mark.role];

    if (fn) {
      fn(stage.legend, item);
    } else {//console.log(`need to render legend ${item.mark.role}`);
    }
  });
};

var _default = markStager;
exports.default = _default;
},{"../base":"QMMK"}],"r12m":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _base = require("../base");

var _color = require("../color");

var _defaults = require("../defaults");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const markStager = (options, stage, scene, x, y, groupType) => {
  let i = 0;

  _base.base.vega.sceneVisit(scene, function (item) {
    //for orthographic (2d) - always use 0 or else Deck will not show them
    const z = stage.view === '2d' ? 0 : item.z || 0;
    const depth = (stage.view === '2d' ? 0 : item.depth || 0) + _defaults.min3dDepth; //change direction of y from SVG to GL

    const ty = -1;
    let ordinal = i;

    if (item.datum.GL_ORDINAL !== void 0) {
      options.ordinalsSpecified = true;
      ordinal = item.datum.GL_ORDINAL;

      if (ordinal > options.maxOrdinal) {
        options.maxOrdinal = ordinal;
      }
    }

    const cube = {
      ordinal,
      size: [item.width, item.height, depth],
      position: [x + (item.x || 0) - options.offsetX, ty * (y + (item.y || 0) - options.offsetY) - item.height, z],
      color: (0, _color.colorFromString)(item.fill) || options.defaultCubeColor || [128, 128, 128, 128]
    };
    cube.color[3] = item.opacity === undefined ? 255 : 255 * item.opacity;
    stage.cubeData.push(cube);
    i++;
  });
};

var _default = markStager;
exports.default = _default;
},{"../base":"QMMK","../color":"cOXv","../defaults":"ll2T"}],"tIs3":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _base = require("../base");

var _color = require("../color");

const markStager = (options, stage, scene, x, y, groupType) => {
  //scale Deck.Gl text to Vega size
  const fontScale = 6; //Deck.gl centers text on Y. TODO: is this correct on x axis?

  const offsetYCenter = 16; //change direction of y from SVG to GL

  const ty = -1;

  _base.base.vega.sceneVisit(scene, function (item) {
    if (!item.text) return;
    const size = item.fontSize * fontScale;
    const textItem = {
      color: (0, _color.colorFromString)(item.fill),
      text: item.text.toString(),
      position: [x + item.x - options.offsetX, ty * (y + item.y + offsetYCenter - options.offsetY), 0],
      size,
      angle: convertAngle(item.angle),
      textAnchor: convertAlignment(item.align),
      alignmentBaseline: convertBaseline(item.baseline)
    };

    if (item.mark.role === 'axis-label') {
      const tickText = textItem;
      tickText.value = item.datum.value;
      options.currAxis.tickText.push(tickText);
    } else if (item.mark.role === 'axis-title') {
      options.currAxis.title = textItem;
    } else if (options.currFacetRect && !options.currFacetRect.facetTitle) {
      options.currFacetRect.facetTitle = textItem;
      textItem.position = [x - options.offsetX, ty * (y + offsetYCenter - options.offsetY), 0];
    } else {
      stage.textData.push(textItem);
    }
  });
};

function convertAngle(vegaTextAngle) {
  if (vegaTextAngle && !isNaN(vegaTextAngle)) {
    return 360 - vegaTextAngle;
  }

  return 0;
}

function convertAlignment(textAlign) {
  switch (textAlign) {
    case 'center':
      return 'middle';

    case 'left':
      return 'start';

    case 'right':
      return 'end';
  }

  return 'start';
}

function convertBaseline(baseline) {
  switch (baseline) {
    case 'middle':
      return 'center';
  }

  return baseline || 'bottom';
}

var _default = markStager;
exports.default = _default;
},{"../base":"QMMK","../color":"cOXv"}],"bMa7":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.GroupType = void 0;
var GroupType;
exports.GroupType = GroupType;

(function (GroupType) {
  GroupType[GroupType["none"] = 0] = "none";
  GroupType[GroupType["legend"] = 1] = "legend";
  GroupType[GroupType["xAxis"] = 2] = "xAxis";
  GroupType[GroupType["yAxis"] = 3] = "yAxis";
})(GroupType || (exports.GroupType = GroupType = {}));
},{}],"axeS":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.sceneToStage = sceneToStage;

var _legend = _interopRequireDefault(require("./marks/legend"));

var _rect = _interopRequireDefault(require("./marks/rect"));

var _rule = _interopRequireWildcard(require("./marks/rule"));

var _text = _interopRequireDefault(require("./marks/text"));

var _base = require("./base");

var _color = require("./color");

var _defaults = require("./defaults");

var _interfaces = require("./marks/interfaces");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function convertGroupRole(group) {
  if (group.mark.role === 'legend') return _interfaces.GroupType.legend;

  if (group.mark.role === 'axis') {
    var vegaAxisDatum = group.datum;

    if (vegaAxisDatum) {
      switch (vegaAxisDatum.orient) {
        case 'bottom':
        case 'top':
          return _interfaces.GroupType.xAxis;

        case 'left':
        case 'right':
          return _interfaces.GroupType.yAxis;
      }
    }
  }
}

const group = (options, stage, scene, x, y, groupType) => {
  _base.base.vega.sceneVisit(scene, function (g) {
    if (g.bounds.x1 < options.offsetX) {
      options.offsetX = g.bounds.x1;
    }

    if (g.bounds.y1 < options.offsetY) {
      options.offsetY = g.bounds.y1;
    }

    const gx = g.x || 0,
          gy = g.y || 0;

    if (g.context && g.context.background && !stage.backgroundColor) {
      stage.backgroundColor = (0, _color.colorFromString)(g.context.background);
    }

    if (g.stroke) {
      const facetRect = {
        lines: (0, _rule.box)(gx + x - options.offsetX, gy + y - options.offsetY, g.height, g.width, g.stroke, _defaults.groupStrokeWidth)
      };
      stage.facets.push(facetRect);
      options.currFacetRect = facetRect;
    }

    groupType = convertGroupRole(g) || groupType;
    setCurrentAxis(options, stage, groupType); // draw group contents

    _base.base.vega.sceneVisit(g, function (item) {
      mainStager(options, stage, item, gx + x, gy + y, groupType);
    });
  });
};

function setCurrentAxis(options, stage, groupType) {
  let axes;

  switch (groupType) {
    case _interfaces.GroupType.xAxis:
      axes = stage.axes.x;
      break;

    case _interfaces.GroupType.yAxis:
      axes = stage.axes.y;
      break;

    default:
      return;
  }

  options.currAxis = {
    domain: null,
    tickText: [],
    ticks: []
  };
  axes.push(options.currAxis);
}

const markStagers = {
  group,
  legend: _legend.default,
  rect: _rect.default,
  rule: _rule.default,
  text: _text.default
};

var mainStager = (options, stage, scene, x, y, groupType) => {
  if (scene.marktype !== 'group' && groupType === _interfaces.GroupType.legend) {
    (0, _legend.default)(options, stage, scene, x, y, groupType);
  } else {
    var markStager = markStagers[scene.marktype];

    if (markStager) {
      markStager(options, stage, scene, x, y, groupType);
    } else {//console.log(`need to render ${scene.marktype}`);
    }
  }
};

function sceneToStage(options, stage, scene) {
  mainStager(options, stage, scene, 0, 0, null);
  sortAxis(stage.axes.x, 0);
  sortAxis(stage.axes.y, 1);
}

function sortAxis(axes, dim) {
  axes.forEach(axis => {
    if (axis.domain) orderDomain(axis.domain, dim);
    axis.ticks.sort((a, b) => a.sourcePosition[dim] - b.sourcePosition[dim]);
    axis.tickText.sort((a, b) => a.position[dim] - b.position[dim]);
  });
}

function orderDomain(domain, dim) {
  if (domain.sourcePosition[dim] > domain.targetPosition[dim]) {
    const temp = domain.targetPosition;
    domain.targetPosition = domain.sourcePosition;
    domain.sourcePosition = temp;
  }
}
},{"./marks/legend":"X84i","./marks/rect":"r12m","./marks/rule":"PKNM","./marks/text":"tIs3","./base":"QMMK","./color":"cOXv","./defaults":"ll2T","./marks/interfaces":"bMa7"}],"ojub":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.targetViewState = targetViewState;
exports.viewStateProps = void 0;
const viewStateProps = ['distance', 'fov', 'lookAt', 'rotationOrbit', 'rotationX', 'zoom'];
exports.viewStateProps = viewStateProps;

function targetViewState(height, width, view) {
  const distance = 10;
  const fov = 60;
  const lookAt = [width / 2, -height / 2, 0]; //add a 4th dimension to make transitions work

  lookAt.push(1);

  if (view === '2d') {
    return {
      distance,
      fov,
      lookAt,
      rotationOrbit: 0,
      rotationX: 0,
      zoom: 10 / height
    };
  } else {
    return {
      distance,
      fov,
      lookAt,
      rotationOrbit: -25,
      rotationX: 60,
      zoom: 9 / height
    };
  }
}
},{}],"PO9l":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Presenter = void 0;

var _base = require("./base");

var _rule = require("./marks/rule");

var _panel = require("./panel");

var _color = require("./color");

var _deckgl = require("./deck.gl-classes/deckgl");

var _defaults = require("./defaults");

var _clone = require("./clone");

var _d3Ease = require("d3-ease");

var _layers = require("./layers");

var _legend = require("./legend");

var _linearInterpolator = require("./deck.gl-classes/linearInterpolator");

var _tsxCreateElement = require("tsx-create-element");

var _patchedCubeArray = require("./patchedCubeArray");

var _enums = require("./enums");

var _stagers = require("./stagers");

var _viewState = require("./viewState");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

/**
 * Class which presents a Stage of chart data using Deck.gl to render.
 */
class Presenter {
  /**
   * Instantiate a new Presenter.
   * @param el Parent HTMLElement to present within.
   * @param style Optional PresenterStyle styling options.
   */
  constructor(el, style) {
    this.el = el;
    this.style = (0, _clone.deepMerge)(_defaults.defaultPresenterStyle, style);
    (0, _panel.initializePanel)(this);
    this._last = {
      view: null,
      height: null,
      width: null,
      cubeCount: null,
      stage: null
    };
  }
  /**
   * Get the previously rendered Stage object.
   */


  get stage() {
    return this._last.stage;
  }
  /**
   * Get the current View camera type.
   */


  get view() {
    return this._last.view;
  }
  /**
   * Cancels any pending animation, calling animationCanceled() on original queue.
   */


  animationCancel() {
    if (this.animationTimer) {
      clearTimeout(this.animationTimer);
      this.animationTimer = null;

      if (this.logger) {
        this.logger(`canceling animation ${this.queuedAnimationOptions && this.queuedAnimationOptions.handlerLabel || 'handler'}`);
      }

      if (this.queuedAnimationOptions && this.queuedAnimationOptions.animationCanceled) {
        this.queuedAnimationOptions.animationCanceled.call(null);
      }
    }
  }
  /**
   * Stops the current animation and queues a new animation.
   * @param handler Function to invoke when timeout is complete.
   * @param timeout Length of time to wait before invoking the handler.
   * @param options Optional QueuedAnimationOptions object.
   */


  animationQueue(handler, timeout, options) {
    if (this.logger) {
      this.logger(`queueing animation ${options && options.waitingLabel || 'waiting'}...`);
    }

    this.animationCancel();
    this.animationTimer = setTimeout(() => {
      if (this.logger) {
        this.logger(`queueing animation ${options && options.handlerLabel || 'handler'}...`);
      }

      handler();
    }, timeout);
  }
  /**
   * Retrieve a sub-element of the rendered output.
   * @param type PresenterElement type of the HTMLElement to retrieve.
   */


  getElement(type) {
    const elements = this.el.getElementsByClassName((0, _panel.className)(type, this));

    if (elements && elements.length) {
      return elements[0];
    }
  }
  /**
   * Present the Vega Scene, or Stage object using Deck.gl.
   * @param sceneOrStage Vega Scene object, or Stage object containing chart layout info.
   * @param height Height of the rendering area.
   * @param width Width of the rendering area.
   * @param config Optional presentation configuration object.
   */


  present(sceneOrStage, height, width, config) {
    this.animationCancel();
    let scene = sceneOrStage;
    let stage;
    let options = {
      offsetX: 0,
      offsetY: 0,
      maxOrdinal: -1,
      ordinalsSpecified: false,
      currAxis: null,
      currFacetRect: null,
      defaultCubeColor: this.style.defaultCubeColor
    }; //determine if this is a vega scene

    if (scene.marktype) {
      stage = (0, _defaults.createStage)(scene.view);
      (0, _stagers.sceneToStage)(options, stage, scene);
    } else {
      stage = sceneOrStage;
    }

    if (!this.deckgl) {
      const classes = (0, _deckgl.createDeckGLClassesForPresenter)({
        doubleClickHandler: () => {
          this.homeCamera();
        }
      });
      this.OrbitControllerClass = classes.OrbitControllerClass;
      const deckProps = {
        onLayerClick: config && config.onLayerClick,
        views: [new _base.base.deck.OrbitView({
          controller: this.OrbitControllerClass
        })],
        container: this.getElement(_enums.PresenterElement.gl),
        getCursor: interactiveState => {
          if (interactiveState.onText || interactiveState.onAxisSelection) {
            return 'pointer';
          } else if (interactiveState.onCube) {
            return 'default';
          } else {
            return 'grab';
          }
        }
      };

      if (stage.backgroundColor) {
        deckProps.style = {
          'background-color': (0, _color.colorToString)(stage.backgroundColor)
        };
      }

      this.deckgl = new classes.DeckGL_Class(deckProps);
    }

    let cubeCount = Math.max(this._last.cubeCount, stage.cubeData.length);

    if (options.ordinalsSpecified) {
      cubeCount = Math.max(cubeCount, options.maxOrdinal + 1);
      const empty = {
        isEmpty: true,
        color: [0, 0, 0, 0] // possibly a bug in Deck.gl? set color to invisible.

      };
      stage.cubeData = (0, _patchedCubeArray.patchCubeArray)(cubeCount, empty, stage.cubeData);
    }

    this.setDeckProps(stage, height, width, cubeCount, config);
    (0, _tsxCreateElement.mount)((0, _legend.LegendView)({
      legend: stage.legend,
      onClick: config && config.onLegendClick
    }), this.getElement(_enums.PresenterElement.legend));

    if (config && config.onPresent) {
      config.onPresent();
    }
  }
  /**
   * Present the same recently rendered Stage with only slight modifications such as a color change,
   * using the previous Stage values as a basis.
   * @param stage Partially populated Stage object containing changes.
   * @param modifyConfig Optional presentation configuration object.
   */


  rePresent(stage, modifyConfig) {
    const newStage = Object.assign(Object.assign({}, this._last.stage), stage);
    this.setDeckProps(newStage, this._last.height, this._last.width, this._last.cubeCount, modifyConfig);
  }

  isNewBounds(view, height, width, cubeCount) {
    const lastBounds = this.lastBounds();

    for (let prop in lastBounds) {
      if (lastBounds[prop] === null) return true;
    }

    const newBounds = {
      cubeCount,
      height,
      view,
      width
    };

    for (let prop in lastBounds) {
      if (lastBounds[prop] !== newBounds[prop]) return true;
    }
  }

  lastBounds() {
    const {
      cubeCount,
      height,
      view,
      width
    } = this._last;
    return {
      cubeCount,
      height,
      view,
      width
    };
  }

  setDeckProps(stage, height, width, cubeCount, modifyConfig) {
    const config = (0, _clone.deepMerge)(_defaults.defaultPresenterConfig, modifyConfig);
    const newBounds = this.isNewBounds(stage.view, height, width, cubeCount);
    let lightSettings = this.style.lightSettings[stage.view];
    let lightingMix = stage.view === '3d' ? 1.0 : 0.0;
    let linearInterpolator; //choose the current OrbitView viewstate if possible

    let viewState = this.deckgl.viewState && Object.keys(this.deckgl.viewState).length && this.deckgl.viewState.OrbitView || //otherwise use the initial viewstate if any
    this.deckgl.props.viewState;

    if (!viewState || newBounds || config.shouldViewstateTransition && config.shouldViewstateTransition()) {
      viewState = (0, _viewState.targetViewState)(height, width, stage.view);
      const oldCubeLayer = (0, _layers.getCubeLayer)(this.deckgl.props);

      if (oldCubeLayer) {
        linearInterpolator = new _linearInterpolator.LinearInterpolator(_viewState.viewStateProps);
        linearInterpolator.layerStartProps = {
          lightingMix: oldCubeLayer.props.lightingMix
        };
        linearInterpolator.layerEndProps = {
          lightingMix
        };
        viewState.transitionDuration = config.transitionDurations.view;
        viewState.transitionEasing = _d3Ease.easeExpInOut;
        viewState.transitionInterpolator = linearInterpolator;
      }

      if (stage.view === '2d') {
        lightSettings = this.style.lightSettings['3d'];
      }
    }

    const guideLines = this._showGuides && (0, _rule.box)(0, 0, height, width, '#0f0', 1, true);
    config.preLayer && config.preLayer(stage);
    const layers = (0, _layers.getLayers)(this, config, stage, lightSettings, lightingMix, linearInterpolator, guideLines);
    const deckProps = {
      views: [new _base.base.deck.OrbitView({
        controller: this.OrbitControllerClass
      })],
      viewState,
      layers
    };

    if (config && config.preStage) {
      config.preStage(stage, deckProps);
    }

    this.deckgl.setProps(deckProps);
    delete stage.cubeData;
    this._last = {
      cubeCount,
      height,
      width,
      stage: stage,
      view: stage.view
    };
  }
  /**
   * Home the camera to the last initial position.
   */


  homeCamera() {
    const viewState = (0, _viewState.targetViewState)(this._last.height, this._last.width, this._last.view);
    viewState.transitionDuration = _defaults.defaultPresenterConfig.transitionDurations.view;
    viewState.transitionEasing = _d3Ease.easeExpInOut;
    viewState.transitionInterpolator = new _linearInterpolator.LinearInterpolator(_viewState.viewStateProps);
    const deckProps = {
      views: this.deckgl.props.views,
      viewState,
      layers: this.deckgl.props.layers
    };
    this.deckgl.setProps(deckProps);
  }
  /**
   * Get cube data array from the cubes layer.
   */


  getCubeData() {
    return (0, _layers.getCubes)(this.deckgl.props);
  }
  /**
   * Show guidelines of rendering height/width and center of OrbitView.
   */


  showGuides() {
    this._showGuides = true;
    this.getElement(_enums.PresenterElement.gl).classList.add('show-center');
    this.rePresent(Object.assign(Object.assign({}, this._last.stage), {
      cubeData: this.getCubeData()
    }));
  }

  finalize() {
    this.animationCancel();
    if (this.deckgl) this.deckgl.finalize();
    if (this.el) this.el.innerHTML = '';
    this._last = null;
    this.deckgl = null;
    this.el = null;
    this.logger = null;
    this.queuedAnimationOptions = null;
  }

}

exports.Presenter = Presenter;
},{"./base":"QMMK","./marks/rule":"PKNM","./panel":"uu24","./color":"cOXv","./deck.gl-classes/deckgl":"RLgC","./defaults":"ll2T","./clone":"WXef","d3-ease":"sA9Z","./layers":"MPcW","./legend":"tuEN","./deck.gl-classes/linearInterpolator":"x1fx","tsx-create-element":"fpJu","./patchedCubeArray":"TRuG","./enums":"oQnJ","./stagers":"axeS","./viewState":"ojub"}],"YrL8":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.RendererGl = void 0;

var _base = require("../base");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
//pass in the SuperClass, which should be a vega.View
function _RendererGl(loader) {
  //dynamic superclass, since we don't know have vega.View in the declaration phase
  class RendererGlInternal extends _base.base.vega.Renderer {
    initialize(el, width, height, origin) {
      this.height = height;
      this.width = width; // this method will invoke resize to size the canvas appropriately

      return super.initialize(el, width, height, origin);
    }

    resize(width, height, origin) {
      super.resize(width, height, origin);
      this.origin = origin;
      this.height = height;
      this.width = width; //rteturn this for vega

      return this;
    }

    _render(scene, items) {
      const scene3d = scene;
      scene3d.view = this.getView();
      this.presenter.present(scene3d, this.height, this.width, this.presenterConfig); //return this for vega

      return this;
    }

  }

  const instance = new RendererGlInternal(loader);
  return instance;
} //signature to allow this function to be used with the 'new' keyword.
//need to trick the compiler by casting to 'any'.

/**
 * Subclass of Vega.Renderer, with added properties for accessing a Presenter.
 * This is instantiated by ViewGl.
 */


const RendererGl = _RendererGl;
exports.RendererGl = RendererGl;
},{"../base":"QMMK"}],"BmIb":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ViewGl = void 0;

var _base = require("../base");

var _defaults = require("../defaults");

var _presenter = require("../presenter");

var _enums = require("../enums");

var _rendererGl = require("./rendererGl");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
let registered = false; //dynamic superclass lets us create a subclass at execution phase instead of declaration phase.
//This allows us to retrieve vega.View from either UMD or ES6 consumers of this class.
//pass in the SuperClass, which should be a vega.View

function _ViewGl(runtime, config) {
  //dynamic superclass, since we don't know have vega.View in the declaration phase
  class ViewGlInternal extends _base.base.vega.View {
    constructor(runtime, config = {}) {
      super(runtime, config);
      this.config = config;
      this.presenter = config.presenter;
      config.presenterConfig = config.presenterConfig || {};

      config.presenterConfig.redraw = () => {
        this._redraw = true; //use Vega View private member _redraw

        this.run();
      };
    }

    renderer(renderer) {
      if (renderer === 'deck.gl' && !registered) {
        _base.base.vega.renderModule('deck.gl', {
          handler: _base.base.vega.CanvasHandler,
          renderer: _rendererGl.RendererGl
        });

        registered = true;
      }

      return super.renderer(renderer);
    }

    initialize(el) {
      if (!this.presenter) {
        this.presenter = new _presenter.Presenter(el);
      }

      super.initialize(this.presenter.getElement(_enums.PresenterElement.vegaControls));
      const renderer = this._renderer;
      renderer.presenterConfig = this.config.presenterConfig;
      renderer.presenter = this.presenter;

      renderer.getView = this.config && this.config.getView || (() => this.presenter.view || _defaults.defaultView);

      return this;
    }

    error(e) {
      if (this.presenter.logger) {
        this.presenter.logger(e);
      }
    }

  }

  const instance = new ViewGlInternal(runtime, config);
  return instance;
} //signature to allow this function to be used with the 'new' keyword.
//need to trick the compiler by casting to 'any'.

/**
 * Subclass of Vega.View, with added properties for accessing a Presenter.
 * This is instantiatable by calling `new ViewGl()`. See https://vega.github.io/vega/docs/api/view/
 */


const ViewGl = _ViewGl;
exports.ViewGl = ViewGl;
},{"../base":"QMMK","../defaults":"ll2T","../presenter":"PO9l","../enums":"oQnJ","./rendererGl":"YrL8"}],"IXYG":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
var _exportNames = {
  constants: true,
  controls: true,
  types: true,
  util: true,
  defaults: true,
  base: true,
  use: true,
  Presenter: true,
  ViewGl: true
};
Object.defineProperty(exports, "base", {
  enumerable: true,
  get: function () {
    return _base.base;
  }
});
Object.defineProperty(exports, "use", {
  enumerable: true,
  get: function () {
    return _base.use;
  }
});
Object.defineProperty(exports, "Presenter", {
  enumerable: true,
  get: function () {
    return _presenter.Presenter;
  }
});
Object.defineProperty(exports, "ViewGl", {
  enumerable: true,
  get: function () {
    return _viewGl.ViewGl;
  }
});
exports.defaults = exports.util = exports.types = exports.controls = exports.constants = void 0;

var constants = _interopRequireWildcard(require("./constants"));

exports.constants = constants;

var controls = _interopRequireWildcard(require("./exports/controls"));

exports.controls = controls;

var types = _interopRequireWildcard(require("./exports/types"));

exports.types = types;

var util = _interopRequireWildcard(require("./exports/util"));

exports.util = util;

var defaults = _interopRequireWildcard(require("./defaults"));

exports.defaults = defaults;

var _base = require("./base");

var _presenter = require("./presenter");

var _viewGl = require("./vega-classes/viewGl");

var _enums = require("./enums");

Object.keys(_enums).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _enums[key];
    }
  });
});

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
},{"./constants":"aLsw","./exports/controls":"Fs2P","./exports/types":"jLyM","./exports/util":"xL0e","./defaults":"ll2T","./base":"QMMK","./presenter":"PO9l","./vega-classes/viewGl":"BmIb","./enums":"oQnJ"}],"zviN":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getColumnsFromData = getColumnsFromData;
exports.inferAll = inferAll;
exports.getStats = getStats;

var VegaDeckGl = _interopRequireWildcard(require("@msrvida/vega-deck.gl"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function isQuantitative(column) {
  return column.type === 'number' || column.type === 'integer';
}
/**
 * Derive column metadata from the data array.
 * @param data Array of data objects.
 */


function getColumnsFromData(data, columnTypes) {
  const sample = data[0];
  const fields = sample ? Object.keys(sample) : [];
  const inferences = Object.assign(Object.assign({}, VegaDeckGl.base.vega.inferTypes(data, fields)), columnTypes);
  const columns = fields.map(name => {
    const column = {
      name,
      type: inferences[name]
    };
    return column;
  });
  inferAll(columns, data);
  return columns;
}
/**
 * Populate columns with type inferences and stats.
 * @param columns Array of columns.
 * @param data Array of data objects.
 */


function inferAll(columns, data) {
  columns.forEach(column => {
    if (column) {
      if (typeof column.quantitative !== 'boolean') {
        column.quantitative = isQuantitative(column);
      }

      if (column.type === 'string') {
        checkIsColorData(data, column);
      }

      if (!column.stats) {
        column.stats = getStats(data, column);
      }
    }
  });
}

function checkIsColorData(data, column) {
  for (let i = 0; i < data.length; i++) {
    if (!VegaDeckGl.util.isColor(data[i][column.name])) {
      return;
    }
  }

  column.isColorData = true;
}

function getStats(data, column) {
  const distinctMap = {};
  const stats = {
    distinctValueCount: null,
    max: null,
    mean: null,
    min: null
  };
  let sum = 0;

  for (let i = 0; i < data.length; i++) {
    let row = data[i];
    let value = row[column.name];
    distinctMap[value] = true;

    if (stats.max === null || value > stats.max) {
      stats.max = value;
    }

    if (stats.min === null || value < stats.min) {
      stats.min = value;
    }

    let num = +value;

    if (!isNaN(num)) {
      sum += num;
    }

    if (column.type === 'string' && !stats.hasColorData && VegaDeckGl.util.isColor(value)) {
      stats.hasColorData = true;
    }
  }

  if (column.quantitative) {
    stats.mean = data.length > 0 && sum / data.length;
    stats.hasNegative = detectNegative(column, data);

    if (column.type === 'integer') {
      stats.isSequential = detectSequentialColumn(column, data);
    }
  }

  stats.distinctValueCount = Object.keys(distinctMap).length;
  return stats;
}

function detectNegative(column, data) {
  for (let i = 1; i < data.length; i++) {
    if (data[i][column.name] < 0) return true;
  }

  return false;
}

function detectSequentialColumn(column, data) {
  if (data.length < 2) return false;
  let colname = column.name;

  for (let i = 1; i < data.length; i++) {
    if (data[i][colname] !== data[i - 1][colname] + 1) return false;
  }

  return true;
}
},{"@msrvida/vega-deck.gl":"IXYG"}],"IHcE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getPresenterStyle = getPresenterStyle;
exports.dualColorSchemeColors = exports.cssPrefix = exports.defaultViewerOptions = void 0;

var VegaDeckGl = _interopRequireWildcard(require("@msrvida/vega-deck.gl"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const {
  defaultPresenterConfig,
  defaultPresenterStyle
} = VegaDeckGl.defaults;
const {
  desaturate
} = VegaDeckGl.util;
const defaultViewerOptions = {
  colors: {
    activeCube: [128, 0, 128, 255],
    defaultCube: defaultPresenterStyle.defaultCubeColor,
    hoveredCube: defaultPresenterStyle.highlightColor,
    selectedCube: [255, 255, 0, 255],
    axisSelectHighlight: [128, 128, 128, 128],
    axisLine: [0, 0, 0, 255],
    axisText: [0, 0, 0, 255],
    cellFillerLine: [128, 128, 128, 255],
    unselectedColorMethod: color => {
      const c = desaturate(color, 0.05);
      c[3] = 171;
      return c;
    }
  },
  language: {
    headers: {
      chart: 'Chart',
      details: 'Details',
      legend: 'Legend',
      selection: 'Select & Filter'
    },
    bing: 'bing',
    newColorMap: 'remap color to filtered items',
    oldColorMap: 'keep same colors',
    deselect: 'deselect',
    exclude: 'exclude',
    isolate: 'isolate',
    legendOther: 'other',
    nextDetail: '>',
    previousDetail: '<',
    reset: 'reset',
    colorBinCount: 'Color bin count',
    colorReverse: 'Color reverse',
    count: 'Count',
    scatterPointSize: 'Point size',
    XBinSize: 'X axis bin size',
    YBinSize: 'Y axis bin size',
    XGridSize: 'X grid size',
    YGridSize: 'Y grid size',
    InnerPaddingSize: 'Inner padding size',
    OuterPaddingSize: 'Outer padding size',
    treeMapMethod: 'Method',
    facetColumns: 'Facet columns',
    facetRows: 'Facet rows',
    markOpacitySignal: 'Mark opacity',
    textScaleSignal: 'Text scale',
    xAxisTextAngleSignal: 'X axis text angle',
    yAxisTextAngleSignal: 'Y axis text angle',
    zScaleProportion: 'Z scale proportion to Y',
    selectionCount: count => `${count} items selected`
  },
  maxLegends: 19,
  onError: errors => {//console.log(`UnitVisViewer errors: ${errors.join('\n')}`);
  },
  transitionDurations: Object.assign(Object.assign({}, defaultPresenterConfig.transitionDurations), {
    scope: 600
  }),
  selectionPolygonZ: -1,
  tickSize: 10,
  facetMargins: {
    column: 40,
    row: 40,
    title: 40
  }
};
exports.defaultViewerOptions = defaultViewerOptions;

function getPresenterStyle(options) {
  var style = {
    cssPrefix,
    fontFamily: options.fontFamily,
    defaultCubeColor: options.colors.defaultCube
  };

  if (options.colors.hoveredCube) {
    style.highlightColor = options.colors.hoveredCube;
  }

  if (options.lightSettings) {
    style.lightSettings = options.lightSettings;
  }

  return style;
}

const cssPrefix = 'sanddance-';
exports.cssPrefix = cssPrefix;
const dualColorSchemeColors = {
  black: '#212121',
  gray: '#D2D2D2',
  blue: '#0060F0',
  green: '#00C000',
  orange: '#FF9900',
  red: '#E00000'
};
exports.dualColorSchemeColors = dualColorSchemeColors;
},{"@msrvida/vega-deck.gl":"IXYG"}],"PJe6":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.isInternalFieldName = isInternalFieldName;
Object.defineProperty(exports, "getColumnsFromData", {
  enumerable: true,
  get: function () {
    return _inference.getColumnsFromData;
  }
});
Object.defineProperty(exports, "getStats", {
  enumerable: true,
  get: function () {
    return _inference.getStats;
  }
});
Object.defineProperty(exports, "inferAll", {
  enumerable: true,
  get: function () {
    return _inference.inferAll;
  }
});
Object.defineProperty(exports, "ensureSearchExpressionGroupArray", {
  enumerable: true,
  get: function () {
    return _group.ensureSearchExpressionGroupArray;
  }
});
Object.defineProperty(exports, "getPresenterStyle", {
  enumerable: true,
  get: function () {
    return _defaults.getPresenterStyle;
  }
});

var VegaDeckGl = _interopRequireWildcard(require("@msrvida/vega-deck.gl"));

var _constants = require("./constants");

var _inference = require("./specs/inference");

var _group = require("./searchExpression/group");

var _defaults = require("./defaults");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const {
  GL_ORDINAL
} = VegaDeckGl.constants;

function isInternalFieldName(columnName, includeVegaDeckGLFields = false) {
  if (includeVegaDeckGLFields) {
    if (columnName === GL_ORDINAL) return true;
  }

  for (let f in _constants.FieldNames) {
    if (columnName === _constants.FieldNames[f]) return true;
  }

  return false;
}
},{"@msrvida/vega-deck.gl":"IXYG","./constants":"X4RB","./specs/inference":"zviN","./searchExpression/group":"DYlx","./defaults":"IHcE"}],"JMCm":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.registerColorSchemes = registerColorSchemes;
exports.colorSchemes = void 0;

var VegaDeckGl = _interopRequireWildcard(require("@msrvida/vega-deck.gl"));

var _constants = require("./specs/constants");

var _defaults = require("./defaults");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const dualPairs = [[_defaults.dualColorSchemeColors.black, _defaults.dualColorSchemeColors.gray], [_defaults.dualColorSchemeColors.red, _defaults.dualColorSchemeColors.green], [_defaults.dualColorSchemeColors.red, _defaults.dualColorSchemeColors.blue], [_defaults.dualColorSchemeColors.black, _defaults.dualColorSchemeColors.red], [_defaults.dualColorSchemeColors.black, _defaults.dualColorSchemeColors.orange], [_defaults.dualColorSchemeColors.black, _defaults.dualColorSchemeColors.green]];
/**
 * Array of color schemes.
 */

const colorSchemes = [{
  scheme: _constants.ColorScaleNone,
  colors: [VegaDeckGl.util.colorToString(_defaults.defaultViewerOptions.colors.defaultCube)]
}];
exports.colorSchemes = colorSchemes;
createDualColorSchemes();

function registerColorSchemes(vega) {
  colorSchemes.forEach(cs => {
    if (cs.colors.length === 1) {
      vega.scheme(cs.scheme, x => cs.colors[0]);
    } else {
      vega.scheme(cs.scheme, cs.colors);
    }
  });
}

function createPair(names, colors) {
  const scheme = `dual_${names[0]}${names[1]}`;
  colorSchemes.push({
    scheme,
    colors
  });
}

function createDualColorSchemes() {
  dualPairs.forEach(colors => {
    const names = colors.map(color => {
      for (let key in _defaults.dualColorSchemeColors) if (color === _defaults.dualColorSchemeColors[key]) return key;
    });
    createPair(names, colors);
    createPair([...names].reverse(), [...colors].reverse());
  });
}
},{"@msrvida/vega-deck.gl":"IXYG","./specs/constants":"lE7J","./defaults":"IHcE"}],"sJX3":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Animator = exports.DataLayoutChange = void 0;
var DataLayoutChange;
exports.DataLayoutChange = DataLayoutChange;

(function (DataLayoutChange) {
  DataLayoutChange[DataLayoutChange["same"] = 0] = "same";
  DataLayoutChange[DataLayoutChange["reset"] = 1] = "reset";
  DataLayoutChange[DataLayoutChange["refine"] = 2] = "refine";
})(DataLayoutChange || (exports.DataLayoutChange = DataLayoutChange = {}));

class Animator {
  constructor(dataScope, props) {
    this.dataScope = dataScope;
    this.props = props;
  }

  select(search) {
    return new Promise((resolve, reject) => {
      this.dataScope.select(search);
      this.props.onDataChanged(DataLayoutChange.same);
      resolve();
    });
  }

  deselect() {
    return new Promise((resolve, reject) => {
      this.dataScope.deselect();
      this.props.onDataChanged(DataLayoutChange.same);
      resolve();
    });
  }

  filter(search, keepData, collapseData) {
    this.dataScope.collapse(true, collapseData);
    return new Promise((resolve, reject) => {
      this.props.onAnimateDataChange(DataLayoutChange.refine, 'before refine', 'refine').then(() => {
        this.dataScope.deselect();
        this.dataScope.setFilteredData(keepData);
        this.props.onDataChanged(DataLayoutChange.refine, search);
        resolve();
      }).catch(reject);
    });
  }

  reset() {
    return new Promise((resolve, reject) => {
      this.dataScope.deselect();
      this.dataScope.setFilteredData(null);
      this.props.onAnimateDataChange(DataLayoutChange.reset, 'before reset', 'reset').then(() => {
        this.dataScope.collapse(false);
        this.props.onDataChanged(DataLayoutChange.reset);
        resolve();
      }).catch(reject);
    });
  }

  activate(datum) {
    return new Promise((resolve, reject) => {
      this.dataScope.activate(datum);
      this.props.onDataChanged(DataLayoutChange.same);
      resolve();
    });
  }

  deactivate() {
    return new Promise((resolve, reject) => {
      this.dataScope.deactivate();
      this.props.onDataChanged(DataLayoutChange.same);
      resolve();
    });
  }

}

exports.Animator = Animator;
},{}],"LWoJ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getSelectedColorMap = getSelectedColorMap;
exports.colorMapFromCubes = colorMapFromCubes;
exports.populateColorContext = populateColorContext;
exports.applyColorMapToCubes = applyColorMapToCubes;

var VegaDeckGl = _interopRequireWildcard(require("@msrvida/vega-deck.gl"));

var _constants = require("./specs/constants");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function getSelectedColorMap(currentData, showSelectedData, showActive, viewerOptions) {
  function getSelectionColorItem(datum) {
    let item;

    if (showSelectedData) {
      item = datum[_constants.FieldNames.Selected] ? {
        color: viewerOptions.colors.selectedCube
      } : {
        unSelected: true
      };
    }

    if (showActive && datum[_constants.FieldNames.Active]) {
      item = {
        color: viewerOptions.colors.activeCube
      };
    }

    return item;
  }

  const colorMap = {};
  currentData.forEach(datum => {
    const selectionColor = getSelectionColorItem(datum);

    if (selectionColor) {
      const ordinal = datum[VegaDeckGl.constants.GL_ORDINAL];
      colorMap[ordinal] = selectionColor;
    }
  });
  return colorMap;
}

function colorMapFromCubes(cubes) {
  const map = {};
  cubes.forEach(cube => {
    map[cube.ordinal] = {
      color: cube.color
    };
  });
  return map;
}

function populateColorContext(colorContext, presenter) {
  if (!colorContext.colorMap) {
    const cubes = presenter.getCubeData();
    colorContext.colorMap = colorMapFromCubes(cubes);
  }

  colorContext.legend = VegaDeckGl.util.clone(presenter.stage.legend);
  colorContext.legendElement = presenter.getElement(VegaDeckGl.PresenterElement.legend).children[0];
}

function applyColorMapToCubes(maps, cubes, unselectedColorMethod) {
  Object.keys(maps[0]).forEach(ordinal => {
    const cube = cubes[+ordinal];

    if (cube && !cube.isEmpty) {
      const actualColorMappedItem = maps[0][ordinal];

      if (maps.length > 1) {
        const selectedColorMappedItem = maps[1][ordinal];

        if (selectedColorMappedItem) {
          if (selectedColorMappedItem.unSelected && unselectedColorMethod) {
            cube.color = unselectedColorMethod(actualColorMappedItem.color);
          } else {
            cube.color = selectedColorMappedItem.color;
          }

          return;
        }
      }

      cube.color = actualColorMappedItem.color;
    }
  });
}
},{"@msrvida/vega-deck.gl":"IXYG","./specs/constants":"lE7J"}],"NVlM":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.applySignalValues = applySignalValues;
exports.extractSignalValuesFromView = extractSignalValuesFromView;

function applySignalValues(sv, b) {
  if (!sv || !b || !b.signals || !b.signals.length) return;

  for (let key in sv) {
    let value = sv[key];
    let signalB = b.signals.filter(signal => signal.name === key)[0];

    if (signalB && signalB.bind) {
      signalB.value = value;
    }
  }
}

function extractSignalValuesFromView(view, spec) {
  if (!view || !spec || !spec.signals || !spec.signals.length) return;
  const result = {};
  spec.signals.forEach(signalA => {
    //bound to a UI control
    if (signalA.bind) {
      try {
        result[signalA.name] = view.signal(signalA.name);
      } catch (e) {// continue regardless of error
      }
    }
  });
  return result;
}
},{}],"SZT5":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.assignOrdinals = assignOrdinals;
exports.getSpecColumns = getSpecColumns;
exports.getDataIndexOfCube = getDataIndexOfCube;

var VegaDeckGl = _interopRequireWildcard(require("@msrvida/vega-deck.gl"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function assignOrdinals(columns, data, ordinalMap) {
  const uCol = columns.uid && columns.uid.name;

  if (ordinalMap) {
    data.forEach((d, i) => {
      const key = uCol ? d[uCol] : i;
      d[VegaDeckGl.constants.GL_ORDINAL] = ordinalMap[key];
    });
  } else {
    ordinalMap = {};
    data.forEach((d, i) => {
      d[VegaDeckGl.constants.GL_ORDINAL] = i;
      const uColValue = uCol ? d[uCol] : i;
      ordinalMap[uColValue] = i;
    });
  }

  return ordinalMap;
}

function getSpecColumns(insight, columns) {
  function getColumnByName(name) {
    return columns.filter(c => c.name === name)[0];
  }

  return {
    color: getColumnByName(insight.columns && insight.columns.color),
    facet: getColumnByName(insight.columns && insight.columns.facet),
    group: getColumnByName(insight.columns && insight.columns.group),
    size: getColumnByName(insight.columns && insight.columns.size),
    sort: getColumnByName(insight.columns && insight.columns.sort),
    uid: getColumnByName(insight.columns && insight.columns.uid),
    x: getColumnByName(insight.columns && insight.columns.x),
    y: getColumnByName(insight.columns && insight.columns.y),
    z: getColumnByName(insight.columns && insight.columns.z)
  };
}

function getDataIndexOfCube(cube, data) {
  const len = data.length;

  for (let i = 0; i < len; i++) {
    if (data[i][VegaDeckGl.constants.GL_ORDINAL] === cube.ordinal) {
      return i;
    }
  }
}
},{"@msrvida/vega-deck.gl":"IXYG"}],"G5nM":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.facetSignals = facetSignals;
exports.checkForFacetErrors = checkForFacetErrors;
exports.facetSize = facetSize;
exports.layout = layout;
exports.facetBinStep = facetBinStep;
exports.facetSourceData = facetSourceData;
exports.facetGroupData = facetGroupData;
exports.facetTransforms = facetTransforms;
exports.facetMarks = facetMarks;
exports.facetTitleSeparator = void 0;

var _constants = require("./constants");

var _vegaDeck = require("@msrvida/vega-deck.gl");

const FacetColumnsSequence = 'FacetColumnsSequence';
const FacetRowsSequence = 'FacetRowsSequence';
const SequenceNumber = 'SequenceNumber';
const CellTitle = 'CellTitle';
const CellFiller = 'CellFiller';
const facetTitleSeparator = ' - ';
exports.facetTitleSeparator = facetTitleSeparator;

function facetSignals(context) {
  const {
    insight
  } = context;
  const {
    facets
  } = insight;
  const signals = [{
    name: _constants.SignalNames.FacetColumns,
    value: facets.columns
  }, {
    name: _constants.SignalNames.FacetRows,
    value: facets.rows
  }];
  return signals;
}

function checkForFacetErrors(facets, errors) {
  if (facets) {
    const gridCapacity = facets.columns * facets.rows;

    if (!gridCapacity) {
      errors.push('Must set facets columns & rows to non-zero.');
    }

    if (gridCapacity < 2) {
      errors.push('Not enough facets to facet.');
    }

    if (!facets.columns || facets.columns < 1) {
      errors.push('Facet column columns must be greater than 1.');
    }

    if (!facets.rows || facets.rows < 1) {
      errors.push('Facet column rows must be greater than 1.');
    }
  }
}

function facetSize(context) {
  const {
    insight,
    specViewOptions
  } = context;
  const {
    facets,
    size
  } = insight;
  return {
    height: (size.height - (facets.rows + 1) * (specViewOptions.tickSize + specViewOptions.facetMargins.column)) / facets.columns,
    width: (size.width - (facets.columns + 1) * (specViewOptions.tickSize + specViewOptions.facetMargins.row)) / facets.rows
  };
}

function layout(context) {
  const {
    specViewOptions
  } = context;
  const layout = {
    columns: {
      signal: _constants.SignalNames.FacetColumns
    },
    bounds: 'full',
    padding: {
      column: specViewOptions.facetMargins.column,
      row: specViewOptions.facetMargins.row
    }
  };
  return layout;
}

function facetBinStep(facetColumn, facetCount) {
  const range = facetColumn.stats.max - facetColumn.stats.min;
  return range / facetCount;
}

function emptyBinsDataSource(name, facetColumn, facets) {
  const gridCapacity = facets.columns * facets.rows;
  const step = facetBinStep(facetColumn, gridCapacity);
  const steps = [];

  for (let i = 0; i < gridCapacity; i++) {
    steps[i] = facetColumn.stats.min + i * step + step / 2;
  }

  const values = steps.map(s => {
    const obj = {};
    obj[_constants.FieldNames.Collapsed] = true;
    obj[facetColumn.name] = s;
    return obj;
  });
  const data = {
    name,
    values
  };
  return data;
}

function facetSourceData(facetColumn, facets, name) {
  let data;

  if (facetColumn && facetColumn.quantitative) {
    data = [{
      name: _constants.DataNames.Pre
    }, emptyBinsDataSource(_constants.DataNames.EmptyBin, facetColumn, facets), {
      name,
      source: [_constants.DataNames.Pre, _constants.DataNames.EmptyBin]
    }];
  } else {
    data = [{
      name
    }];
  }

  return data;
}

function facetGroupData(source) {
  const data = [{
    name: _constants.DataNames.FacetCellTitles,
    source,
    transform: [{
      type: 'aggregate',
      groupby: [CellTitle]
    }]
  }, {
    name: CellFiller,
    transform: [{
      type: 'sequence',
      start: 0,
      step: 1,
      stop: {
        signal: `${_constants.SignalNames.FacetColumns} * ${_constants.SignalNames.FacetRows} - length(data('${_constants.DataNames.FacetCellTitles}'))`
      }
    }]
  }, {
    name: FacetColumnsSequence,
    transform: [{
      type: 'sequence',
      start: 0,
      stop: {
        signal: _constants.SignalNames.FacetColumns
      },
      as: SequenceNumber
    }]
  }, {
    name: FacetRowsSequence,
    transform: [{
      type: 'sequence',
      start: 0,
      stop: {
        signal: _constants.SignalNames.FacetRows
      },
      as: SequenceNumber
    }]
  }];
  return data;
}

function facetTransforms(facetColumn, facets) {
  let transforms;

  if (facetColumn.quantitative) {
    const gridCapacity = facets.columns * facets.rows;
    const step = facetBinStep(facetColumn, gridCapacity);
    transforms = [{
      type: 'bin',
      field: facetColumn.name,
      step,
      nice: false,
      extent: [facetColumn.stats.min, facetColumn.stats.max],
      as: [_constants.FieldNames.FacetBin0, _constants.FieldNames.FacetBin1]
    }, {
      type: 'collect',
      sort: {
        field: _constants.FieldNames.FacetBin0
      }
    }, {
      type: 'formula',
      expr: `format(datum.${_constants.FieldNames.FacetBin0}, '~r') + '${facetTitleSeparator}' + format(datum.${_constants.FieldNames.FacetBin1}, '~r')`,
      as: CellTitle
    }];
  } else {
    transforms = [{
      type: 'formula',
      expr: `datum[${JSON.stringify(facetColumn.name)}]`,
      as: CellTitle
    }];
  }

  return transforms;
}

function facetMarks(specViewOptions, sourceDataName, childMarks, childAxes, childData) {
  //TODO: create a style
  const cellFillerLineColor = _vegaDeck.util.colorToString(specViewOptions.colors.cellFillerLine);

  const style = 'cell';
  const mark = {
    style,
    type: 'group',
    from: {
      facet: {
        name: _constants.DataNames.FacetGroupCell,
        data: sourceDataName,
        groupby: [CellTitle]
      }
    },
    title: {
      frame: 'group',
      offset: specViewOptions.facetMargins.title,
      text: {
        signal: `parent['${CellTitle}']`
      },
      limit: {
        signal: 'width'
      },
      color: _vegaDeck.util.colorToString(specViewOptions.colors.axisText),
      fontSize: {
        signal: _constants.SignalNames.TextSize
      }
    },
    encode: {
      update: {
        width: {
          signal: 'width'
        },
        height: {
          signal: 'height'
        }
      }
    },
    data: childData,
    marks: childMarks.map(mark => {
      if (mark.from && mark.from.data && mark.from.data === sourceDataName) {
        mark.from.data = _constants.DataNames.FacetGroupCell;
      }

      return mark;
    })
  };

  if (childAxes) {
    mark.axes = childAxes.map(axis => {
      const clone = _vegaDeck.util.clone(axis); //remove all labels and titles


      clone.labels = false;
      delete clone.title;
      delete clone.titleAlign;
      delete clone.titleAngle;
      delete clone.titleFontSize;
      return clone;
    });
  }

  const filler = {
    style: 'cell',
    type: 'group',
    from: {
      data: CellFiller
    },
    title: {
      frame: 'group',
      offset: specViewOptions.facetMargins.title,
      text: '',
      fontSize: {
        signal: _constants.SignalNames.TextSize
      }
    },
    encode: {
      update: {
        width: {
          signal: 'width'
        },
        height: {
          signal: 'height'
        }
      }
    }
  };

  if (childAxes) {
    filler.axes = childAxes.map(axis => {
      const clone = _vegaDeck.util.clone(axis); //remove all labels and titles


      clone.labels = false;
      delete clone.title;
      delete clone.titleAlign;
      delete clone.titleAngle;
      delete clone.titleFontSize; //change tick & domain color

      clone.tickColor = cellFillerLineColor;
      clone.domainColor = cellFillerLineColor;
      return clone;
    });
  }

  const rowHeader = {
    type: 'group',
    role: 'row-header',
    from: {
      facet: {
        name: 'row-headers',
        data: FacetRowsSequence,
        groupby: [SequenceNumber]
      }
    }
  };

  if (childAxes) {
    rowHeader.axes = [cloneAndOffsetAxis(childAxes.filter(axis => axis.orient === 'left')[0], specViewOptions.facetMargins.column)];
  }

  const columnFooter = {
    type: 'group',
    role: 'column-footer',
    from: {
      facet: {
        name: 'column-footers',
        data: FacetColumnsSequence,
        groupby: [SequenceNumber]
      }
    }
  };

  if (childAxes) {
    columnFooter.axes = [cloneAndOffsetAxis(childAxes.filter(axis => axis.orient === 'bottom')[0], specViewOptions.facetMargins.row)];
  }

  const marks = [mark, filler, rowHeader, columnFooter];
  return marks;
}

function cloneAndOffsetAxis(axis, margin) {
  if (axis) {
    const clone = _vegaDeck.util.clone(axis);

    clone.offset = margin;
    return clone;
  }
}
},{"./constants":"lE7J","@msrvida/vega-deck.gl":"IXYG"}],"nVyP":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.notNice = notNice;
exports.selectNullOrEmpty = selectNullOrEmpty;
exports.selectExact = selectExact;
exports.selectNone = selectNone;
exports.selectExactAxis = selectExactAxis;
exports.selectBetween = selectBetween;
exports.selectBetweenAxis = selectBetweenAxis;
exports.selectBetweenFacet = selectBetweenFacet;

var _facet = require("./specs/facet");

function notNice(niceValue) {
  //convert "nice" numbers to numeric value
  return (niceValue + '').replace(/,/g, '');
}

function tickValue(axis, i) {
  const tick = axis.tickText[i];
  let value;

  if (tick) {
    value = axis.tickText[i].value;
  }

  return {
    tick,
    value
  };
}

function selectNullOrEmpty(column) {
  const searchExpression = {
    name: column.name,
    operator: 'isnullorEmpty'
  };
  return searchExpression;
}

function selectExact(column, value) {
  if (value == null) {
    return selectNullOrEmpty(column);
  }

  const searchExpression = {
    name: column.name,
    operator: '==',
    value
  };
  return searchExpression;
}

function selectNone(column, values) {
  const expressions = values.map((value, i) => {
    const searchExpression = {
      name: column.name,
      operator: '!=',
      value
    };

    if (i) {
      searchExpression.clause = '&&';
    }

    return searchExpression;
  });
  const searchExpressionGroup = {
    expressions
  };
  return searchExpressionGroup;
}

function selectExactAxis(axis, column, i) {
  const result = tickValue(axis, i);

  if (result.tick) {
    return selectExact(column, result.value);
  }
}

function selectBetween(column, lowValue, highValue, lowOperator = '>=', highOperator = '<') {
  const expressions = [];

  if (lowValue !== undefined) {
    expressions.push({
      name: column.name,
      operator: lowOperator,
      value: lowValue
    });
  }

  if (highValue !== undefined) {
    expressions.push({
      name: column.name,
      operator: highOperator,
      value: highValue
    });
  }

  if (expressions.length > 1) {
    expressions[1].clause = '&&';
  }

  const searchExpressionGroup = {
    expressions
  };
  return searchExpressionGroup;
}

function selectBetweenAxis(axis, column, i) {
  const low = tickValue(axis, i);
  const high = tickValue(axis, i + 1);
  return selectBetween(column, low.value, high.value);
}

function selectBetweenFacet(column, title, isFirst, isLast) {
  const values = title.split(_facet.facetTitleSeparator);
  return selectBetween(column, isFirst ? undefined : values[0], isLast ? undefined : values[1]);
}
},{"./specs/facet":"G5nM"}],"g7ni":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.axisSelectionLayer = axisSelectionLayer;

var VegaDeckGl = _interopRequireWildcard(require("@msrvida/vega-deck.gl"));

var _expression = require("./expression");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function axisSelectionLayer(presenter, specCapabilities, columns, stage, clickHandler, highlightColor, polygonZ) {
  const polygons = [];
  const xRole = specCapabilities.roles.filter(r => r.role === 'x')[0];

  if (xRole && xRole.axisSelection) {
    stage.axes.x.filter(axis => axis.tickText.length).forEach(axis => {
      polygons.push.apply(polygons, axisSelectionPolygons(axis, false, xRole.axisSelection, columns.x));
    });
  }

  const yRole = specCapabilities.roles.filter(r => r.role === 'y')[0];

  if (yRole && yRole.axisSelection) {
    stage.axes.y.filter(axis => axis.tickText.length).forEach(axis => {
      polygons.push.apply(polygons, axisSelectionPolygons(axis, true, yRole.axisSelection, columns.y));
    });
  }

  if (stage.facets) {
    polygons.push.apply(polygons, facetSelectionPolygons(stage.facets, columns.facet));
  } //move polygons to Z


  polygons.forEach(datum => {
    datum.polygon.forEach(p => {
      p[2] = polygonZ;
    });
  });

  const onClick = (o, e) => clickHandler(e.srcEvent, o.object.search);

  const polygonLayer = new VegaDeckGl.base.layers.PolygonLayer({
    autoHighlight: true,
    coordinateSystem: VegaDeckGl.base.deck.COORDINATE_SYSTEM.IDENTITY,
    data: polygons,
    extruded: false,
    highlightColor,
    id: 'selections',
    onHover: (o, e) => {
      if (o.index === -1) {
        presenter.deckgl.interactiveState.onAxisSelection = false;
      } else {
        presenter.deckgl.interactiveState.onAxisSelection = true;
      }
    },
    onClick,
    getElevation: () => 0,
    getFillColor: () => [0, 0, 0, 0],
    pickable: true,
    stroked: false
  });
  return polygonLayer;
}

function axisSelectionPolygons(axis, vertical, axisSelectionType, column) {
  const polygons = [];
  const size = 50;
  const getSearch = axisSelectionType === 'exact' ? (a, c, i) => ({
    expressions: [(0, _expression.selectExactAxis)(a, c, i)]
  }) : _expression.selectBetweenAxis;
  const {
    domain,
    ticks
  } = axis;

  if (ticks.length > 0 && domain) {
    const dim = vertical ? 1 : 0;
    const between = Math.abs(ticks[0].sourcePosition[dim] - domain.sourcePosition[dim]) > 1;
    let divisions;

    if (between) {
      divisions = [];

      for (let i = 1; i < ticks.length; i++) {
        divisions.push((ticks[i].sourcePosition[dim] + ticks[i - 1].sourcePosition[dim]) / 2);
      }
    } else {
      divisions = ticks.slice(1, -1).map(tick => tick.sourcePosition[dim]);
    }

    const add = (p2, i) => {
      var coords = [[p1, q1], [p2, q1], [p2, q2], [p1, q2]];
      polygons.push({
        search: getSearch(axis, column, i),
        polygon: vertical ? coords.map(xy => xy.reverse()) : coords
      });
      p1 = p2;
    };

    let p1 = domain.sourcePosition[dim];
    const q1 = domain.sourcePosition[vertical ? 0 : 1];
    const q2 = q1 - size;
    divisions.forEach(add);
    add(domain.targetPosition[dim], ticks.length - (between ? 1 : 2));
  }

  return polygons;
}

function facetSelectionPolygons(facetRects, facetColumn) {
  const polygons = [];
  facetRects.forEach((facetRect, i) => {
    //take any 2 lines to get a box dimension
    const [x, y] = minMaxPoints(facetRect.lines.slice(2));
    const search = facetRect.facetTitle ? facetColumn.quantitative ? (0, _expression.selectBetweenFacet)(facetColumn, facetRect.facetTitle.text, i === 0, i === facetRects.length - 1) : {
      expressions: [(0, _expression.selectExact)(facetColumn, facetRect.facetTitle.text)]
    } : {
      expressions: [(0, _expression.selectNullOrEmpty)(facetColumn)]
    };
    polygons.push({
      search,
      polygon: [[x.min, y.min], [x.max, y.min], [x.max, y.max], [x.min, y.max]]
    });
  });
  return polygons;
}

function minMaxPoints(lines) {
  const points = [];
  lines.forEach(line => {
    [line.sourcePosition, line.targetPosition].forEach(point => {
      points.push(point);
    });
  });
  return [0, 1].map(dim => {
    let minMax = {
      min: null,
      max: null
    };
    points.forEach(point => {
      if (minMax.max == null) {
        minMax.max = point[dim];
      } else {
        minMax.max = Math.max(minMax.max, point[dim]);
      }

      if (minMax.min == null) {
        minMax.min = point[dim];
      } else {
        minMax.min = Math.min(minMax.min, point[dim]);
      }
    });
    return minMax;
  });
}
},{"@msrvida/vega-deck.gl":"IXYG","./expression":"nVyP"}],"pH50":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.columnToAxisType = columnToAxisType;
exports.partialAxes = partialAxes;
exports.AxisType = void 0;

var _constants = require("./constants");

var _vegaDeck = require("@msrvida/vega-deck.gl");

var AxisType;
exports.AxisType = AxisType;

(function (AxisType) {
  AxisType[AxisType["quantitative"] = 0] = "quantitative";
  AxisType[AxisType["categoric"] = 1] = "categoric";
  AxisType[AxisType["date"] = 2] = "date";
})(AxisType || (exports.AxisType = AxisType = {}));

function columnToAxisType(c) {
  if (c.quantitative) {
    return AxisType.quantitative;
  }

  return AxisType.categoric;
}

function partialAxes(specViewOptions, bottomType, leftType) {
  const lineColor = _vegaDeck.util.colorToString(specViewOptions.colors.axisLine);

  const axisColor = {
    domainColor: lineColor,
    tickColor: lineColor,
    labelColor: _vegaDeck.util.colorToString(specViewOptions.colors.axisText)
  };
  const bottom = Object.assign({
    orient: 'bottom',
    labelAlign: 'left',
    labelAngle: {
      signal: _constants.SignalNames.TextAngleX
    },
    labelFontSize: {
      signal: _constants.SignalNames.TextSize
    },
    titleAngle: {
      signal: _constants.SignalNames.TextAngleX
    },
    titleAlign: 'left',
    titleFontSize: {
      signal: _constants.SignalNames.TextTitleSize
    },
    titleColor: _vegaDeck.util.colorToString(specViewOptions.colors.axisText),
    tickSize: specViewOptions.tickSize
  }, axisColor);

  if (bottomType === AxisType.quantitative) {
    bottom.format = '~r';
  }

  const left = Object.assign({
    orient: 'left',
    labelAlign: 'right',
    labelAngle: {
      signal: _constants.SignalNames.TextAngleY
    },
    labelFontSize: {
      signal: _constants.SignalNames.TextSize
    },
    titleAngle: {
      signal: _constants.SignalNames.TextAngleY
    },
    titleAlign: 'right',
    titleFontSize: {
      signal: _constants.SignalNames.TextTitleSize
    },
    titleColor: _vegaDeck.util.colorToString(specViewOptions.colors.axisText),
    tickSize: specViewOptions.tickSize
  }, axisColor);

  if (leftType === AxisType.quantitative) {
    left.format = '~r';
  }

  return {
    left,
    bottom
  };
}
},{"./constants":"lE7J","@msrvida/vega-deck.gl":"IXYG"}],"Eujb":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _axes = require("../axes");

var _constants = require("../constants");

function _default(context) {
  const {
    specColumns,
    specViewOptions
  } = context;
  const pa = (0, _axes.partialAxes)(specViewOptions, _axes.AxisType.quantitative, (0, _axes.columnToAxisType)(specColumns.y));
  const axes = [Object.assign({
    scale: _constants.ScaleNames.Y,
    title: specColumns.y.name
  }, pa.left), Object.assign({
    scale: _constants.BarChartScaleNames.levelScale,
    title: specViewOptions.language.count,
    encode: {
      labels: {
        update: {
          text: {
            signal: `${_constants.BarChartSignalNames.compartmentsPerLevelSignal} * datum.value`
          }
        }
      }
    }
  }, pa.bottom)];
  return axes;
}
},{"../axes":"pH50","../constants":"lE7J"}],"WTHz":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constants = require("../constants");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context) {
  const {
    specColumns
  } = context;
  const stackTransform = {
    type: 'stack',
    groupby: [{
      field: specColumns.y.name
    }],
    as: [_constants.FieldNames.BarChartStack0, _constants.FieldNames.BarChartStack1]
  };

  if (specColumns.sort) {
    stackTransform.sort = {
      field: specColumns.sort.name
    };
  }

  const transforms = [stackTransform, {
    type: 'extent',
    signal: _constants.BarChartSignalNames.levelExtentSignal,
    field: _constants.FieldNames.BarChartStack1
  }];
  return transforms;
}
},{"../constants":"lE7J"}],"KQm2":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constants = require("../constants");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context, groupBy) {
  const {
    specColumns
  } = context;
  const bucket_extent = 'bucket_extent';
  const stackTransform = {
    type: 'stack',
    groupby: [_constants.FieldNames.BarChartBin0],
    as: [_constants.FieldNames.BarChartStack0, _constants.FieldNames.BarChartStack1]
  };

  if (groupBy) {
    stackTransform.groupby.push(groupBy.name);
  }

  if (specColumns.sort) {
    stackTransform.sort = {
      field: specColumns.sort.name
    };
  }

  const transforms = [{
    type: 'extent',
    field: specColumns.y.name,
    signal: bucket_extent
  }, {
    type: 'bin',
    field: specColumns.y.name,
    extent: {
      signal: bucket_extent
    },
    maxbins: {
      signal: _constants.SignalNames.YBins
    },
    as: [_constants.FieldNames.BarChartBin0, _constants.FieldNames.BarChartBin1],
    signal: _constants.BarChartSignalNames.quantitativeBinSignal
  }, stackTransform, {
    type: 'extent',
    signal: _constants.BarChartSignalNames.levelExtentSignal,
    field: _constants.FieldNames.BarChartStack1
  }];
  return transforms;
}
},{"../constants":"lE7J"}],"vEfp":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.allTruthy = allTruthy;

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

/**
 * Returns array with items which are truthy.
 * @param args array or arrays to concat into a single array.
 */
function allTruthy(...args) {
  return args.reduce((p, c) => c ? p.concat(c) : p, []).filter(Boolean);
}
},{}],"Wjzt":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.topLookup = topLookup;

var _constants = require("./constants");

function topLookup(column, count) {
  const data = [{
    name: _constants.DataNames.TopLookup,
    source: _constants.DataNames.Main,
    transform: [{
      type: 'aggregate',
      groupby: [column.name]
    }, {
      type: 'window',
      ops: ['count'],
      as: [_constants.FieldNames.TopIndex]
    }, {
      type: 'filter',
      expr: `datum.${_constants.FieldNames.TopIndex} <= ${count}`
    }]
  }, {
    name: _constants.DataNames.Legend,
    source: _constants.DataNames.Main,
    transform: [{
      type: 'lookup',
      from: _constants.DataNames.TopLookup,
      key: column.name,
      fields: [column.name],
      values: [column.name],
      as: [_constants.FieldNames.Top]
    }, {
      type: 'formula',
      expr: `datum.${_constants.FieldNames.Top} == null ? '${_constants.Other}' : datum.${_constants.FieldNames.Top}`,
      as: _constants.FieldNames.Top
    }]
  }];
  return data;
}
},{"./constants":"lE7J"}],"IlVI":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.bucketed = bucketed;
exports.stacked = stacked;

var _transform = _interopRequireDefault(require("./transform.qualitative"));

var _transform2 = _interopRequireDefault(require("./transform.quantitative"));

var _array = require("../../array");

var _constants = require("../constants");

var _facet = require("../facet");

var _top = require("../top");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context, namespace) {
  const {
    specColumns,
    insight,
    specViewOptions
  } = context;
  const categoricalColor = specColumns.color && !specColumns.color.quantitative;
  const nestedDataName = specColumns.facet && specColumns.facet.quantitative ? _constants.DataNames.Pre : _constants.DataNames.Main;
  const data = (0, _array.allTruthy)((0, _facet.facetSourceData)(specColumns.facet, insight.facets, _constants.DataNames.Main), categoricalColor && (0, _top.topLookup)(specColumns.color, specViewOptions.maxLegends), [bucketed(context, namespace, categoricalColor ? _constants.DataNames.Legend : nestedDataName), stacked(namespace, namespace.bucket, specColumns.facet && (0, _facet.facetTransforms)(specColumns.facet, insight.facets))], specColumns.y.quantitative && [{
    name: _constants.DataNames.QuantitativeData,
    transform: [{
      type: 'sequence',
      start: {
        signal: `${_constants.BarChartSignalNames.quantitativeBinSignal}.start`
      },
      stop: {
        signal: `${_constants.BarChartSignalNames.quantitativeBinSignal}.stop`
      },
      step: {
        signal: `${_constants.BarChartSignalNames.quantitativeBinSignal}.step`
      }
    }]
  }], specColumns.facet && (0, _facet.facetGroupData)(namespace.stacked));
  return data;
}

function bucketed(context, namespace, source) {
  const {
    specColumns: columns
  } = context;
  const data = {
    name: namespace.bucket,
    source,
    transform: columns.y.quantitative ? (0, _transform2.default)(context, columns.facet) : (0, _transform.default)(context)
  };
  return data;
}

function stacked(namespace, source, transforms) {
  const data = {
    name: namespace.stacked,
    source,
    transform: (0, _array.allTruthy)(transforms, xy(namespace))
  };
  return data;
}

function xy(namespace) {
  const transforms = [{
    type: 'formula',
    expr: `floor(datum.${_constants.FieldNames.BarChartStack0} / ${_constants.BarChartSignalNames.compartmentsPerLevelSignal})`,
    as: namespace.__level
  }, {
    type: 'formula',
    expr: `datum.${_constants.FieldNames.BarChartStack0} % ${_constants.BarChartSignalNames.compartmentsPerLevelSignal}`,
    as: namespace.__compartment
  }];
  return transforms;
}
},{"./transform.qualitative":"WTHz","./transform.quantitative":"KQm2","../../array":"vEfp","../constants":"lE7J","../facet":"G5nM","../top":"Wjzt"}],"zTeX":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.fill = fill;
exports.opacity = opacity;

var _constants = require("./constants");

var _vegaDeck = require("@msrvida/vega-deck.gl");

function fill(context) {
  const {
    specColumns,
    insight,
    specViewOptions
  } = context;
  const colorColumn = specColumns.color;
  return colorColumn ? colorColumn.isColorData || insight.directColor ? {
    field: colorColumn.name
  } : {
    scale: _constants.ScaleNames.Color,
    field: colorColumn.quantitative ? colorColumn.name : _constants.FieldNames.Top
  } : {
    value: _vegaDeck.util.colorToString(specViewOptions.colors.defaultCube)
  };
}

function opacity(context) {
  const result = {
    signal: _constants.SignalNames.MarkOpacity
  };
  return result;
}
},{"./constants":"lE7J","@msrvida/vega-deck.gl":"IXYG"}],"lYO7":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.testForCollapseSelection = testForCollapseSelection;

var _constants = require("./constants");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function testForCollapseSelection() {
  return `datum.${_constants.FieldNames.Collapsed}`;
}
},{"./constants":"lE7J"}],"ghTQ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var VegaDeckGl = _interopRequireWildcard(require("@msrvida/vega-deck.gl"));

var _constants = require("../constants");

var _fill = require("../fill");

var _selection = require("../selection");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context, namespace) {
  const {
    specColumns
  } = context;
  const mark = {
    type: 'rect',
    from: {
      data: namespace.stacked
    },
    encode: {
      update: {
        y: {
          scale: _constants.ScaleNames.Y,
          field: specColumns.y.quantitative ? _constants.FieldNames.BarChartBin0 : specColumns.y.name,
          offset: {
            scale: _constants.BarChartScaleNames.compartmentScale,
            field: namespace.__compartment
          }
        },
        height: [{
          test: `bandwidth('${_constants.BarChartScaleNames.compartmentScale}') < 1`,
          value: VegaDeckGl.defaults.minPixelSize
        }, {
          scale: _constants.BarChartScaleNames.compartmentScale,
          band: 1
        }],
        x: [{
          scale: _constants.ScaleNames.X,
          test: (0, _selection.testForCollapseSelection)(),
          signal: `${_constants.SignalNames.XDomain}[0]`
        }, {
          scale: _constants.ScaleNames.X,
          field: namespace.__level,
          band: 1,
          offset: {
            signal: `-bandwidth('${_constants.ScaleNames.X}')-1`
          }
        }],
        width: [{
          test: (0, _selection.testForCollapseSelection)(),
          value: 0
        }, {
          test: `bandwidth('${_constants.ScaleNames.X}') < 1`,
          value: VegaDeckGl.defaults.minPixelSize
        }, {
          scale: _constants.ScaleNames.X,
          band: 1
        }],
        fill: (0, _fill.fill)(context),
        opacity: (0, _fill.opacity)(context)
      }
    }
  };

  if (specColumns.z) {
    const update = mark.encode.update;
    update.z = {
      value: 0
    };
    update.depth = [{
      test: (0, _selection.testForCollapseSelection)(),
      value: 0
    }, {
      scale: _constants.ScaleNames.Z,
      field: specColumns.z.name
    }];
  }

  return [mark];
}
},{"@msrvida/vega-deck.gl":"IXYG","../constants":"lE7J","../fill":"zTeX","../selection":"lYO7"}],"G1G9":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constants = require("../constants");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context, namespace) {
  const {
    specColumns
  } = context;
  const scales = [{
    name: _constants.BarChartScaleNames.bucketScale,
    type: 'band',
    range: 'height',
    domain: {
      data: namespace.bucket,
      field: specColumns.y.name,
      sort: true
    }
  }, {
    name: _constants.ScaleNames.Y,
    type: 'band',
    range: [0, {
      signal: 'height'
    }],
    padding: 0.01,
    domain: {
      data: namespace.stacked,
      field: specColumns.y.name,
      sort: true
    },
    reverse: true
  }];
  return scales;
}
},{"../constants":"lE7J"}],"wNwz":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constants = require("../constants");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default() {
  const scales = [{
    name: _constants.ScaleNames.Y,
    type: 'band',
    range: [0, {
      signal: 'height'
    }],
    padding: 0.01,
    domain: {
      data: _constants.DataNames.QuantitativeData,
      field: 'data',
      sort: true
    },
    reverse: true
  }];
  return scales;
}
},{"../constants":"lE7J"}],"SMhG":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.linearScale = linearScale;
exports.pointScale = pointScale;
exports.binnableColorScale = binnableColorScale;

var _constants = require("./constants");

function linearScale(name, data, field, range, reverse, zero) {
  const scale = {
    name,
    type: 'linear',
    range,
    round: true,
    reverse,
    domain: {
      data,
      field
    },
    zero,
    nice: true
  };
  return scale;
}

function pointScale(name, data, range, field, reverse) {
  const scale = {
    name,
    type: 'point',
    range,
    domain: {
      data,
      field,
      sort: true
    },
    padding: 0.5
  };

  if (reverse !== undefined) {
    scale.reverse = reverse;
  }

  return scale;
}

function binnableColorScale(colorBin, data, field, scheme) {
  scheme = scheme || _constants.ColorScaleNone;
  const name = _constants.ScaleNames.Color;
  const domain = {
    data,
    field
  };
  const range = {
    scheme
  };
  const reverse = {
    signal: _constants.SignalNames.ColorReverse
  };

  if (colorBin !== 'continuous') {
    range.count = {
      signal: _constants.SignalNames.ColorBinCount
    };
  }

  switch (colorBin) {
    case 'continuous':
      {
        const sequentialScale = {
          name,
          type: 'linear',
          domain,
          range,
          reverse
        };
        return sequentialScale;
      }

    case 'quantile':
      {
        const quantileScale = {
          name,
          type: 'quantile',
          domain,
          range,
          reverse
        };
        return quantileScale;
      }

    default:
      {
        const quantizeScale = {
          name,
          type: 'quantize',
          domain,
          range,
          reverse
        };
        return quantizeScale;
      }
  }
}
},{"./constants":"lE7J"}],"hgmt":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _scales = _interopRequireDefault(require("./scales.qualitative"));

var _scales2 = _interopRequireDefault(require("./scales.quantitative"));

var _constants = require("../constants");

var _scales3 = require("../scales");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context, namespace) {
  const {
    specColumns,
    insight
  } = context;
  const scales = [{
    name: _constants.BarChartScaleNames.compartmentScale,
    type: 'band',
    range: [0, {
      signal: _constants.BarChartSignalNames.compartmentHeightSignal
    }],
    padding: 0.1,
    domain: {
      signal: `sequence(0, ${_constants.BarChartSignalNames.compartmentsPerLevelSignal}+1, 1)`
    }
  }, {
    name: _constants.BarChartScaleNames.levelScale,
    range: [{
      signal: '0'
    }, {
      signal: 'width'
    }],
    round: true,
    domain: {
      data: namespace.stacked,
      field: namespace.__level,
      sort: true
    },
    zero: true,
    nice: true
  }, {
    name: _constants.ScaleNames.X,
    type: 'band',
    range: [{
      signal: '0'
    }, {
      signal: 'width'
    }],
    padding: 0.1,
    round: false,
    reverse: false,
    align: 1,
    domain: {
      data: namespace.stacked,
      field: namespace.__level,
      sort: true
    }
  }];

  if (specColumns.color && !specColumns.color.isColorData && !insight.directColor) {
    if (specColumns.color.quantitative) {
      scales.push((0, _scales3.binnableColorScale)(insight.colorBin, namespace.bucket, specColumns.color.name, insight.scheme));
    } else {
      scales.push({
        name: _constants.ScaleNames.Color,
        type: 'ordinal',
        domain: {
          data: namespace.bucket,
          field: _constants.FieldNames.Top,
          sort: true
        },
        range: {
          scheme: insight.scheme || _constants.ColorScaleNone
        },
        reverse: {
          signal: _constants.SignalNames.ColorReverse
        }
      });
    }
  }

  if (specColumns.z) {
    const zRange = [0, {
      signal: _constants.SignalNames.ZHeight
    }];
    scales.push(specColumns.z.quantitative ? (0, _scales3.linearScale)(_constants.ScaleNames.Z, _constants.DataNames.Main, specColumns.z.name, zRange, false, true) : (0, _scales3.pointScale)(_constants.ScaleNames.Z, _constants.DataNames.Main, zRange, specColumns.z.name));
  }

  return scales.concat(specColumns.y.quantitative ? (0, _scales2.default)() : (0, _scales.default)(context, namespace));
}
},{"./scales.qualitative":"G1G9","./scales.quantitative":"wNwz","../constants":"lE7J","../scales":"SMhG"}],"iEcA":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.textSignals = textSignals;
exports.colorBinCountSignal = colorBinCountSignal;
exports.colorReverseSignal = colorReverseSignal;
exports.defaultZProportion = void 0;

var _constants = require("./constants");

const defaultZProportion = 0.6;
exports.defaultZProportion = defaultZProportion;

function textSignals(context) {
  const {
    specViewOptions
  } = context;
  const signals = [{
    name: _constants.SignalNames.ZProportion,
    value: defaultZProportion,
    bind: {
      name: specViewOptions.language.zScaleProportion,
      debounce: 50,
      input: 'range',
      min: 0.2,
      max: 2,
      step: 0.1
    }
  }, {
    name: _constants.SignalNames.ZHeight,
    update: `height * ${_constants.SignalNames.ZProportion}`
  }, {
    name: _constants.SignalNames.TextScale,
    value: 2,
    bind: {
      name: specViewOptions.language.textScaleSignal,
      debounce: 50,
      input: 'range',
      min: 1,
      max: 5,
      step: 0.5
    }
  }, {
    name: _constants.SignalNames.TextSize,
    update: `${_constants.SignalNames.TextScale} * 10`
  }, {
    name: _constants.SignalNames.TextTitleSize,
    update: `${_constants.SignalNames.TextScale} * 15`
  }, {
    name: _constants.SignalNames.TextAngleX,
    value: 30,
    bind: {
      name: specViewOptions.language.xAxisTextAngleSignal,
      debounce: 50,
      input: 'range',
      min: 0,
      max: 90,
      step: 1
    }
  }, {
    name: _constants.SignalNames.TextAngleY,
    value: 0,
    bind: {
      name: specViewOptions.language.yAxisTextAngleSignal,
      debounce: 50,
      input: 'range',
      min: -90,
      max: 0,
      step: 1
    }
  }, {
    name: _constants.SignalNames.MarkOpacity,
    value: 1,
    bind: {
      name: specViewOptions.language.markOpacitySignal,
      debounce: 50,
      input: 'range',
      min: 0.1,
      max: 1,
      step: 0.05
    }
  }];
  return signals;
}

function colorBinCountSignal(context) {
  const {
    specViewOptions
  } = context;
  const signal = {
    name: _constants.SignalNames.ColorBinCount,
    value: 7,
    bind: {
      name: specViewOptions.language.colorBinCount,
      input: 'range',
      min: 1,
      max: specViewOptions.maxLegends + 1,
      step: 1
    }
  };
  return signal;
}

function colorReverseSignal(context) {
  const {
    specViewOptions
  } = context;
  const signal = {
    name: _constants.SignalNames.ColorReverse,
    value: false,
    bind: {
      name: specViewOptions.language.colorReverse,
      input: 'checkbox'
    }
  };
  return signal;
}
},{"./constants":"lE7J"}],"Hk0h":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _array = require("../../array");

var _constants = require("../constants");

var _signals = require("../signals");

var _facet = require("../facet");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context) {
  const {
    specColumns,
    specViewOptions
  } = context;
  const signals = (0, _array.allTruthy)((0, _signals.textSignals)(context), [{
    name: _constants.SignalNames.XDomain,
    update: `domain('${_constants.ScaleNames.X}')`
  }, specColumns.y.quantitative && {
    name: _constants.SignalNames.YBins,
    value: 7,
    bind: {
      name: specViewOptions.language.YBinSize,
      input: 'range',
      min: 1,
      max: 20,
      step: 1
    }
  }, {
    name: _constants.BarChartSignalNames.compartmentHeightSignal,
    update: `bandwidth('${specColumns.y.quantitative ? _constants.ScaleNames.Y : _constants.BarChartScaleNames.bucketScale}')`
  }, {
    name: _constants.BarChartSignalNames.aspectRatioSignal,
    update: `${_constants.BarChartSignalNames.compartmentHeightSignal}/width`
  }, {
    name: _constants.BarChartSignalNames.compartmentsPerLevelSignal,
    update: `ceil(sqrt(${_constants.BarChartSignalNames.aspectRatioSignal}*${_constants.BarChartSignalNames.levelExtentSignal}[1]))`
  }, (0, _signals.colorBinCountSignal)(context), (0, _signals.colorReverseSignal)(context)], specColumns.facet && (0, _facet.facetSignals)(context));
  return signals;
}
},{"../../array":"vEfp","../constants":"lE7J","../signals":"iEcA","../facet":"G5nM"}],"OiCi":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getLegends = getLegends;

var _constants = require("./constants");

function legend(column) {
  const legend = {
    orient: 'none',
    title: column.name,
    fill: _constants.ScaleNames.Color,
    encode: {
      symbols: {
        update: {
          shape: {
            value: 'square'
          }
        }
      }
    }
  };

  if (column.quantitative) {
    legend.type = 'symbol';
    legend.format = '~r';
  }

  return legend;
}

function getLegends(context) {
  const {
    specColumns,
    insight
  } = context;

  if (specColumns.color && !insight.hideLegend && !insight.directColor && !specColumns.color.isColorData) {
    return [legend(specColumns.color)];
  }
}
},{"./constants":"lE7J"}],"wFiV":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.BarChartNameSpace = void 0;

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
class BarChartNameSpace {
  constructor(nameSpace = '') {
    ['bucket', 'stacked', '__compartment', '__level'].forEach(name => {
      this[name] = `${name}${nameSpace}`;
    });
  }

}

exports.BarChartNameSpace = BarChartNameSpace;
},{}],"zw2H":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.barchartH = void 0;

var _axes = _interopRequireDefault(require("./axes"));

var _data = _interopRequireWildcard(require("./data"));

var _marks = _interopRequireDefault(require("./marks"));

var _scales = _interopRequireDefault(require("./scales"));

var _signals = _interopRequireDefault(require("./signals"));

var _facet = require("../facet");

var _constants = require("../constants");

var _legends = require("../legends");

var _namespace = require("../namespace");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const barchartH = context => {
  const {
    specColumns,
    insight,
    specViewOptions
  } = context;
  const errors = [];
  if (!specColumns.y) errors.push('Must set a field for y axis');
  (0, _facet.checkForFacetErrors)(insight.facets, errors);
  const specCapabilities = {
    roles: [{
      role: 'y',
      binnable: true,
      axisSelection: specColumns.y && specColumns.y.quantitative ? 'range' : 'exact',
      signals: [_constants.SignalNames.YBins]
    }, {
      role: 'z',
      allowNone: true
    }, {
      role: 'color',
      allowNone: true
    }, {
      role: 'sort',
      allowNone: true
    }, {
      role: 'facet',
      allowNone: true
    }]
  };

  if (errors.length) {
    return {
      errors,
      specCapabilities,
      vegaSpec: null
    };
  }

  const rootNamespace = new _namespace.BarChartNameSpace();
  let axes;

  if (!insight.hideAxes) {
    axes = (0, _axes.default)(context);
  }

  let marks;

  if (specColumns.facet) {
    const cellNamespace = new _namespace.BarChartNameSpace('Cell');
    const cellMarks = (0, _marks.default)(context, cellNamespace);
    const cd = specColumns.y.quantitative ? [(0, _data.stacked)(cellNamespace, _constants.DataNames.FacetGroupCell)] : [(0, _data.bucketed)(context, cellNamespace, _constants.DataNames.FacetGroupCell), (0, _data.stacked)(cellNamespace, cellNamespace.bucket)];
    marks = (0, _facet.facetMarks)(specViewOptions, rootNamespace.stacked, cellMarks, axes, cd);
    axes = [];
  } else {
    marks = (0, _marks.default)(context, rootNamespace);
  }

  const size = specColumns.facet ? (0, _facet.facetSize)(context) : insight.size;
  var vegaSpec = {
    $schema: 'https://vega.github.io/schema/vega/v3.json',
    height: size.height,
    width: size.width,
    signals: (0, _signals.default)(context),
    scales: (0, _scales.default)(context, rootNamespace),
    data: (0, _data.default)(context, rootNamespace),
    marks
  };

  if (!insight.hideAxes && axes && axes.length) {
    vegaSpec.axes = axes;
  }

  const legends = (0, _legends.getLegends)(context);

  if (legends) {
    vegaSpec.legends = legends;
  }

  if (specColumns.facet) {
    vegaSpec.layout = (0, _facet.layout)(context);
  } else {
    //use autosize only when not faceting
    vegaSpec.autosize = 'fit';
  }

  return {
    vegaSpec,
    specCapabilities
  };
};

exports.barchartH = barchartH;
},{"./axes":"Eujb","./data":"IlVI","./marks":"ghTQ","./scales":"hgmt","./signals":"Hk0h","../facet":"G5nM","../constants":"lE7J","../legends":"OiCi","../namespace":"wFiV"}],"auOE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _axes = require("../axes");

var _constants = require("../constants");

function _default(context) {
  const {
    specColumns,
    specViewOptions
  } = context;
  const pa = (0, _axes.partialAxes)(specViewOptions, (0, _axes.columnToAxisType)(specColumns.x), _axes.AxisType.quantitative);
  const axes = [Object.assign({
    scale: _constants.ScaleNames.X,
    title: specColumns.x.name
  }, pa.bottom), Object.assign({
    scale: _constants.BarChartScaleNames.levelScale,
    title: specViewOptions.language.count,
    encode: {
      labels: {
        update: {
          text: {
            signal: `${_constants.BarChartSignalNames.compartmentsPerLevelSignal} * datum.value`
          }
        }
      }
    }
  }, pa.left)];
  return axes;
}
},{"../axes":"pH50","../constants":"lE7J"}],"qAPu":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constants = require("../constants");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context) {
  const {
    specColumns
  } = context;
  const stackTransform = {
    type: 'stack',
    groupby: [{
      field: specColumns.x.name
    }],
    as: [_constants.FieldNames.BarChartStack0, _constants.FieldNames.BarChartStack1]
  };

  if (specColumns.sort) {
    stackTransform.sort = {
      field: specColumns.sort.name
    };
  }

  const transforms = [stackTransform, {
    type: 'extent',
    signal: _constants.BarChartSignalNames.levelExtentSignal,
    field: _constants.FieldNames.BarChartStack1
  }];
  return transforms;
}
},{"../constants":"lE7J"}],"vG7I":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constants = require("../constants");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context, groupBy) {
  const {
    specColumns
  } = context;
  const bucket_extent = 'bucket_extent';
  const stackTransform = {
    type: 'stack',
    groupby: [_constants.FieldNames.BarChartBin0],
    as: [_constants.FieldNames.BarChartStack0, _constants.FieldNames.BarChartStack1]
  };

  if (groupBy) {
    stackTransform.groupby.push(groupBy.name);
  }

  if (specColumns.sort) {
    stackTransform.sort = {
      field: specColumns.sort.name
    };
  }

  const transforms = [{
    type: 'extent',
    field: specColumns.x.name,
    signal: bucket_extent
  }, {
    type: 'bin',
    field: specColumns.x.name,
    extent: {
      signal: bucket_extent
    },
    maxbins: {
      signal: _constants.SignalNames.XBins
    },
    as: [_constants.FieldNames.BarChartBin0, _constants.FieldNames.BarChartBin1],
    signal: _constants.BarChartSignalNames.quantitativeBinSignal
  }, stackTransform, {
    type: 'extent',
    signal: _constants.BarChartSignalNames.levelExtentSignal,
    field: _constants.FieldNames.BarChartStack1
  }];
  return transforms;
}
},{"../constants":"lE7J"}],"AebZ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.bucketed = bucketed;
exports.stacked = stacked;

var _transform = _interopRequireDefault(require("./transform.qualitative"));

var _transform2 = _interopRequireDefault(require("./transform.quantitative"));

var _array = require("../../array");

var _constants = require("../constants");

var _facet = require("../facet");

var _top = require("../top");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context, namespace) {
  const {
    specColumns,
    insight,
    specViewOptions
  } = context;
  const categoricalColor = specColumns.color && !specColumns.color.quantitative;
  const nestedDataName = specColumns.facet && specColumns.facet.quantitative ? _constants.DataNames.Pre : _constants.DataNames.Main;
  const data = (0, _array.allTruthy)((0, _facet.facetSourceData)(specColumns.facet, insight.facets, _constants.DataNames.Main), categoricalColor && (0, _top.topLookup)(specColumns.color, specViewOptions.maxLegends), [bucketed(context, namespace, categoricalColor ? _constants.DataNames.Legend : nestedDataName), stacked(namespace, namespace.bucket, specColumns.facet && (0, _facet.facetTransforms)(specColumns.facet, insight.facets))], specColumns.x.quantitative && [{
    name: _constants.DataNames.QuantitativeData,
    transform: [{
      type: 'sequence',
      start: {
        signal: `${_constants.BarChartSignalNames.quantitativeBinSignal}.start`
      },
      stop: {
        signal: `${_constants.BarChartSignalNames.quantitativeBinSignal}.stop`
      },
      step: {
        signal: `${_constants.BarChartSignalNames.quantitativeBinSignal}.step`
      }
    }]
  }], specColumns.facet && (0, _facet.facetGroupData)(namespace.stacked));
  return data;
}

function bucketed(context, namespace, source) {
  const {
    specColumns: columns
  } = context;
  const data = {
    name: namespace.bucket,
    source,
    transform: columns.x.quantitative ? (0, _transform2.default)(context, columns.facet) : (0, _transform.default)(context)
  };
  return data;
}

function stacked(namespace, source, transforms) {
  const data = {
    name: namespace.stacked,
    source,
    transform: (0, _array.allTruthy)(transforms, xy(namespace))
  };
  return data;
}

function xy(namespace) {
  const transforms = [{
    type: 'formula',
    expr: `floor(datum.${_constants.FieldNames.BarChartStack0} / ${_constants.BarChartSignalNames.compartmentsPerLevelSignal})`,
    as: namespace.__level
  }, {
    type: 'formula',
    expr: `datum.${_constants.FieldNames.BarChartStack0} % ${_constants.BarChartSignalNames.compartmentsPerLevelSignal}`,
    as: namespace.__compartment
  }];
  return transforms;
}
},{"./transform.qualitative":"qAPu","./transform.quantitative":"vG7I","../../array":"vEfp","../constants":"lE7J","../facet":"G5nM","../top":"Wjzt"}],"Et3C":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var VegaDeckGl = _interopRequireWildcard(require("@msrvida/vega-deck.gl"));

var _constants = require("../constants");

var _fill = require("../fill");

var _selection = require("../selection");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context, namespace) {
  const {
    specColumns
  } = context;
  const mark = {
    type: 'rect',
    from: {
      data: namespace.stacked
    },
    encode: {
      update: {
        x: {
          scale: _constants.ScaleNames.X,
          field: specColumns.x.quantitative ? _constants.FieldNames.BarChartBin0 : specColumns.x.name,
          offset: {
            scale: _constants.BarChartScaleNames.compartmentScale,
            field: namespace.__compartment
          }
        },
        width: [{
          test: `bandwidth('${_constants.BarChartScaleNames.compartmentScale}') < 1`,
          value: VegaDeckGl.defaults.minPixelSize
        }, {
          scale: _constants.BarChartScaleNames.compartmentScale,
          band: 1
        }],
        y: [{
          scale: _constants.ScaleNames.Y,
          test: (0, _selection.testForCollapseSelection)(),
          signal: `${_constants.SignalNames.YDomain}[0]`
        }, {
          scale: _constants.ScaleNames.Y,
          field: namespace.__level,
          band: 1,
          offset: {
            signal: `-bandwidth('${_constants.ScaleNames.Y}')-1`
          }
        }],
        height: [{
          test: (0, _selection.testForCollapseSelection)(),
          value: 0
        }, {
          test: `bandwidth('${_constants.ScaleNames.Y}') < 1`,
          value: VegaDeckGl.defaults.minPixelSize
        }, {
          scale: _constants.ScaleNames.Y,
          band: 1
        }],
        fill: (0, _fill.fill)(context),
        opacity: (0, _fill.opacity)(context)
      }
    }
  };

  if (specColumns.z) {
    const update = mark.encode.update;
    update.z = {
      value: 0
    };
    update.depth = [{
      test: (0, _selection.testForCollapseSelection)(),
      value: 0
    }, {
      scale: _constants.ScaleNames.Z,
      field: specColumns.z.name
    }];
  }

  return [mark];
}
},{"@msrvida/vega-deck.gl":"IXYG","../constants":"lE7J","../fill":"zTeX","../selection":"lYO7"}],"xL14":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constants = require("../constants");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context, namespace) {
  const {
    specColumns
  } = context;
  const scales = [{
    name: _constants.BarChartScaleNames.bucketScale,
    type: 'band',
    range: 'width',
    domain: {
      data: namespace.bucket,
      field: specColumns.x.name,
      sort: true
    }
  }, {
    name: _constants.ScaleNames.X,
    type: 'band',
    range: [0, {
      signal: 'width'
    }],
    padding: 0.01,
    domain: {
      data: namespace.stacked,
      field: specColumns.x.name,
      sort: true
    }
  }];
  return scales;
}
},{"../constants":"lE7J"}],"w1zQ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constants = require("../constants");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default() {
  const scales = [{
    name: _constants.ScaleNames.X,
    type: 'band',
    range: [0, {
      signal: 'width'
    }],
    padding: 0.01,
    domain: {
      data: _constants.DataNames.QuantitativeData,
      field: 'data',
      sort: true
    }
  }];
  return scales;
}
},{"../constants":"lE7J"}],"Kj8B":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _scales = _interopRequireDefault(require("./scales.qualitative"));

var _scales2 = _interopRequireDefault(require("./scales.quantitative"));

var _constants = require("../constants");

var _scales3 = require("../scales");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context, namespace) {
  const {
    specColumns,
    insight
  } = context;
  const scales = [{
    name: _constants.BarChartScaleNames.compartmentScale,
    type: 'band',
    range: [0, {
      signal: _constants.BarChartSignalNames.compartmentWidthSignal
    }],
    padding: 0.1,
    domain: {
      signal: `sequence(0, ${_constants.BarChartSignalNames.compartmentsPerLevelSignal}+1, 1)`
    }
  }, {
    name: _constants.BarChartScaleNames.levelScale,
    range: [{
      signal: 'height'
    }, {
      signal: '0'
    }],
    round: true,
    domain: {
      data: namespace.stacked,
      field: namespace.__level,
      sort: true
    },
    zero: true,
    nice: true
  }, {
    name: _constants.ScaleNames.Y,
    type: 'band',
    range: [{
      signal: 'height'
    }, {
      signal: '0'
    }],
    padding: 0.1,
    round: false,
    reverse: false,
    align: 1,
    domain: {
      data: namespace.stacked,
      field: namespace.__level,
      sort: true
    }
  }];

  if (specColumns.color && !specColumns.color.isColorData && !insight.directColor) {
    if (specColumns.color.quantitative) {
      scales.push((0, _scales3.binnableColorScale)(insight.colorBin, namespace.bucket, specColumns.color.name, insight.scheme));
    } else {
      scales.push({
        name: _constants.ScaleNames.Color,
        type: 'ordinal',
        domain: {
          data: namespace.bucket,
          field: _constants.FieldNames.Top,
          sort: true
        },
        range: {
          scheme: insight.scheme || _constants.ColorScaleNone
        },
        reverse: {
          signal: _constants.SignalNames.ColorReverse
        }
      });
    }
  }

  if (specColumns.z) {
    const zRange = [0, {
      signal: _constants.SignalNames.ZHeight
    }];
    scales.push(specColumns.z.quantitative ? (0, _scales3.linearScale)(_constants.ScaleNames.Z, _constants.DataNames.Main, specColumns.z.name, zRange, false, true) : (0, _scales3.pointScale)(_constants.ScaleNames.Z, _constants.DataNames.Main, zRange, specColumns.z.name));
  }

  return scales.concat(specColumns.x.quantitative ? (0, _scales2.default)() : (0, _scales.default)(context, namespace));
}
},{"./scales.qualitative":"xL14","./scales.quantitative":"w1zQ","../constants":"lE7J","../scales":"SMhG"}],"gRL2":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _array = require("../../array");

var _constants = require("../constants");

var _signals = require("../signals");

var _facet = require("../facet");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context) {
  const {
    specColumns,
    specViewOptions
  } = context;
  const signals = (0, _array.allTruthy)((0, _signals.textSignals)(context), [{
    name: _constants.SignalNames.YDomain,
    update: `domain('${_constants.ScaleNames.Y}')`
  }, specColumns.x.quantitative && {
    name: _constants.SignalNames.XBins,
    value: 7,
    bind: {
      name: specViewOptions.language.XBinSize,
      input: 'range',
      min: 1,
      max: 20,
      step: 1
    }
  }, {
    name: _constants.BarChartSignalNames.compartmentWidthSignal,
    update: `bandwidth('${specColumns.x.quantitative ? _constants.ScaleNames.X : _constants.BarChartScaleNames.bucketScale}')`
  }, {
    name: _constants.BarChartSignalNames.aspectRatioSignal,
    update: `${_constants.BarChartSignalNames.compartmentWidthSignal}/height`
  }, {
    name: _constants.BarChartSignalNames.compartmentsPerLevelSignal,
    update: `ceil(sqrt(${_constants.BarChartSignalNames.aspectRatioSignal}*${_constants.BarChartSignalNames.levelExtentSignal}[1]))`
  }, (0, _signals.colorBinCountSignal)(context), (0, _signals.colorReverseSignal)(context)], specColumns.facet && (0, _facet.facetSignals)(context));
  return signals;
}
},{"../../array":"vEfp","../constants":"lE7J","../signals":"iEcA","../facet":"G5nM"}],"FIhV":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.barchartV = void 0;

var _axes = _interopRequireDefault(require("./axes"));

var _data = _interopRequireWildcard(require("./data"));

var _marks = _interopRequireDefault(require("./marks"));

var _scales = _interopRequireDefault(require("./scales"));

var _signals = _interopRequireDefault(require("./signals"));

var _facet = require("../facet");

var _constants = require("../constants");

var _legends = require("../legends");

var _namespace = require("../namespace");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const barchartV = context => {
  const {
    specColumns,
    insight,
    specViewOptions
  } = context;
  const errors = [];
  if (!specColumns.x) errors.push('Must set a field for x axis');
  (0, _facet.checkForFacetErrors)(insight.facets, errors);
  const specCapabilities = {
    roles: [{
      role: 'x',
      binnable: true,
      axisSelection: specColumns.x && specColumns.x.quantitative ? 'range' : 'exact',
      signals: [_constants.SignalNames.XBins]
    }, {
      role: 'z',
      allowNone: true
    }, {
      role: 'color',
      allowNone: true
    }, {
      role: 'sort',
      allowNone: true
    }, {
      role: 'facet',
      allowNone: true
    }]
  };

  if (errors.length) {
    return {
      errors,
      specCapabilities,
      vegaSpec: null
    };
  }

  const rootNamespace = new _namespace.BarChartNameSpace();
  let axes;

  if (!insight.hideAxes) {
    axes = (0, _axes.default)(context);
  }

  let marks;

  if (specColumns.facet) {
    const cellNamespace = new _namespace.BarChartNameSpace('Cell');
    const cellMarks = (0, _marks.default)(context, cellNamespace);
    const cd = specColumns.x.quantitative ? [(0, _data.stacked)(cellNamespace, _constants.DataNames.FacetGroupCell)] : [(0, _data.bucketed)(context, cellNamespace, _constants.DataNames.FacetGroupCell), (0, _data.stacked)(cellNamespace, cellNamespace.bucket)];
    marks = (0, _facet.facetMarks)(specViewOptions, rootNamespace.stacked, cellMarks, axes, cd);
    axes = [];
  } else {
    marks = (0, _marks.default)(context, rootNamespace);
  }

  const size = specColumns.facet ? (0, _facet.facetSize)(context) : insight.size;
  var vegaSpec = {
    $schema: 'https://vega.github.io/schema/vega/v3.json',
    height: size.height,
    width: size.width,
    signals: (0, _signals.default)(context),
    scales: (0, _scales.default)(context, rootNamespace),
    data: (0, _data.default)(context, rootNamespace),
    marks
  };

  if (!insight.hideAxes && axes && axes.length) {
    vegaSpec.axes = axes;
  }

  const legends = (0, _legends.getLegends)(context);

  if (legends) {
    vegaSpec.legends = legends;
  }

  if (specColumns.facet) {
    vegaSpec.layout = (0, _facet.layout)(context);
  } else {
    //use autosize only when not faceting
    vegaSpec.autosize = 'fit';
  }

  return {
    vegaSpec,
    specCapabilities
  };
};

exports.barchartV = barchartV;
},{"./axes":"auOE","./data":"AebZ","./marks":"Et3C","./scales":"Kj8B","./signals":"gRL2","../facet":"G5nM","../constants":"lE7J","../legends":"OiCi","../namespace":"wFiV"}],"koZ1":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _axes = require("../axes");

function _default(context) {
  const {
    specColumns,
    specViewOptions
  } = context;
  const pa = (0, _axes.partialAxes)(specViewOptions, (0, _axes.columnToAxisType)(specColumns.x), (0, _axes.columnToAxisType)(specColumns.y));
  const axes = [Object.assign({
    scale: 'xscale',
    title: specColumns.x.name,
    bandPosition: 0.5,
    grid: true,
    labelFlush: true
  }, pa.bottom), Object.assign({
    scale: 'yscale',
    title: specColumns.y.name,
    bandPosition: specColumns.y.quantitative ? 0 : 0.5,
    grid: true,
    labelFlush: true
  }, pa.left)];
  return axes;
}
},{"../axes":"pH50"}],"l44C":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _array = require("../../array");

var _constants = require("../constants");

var _top = require("../top");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context) {
  const {
    specColumns,
    specViewOptions
  } = context;
  const categoricalColor = specColumns.color && !specColumns.color.quantitative;
  const data = (0, _array.allTruthy)([{
    name: _constants.DataNames.Main,
    transform: (0, _array.allTruthy)(specColumns.x.quantitative && [{
      type: 'extent',
      field: specColumns.x.name,
      signal: 'var_Xextent'
    }, {
      type: 'bin',
      field: specColumns.x.name,
      extent: {
        signal: 'var_Xextent'
      },
      maxbins: {
        signal: _constants.SignalNames.XBins
      },
      as: [_constants.FieldNames.DensityXBin0, _constants.FieldNames.DensityXBin1],
      signal: 'binXSignal'
    }], specColumns.y.quantitative && [{
      type: 'extent',
      field: specColumns.y.name,
      signal: 'var_Yextent'
    }, {
      type: 'bin',
      field: specColumns.y.name,
      extent: {
        signal: 'var_Yextent'
      },
      maxbins: {
        signal: _constants.SignalNames.YBins
      },
      as: [_constants.FieldNames.DensityYBin0, _constants.FieldNames.DensityYBin1],
      signal: 'binYSignal'
    }])
  }], specColumns.x.quantitative && [{
    name: 'xaxisdata',
    transform: [{
      type: 'sequence',
      start: {
        signal: 'binXSignal.start'
      },
      stop: {
        signal: 'binXSignal.stop'
      },
      step: {
        signal: 'binXSignal.step'
      }
    }]
  }], specColumns.y.quantitative && [{
    name: 'yaxisdata',
    transform: [{
      type: 'sequence',
      start: {
        signal: 'binYSignal.start'
      },
      stop: {
        signal: 'binYSignal.stop'
      },
      step: {
        signal: 'binYSignal.step'
      }
    }]
  }], categoricalColor && (0, _top.topLookup)(specColumns.color, specViewOptions.maxLegends), [{
    name: 'aggregated',
    source: categoricalColor ? _constants.DataNames.Legend : _constants.DataNames.Main,
    transform: [{
      type: 'joinaggregate',
      groupby: [specColumns.x.quantitative ? _constants.FieldNames.DensityXBin0 : specColumns.x.name, specColumns.y.quantitative ? _constants.FieldNames.DensityYBin0 : specColumns.y.name],
      ops: ['count'],
      as: [_constants.FieldNames.DensityCount]
    }, windowTransform(specColumns), {
      type: 'extent',
      field: _constants.FieldNames.DensityRow,
      signal: 'cextent'
    }]
  }]);
  return data;
}

function windowTransform(columns) {
  const t = {
    type: 'window',
    groupby: [columns.x.quantitative ? _constants.FieldNames.DensityXBin0 : columns.x.name, columns.y.quantitative ? _constants.FieldNames.DensityYBin0 : columns.y.name],
    ops: ['row_number'],
    as: [_constants.FieldNames.DensityRow]
  };

  if (columns.sort) {
    t.sort = {
      field: [columns.sort.name],
      order: ['descending']
    };
  }

  return t;
}
},{"../../array":"vEfp","../constants":"lE7J","../top":"Wjzt"}],"SzGb":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constants = require("../constants");

var _fill = require("../fill");

var _selection = require("../selection");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context) {
  const {
    specColumns
  } = context;
  const mark = {
    type: 'rect',
    from: {
      data: 'aggregated'
    },
    sort: {
      field: [specColumns.x.name, specColumns.y.name],
      order: ['ascending', 'ascending']
    },
    encode: {
      update: {
        xc: {
          scale: 'xscale',
          field: specColumns.x.quantitative ? _constants.FieldNames.DensityXBin0 : specColumns.x.name,
          offset: {
            signal: `scale('sizescale', ((datum.${_constants.FieldNames.DensityRow}-1) % floor(sqrt(datum.${_constants.FieldNames.DensityCount}))))-scale('sizescale', sqrt(datum.${_constants.FieldNames.DensityCount})-2)/2`
          }
        },
        yc: {
          scale: 'yscale',
          field: specColumns.y.quantitative ? _constants.FieldNames.DensityYBin0 : specColumns.y.name,
          offset: {
            signal: `scale('sizescale',height/width*floor(((datum.${_constants.FieldNames.DensityRow}-1) / floor(sqrt(datum.${_constants.FieldNames.DensityCount}))))) - scale('sizescale', height/width*sqrt(datum.${_constants.FieldNames.DensityCount})+2)/2`
          }
        },
        width: {
          signal: 'unitsize'
        },
        height: {
          signal: 'height/width*unitsize'
        },
        fill: (0, _fill.fill)(context),
        opacity: (0, _fill.opacity)(context)
      }
    }
  };

  if (specColumns.z) {
    const update = mark.encode.update;
    update.z = {
      value: 0
    };
    update.depth = [{
      test: (0, _selection.testForCollapseSelection)(),
      value: 0
    }, {
      scale: _constants.ScaleNames.Z,
      field: specColumns.z.name
    }];
  }

  return [mark];
}
},{"../constants":"lE7J","../fill":"zTeX","../selection":"lYO7"}],"jGvU":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _scales = require("../scales");

var _constants = require("../constants");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context) {
  const {
    specColumns,
    insight
  } = context;
  const scales = [{
    name: 'xscale',
    type: 'point',
    domain: specColumns.x.quantitative ? {
      data: 'xaxisdata',
      field: 'data',
      sort: true
    } : {
      data: _constants.DataNames.Main,
      field: specColumns.x.name,
      sort: true
    },
    range: 'width',
    padding: 0.5
  }, {
    name: 'yscale',
    type: 'point',
    domain: specColumns.y.quantitative ? {
      data: 'yaxisdata',
      field: 'data',
      sort: true
    } : {
      data: _constants.DataNames.Main,
      field: specColumns.y.name,
      sort: true
    },
    range: 'height',
    reverse: true,
    padding: 0.5
  }, {
    name: 'sizescale',
    type: 'linear',
    domain: [0, {
      signal: 'sqrt(cextent[1])'
    }],
    range: [0, {
      signal: 'width/max(xsize,ysize)'
    }]
  }];

  if (specColumns.color && !specColumns.color.isColorData && !insight.directColor) {
    if (specColumns.color.quantitative) {
      scales.push((0, _scales.binnableColorScale)(insight.colorBin, _constants.DataNames.Main, specColumns.color.name, insight.scheme));
    } else {
      scales.push({
        name: _constants.ScaleNames.Color,
        type: 'ordinal',
        domain: {
          data: _constants.DataNames.Legend,
          field: _constants.FieldNames.Top,
          sort: true
        },
        range: {
          scheme: insight.scheme || _constants.ColorScaleNone
        },
        reverse: {
          signal: _constants.SignalNames.ColorReverse
        }
      });
    }
  }

  if (specColumns.z) {
    const zRange = [0, {
      signal: _constants.SignalNames.ZHeight
    }];
    scales.push(specColumns.z.quantitative ? (0, _scales.linearScale)(_constants.ScaleNames.Z, _constants.DataNames.Main, specColumns.z.name, zRange, false, true) : (0, _scales.pointScale)(_constants.ScaleNames.Z, _constants.DataNames.Main, zRange, specColumns.z.name));
  }

  return scales;
}
},{"../scales":"SMhG","../constants":"lE7J"}],"Jqxo":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _array = require("../../array");

var _signals = require("../signals");

var _facet = require("../facet");

var _constants = require("../constants");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context) {
  const {
    specColumns,
    insight,
    specViewOptions
  } = context;
  const signals = (0, _array.allTruthy)((0, _signals.textSignals)(context), [(0, _signals.colorBinCountSignal)(context), (0, _signals.colorReverseSignal)(context), {
    name: 'unitpad',
    value: 0.1,
    bind: {
      name: _constants.SignalNames.InnerPadding,
      input: 'range',
      min: 0.1,
      max: 1.0,
      step: 0.1
    }
  }, {
    name: 'xsize',
    update: 'domain(\'xscale\').length'
  }, {
    name: 'ysize',
    update: 'domain(\'yscale\').length'
  }, {
    name: 'cellwidth',
    update: 'width/max(xsize,ysize)'
  }, {
    name: 'maxnumbers',
    update: 'sqrt(cextent[1])'
  }, {
    name: 'unitsize',
    update: 'cellwidth/((1 + unitpad)*maxnumbers)'
  }, specColumns.x.quantitative && {
    name: _constants.SignalNames.XBins,
    value: 30,
    bind: {
      name: specViewOptions.language.XBinSize,
      input: 'range',
      min: 1,
      max: 60,
      step: 1
    }
  }, specColumns.y.quantitative && {
    name: _constants.SignalNames.YBins,
    value: 30,
    bind: {
      name: specViewOptions.language.YBinSize,
      input: 'range',
      min: 1,
      max: 60,
      step: 1
    }
  }], insight.columns.facet && (0, _facet.facetSignals)(context));
  return signals;
}
},{"../../array":"vEfp","../signals":"iEcA","../facet":"G5nM","../constants":"lE7J"}],"dSSD":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.density = void 0;

var _axes = _interopRequireDefault(require("./axes"));

var _data = _interopRequireDefault(require("./data"));

var _marks = _interopRequireDefault(require("./marks"));

var _scales = _interopRequireDefault(require("./scales"));

var _signals = _interopRequireDefault(require("./signals"));

var _facet = require("../facet");

var _legends = require("../legends");

var _constants = require("../constants");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const density = context => {
  const {
    specColumns,
    insight
  } = context;
  const errors = [];
  if (!specColumns.x) errors.push('Must set a field for x axis');
  if (!specColumns.y) errors.push('Must set a field for y axis');
  (0, _facet.checkForFacetErrors)(insight.facets, errors);
  const specCapabilities = {
    roles: [{
      role: 'x',
      binnable: true,
      axisSelection: specColumns.x && specColumns.x.quantitative ? 'range' : 'exact',
      signals: [_constants.SignalNames.XBins]
    }, {
      role: 'y',
      binnable: true,
      axisSelection: specColumns.y && specColumns.y.quantitative ? 'range' : 'exact',
      signals: [_constants.SignalNames.YBins]
    }, {
      role: 'z',
      allowNone: true
    }, {
      role: 'color',
      allowNone: true
    }, {
      role: 'sort',
      allowNone: true
    }]
  };

  if (errors.length) {
    return {
      errors,
      specCapabilities,
      vegaSpec: null
    };
  }

  const size = specColumns.facet ? (0, _facet.facetSize)(context) : insight.size;
  var vegaSpec = {
    $schema: 'https://vega.github.io/schema/vega/v3.json',
    height: size.height,
    width: size.width,
    signals: (0, _signals.default)(context),
    data: (0, _data.default)(context),
    scales: (0, _scales.default)(context),
    marks: (0, _marks.default)(context)
  };

  if (!insight.hideAxes) {
    vegaSpec.axes = (0, _axes.default)(context);
  }

  const legends = (0, _legends.getLegends)(context);

  if (legends) {
    vegaSpec.legends = legends;
  }

  if (specColumns.facet) {
    vegaSpec.layout = (0, _facet.layout)(context);
  } else {
    //use autosize only when not faceting
    vegaSpec.autosize = 'fit';
  }

  return {
    vegaSpec,
    specCapabilities
  };
};

exports.density = density;
},{"./axes":"koZ1","./data":"l44C","./marks":"SzGb","./scales":"jGvU","./signals":"Jqxo","../facet":"G5nM","../legends":"OiCi","../constants":"lE7J"}],"GTux":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _array = require("../../array");

var _constants = require("../constants");

var _top = require("../top");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context) {
  const {
    specColumns,
    specViewOptions
  } = context;
  const categoricalColor = specColumns.color && !specColumns.color.quantitative;
  const data = (0, _array.allTruthy)([{
    name: _constants.DataNames.Main,
    transform: (0, _array.allTruthy)([specColumns.sort && {
      type: 'collect',
      sort: {
        field: specColumns.sort.name
      }
    }, {
      type: 'window',
      ops: ['count'],
      as: [_constants.FieldNames.GridIndex]
    }])
  }], categoricalColor && (0, _top.topLookup)(specColumns.color, specViewOptions.maxLegends));
  return data;
}
},{"../../array":"vEfp","../constants":"lE7J","../top":"Wjzt"}],"mCtA":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Total = exports.RowCount = exports.ColumnCount = void 0;
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const ColumnCount = 'columncount';
exports.ColumnCount = ColumnCount;
const RowCount = 'rowcount';
exports.RowCount = RowCount;
const Total = 'total';
exports.Total = Total;
},{}],"FGRD":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constants = require("./constants");

var _constants2 = require("../constants");

var _fill = require("../fill");

var _selection = require("../selection");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context, data) {
  const {
    specColumns
  } = context;
  const marks = [{
    type: 'rect',
    from: {
      data
    },
    encode: {
      update: {
        x: {
          signal: `(datum.${_constants2.FieldNames.GridIndex}-1)%${_constants.ColumnCount}`,
          scale: _constants2.ScaleNames.X
        },
        width: {
          scale: _constants2.ScaleNames.X,
          band: true
        },
        y: {
          signal: `floor((datum.${_constants2.FieldNames.GridIndex}-1)/${_constants.ColumnCount})`,
          scale: _constants2.ScaleNames.Y
        },
        height: {
          scale: _constants2.ScaleNames.Y,
          band: true
        },
        fill: (0, _fill.fill)(context),
        opacity: (0, _fill.opacity)(context)
      }
    }
  }];

  if (specColumns.z) {
    const update = marks[0].encode.update;
    update.z = {
      value: 0
    };
    update.depth = [{
      test: (0, _selection.testForCollapseSelection)(),
      value: 0
    }, {
      scale: _constants2.ScaleNames.Z,
      field: specColumns.z.name
    }];
  }

  return marks;
}
},{"./constants":"mCtA","../constants":"lE7J","../fill":"zTeX","../selection":"lYO7"}],"JnVH":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _scales = require("../scales");

var _constants = require("../constants");

var _constants2 = require("./constants");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context) {
  const {
    specColumns,
    insight
  } = context;
  const scales = [{
    name: _constants.ScaleNames.X,
    type: 'band',
    domain: {
      signal: `sequence(0, ${_constants2.ColumnCount}, 1)`
    },
    range: 'width',
    paddingInner: 0.1,
    paddingOuter: 0
  }, {
    name: _constants.ScaleNames.Y,
    type: 'band',
    domain: {
      signal: `sequence(0, ${_constants2.RowCount}, 1)`
    },
    range: 'height',
    paddingInner: 0.1,
    paddingOuter: 0
  }];

  if (specColumns.color && !specColumns.color.isColorData && !insight.directColor) {
    if (specColumns.color.quantitative) {
      scales.push((0, _scales.binnableColorScale)(insight.colorBin, _constants.DataNames.Main, specColumns.color.name, insight.scheme));
    } else {
      scales.push({
        name: _constants.ScaleNames.Color,
        type: 'ordinal',
        domain: {
          data: _constants.DataNames.Legend,
          field: _constants.FieldNames.Top,
          sort: true
        },
        range: {
          scheme: insight.scheme || _constants.ColorScaleNone
        },
        reverse: {
          signal: _constants.SignalNames.ColorReverse
        }
      });
    }
  }

  if (specColumns.z) {
    const zRange = [0, {
      signal: _constants.SignalNames.ZHeight
    }];
    scales.push(specColumns.z.quantitative ? (0, _scales.linearScale)(_constants.ScaleNames.Z, _constants.DataNames.Main, specColumns.z.name, zRange, false, false) : (0, _scales.pointScale)(_constants.ScaleNames.Z, _constants.DataNames.Main, zRange, specColumns.z.name));
  }

  return scales;
}
},{"../scales":"SMhG","../constants":"lE7J","./constants":"mCtA"}],"mTQf":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _array = require("../../array");

var _signals = require("../signals");

var _constants = require("./constants");

var _constants2 = require("../constants");

var _facet = require("../facet");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context) {
  const {
    insight
  } = context;
  const signals = (0, _array.allTruthy)((0, _signals.textSignals)(context), [(0, _signals.colorBinCountSignal)(context), {
    name: _constants.Total,
    update: `data('${_constants2.DataNames.Main}').length`
  }, {
    name: _constants.ColumnCount,
    update: `ceil(sqrt((width/height)*${_constants.Total}))`
  }, {
    name: _constants.RowCount,
    update: `${_constants.Total}/${_constants.ColumnCount}`
  }, (0, _signals.colorReverseSignal)(context)], insight.columns && insight.columns.facet && (0, _facet.facetSignals)(context));
  return signals;
}
},{"../../array":"vEfp","../signals":"iEcA","./constants":"mCtA","../constants":"lE7J","../facet":"G5nM"}],"qmna":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.grid = void 0;

var _data = _interopRequireDefault(require("./data"));

var _marks = _interopRequireDefault(require("./marks"));

var _scales = _interopRequireDefault(require("./scales"));

var _signals = _interopRequireDefault(require("./signals"));

var _constants = require("../constants");

var _legends = require("../legends");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const grid = context => {
  const {
    specColumns,
    insight
  } = context;
  const errors = [];
  const specCapabilities = {
    roles: [{
      role: 'z',
      allowNone: true
    }, {
      role: 'color',
      allowNone: true
    }, {
      role: 'sort',
      allowNone: true
    }]
  };

  if (errors.length) {
    return {
      errors,
      specCapabilities,
      vegaSpec: null
    };
  }

  const categoricalColor = specColumns.color && !specColumns.color.quantitative;
  const dataName = categoricalColor ? _constants.DataNames.Legend : _constants.DataNames.Main;
  const size = insight.size;
  var vegaSpec = {
    $schema: 'https://vega.github.io/schema/vega/v3.json',
    height: size.height,
    width: size.width,
    signals: (0, _signals.default)(context),
    scales: (0, _scales.default)(context),
    data: (0, _data.default)(context),
    marks: (0, _marks.default)(context, dataName)
  };
  const legends = (0, _legends.getLegends)(context);

  if (legends) {
    vegaSpec.legends = legends;
  } //use autosize only when not faceting


  vegaSpec.autosize = 'fit';
  return {
    vegaSpec,
    specCapabilities
  };
};

exports.grid = grid;
},{"./data":"GTux","./marks":"FGRD","./scales":"JnVH","./signals":"mTQf","../constants":"lE7J","../legends":"OiCi"}],"Gw1P":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _axes = require("../axes");

var _constants = require("../constants");

function _default(context) {
  const {
    specColumns,
    specViewOptions
  } = context;
  const pa = (0, _axes.partialAxes)(specViewOptions, (0, _axes.columnToAxisType)(specColumns.x), (0, _axes.columnToAxisType)(specColumns.y));
  const axes = [Object.assign({
    scale: _constants.ScaleNames.X,
    title: specColumns.x.name
  }, pa.bottom), Object.assign({
    scale: _constants.ScaleNames.Y,
    title: specColumns.y.name
  }, pa.left)];
  return axes;
}
},{"../axes":"pH50","../constants":"lE7J"}],"IRDx":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _array = require("../../array");

var _constants = require("../constants");

var _facet = require("../facet");

var _top = require("../top");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context) {
  const {
    specColumns,
    insight,
    specViewOptions
  } = context;
  const categoricalColor = specColumns.color && !specColumns.color.quantitative;
  const ScatterDataName = 'SandDanceScatterPlotData';
  const data = (0, _array.allTruthy)((0, _facet.facetSourceData)(specColumns.facet, insight.facets, ScatterDataName), [{
    name: _constants.DataNames.Main,
    source: ScatterDataName,
    transform: (0, _array.allTruthy)(filterInvalidWhenNumeric(specColumns.x), filterInvalidWhenNumeric(specColumns.y), filterInvalidWhenNumeric(specColumns.z), specColumns.facet && (0, _facet.facetTransforms)(specColumns.facet, insight.facets))
  }], categoricalColor && (0, _top.topLookup)(specColumns.color, specViewOptions.maxLegends), specColumns.facet && (0, _facet.facetGroupData)(_constants.DataNames.Main));
  return data;
}

function filterInvalidWhenNumeric(column) {
  if (column && column.quantitative) {
    const transforms = [{
      type: 'filter',
      expr: `datum[${JSON.stringify(column.name)}] != null`
    }];
    return transforms;
  }
}
},{"../../array":"vEfp","../constants":"lE7J","../facet":"G5nM","../top":"Wjzt"}],"NQ7u":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constants = require("../constants");

var _fill = require("../fill");

var _selection = require("../selection");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context) {
  const {
    specColumns
  } = context;
  const categoricalColor = specColumns.color && !specColumns.color.quantitative;
  const marks = [{
    type: 'rect',
    from: {
      data: categoricalColor ? _constants.DataNames.Legend : _constants.DataNames.Main
    },
    encode: {
      update: {
        x: {
          scale: _constants.ScaleNames.X,
          field: specColumns.x.name,
          offset: 1
        },
        width: {
          signal: _constants.SignalNames.PointSize
        },
        y: [{
          scale: _constants.ScaleNames.Y,
          test: (0, _selection.testForCollapseSelection)(),
          signal: `${_constants.SignalNames.YDomain}[0]`
        }, {
          scale: _constants.ScaleNames.Y,
          field: specColumns.y.name,
          offset: {
            signal: `-${_constants.SignalNames.PointSize}`
          }
        }],
        height: [{
          test: (0, _selection.testForCollapseSelection)(),
          value: 0
        }, {
          signal: _constants.SignalNames.PointSize
        }],
        fill: (0, _fill.fill)(context),
        opacity: (0, _fill.opacity)(context)
      }
    }
  }];

  if (specColumns.z) {
    const update = marks[0].encode.update;
    update.z = [{
      test: (0, _selection.testForCollapseSelection)(),
      value: 0
    }, {
      scale: _constants.ScaleNames.Z,
      field: specColumns.z.name
    }];
    update.depth = {
      signal: _constants.SignalNames.PointSize
    };
  }

  return marks;
}
},{"../constants":"lE7J","../fill":"zTeX","../selection":"lYO7"}],"hrDZ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _scales = require("../scales");

var _constants = require("../constants");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context) {
  const {
    specColumns,
    insight
  } = context;
  const scales = [specColumns.x.quantitative ? (0, _scales.linearScale)(_constants.ScaleNames.X, _constants.DataNames.Main, specColumns.x.name, 'width', false, false) : (0, _scales.pointScale)(_constants.ScaleNames.X, _constants.DataNames.Main, 'width', specColumns.x.name), specColumns.y.quantitative ? (0, _scales.linearScale)(_constants.ScaleNames.Y, _constants.DataNames.Main, specColumns.y.name, 'height', false, false) : (0, _scales.pointScale)(_constants.ScaleNames.Y, _constants.DataNames.Main, 'height', specColumns.y.name, true)];

  if (specColumns.color && !specColumns.color.isColorData && !insight.directColor) {
    if (specColumns.color.quantitative) {
      scales.push((0, _scales.binnableColorScale)(insight.colorBin, _constants.DataNames.Main, specColumns.color.name, insight.scheme));
    } else {
      scales.push({
        name: _constants.ScaleNames.Color,
        type: 'ordinal',
        domain: {
          data: _constants.DataNames.Legend,
          field: _constants.FieldNames.Top,
          sort: true
        },
        range: {
          scheme: insight.scheme || _constants.ColorScaleNone
        },
        reverse: {
          signal: _constants.SignalNames.ColorReverse
        }
      });
    }
  }

  if (specColumns.z) {
    const zRange = [0, {
      signal: _constants.SignalNames.ZHeight
    }];
    scales.push(specColumns.z.quantitative ? (0, _scales.linearScale)(_constants.ScaleNames.Z, _constants.DataNames.Main, specColumns.z.name, zRange, false, false) : (0, _scales.pointScale)(_constants.ScaleNames.Z, _constants.DataNames.Main, zRange, specColumns.z.name));
  }

  return scales;
}
},{"../scales":"SMhG","../constants":"lE7J"}],"skK7":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _array = require("../../array");

var _signals = require("../signals");

var _facet = require("../facet");

var _constants = require("../constants");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context) {
  const {
    insight,
    specViewOptions
  } = context;
  const signals = (0, _array.allTruthy)((0, _signals.textSignals)(context), [{
    name: _constants.SignalNames.YDomain,
    update: `domain('${_constants.ScaleNames.Y}')`
  }, {
    name: _constants.SignalNames.PointSize,
    value: 5,
    bind: {
      name: specViewOptions.language.scatterPointSize,
      debounce: 50,
      input: 'range',
      min: 1,
      max: 25,
      step: 1
    }
  }, (0, _signals.colorBinCountSignal)(context), (0, _signals.colorReverseSignal)(context)], insight.columns.facet && (0, _facet.facetSignals)(context));
  return signals;
}
},{"../../array":"vEfp","../signals":"iEcA","../facet":"G5nM","../constants":"lE7J"}],"HYS8":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.scatterplot = void 0;

var _axes = _interopRequireDefault(require("./axes"));

var _data = _interopRequireDefault(require("./data"));

var _marks = _interopRequireDefault(require("./marks"));

var _scales = _interopRequireDefault(require("./scales"));

var _signals = _interopRequireDefault(require("./signals"));

var _facet = require("../facet");

var _legends = require("../legends");

var _constants = require("../constants");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const scatterplot = context => {
  const {
    specColumns,
    insight,
    specViewOptions
  } = context;
  const errors = [];
  if (!specColumns.x) errors.push('Must set a field for x axis');
  if (!specColumns.y) errors.push('Must set a field for y axis');
  (0, _facet.checkForFacetErrors)(insight.facets, errors);
  const specCapabilities = {
    roles: [{
      role: 'x',
      axisSelection: specColumns.x && specColumns.x.quantitative ? 'range' : 'exact'
    }, {
      role: 'y',
      axisSelection: specColumns.y && specColumns.y.quantitative ? 'range' : 'exact'
    }, {
      role: 'z',
      allowNone: true
    }, {
      role: 'color',
      allowNone: true
    }, {
      role: 'sort',
      allowNone: true
    }, {
      role: 'facet',
      allowNone: true
    }],
    signals: [_constants.SignalNames.PointSize]
  };

  if (errors.length) {
    return {
      errors,
      specCapabilities,
      vegaSpec: null
    };
  }

  let axes;

  if (!insight.hideAxes) {
    axes = (0, _axes.default)(context);
  }

  let marks = (0, _marks.default)(context);

  if (specColumns.facet) {
    marks = (0, _facet.facetMarks)(specViewOptions, marks[0].from.data, marks, axes);
    axes = [];
  }

  const size = specColumns.facet ? (0, _facet.facetSize)(context) : insight.size;
  var vegaSpec = {
    $schema: 'https://vega.github.io/schema/vega/v3.json',
    height: size.height,
    width: size.width,
    signals: (0, _signals.default)(context),
    data: (0, _data.default)(context),
    scales: (0, _scales.default)(context),
    marks
  };

  if (!insight.hideAxes && axes && axes.length) {
    vegaSpec.axes = axes;
  }

  const legends = (0, _legends.getLegends)(context);

  if (legends) {
    vegaSpec.legends = legends;
  }

  if (specColumns.facet) {
    vegaSpec.layout = (0, _facet.layout)(context);
  } else {
    //use autosize only when not faceting
    vegaSpec.autosize = 'fit';
  }

  return {
    vegaSpec,
    specCapabilities
  };
};

exports.scatterplot = scatterplot;
},{"./axes":"Gw1P","./data":"IRDx","./marks":"NQ7u","./scales":"hrDZ","./signals":"skK7","../facet":"G5nM","../legends":"OiCi","../constants":"lE7J"}],"EgtV":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _axes = require("../axes");

function _default(context) {
  const {
    specColumns,
    specViewOptions
  } = context;
  const pa = (0, _axes.partialAxes)(specViewOptions, (0, _axes.columnToAxisType)(specColumns.x), (0, _axes.columnToAxisType)(specColumns.y));
  const axes = [Object.assign({
    scale: 'xband',
    title: specColumns.x.name,
    bandPosition: 0.5,
    grid: true,
    labelFlush: true
  }, pa.bottom), Object.assign({
    scale: 'yband',
    title: specColumns.y.name,
    bandPosition: specColumns.y.quantitative ? 0 : 0.5,
    grid: true,
    labelFlush: true
  }, pa.left)];
  return axes;
}
},{"../axes":"pH50"}],"yHuT":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _array = require("../../array");

var _constants = require("../constants");

var _top = require("../top");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context) {
  const {
    specColumns,
    specViewOptions
  } = context;
  const categoricalColor = specColumns.color && !specColumns.color.quantitative;
  const data = (0, _array.allTruthy)([{
    name: _constants.DataNames.Main,
    transform: (0, _array.allTruthy)([{
      type: 'extent',
      field: specColumns.x.name,
      signal: 'long_extent'
    }, {
      type: 'extent',
      field: specColumns.y.name,
      signal: 'lat_extent'
    }, specColumns.x.quantitative && {
      type: 'bin',
      field: specColumns.x.name,
      extent: {
        signal: 'long_extent'
      },
      maxbins: {
        signal: _constants.SignalNames.XBins
      },
      nice: false,
      as: [_constants.FieldNames.StacksLongBin0, _constants.FieldNames.StacksLongBin1],
      signal: 'binXSignal'
    }, specColumns.y.quantitative && {
      type: 'bin',
      field: specColumns.y.name,
      extent: {
        signal: 'lat_extent'
      },
      nice: false,
      maxbins: {
        signal: _constants.SignalNames.YBins
      },
      as: [_constants.FieldNames.StacksLatBin0, _constants.FieldNames.StacksLatBin1],
      signal: 'binYSignal'
    }])
  }], specColumns.x.quantitative && [{
    name: 'xaxisdata',
    transform: [{
      type: 'sequence',
      start: {
        signal: 'binXSignal.start'
      },
      stop: {
        signal: 'binXSignal.stop'
      },
      step: {
        signal: 'binXSignal.step'
      }
    }]
  }], specColumns.y.quantitative && [{
    name: 'yaxisdata',
    transform: [{
      type: 'sequence',
      start: {
        signal: 'binYSignal.start'
      },
      stop: {
        signal: 'binYSignal.stop'
      },
      step: {
        signal: 'binYSignal.step'
      }
    }]
  }], categoricalColor && (0, _top.topLookup)(specColumns.color, specViewOptions.maxLegends), [{
    name: 'stackedgroup',
    source: categoricalColor ? _constants.DataNames.Legend : _constants.DataNames.Main,
    transform: [stackTransform(specColumns.sort, specColumns.x, specColumns.y), {
      type: 'extent',
      signal: 'xtent',
      field: _constants.FieldNames.StacksStart
    }, {
      type: 'formula',
      expr: `datum.${_constants.FieldNames.StacksEnd} % columns`,
      as: '_columns'
    }, {
      type: 'formula',
      expr: `floor(datum.${_constants.FieldNames.StacksStart} / columns)`,
      as: 'row'
    }, {
      type: 'formula',
      expr: `datum.${_constants.FieldNames.StacksStart} % ${_constants.SignalNames.XGridSize}`,
      as: 'column'
    }, {
      type: 'formula',
      expr: `floor((datum.${_constants.FieldNames.StacksStart} % columns)/ ${_constants.SignalNames.XGridSize})`,
      as: 'depth'
    }, {
      type: 'extent',
      signal: 'rowxtent',
      field: 'row'
    }]
  }]);
  return data;
}

function stackTransform(sortColumn, xColumn, yColumn) {
  const st = {
    type: 'stack',
    groupby: [yColumn.quantitative ? _constants.FieldNames.StacksLatBin0 : yColumn.name, xColumn.quantitative ? _constants.FieldNames.StacksLongBin0 : xColumn.name],
    as: [_constants.FieldNames.StacksStart, _constants.FieldNames.StacksEnd]
  };

  if (sortColumn) {
    st.sort = {
      field: sortColumn.name
    };
  }

  return st;
}
},{"../../array":"vEfp","../constants":"lE7J","../top":"Wjzt"}],"HgPa":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constants = require("../constants");

var _fill = require("../fill");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context) {
  const {
    specColumns
  } = context;
  const marks = [{
    name: 'marks2',
    type: 'rect',
    from: {
      data: 'stackedgroup'
    },
    encode: {
      update: {
        x: {
          scale: 'xband',
          field: specColumns.x.quantitative ? _constants.FieldNames.StacksLongBin0 : specColumns.x.name,
          offset: {
            scale: 'xinternalscale',
            field: 'column'
          }
        },
        y: {
          scale: 'yband',
          field: specColumns.y.quantitative ? _constants.FieldNames.StacksLatBin0 : specColumns.y.name,
          offset: {
            scale: 'yinternalscale',
            field: 'depth'
          }
        },
        z: {
          scale: 'zband',
          field: 'row'
        },
        depth: {
          scale: 'zband',
          band: true
        },
        width: {
          signal: 'actsize'
        },
        height: {
          signal: 'actsize'
        },
        fill: (0, _fill.fill)(context),
        opacity: (0, _fill.opacity)(context)
      }
    }
  }];
  return marks;
}
},{"../constants":"lE7J","../fill":"zTeX"}],"iROM":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _scales = require("../scales");

var _constants = require("../constants");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context) {
  const {
    specColumns,
    insight
  } = context;
  const scales = [{
    name: 'xband',
    type: 'band',
    domain: specColumns.x.quantitative ? {
      data: 'xaxisdata',
      field: 'data',
      sort: true
    } : {
      data: _constants.DataNames.Main,
      field: specColumns.x.quantitative ? _constants.FieldNames.StacksLongBin0 : specColumns.x.name,
      sort: true
    },
    range: [0, {
      signal: 'width'
    }],
    padding: {
      signal: _constants.SignalNames.OuterPadding
    },
    round: true
  }, {
    name: 'yband',
    type: 'band',
    reverse: true,
    domain: specColumns.y.quantitative ? {
      data: 'yaxisdata',
      field: 'data',
      sort: true
    } : {
      data: _constants.DataNames.Main,
      field: specColumns.y.quantitative ? _constants.FieldNames.StacksLatBin0 : specColumns.y.name,
      sort: true
    },
    range: 'height',
    padding: {
      signal: _constants.SignalNames.OuterPadding
    },
    round: true
  }, {
    name: 'zband',
    type: 'band',
    reverse: false,
    domain: {
      data: 'stackedgroup',
      field: 'row',
      sort: true
    },
    align: 0.0,
    range: [0, {
      signal: 'countheight'
    }],
    padding: {
      signal: _constants.SignalNames.InnerPadding
    },
    round: false
  }, {
    name: 'xinternalscale',
    type: 'band',
    range: [0, {
      signal: 'xbandw'
    }],
    padding: {
      signal: _constants.SignalNames.InnerPadding
    },
    domain: {
      data: 'stackedgroup',
      field: 'column',
      sort: true
    }
  }, {
    name: 'yinternalscale',
    type: 'band',
    range: [0, {
      signal: 'ybandw'
    }],
    padding: {
      signal: _constants.SignalNames.InnerPadding
    },
    domain: {
      data: 'stackedgroup',
      field: 'depth',
      sort: true
    }
  }];

  if (specColumns.color && !specColumns.color.isColorData && !insight.directColor) {
    if (specColumns.color.quantitative) {
      scales.push((0, _scales.binnableColorScale)(insight.colorBin, _constants.DataNames.Main, specColumns.color.name, insight.scheme));
    } else {
      scales.push({
        name: _constants.ScaleNames.Color,
        type: 'ordinal',
        domain: {
          data: _constants.DataNames.Legend,
          field: _constants.FieldNames.Top,
          sort: true
        },
        range: {
          scheme: insight.scheme || _constants.ColorScaleNone
        },
        reverse: {
          signal: _constants.SignalNames.ColorReverse
        }
      });
    }
  }

  return scales;
}
},{"../scales":"SMhG","../constants":"lE7J"}],"e6rP":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _array = require("../../array");

var _signals = require("../signals");

var _facet = require("../facet");

var _constants = require("../constants");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context) {
  const {
    specColumns,
    insight,
    specViewOptions
  } = context;
  const signals = (0, _array.allTruthy)((0, _signals.textSignals)(context), [(0, _signals.colorBinCountSignal)(context), (0, _signals.colorReverseSignal)(context), {
    name: _constants.SignalNames.XGridSize,
    value: 3,
    bind: {
      name: specViewOptions.language.XGridSize,
      input: 'range',
      min: 1,
      max: 20,
      step: 1
    }
  }, {
    name: _constants.SignalNames.YGridSize,
    value: 3,
    bind: {
      name: specViewOptions.language.YGridSize,
      input: 'range',
      min: 1,
      max: 20,
      step: 1
    }
  }, specColumns.x.quantitative && {
    name: _constants.SignalNames.XBins,
    value: 30,
    bind: {
      name: specViewOptions.language.XBinSize,
      input: 'range',
      min: 1,
      max: 60,
      step: 1
    }
  }, specColumns.y.quantitative && {
    name: _constants.SignalNames.YBins,
    value: 30,
    bind: {
      name: specViewOptions.language.YBinSize,
      input: 'range',
      min: 1,
      max: 60,
      step: 1
    }
  }, {
    name: _constants.SignalNames.InnerPadding,
    value: 0.1,
    bind: {
      name: specViewOptions.language.InnerPaddingSize,
      input: 'range',
      min: 0.1,
      max: 0.6,
      step: 0.1
    }
  }, {
    name: _constants.SignalNames.OuterPadding,
    value: 0.2,
    bind: {
      name: specViewOptions.language.OuterPaddingSize,
      input: 'range',
      min: 0.1,
      max: 0.6,
      step: 0.1
    }
  }, {
    name: 'columns',
    update: `${_constants.SignalNames.XGridSize}*${_constants.SignalNames.YGridSize}`
  }, {
    name: 'xbandw',
    update: 'bandwidth(\'xband\')'
  }, {
    name: 'xbandsize',
    update: `(xbandw / (${_constants.SignalNames.XGridSize} + ${_constants.SignalNames.InnerPadding}))*(1-${_constants.SignalNames.InnerPadding})`
  }, {
    name: 'ybandw',
    update: `height/((${specColumns.y.quantitative ? _constants.SignalNames.YBins : specColumns.y.stats.distinctValueCount}) * (1 + ${_constants.SignalNames.OuterPadding}))`
  }, {
    name: 'ybandsize',
    update: `(ybandw / (${_constants.SignalNames.YGridSize} + ${_constants.SignalNames.InnerPadding}))*(1-${_constants.SignalNames.InnerPadding})`
  }, {
    name: 'actsize',
    update: 'min(xbandsize,ybandsize)'
  }, {
    name: 'countheight',
    update: `rowxtent[1]*actsize*${_constants.SignalNames.ZProportion}/${_signals.defaultZProportion}`
  }], insight.columns.facet && (0, _facet.facetSignals)(context));
  return signals;
}
},{"../../array":"vEfp","../signals":"iEcA","../facet":"G5nM","../constants":"lE7J"}],"QAJj":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.stacks = void 0;

var _axes = _interopRequireDefault(require("./axes"));

var _data = _interopRequireDefault(require("./data"));

var _marks = _interopRequireDefault(require("./marks"));

var _scales = _interopRequireDefault(require("./scales"));

var _signals = _interopRequireDefault(require("./signals"));

var _facet = require("../facet");

var _legends = require("../legends");

var _constants = require("../constants");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const stacks = context => {
  const {
    specColumns,
    insight
  } = context;
  const errors = [];
  if (!specColumns.x) errors.push('Must set a field for x axis');
  if (!specColumns.y) errors.push('Must set a field for y axis');
  (0, _facet.checkForFacetErrors)(insight.facets, errors);
  const specCapabilities = {
    roles: [{
      role: 'x',
      binnable: true,
      axisSelection: specColumns.x && specColumns.x.quantitative ? 'range' : 'exact',
      signals: [_constants.SignalNames.XBins]
    }, {
      role: 'y',
      binnable: true,
      axisSelection: specColumns.y && specColumns.y.quantitative ? 'range' : 'exact',
      signals: [_constants.SignalNames.YBins]
    }, {
      role: 'z',
      allowNone: true
    }, {
      role: 'color',
      allowNone: true
    }, {
      role: 'sort',
      allowNone: true
    }]
  };

  if (errors.length) {
    return {
      errors,
      specCapabilities,
      vegaSpec: null
    };
  }

  const size = specColumns.facet ? (0, _facet.facetSize)(context) : insight.size;
  var vegaSpec = {
    $schema: 'https://vega.github.io/schema/vega/v3.json',
    height: size.height,
    width: size.width,
    signals: (0, _signals.default)(context),
    data: (0, _data.default)(context),
    scales: (0, _scales.default)(context),
    marks: (0, _marks.default)(context)
  };

  if (!insight.hideAxes) {
    vegaSpec.axes = (0, _axes.default)(context);
  }

  const legends = (0, _legends.getLegends)(context);

  if (legends) {
    vegaSpec.legends = legends;
  }

  if (specColumns.facet) {
    vegaSpec.layout = (0, _facet.layout)(context);
  } else {
    //use autosize only when not faceting
    vegaSpec.autosize = 'fit';
  }

  return {
    vegaSpec,
    specCapabilities
  };
};

exports.stacks = stacks;
},{"./axes":"EgtV","./data":"yHuT","./marks":"HgPa","./scales":"iROM","./signals":"e6rP","../facet":"G5nM","../legends":"OiCi","../constants":"lE7J"}],"tM0D":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.treemapTransforms = treemapTransforms;

var _array = require("../../array");

var _constants = require("../constants");

var _facet = require("../facet");

var _top = require("../top");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context) {
  const {
    specColumns,
    insight,
    specViewOptions
  } = context;
  const categoricalColor = specColumns.color && !specColumns.color.quantitative;
  const TreeMapDataName = 'SandDanceTreeMapData';
  const data = (0, _array.allTruthy)((0, _facet.facetSourceData)(specColumns.facet, insight.facets, TreeMapDataName), [{
    name: _constants.DataNames.Main,
    source: TreeMapDataName,
    transform: (0, _array.allTruthy)(specColumns.facet && (0, _facet.facetTransforms)(specColumns.facet, insight.facets), !specColumns.facet && treemapTransforms(insight))
  }], categoricalColor && (0, _top.topLookup)(specColumns.color, specViewOptions.maxLegends), specColumns.facet && (0, _facet.facetGroupData)(_constants.DataNames.Main));
  return data;
}

function treemapTransforms(insight) {
  const transforms = [{
    type: 'nest',
    keys: [insight.columns.group || '__NONE__']
  }, {
    type: 'treemap',
    field: insight.columns.size,
    sort: {
      field: 'value',
      order: 'descending'
    },
    round: true,
    method: {
      signal: _constants.SignalNames.TreeMapMethod
    },
    padding: 1,
    size: [{
      signal: 'width'
    }, {
      signal: 'height'
    }],
    as: [_constants.FieldNames.TreemapStackX0, _constants.FieldNames.TreemapStackY0, _constants.FieldNames.TreemapStackX1, _constants.FieldNames.TreemapStackY1, _constants.FieldNames.TreemapStackDepth, _constants.FieldNames.TreemapStackChildren]
  }];
  return transforms;
}
},{"../../array":"vEfp","../constants":"lE7J","../facet":"G5nM","../top":"Wjzt"}],"rISE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constants = require("../constants");

var _fill = require("../fill");

var _selection = require("../selection");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context, data) {
  const {
    specColumns
  } = context;
  const marks = [{
    type: 'rect',
    from: {
      data
    },
    encode: {
      update: {
        x: {
          field: _constants.FieldNames.TreemapStackX0
        },
        y: {
          field: _constants.FieldNames.TreemapStackY0
        },
        x2: {
          field: _constants.FieldNames.TreemapStackX1
        },
        y2: {
          field: _constants.FieldNames.TreemapStackY1
        },
        fill: (0, _fill.fill)(context),
        opacity: (0, _fill.opacity)(context)
      }
    }
  }];

  if (specColumns.z) {
    const update = marks[0].encode.update;
    update.z = {
      value: 0
    };
    update.depth = [{
      test: (0, _selection.testForCollapseSelection)(),
      value: 0
    }, {
      scale: _constants.ScaleNames.Z,
      field: specColumns.z.name
    }];
  }

  return marks;
}
},{"../constants":"lE7J","../fill":"zTeX","../selection":"lYO7"}],"IFi8":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _scales = require("../scales");

var _constants = require("../constants");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context) {
  const {
    specColumns,
    insight
  } = context;
  const scales = [];

  if (specColumns.color && !specColumns.color.isColorData && !insight.directColor) {
    if (specColumns.color.quantitative) {
      scales.push((0, _scales.binnableColorScale)(insight.colorBin, _constants.DataNames.Main, specColumns.color.name, insight.scheme));
    } else {
      scales.push({
        name: _constants.ScaleNames.Color,
        type: 'ordinal',
        domain: {
          data: _constants.DataNames.Legend,
          field: _constants.FieldNames.Top,
          sort: true
        },
        range: {
          scheme: insight.scheme || _constants.ColorScaleNone
        },
        reverse: {
          signal: _constants.SignalNames.ColorReverse
        }
      });
    }
  }

  if (specColumns.z) {
    const zRange = [0, {
      signal: _constants.SignalNames.ZHeight
    }];
    scales.push(specColumns.z.quantitative ? (0, _scales.linearScale)(_constants.ScaleNames.Z, _constants.DataNames.Main, specColumns.z.name, zRange, false, false) : (0, _scales.pointScale)(_constants.ScaleNames.Z, _constants.DataNames.Main, zRange, specColumns.z.name));
  }

  return scales;
}
},{"../scales":"SMhG","../constants":"lE7J"}],"yf8k":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _array = require("../../array");

var _signals = require("../signals");

var _facet = require("../facet");

var _constants = require("../constants");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function _default(context) {
  const {
    insight,
    specViewOptions
  } = context;
  const signals = (0, _array.allTruthy)((0, _signals.textSignals)(context), [(0, _signals.colorBinCountSignal)(context), {
    name: _constants.SignalNames.TreeMapMethod,
    value: 'squarify',
    bind: {
      name: specViewOptions.language.treeMapMethod,
      input: 'select',
      options: ['squarify', 'binary']
    }
  }, (0, _signals.colorReverseSignal)(context)], insight.columns.facet && (0, _facet.facetSignals)(context));
  return signals;
}
},{"../../array":"vEfp","../signals":"iEcA","../facet":"G5nM","../constants":"lE7J"}],"F4Ex":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.treemap = void 0;

var _data = _interopRequireWildcard(require("./data"));

var _marks = _interopRequireDefault(require("./marks"));

var _scales = _interopRequireDefault(require("./scales"));

var _signals = _interopRequireDefault(require("./signals"));

var _facet = require("../facet");

var _constants = require("../constants");

var _legends = require("../legends");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const treemap = context => {
  const {
    specColumns,
    insight,
    specViewOptions
  } = context;
  const errors = [];
  if (!specColumns.size) errors.push('Must set a field for size');
  (0, _facet.checkForFacetErrors)(insight.facets, errors);
  const specCapabilities = {
    roles: [{
      role: 'size',
      excludeCategoric: true
    }, {
      role: 'group',
      allowNone: true
    }, {
      role: 'z',
      allowNone: true
    }, {
      role: 'color',
      allowNone: true
    }, {
      role: 'facet',
      allowNone: true
    }],
    signals: [_constants.SignalNames.TreeMapMethod]
  };

  if (errors.length) {
    return {
      errors,
      specCapabilities,
      vegaSpec: null
    };
  }

  const categoricalColor = specColumns.color && !specColumns.color.quantitative;
  const dataName = categoricalColor ? _constants.DataNames.Legend : _constants.DataNames.Main;
  const TreeMapName = 'SandDanceTreeMapFaceted';
  const data = (0, _data.default)(context);
  let marks = (0, _marks.default)(context, specColumns.facet ? TreeMapName : dataName);

  if (specColumns.facet) {
    const childData = {
      name: TreeMapName,
      source: _constants.DataNames.FacetGroupCell,
      transform: (0, _data.treemapTransforms)(insight)
    };
    marks = (0, _facet.facetMarks)(specViewOptions, dataName, marks, null, [childData]);
    marks[0].marks;
  }

  const size = specColumns.facet ? (0, _facet.facetSize)(context) : insight.size;
  var vegaSpec = {
    $schema: 'https://vega.github.io/schema/vega/v3.json',
    height: size.height,
    width: size.width,
    signals: (0, _signals.default)(context),
    data,
    scales: (0, _scales.default)(context),
    marks
  };
  const legends = (0, _legends.getLegends)(context);

  if (legends) {
    vegaSpec.legends = legends;
  }

  if (specColumns.facet) {
    vegaSpec.layout = (0, _facet.layout)(context);
  } else {
    //use autosize only when not faceting
    vegaSpec.autosize = 'fit';
  }

  return {
    vegaSpec,
    specCapabilities
  };
};

exports.treemap = treemap;
},{"./data":"tM0D","./marks":"rISE","./scales":"IFi8","./signals":"yf8k","../facet":"G5nM","../constants":"lE7J","../legends":"OiCi"}],"Fpm2":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.create = create;
exports.constants = exports.creators = void 0;

var constants = _interopRequireWildcard(require("./constants"));

exports.constants = constants;

var _barchartH = require("./barchartH");

var _barchartV = require("./barchartV");

var _density = require("./density");

var _grid = require("./grid");

var _scatterPlot = require("./scatterPlot");

var _stacks = require("./stacks");

var _treeMap = require("./treeMap");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const creators = {
  barchart: _barchartV.barchartV,
  barchartH: _barchartH.barchartH,
  barchartV: _barchartV.barchartV,
  density: _density.density,
  grid: _grid.grid,
  scatterplot: _scatterPlot.scatterplot,
  stacks: _stacks.stacks,
  treemap: _treeMap.treemap
};
exports.creators = creators;

function create(context) {
  const {
    insight
  } = context;
  const creator = creators[insight.chart];

  if (creator) {
    const specResult = creator(context); //TODO: find why Vega is doing this. fixup for facets

    if (specResult.vegaSpec && insight.columns && insight.columns.facet && insight.facets.columns === 2 && insight.facets.rows === 1) {
      specResult.vegaSpec.width = insight.size.width / 3;
    }

    return specResult;
  }
}
},{"./constants":"lE7J","./barchartH":"zw2H","./barchartV":"FIhV","./density":"dSSD","./grid":"qmna","./scatterPlot":"HYS8","./stacks":"QAJj","./treeMap":"F4Ex"}],"IW8t":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.cloneVegaSpecWithData = cloneVegaSpecWithData;

var _ = require(".");

var _inference = require("./inference");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function cloneVegaSpecWithData(context, currData) {
  const {
    specColumns
  } = context;
  const columns = [specColumns.color, specColumns.facet, specColumns.group, specColumns.size, specColumns.sort, specColumns.x, specColumns.y, specColumns.z];
  (0, _inference.inferAll)(columns, currData);
  const specResult = (0, _.create)(context);

  if (!specResult.errors) {
    const data0 = specResult.vegaSpec.data[0];
    data0.values = currData;
  }

  return specResult;
}
},{".":"Fpm2","./inference":"zviN"}],"FPRg":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Exec = void 0;

var VegaDeckGl = _interopRequireWildcard(require("@msrvida/vega-deck.gl"));

var _group = require("./group");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function valueToBoolean(value) {
  if (typeof value === 'string') {
    switch (value.toLowerCase()) {
      case 'true':
        return true;

      case 'false':
        return false;
    }
  }

  return !!value;
}

function valueToString(value) {
  if (value == null) {
    return '';
  }

  switch (typeof value) {
    case 'string':
      return value;

    case 'boolean':
    case 'number':
      return value.toString();
  }

  return '';
}

function isStringOperation(ex) {
  switch (ex.operator) {
    case 'contains':
    case '!contains':
    case 'starts':
    case '!starts':
      return true;
  }

  return false;
}

function isnullorEmpty(value) {
  if (value == null) return true; //double equal sign to also catch undefined

  if (typeof value === 'string' && value.length === 0) return true;
  return false;
}

class Exec {
  constructor(search, columns) {
    this.columns = columns;
    this.groups = VegaDeckGl.util.clone((0, _group.ensureSearchExpressionGroupArray)(search));
    this.groups.forEach(group => {
      group.expressions.forEach(ex => {
        ex.column = this.getColumn(ex.name);
        ex.valueBool = valueToBoolean(ex.value);
        ex.valueLow = valueToString(ex.value).toLocaleLowerCase();
        ex.stringOperation = isStringOperation(ex);
      });
    });
  }

  getColumn(name) {
    for (let i = 0; i < this.columns.length; i++) {
      if (this.columns[i].name == name) {
        return this.columns[i];
      }
    }
  }

  runExpressionOnColumn(datum, ex) {
    const actualDataValue = datum[ex.name];

    if (ex.operator === 'isnullorEmpty') {
      return isnullorEmpty(actualDataValue);
    } else if (ex.operator === '!isnullorEmpty') {
      return !isnullorEmpty(actualDataValue);
    }

    let dataValue = actualDataValue;
    let expressionValue = ex.value;

    if (ex.column) {
      if (ex.column.type === 'string' || ex.stringOperation) {
        dataValue = valueToString(actualDataValue).toLocaleLowerCase();
        expressionValue = ex.valueLow;
      } else if (ex.column.type === 'boolean') {
        dataValue = valueToBoolean(actualDataValue);
        expressionValue = ex.valueBool;
      } else if (ex.column.quantitative) {
        dataValue = +actualDataValue;
        expressionValue = +ex.value;
      }
    }

    switch (ex.operator) {
      case '!=':
        return dataValue != expressionValue;

      case '<':
        return dataValue < expressionValue;

      case '<=':
        return dataValue <= expressionValue;

      case '==':
        return dataValue == expressionValue;

      case '>':
        return dataValue > expressionValue;

      case '>=':
        return dataValue >= expressionValue;

      case 'contains':
        return dataValue.indexOf(expressionValue) >= 0;

      case '!contains':
        return dataValue.indexOf(expressionValue) < 0;

      case 'starts':
        return dataValue.indexOf(expressionValue) == 0;

      case '!starts':
        return dataValue.indexOf(expressionValue) !== 0;
    }
  }

  runExpression(datum, ex) {
    if (ex.name == null) {
      //run on all columns
      const group = {
        expressions: this.columns.map((column, i) => {
          const ex2 = Object.assign(Object.assign({}, ex), {
            column,
            name: column.name
          });

          if (i) {
            ex2.clause = '||';
          }

          return ex2;
        })
      };
      return this.runGroup(datum, group);
    } else {
      return this.runExpressionOnColumn(datum, ex);
    }
  }

  runGroup(datum, group) {
    let accumulator = this.runExpression(datum, group.expressions[0]);

    for (let i = 1; i < group.expressions.length; i++) {
      let ex = group.expressions[i];

      switch (ex.clause) {
        case '&&':
          accumulator = accumulator && this.runExpression(datum, ex);
          break;

        case '||':
          accumulator = accumulator || this.runExpression(datum, ex);
          break;
      }
    }

    return accumulator;
  }

  run(datum) {
    let accumulator = this.runGroup(datum, this.groups[0]);

    for (let i = 1; i < this.groups.length; i++) {
      let group = this.groups[i];

      switch (group.clause) {
        case '&&':
          accumulator = accumulator && this.runGroup(datum, group);
          break;

        case '||':
          accumulator = accumulator || this.runGroup(datum, group);
          break;
      }
    }

    return accumulator;
  }

}

exports.Exec = Exec;
},{"@msrvida/vega-deck.gl":"IXYG","./group":"DYlx"}],"MwCS":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.DataScope = void 0;

var VegaDeckGl = _interopRequireWildcard(require("@msrvida/vega-deck.gl"));

var _constants = require("./specs/constants");

var _exec = require("./searchExpression/exec");

var _inference = require("./specs/inference");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
class DataScope {
  constructor() {
    this.filteredColumnsStats = {};
  }

  setData(data, columns) {
    const differentData = this.data !== data;

    if (differentData) {
      if (this.data) {
        //clean up things we added to old data
        this.deselect();
      }

      this.data = data;
      this.columns = columns;
      this.filteredData = null;
      this.filteredColumnsStats = {};
    }

    return differentData;
  }

  setFilteredData(filteredData) {
    this.filteredData = filteredData;
    this.filteredColumnsStats = {};
  }

  getColumns(columnTypes) {
    if (!this.columns) {
      this.columns = (0, _inference.getColumnsFromData)(this.data, columnTypes);
    }

    return this.columns;
  }

  getFilteredColumnStats(columnName) {
    if (!this.filteredColumnsStats[columnName]) {
      this.filteredColumnsStats[columnName] = (0, _inference.getStats)(this.filteredData, this.columns.filter(c => c.name === columnName)[0]);
    }

    return this.filteredColumnsStats[columnName];
  }

  currentData() {
    return this.filteredData || this.data;
  }

  select(search) {
    this.deselect();

    if (search) {
      this.selection = this.createUserSelection(search, true);

      if (this.selection.included.length) {
        this.activate(this.selection.included[0]);
      }
    }
  }

  createUserSelection(search, assign) {
    const exec = new _exec.Exec(search, this.getColumns());
    const s = {
      search,
      included: [],
      excluded: []
    };
    this.currentData().forEach(datum => {
      if (exec.run(datum)) {
        if (assign) {
          datum[_constants.FieldNames.Selected] = true;
        }

        s.included.push(datum);
      } else {
        s.excluded.push(datum);
      }
    });
    return s;
  }

  deselect() {
    this.deactivate();
    this.data.forEach(datum => {
      delete datum[_constants.FieldNames.Selected];
    });
    this.selection = null;
  }

  hasFilteredData() {
    return !!this.filteredData;
  }

  hasSelectedData() {
    return !!this.selection;
  }

  collapse(collapsed, data = this.data) {
    data.forEach(datum => {
      datum[_constants.FieldNames.Collapsed] = collapsed;
    });
    this.isCollapsed = collapsed;
  }

  activate(datum) {
    this.deactivate();
    datum[_constants.FieldNames.Active] = true;
    this.active = datum;
  }

  deactivate() {
    if (this.active) {
      delete this.active[_constants.FieldNames.Active];
    }

    this.active = null;
  }

  ordinalIndexWithinSelection(ordinal) {
    if (this.selection) {
      for (let i = 0; i < this.selection.included.length; i++) {
        let datum = this.selection.included[i];

        if (datum[VegaDeckGl.constants.GL_ORDINAL] === ordinal) {
          return {
            datum,
            index: i
          };
        }
      }
    }

    return {
      datum: null,
      index: -1
    };
  }

  finalize() {
    this.data = null;
    this.filteredData = null;
    this.filteredColumnsStats = null;

    if (this.selection) {
      this.selection.excluded = null;
      this.selection.included = null;
      this.selection = null;
    }
  }

}

exports.DataScope = DataScope;
},{"@msrvida/vega-deck.gl":"IXYG","./specs/constants":"lE7J","./searchExpression/exec":"FPRg","./specs/inference":"zviN"}],"XziH":[function(require,module,exports) {
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _xregexp = require('./xregexp');

var _xregexp2 = _interopRequireDefault(_xregexp);

var _build = require('./addons/build');

var _build2 = _interopRequireDefault(_build);

var _matchrecursive = require('./addons/matchrecursive');

var _matchrecursive2 = _interopRequireDefault(_matchrecursive);

var _unicodeBase = require('./addons/unicode-base');

var _unicodeBase2 = _interopRequireDefault(_unicodeBase);

var _unicodeBlocks = require('./addons/unicode-blocks');

var _unicodeBlocks2 = _interopRequireDefault(_unicodeBlocks);

var _unicodeCategories = require('./addons/unicode-categories');

var _unicodeCategories2 = _interopRequireDefault(_unicodeCategories);

var _unicodeProperties = require('./addons/unicode-properties');

var _unicodeProperties2 = _interopRequireDefault(_unicodeProperties);

var _unicodeScripts = require('./addons/unicode-scripts');

var _unicodeScripts2 = _interopRequireDefault(_unicodeScripts);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

(0, _build2.default)(_xregexp2.default);
(0, _matchrecursive2.default)(_xregexp2.default);
(0, _unicodeBase2.default)(_xregexp2.default);
(0, _unicodeBlocks2.default)(_xregexp2.default);
(0, _unicodeCategories2.default)(_xregexp2.default);
(0, _unicodeProperties2.default)(_xregexp2.default);
(0, _unicodeScripts2.default)(_xregexp2.default);

exports.default = _xregexp2.default;
module.exports = exports['default'];
},{"./xregexp":"u2A8","./addons/build":"R9Tm","./addons/matchrecursive":"YS0V","./addons/unicode-base":"d64b","./addons/unicode-blocks":"n813","./addons/unicode-categories":"IOa4","./addons/unicode-properties":"cRRZ","./addons/unicode-scripts":"A4yq"}],"VstV":[function(require,module,exports) {
'use strict';

const xRegExp = require('xregexp');

module.exports = (text, separator) => {
  if (typeof text !== 'string') {
    throw new TypeError('Expected a string');
  }

  separator = typeof separator === 'undefined' ? '_' : separator;
  const regex1 = xRegExp('([\\p{Ll}\\d])(\\p{Lu})', 'g');
  const regex2 = xRegExp('(\\p{Lu}+)(\\p{Lu}[\\p{Ll}\\d]+)', 'g');
  return text // TODO: Use this instead of `xregexp` when targeting Node.js 10:
  // .replace(/([\p{Lowercase_Letter}\d])(\p{Uppercase_Letter})/gu, `$1${separator}$2`)
  // .replace(/(\p{Lowercase_Letter}+)(\p{Uppercase_Letter}[\p{Lowercase_Letter}\d]+)/gu, `$1${separator}$2`)
  .replace(regex1, "$1".concat(separator, "$2")).replace(regex2, "$1".concat(separator, "$2")).toLowerCase();
};
},{"xregexp":"XziH"}],"m4Jj":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.createElement = createElement;
exports.mount = mount;

var _decamelize = _interopRequireWildcard(require("decamelize"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

//handle es6 / bundling
const decamelize = _decamelize['default'] || _decamelize;

function createElement(tag, attrs, ...children) {
  if (typeof tag === 'function') {
    const fn = tag;
    const props = attrs;
    props.children = children;
    return fn(props);
  } else {
    const el = document.createElement(tag);
    const map = attrs;

    for (let name in map) {
      if (name && map.hasOwnProperty(name)) {
        let value = map[name];

        if (name === 'className' && value !== void 0) {
          el.setAttribute('class', value.toString());
        } else if (value === false || value === null || value === undefined) {
          continue;
        } else if (value === true) {
          el.setAttribute(name, name);
        } else if (typeof value === 'function') {
          el[name.toLowerCase()] = value;
        } else if (typeof value === 'object') {
          el.setAttribute(name, flatten(value));
        } else {
          el.setAttribute(name, value.toString());
        }
      }
    }

    if (children && children.length > 0) {
      appendChildren(el, children);
    }

    return el;
  }
}

function flatten(o) {
  const arr = [];

  for (let prop in o) arr.push(`${decamelize(prop, '-')}:${o[prop]}`);

  return arr.join(';');
}

function addChild(parentElement, child) {
  if (child === null || child === undefined || typeof child === "boolean") {
    return;
  } else if (Array.isArray(child)) {
    appendChildren(parentElement, child);
  } else if (isElement(child)) {
    parentElement.appendChild(child);
  } else {
    parentElement.appendChild(document.createTextNode(child.toString()));
  }
}

function appendChildren(parentElement, children) {
  children.forEach(child => addChild(parentElement, child));
}

function isElement(el) {
  //nodeType cannot be zero https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
  return !!el.nodeType;
}

function mount(element, container) {
  const activeChildPositions = getActiveChildPositions(container);
  container.innerHTML = '';

  if (element) {
    addChild(container, element);
    if (activeChildPositions) focusChildAtPosition(container, activeChildPositions);
  }
}

function focusChildAtPosition(element, childPositions) {
  while (element && childPositions.length) element = element.children.item(childPositions.shift());

  if (element) element.focus();
}

function getActiveChildPositions(containerElement) {
  var active = document.activeElement;
  var childPositions = [];

  while (active !== document.body && active !== containerElement) {
    childPositions.unshift(childPosition(active));
    active = active.parentElement;
  }

  if (active === containerElement && childPositions.length) return childPositions;
}

function childPosition(element) {
  let i = 0;

  while (element = element.previousElementSibling) i++;

  return i;
}
},{"decamelize":"VstV"}],"GYE0":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Details = void 0;

var searchExpression = _interopRequireWildcard(require("./searchExpression"));

var _vegaDeck = require("@msrvida/vega-deck.gl");

var _tsxCreateElement = require("tsx-create-element");

var _defaults = require("./defaults");

var _util = require("./util");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
var Action;

(function (Action) {
  Action[Action["deselect"] = 0] = "deselect";
  Action[Action["isolate"] = 1] = "isolate";
  Action[Action["exclude"] = 2] = "exclude";
  Action[Action["reset"] = 3] = "reset";
  Action[Action["next"] = 4] = "next";
  Action[Action["previous"] = 5] = "previous";
})(Action || (Action = {}));

class Details {
  constructor(parentElement, language, animator, dataScope, colorMapHandler, hasColorMaps) {
    this.language = language;
    this.animator = animator;
    this.dataScope = dataScope;
    this.colorMapHandler = colorMapHandler;
    this.hasColorMaps = hasColorMaps;
    this.element = _vegaDeck.util.addDiv(parentElement, `${_defaults.cssPrefix}unitControls`);
    this.clear();
  }

  finalize() {
    if (this.element) this.element.innerHTML = '';
    this.dataScope = null;
    this.element = null;
  }

  clear() {
    this.state = {
      userSelection: null,
      index: -1,
      remapColor: false
    };
    this.render();
  }

  clearSelection() {
    this.state.userSelection = null;
    this.state.index = -1;
    this.render();
  }

  populate(userSelection, index = 0) {
    this.state.userSelection = userSelection;
    this.state.index = index;
    this.render();
  }

  selectByNameValue(columnName, value) {
    const search = {
      name: columnName,
      operator: '==',
      value
    };
    this.clearSelection();
    this.animator.select(search);
    this.populate(this.dataScope.selection);
  }

  remapChanged(remap) {
    this.state.remapColor = remap;
    this.colorMapHandler(remap);
    this.render();
  }

  handleAction(action) {
    let p;
    const u = this.state.userSelection;

    switch (action) {
      case Action.deselect:
        {
          this.clearSelection();
          p = this.animator.deselect();
          break;
        }

      case Action.exclude:
        {
          this.clearSelection();
          p = this.animator.filter(searchExpression.invert(u.search), u.excluded, u.included);
          this.state.remapColor = false;
          break;
        }

      case Action.isolate:
        {
          this.clearSelection();
          p = this.animator.filter(u.search, u.included, u.excluded);
          this.state.remapColor = false;
          break;
        }

      case Action.reset:
        {
          this.clear();
          p = this.animator.reset();
          break;
        }

      default:
        {
          switch (action) {
            case Action.previous:
              {
                this.state.index--;

                if (this.state.index < 0) {
                  this.state.index = this.state.userSelection.included.length - 1;
                }

                break;
              }

            case Action.next:
              {
                this.state.index++;

                if (this.state.index >= this.state.userSelection.included.length) {
                  this.state.index = 0;
                }

                break;
              }
          }

          this.render();
          p = this.animator.activate(this.state.userSelection.included[this.state.index]);
        }
    }

    p.then(() => this.render());
  }

  render() {
    const hasRefinedData = this.dataScope.hasFilteredData();
    const renderProps = {
      language: this.language,
      actionHandler: action => this.handleAction(action),
      selectionHandler: (columnName, value) => this.selectByNameValue(columnName, value),
      count: this.state.userSelection && this.state.userSelection.included.length,
      hasRefinedData,
      item: this.state.userSelection && this.state.userSelection.included[this.state.index],
      remapColorHandler: remap => this.remapChanged(remap),
      hasColorMaps: this.hasColorMaps() && hasRefinedData,
      remapColor: this.state.remapColor
    };
    (0, _tsxCreateElement.mount)(renderDetails(renderProps), this.element);
  }

}

exports.Details = Details;

const renderDetails = props => {
  const controlButtons = [(0, _tsxCreateElement.createElement)("button", {
    disabled: !props.item,
    onClick: e => props.actionHandler(Action.deselect)
  }, props.language.deselect), (0, _tsxCreateElement.createElement)("button", {
    disabled: !props.item,
    onClick: e => props.actionHandler(Action.isolate)
  }, props.language.isolate), (0, _tsxCreateElement.createElement)("button", {
    disabled: !props.item,
    onClick: e => props.actionHandler(Action.exclude)
  }, props.language.exclude)];
  const colorMapping = (0, _tsxCreateElement.createElement)("div", null, (0, _tsxCreateElement.createElement)("button", {
    disabled: props.remapColor,
    onClick: e => props.remapColorHandler(true)
  }, props.language.newColorMap), (0, _tsxCreateElement.createElement)("button", {
    disabled: !props.remapColor,
    onClick: e => props.remapColorHandler(false)
  }, props.language.oldColorMap));
  const singleItem = props.count === 1;
  const scrollButtons = [(0, _tsxCreateElement.createElement)("button", {
    disabled: singleItem,
    onClick: e => props.actionHandler(Action.previous)
  }, props.language.previousDetail), (0, _tsxCreateElement.createElement)("button", {
    disabled: singleItem,
    onClick: e => props.actionHandler(Action.next)
  }, props.language.nextDetail), (0, _tsxCreateElement.createElement)("span", null, " ", props.language.selectionCount(props.count))];
  const rows = [];

  for (let prop in props.item) {
    if (prop === _vegaDeck.constants.GL_ORDINAL) {
      continue;
    }

    if ((0, _util.isInternalFieldName)(prop)) {
      continue;
    }

    rows.push({
      cells: [{
        content: prop
      }, {
        content: linkSelect(props.language, prop, props.item[prop], props.selectionHandler)
      }]
    });
  }

  return (0, _tsxCreateElement.createElement)("div", null, props.hasColorMaps && colorMapping, (0, _tsxCreateElement.createElement)("h4", null, props.language.headers.selection), (0, _tsxCreateElement.createElement)("div", {
    className: `${_defaults.cssPrefix}selection`
  }, controlButtons, (0, _tsxCreateElement.createElement)("button", {
    disabled: !props.hasRefinedData,
    onClick: e => props.actionHandler(Action.reset)
  }, "reset")), props.item && (0, _tsxCreateElement.createElement)("h4", null, props.language.headers.details), (0, _tsxCreateElement.createElement)("div", null, (0, _tsxCreateElement.createElement)("div", {
    className: `${_defaults.cssPrefix}details-scroll`
  }, props.item && scrollButtons), (0, _tsxCreateElement.createElement)("div", {
    className: `${_defaults.cssPrefix}details`
  }, props.item && (0, _tsxCreateElement.createElement)(_vegaDeck.controls.Table, {
    rows: rows
  }))));
};

function linkSelect(language, columnName, value, selectionHandler) {
  return (0, _tsxCreateElement.createElement)("span", null, (0, _tsxCreateElement.createElement)("a", {
    href: "#",
    onClick: e => selectionHandler(columnName, value)
  }, value), isNaN(value) ? [' ', (0, _tsxCreateElement.createElement)("a", {
    className: "bing-search",
    href: `https://www.bing.com/search?q=${encodeURIComponent(value)}`,
    target: "_blank"
  }, language.bing)] : '');
}
},{"./searchExpression":"AwjT","@msrvida/vega-deck.gl":"IXYG","tsx-create-element":"m4Jj","./defaults":"IHcE","./util":"PJe6"}],"MzeS":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ensureHeaders = ensureHeaders;

var _vegaDeck = require("@msrvida/vega-deck.gl");

function ensureHeaders(presenter, headers) {
  const vegaControls = presenter.getElement(_vegaDeck.PresenterElement.vegaControls);
  conditionalHeader(!!vegaControls.querySelectorAll('.vega-bindings > *').length, vegaControls, headers.chart);
  const legend = presenter.getElement(_vegaDeck.PresenterElement.legend);
  conditionalHeader(!!legend.children.length, legend, headers.legend);
}

function conditionalHeader(condition, element, header) {
  var existing = existingHeader(element, header);

  if (condition && !existing) {
    addHeader(element, header);
  }

  if (!condition && existing) {
    existing.remove();
  }
}

function addHeader(element, header) {
  const h = document.createElement('h4');
  h.innerHTML = header;
  element.insertAdjacentElement('beforebegin', h);
}

function existingHeader(element, header) {
  const {
    previousElementSibling
  } = element;

  if (previousElementSibling && previousElementSibling.innerHTML === header) {
    return previousElementSibling;
  }
}
},{"@msrvida/vega-deck.gl":"IXYG"}],"i6xf":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.finalizeLegend = finalizeLegend;

var _expression = require("./expression");

var _constants = require("./specs/constants");

function legendRange(colorBinType, column, legend, clickedIndex) {
  if (column.quantitative) {
    return selectQuantitative(colorBinType, column, legend, clickedIndex);
  } else {
    return selectCategorical(column, legend, clickedIndex);
  }
}

function selectCategorical(column, legend, clickedIndex) {
  const value = legend.rows[clickedIndex].value;

  if (value === _constants.Other) {
    const values = [];

    for (let i in legend.rows) {
      if (+i !== clickedIndex) {
        values.push(legend.rows[i].value);
      }
    }

    return (0, _expression.selectNone)(column, values);
  } else {
    //select equal
    return {
      expressions: [(0, _expression.selectExact)(column, legend.rows[clickedIndex].value)]
    };
  }
}

function selectQuantitative(colorBinType, column, legend, clickedIndex) {
  const keys = Object.keys(legend.rows).map(key => +key).sort((a, b) => +a - +b);
  let lowValue;
  let lowOperator;
  let highValue;
  let highOperator;
  const rowText = legend.rows[clickedIndex].label;

  switch (colorBinType) {
    case 'continuous':
      {
        lowValue = rowText;

        if (clickedIndex < keys.length - 1) {
          highValue = legend.rows[clickedIndex + 1].value;
        }

        break;
      }

    default:
      {
        if (rowText.indexOf('null') > 0) {
          const ex = {
            expressions: [(0, _expression.selectNullOrEmpty)(column)]
          };
          return ex;
        }

        const dash = rowText.indexOf('–'); //this is not the common dash character!

        if (dash > 0) {
          //bug in Vega for quantize?
          //lowOperator = '>';
          //highOperator = '<=';
          lowValue = rowText.substr(0, dash);
          highValue = rowText.substr(dash + 1);
        } else {
          if (rowText.indexOf('<') >= 0) {
            highValue = rowText.substring(2);
          } else {
            if (rowText.indexOf('≥') >= 0) {
              lowValue = rowText.substring(2);
            }
          }
        }
      }
  }

  if (lowValue) lowValue = (0, _expression.notNice)(lowValue);
  if (highValue) highValue = (0, _expression.notNice)(highValue);
  return (0, _expression.selectBetween)(column, lowValue, highValue, lowOperator, highOperator);
}

function finalizeLegend(colorBinType, colorColumn, legend, language) {
  const rowTexts = [];

  for (let i in legend.rows) {
    let row = legend.rows[i];
    row.search = legendRange(colorBinType, colorColumn, legend, +i);

    if (row.value === _constants.Other) {
      row.label = language.legendOther;
    } else if (rowTexts.indexOf(row.value) >= 0) {
      delete legend.rows[i];
    } else {
      rowTexts.push(row.value);
    }
  }
}
},{"./expression":"nVyP","./specs/constants":"lE7J"}],"Fg2j":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.recolorAxes = recolorAxes;

var VegaDeckGl = _interopRequireWildcard(require("@msrvida/vega-deck.gl"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function cloneAxis(axes, axisColor, axisTextColor) {
  return axes.map(axis => {
    const newAxis = VegaDeckGl.util.deepMerge(axis);
    newAxis.domain.color = axisColor;
    newAxis.title.color = axisTextColor;
    newAxis.ticks.forEach(t => {
      t.color = axisColor;
    });
    newAxis.tickText.forEach(t => {
      t.color = axisTextColor;
    });
    return newAxis;
  });
}

function cloneTextData(textData, color) {
  return textData.map(t => {
    return Object.assign(Object.assign({}, t), {
      color
    });
  });
}

function colorEquals(a, b) {
  if (a.length !== b.length) return false;

  for (let i = 0; i < a.length; i++) {
    if (a[i] !== b[i]) return false;
  }

  return true;
}

function recolorAxes(stage, oldColors, newColors) {
  const hasNewLineColor = newColors.axisLine && !colorEquals(newColors.axisLine, oldColors.axisLine);
  const hasNewTextColor = newColors.axisText && !colorEquals(newColors.axisText, oldColors.axisText);
  let axes;
  let textData;

  if (hasNewLineColor || hasNewTextColor) {
    const lineColor = newColors.axisLine || oldColors.axisLine;
    const textColor = newColors.axisText || oldColors.axisText;
    axes = {
      x: cloneAxis(stage.axes.x, lineColor, textColor),
      y: cloneAxis(stage.axes.y, lineColor, textColor)
    };
  }

  if (hasNewTextColor) {
    textData = cloneTextData(stage.textData, newColors.axisText);
  }

  return {
    axes,
    textData
  };
}
},{"@msrvida/vega-deck.gl":"IXYG"}],"YL9e":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Tooltip = void 0;

var VegaDeckGl = _interopRequireWildcard(require("@msrvida/vega-deck.gl"));

var _tsxCreateElement = require("tsx-create-element");

var _util = require("./util");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const {
  GL_ORDINAL
} = VegaDeckGl.constants;
const {
  outerSize
} = VegaDeckGl.util;
const {
  Table
} = VegaDeckGl.controls;

class Tooltip {
  constructor(props) {
    const renderProps = {
      cssPrefix: props.cssPrefix,
      rows: getRows(props.item, props.options)
    };
    this.element = renderTooltip(renderProps);

    if (this.element) {
      this.element.style.position = 'absolute';
      this.child = this.element.firstChild;
      document.body.appendChild(this.element); //measure and move as necessary

      let m = outerSize(this.child);

      while (m.height > document.documentElement.clientHeight) {
        let tr = this.child.querySelector('tr:last-child');

        if (tr) {
          tr.parentElement.removeChild(tr);
        } else {
          break;
        }

        m = outerSize(this.child);
      }

      if (props.position.clientX + m.width >= document.documentElement.clientWidth) {
        this.child.style.right = '0';
      }

      let moveTop = true;

      if (props.position.clientY + m.height >= document.documentElement.clientHeight) {
        if (props.position.clientY - m.height > 0) {
          this.child.style.bottom = '0';
        } else {
          moveTop = false;
        }
      }

      if (moveTop) {
        this.element.style.top = `${props.position.clientY}px`;
      }

      this.element.style.left = `${props.position.clientX}px`;
    }
  }

  finalize() {
    if (this.element) {
      document.body.removeChild(this.element);
    }

    this.element = null;
  }

}

exports.Tooltip = Tooltip;

function getRows(item, options) {
  const rows = [];

  for (let columnName in item) {
    if (columnName === GL_ORDINAL) {
      continue;
    }

    if ((0, _util.isInternalFieldName)(columnName)) {
      continue;
    }

    if (options && options.exclude) {
      if (options.exclude(columnName)) {
        continue;
      }
    }

    let value = item[columnName];
    let content;

    if (options && options.displayValue) {
      content = options.displayValue(value);
    } else {
      switch (value) {
        case null:
          content = (0, _tsxCreateElement.createElement)("i", null, "null");
          break;

        case undefined:
          content = (0, _tsxCreateElement.createElement)("i", null, "undefined");
          break;

        default:
          content = value.toString();
      }
    }

    rows.push({
      cells: [{
        content: columnName + ':'
      }, {
        content
      }]
    });
  }

  return rows;
}

const renderTooltip = props => {
  return props.rows.length === 0 ? null : (0, _tsxCreateElement.createElement)("div", {
    className: `${props.cssPrefix}tooltip`
  }, Table({
    rows: props.rows
  }));
};
},{"@msrvida/vega-deck.gl":"IXYG","tsx-create-element":"m4Jj","./util":"PJe6"}],"TOkL":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Viewer = void 0;

var searchExpression = _interopRequireWildcard(require("./searchExpression"));

var VegaDeckGl = _interopRequireWildcard(require("@msrvida/vega-deck.gl"));

var _animator = require("./animator");

var _colorCubes = require("./colorCubes");

var _signals = require("./signals");

var _ordinal = require("./ordinal");

var _axisSelection = require("./axisSelection");

var _clone = require("./specs/clone");

var _dataScope = require("./dataScope");

var _defaults = require("./defaults");

var _details = require("./details");

var _headers = require("./headers");

var _legend = require("./legend");

var _tsxCreateElement = require("tsx-create-element");

var _axes = require("./axes");

var _colorSchemes = require("./colorSchemes");

var _tooltip = require("./tooltip");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var __awaiter = void 0 && (void 0).__awaiter || function (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());
  });
}; // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.


const {
  defaultView
} = VegaDeckGl.defaults;
let didRegisterColorSchemes = false;
/**
 * Component to view a SandDance data visualization.
 */

class Viewer {
  /**
   * Instantiate a new Viewer.
   * @param element Parent HTMLElement to present within.
   * @param options Optional viewer options object.
   */
  constructor(element, options) {
    this.element = element;
    this.options = VegaDeckGl.util.deepMerge(_defaults.defaultViewerOptions, options);
    this.presenter = new VegaDeckGl.Presenter(element, (0, _defaults.getPresenterStyle)(this.options));
    this._dataScope = new _dataScope.DataScope();
    this._animator = new _animator.Animator(this._dataScope, {
      onDataChanged: this.onDataChanged.bind(this),
      onAnimateDataChange: this.onAnimateDataChange.bind(this)
    });
    this._details = new _details.Details(this.presenter.getElement(VegaDeckGl.PresenterElement.panel), this.options.language, this._animator, this._dataScope, remap => {
      this.currentColorContext = ~~remap;
      this.renderSameLayout();
    }, () => this.insight && this.insight.columns && !!this.insight.columns.color && this.colorContexts && this.colorContexts.length > 1);
    this.insight = {};
    this._signalValues = {};
  }

  changeColorContexts(colorContexts) {
    this.colorContexts = colorContexts;
    this.currentColorContext = 0;
    this.options.onColorContextChange && this.options.onColorContextChange();
  }

  applyLegendColorContext(colorContext) {
    (0, _tsxCreateElement.mount)(colorContext.legendElement, this.presenter.getElement(VegaDeckGl.PresenterElement.legend));
    this.presenter.stage.legend = colorContext.legend;
  }

  onAnimateDataChange(dataChange, waitingLabel, handlerLabel) {
    return new Promise((resolve, reject) => {
      let innerPromise;

      if (dataChange === _animator.DataLayoutChange.refine) {
        const oldColorContext = this.colorContexts[this.currentColorContext];
        innerPromise = new Promise(innerResolve => {
          this.renderNewLayout({
            preStage: (stage, deckProps) => {
              (0, _legend.finalizeLegend)(this.insight.colorBin, this._specColumns.color, stage.legend, this.options.language);
              this.overrideAxisLabels(stage);
              (0, _colorCubes.applyColorMapToCubes)([oldColorContext.colorMap], VegaDeckGl.util.getCubes(deckProps));

              if (this.options.onStage) {
                this.options.onStage(stage, deckProps);
              }
            }
          }).then(() => {
            //apply old legend
            this.applyLegendColorContext(oldColorContext);
            innerResolve();
          });
        });
      } else {
        innerPromise = this.renderNewLayout({
          preStage: (stage, deckProps) => {
            (0, _legend.finalizeLegend)(this.insight.colorBin, this._specColumns.color, stage.legend, this.options.language);
            this.overrideAxisLabels(stage);

            if (this.options.onStage) {
              this.options.onStage(stage, deckProps);
            }
          }
        });
      }

      innerPromise.then(() => {
        this.presenter.animationQueue(resolve, this.options.transitionDurations.position, {
          waitingLabel,
          handlerLabel,
          animationCanceled: reject
        });
      });
    });
  }

  onDataChanged(dataLayout, filter) {
    return __awaiter(this, void 0, void 0, function* () {
      switch (dataLayout) {
        case _animator.DataLayoutChange.same:
          {
            this.renderSameLayout();
            break;
          }

        case _animator.DataLayoutChange.refine:
          {
            //save cube colors
            const oldColorContext = this.colorContexts[this.currentColorContext];
            let colorMap;
            yield this.renderNewLayout({
              preStage: (stage, deckProps) => {
                //save off the spec colors
                colorMap = (0, _colorCubes.colorMapFromCubes)(stage.cubeData);
                (0, _colorCubes.applyColorMapToCubes)([oldColorContext.colorMap], VegaDeckGl.util.getCubes(deckProps));
                this.preStage(stage, deckProps);
              },
              onPresent: () => {
                //save new legend
                const newColorContext = {
                  colorMap,
                  legend: VegaDeckGl.util.clone(this.presenter.stage.legend),
                  legendElement: this.presenter.getElement(VegaDeckGl.PresenterElement.legend).children[0]
                }; //apply old legend

                this.applyLegendColorContext(oldColorContext);
                this.changeColorContexts([oldColorContext, newColorContext]);
              }
            }); //narrow the filter only if it is different

            if (!searchExpression.compare(this.insight.filter, filter)) {
              this.insight.filter = searchExpression.narrow(this.insight.filter, filter);
            }

            if (this.options.onDataFilter) {
              this.options.onDataFilter(this.insight.filter, this._dataScope.currentData());
            }

            break;
          }

        case _animator.DataLayoutChange.reset:
          {
            const colorContext = {
              colorMap: null,
              legend: null,
              legendElement: null
            };
            this.changeColorContexts([colorContext]);
            yield this.renderNewLayout({
              onPresent: () => {
                (0, _colorCubes.populateColorContext)(colorContext, this.presenter);
              }
            });
            delete this.insight.filter;

            if (this.options.onDataFilter) {
              this.options.onDataFilter(null, null);
            }

            break;
          }
      }

      if (this.options.onSelectionChanged) {
        const sel = this.getSelection();
        this.options.onSelectionChanged(sel && sel.search || null, 0, sel && sel.selectedData || null);
      }
    });
  }

  getSpecColumnsWithFilteredStats() {
    if (!this._dataScope.hasFilteredData()) {
      return this._specColumns;
    }

    const roles = ['color', 'facet', 'group', 'size', 'sort', 'x', 'y', 'z'];
    const specColumns = Object.assign({}, this._specColumns);
    roles.forEach(r => {
      if (specColumns[r]) {
        const column = Object.assign({}, specColumns[r]);
        column.stats = this.getColumnStats(column);
        specColumns[r] = column;
      }
    });
    return specColumns;
  }

  renderNewLayout(c, view) {
    return __awaiter(this, void 0, void 0, function* () {
      const currData = this._dataScope.currentData();

      const context = {
        specColumns: this.getSpecColumnsWithFilteredStats(),
        insight: this.insight,
        specViewOptions: this.options
      };
      const specResult = (0, _clone.cloneVegaSpecWithData)(context, currData);

      if (!specResult.errors) {
        const uiValues = (0, _signals.extractSignalValuesFromView)(this.vegaViewGl, this.vegaSpec);
        this._signalValues = Object.assign(Object.assign(Object.assign({}, this._signalValues), uiValues), this.insight.signalValues);
        (0, _signals.applySignalValues)(this._signalValues, specResult.vegaSpec);
        this.vegaSpec = specResult.vegaSpec;
        this.options.onVegaSpec && this.options.onVegaSpec(this.vegaSpec);
        this.specCapabilities = specResult.specCapabilities;
        const config = this.createConfig(c);

        if (view) {
          config.getView = () => view;
        }

        if (!didRegisterColorSchemes) {
          (0, _colorSchemes.registerColorSchemes)(VegaDeckGl.base.vega);
          didRegisterColorSchemes = true;
        }

        try {
          const runtime = VegaDeckGl.base.vega.parse(this.vegaSpec);
          this.vegaViewGl = new VegaDeckGl.ViewGl(runtime, config).renderer('deck.gl').initialize(this.element);
          yield this.vegaViewGl.runAsync(); //capture new color color contexts via signals

          this.configForSignalCapture(config.presenterConfig);
        } catch (e) {
          specResult.errors = [e.message];
        }

        if (!specResult.errors) {
          (0, _headers.ensureHeaders)(this.presenter, this.options.language.headers);
        }
      }

      if (specResult.errors) {
        if (this.options.onError) {
          this.options.onError(specResult.errors);
        } else if (this.presenter.logger) {
          this.presenter.logger(`errors rendering Vega spec:${specResult.errors.join('\n')}`);
        }
      }

      return specResult;
    });
  }
  /**
   * Render the same layout with new options.
   * @param newViewerOptions New options object.
   */


  renderSameLayout(newViewerOptions) {
    const colorContext = this.colorContexts[this.currentColorContext];
    const clonedCubes = this.presenter.getCubeData().map(cube => {
      return Object.assign({}, cube);
    });
    this.applyLegendColorContext(colorContext);
    let {
      axes,
      textData
    } = this.presenter.stage;
    let recoloredAxes;

    if (newViewerOptions) {
      if (newViewerOptions.colors) {
        recoloredAxes = (0, _axes.recolorAxes)(this.presenter.stage, this._lastColorOptions, newViewerOptions.colors);
        axes = recoloredAxes.axes || axes;
        textData = recoloredAxes.textData || textData;
      }

      this.options = VegaDeckGl.util.deepMerge(this.options, newViewerOptions);
    }

    let colorMaps = [colorContext.colorMap];
    let colorMethod;

    const hasSelectedData = this._dataScope.hasSelectedData();

    const hasActive = !!this._dataScope.active;

    if (hasSelectedData || hasActive) {
      const selectedColorMap = (0, _colorCubes.getSelectedColorMap)(this._dataScope.currentData(), hasSelectedData, hasActive, this.options);
      colorMaps.push(selectedColorMap);
      colorMethod = this.options.colors.unselectedColorMethod;
    }

    (0, _colorCubes.applyColorMapToCubes)(colorMaps, clonedCubes, colorMethod);
    const stage = {
      cubeData: clonedCubes,
      axes,
      textData
    };
    this.vegaViewGl.presenter.rePresent(stage, this.createConfig().presenterConfig);
  }

  getView(view) {
    if (view === undefined) {
      if (this.presenter.view === null) {
        return defaultView;
      } else {
        return this.presenter.view;
      }
    } else {
      return view;
    }
  }

  transformData(values, transform) {
    try {
      const runtime = VegaDeckGl.base.vega.parse({
        $schema: 'https://vega.github.io/schema/vega/v4.json',
        data: [{
          name: 'source',
          values,
          transform
        }]
      });
      new VegaDeckGl.ViewGl(runtime).run();
    } catch (e) {// continue regardless of error
    }

    return values;
  }
  /**
   * Render data into a visualization.
   * @param insight Object to create a visualization specification.
   * @param data Array of data objects.
   * @param view Optional View to specify camera type.
   * @param ordinalMap Optional map of ordinals to assign to the data such that the same cubes can be re-used for new data.
   */


  render(insight, data, options = {}) {
    return __awaiter(this, void 0, void 0, function* () {
      let result; //see if refine expression has changed

      if (!searchExpression.compare(insight.filter, this.insight.filter)) {
        const allowAsyncRenderTime = 100;

        if (insight.filter) {
          //refining
          result = yield this._render(insight, data, options);
          this.presenter.animationQueue(() => {
            this.filter(insight.filter);
          }, allowAsyncRenderTime, {
            waitingLabel: 'layout before refine',
            handlerLabel: 'refine after layout'
          });
        } else {
          //not refining
          this._dataScope.setFilteredData(null);

          result = yield this._render(insight, data, options);
          this.presenter.animationQueue(() => {
            this.reset();
          }, allowAsyncRenderTime, {
            waitingLabel: 'layout before reset',
            handlerLabel: 'reset after layout'
          });
        }
      } else {
        result = yield this._render(insight, data, options);
      }

      return result;
    });
  }

  shouldViewstateTransition(newInsight, oldInsight) {
    if (!oldInsight.columns) return false;
    if (oldInsight.chart !== newInsight.chart) return true;
    if (oldInsight.size.height !== newInsight.size.height) return true;
    if (oldInsight.size.width !== newInsight.size.width) return true;
    if (oldInsight.columns.facet !== newInsight.columns.facet) return true;
    return false;
  }

  configForSignalCapture(presenterConfig) {
    const colorContext = {
      colorMap: null,
      legend: null,
      legendElement: null
    }; //now be ready to capture color changing signals 

    presenterConfig.preStage = (stage, deckProps) => {
      if (this._shouldSaveColorContext()) {
        //save off the colors from Vega layout
        colorContext.colorMap = (0, _colorCubes.colorMapFromCubes)(stage.cubeData);
      }

      this.preStage(stage, deckProps);
    };

    presenterConfig.onPresent = () => {
      if (this._shouldSaveColorContext()) {
        (0, _colorCubes.populateColorContext)(colorContext, this.presenter);
        this.changeColorContexts([colorContext]);

        this._dataScope.deselect();
      }
    };
  }

  _render(insight, data, options) {
    return __awaiter(this, void 0, void 0, function* () {
      if (this._tooltip) {
        this._tooltip.finalize();

        this._tooltip = null;
      }

      if (this._dataScope.setData(data, options.columns)) {
        //data is different, reset the signal value cache
        this._signalValues = {}; //apply transform to the data

        this.transformData(data, insight.transform);
      }

      this._specColumns = (0, _ordinal.getSpecColumns)(insight, this._dataScope.getColumns(options.columnTypes));
      const ordinalMap = (0, _ordinal.assignOrdinals)(this._specColumns, data, options.ordinalMap);
      this.insight = VegaDeckGl.util.clone(insight);
      this._lastColorOptions = VegaDeckGl.util.clone(this.options.colors);

      this._shouldSaveColorContext = () => !options.initialColorContext;

      const colorContext = options.initialColorContext || {
        colorMap: null,
        legend: null,
        legendElement: null
      };
      const specResult = yield this.renderNewLayout({
        preStage: (stage, deckProps) => {
          if (this._shouldSaveColorContext()) {
            //save off the colors from Vega layout
            colorContext.colorMap = (0, _colorCubes.colorMapFromCubes)(stage.cubeData);
          } else {
            //apply passed colorContext
            (0, _colorCubes.applyColorMapToCubes)([colorContext.colorMap], VegaDeckGl.util.getCubes(deckProps));
          } //if items are selected, repaint


          const hasSelectedData = !!this._dataScope.hasSelectedData();
          const hasActive = !!this._dataScope.active;

          if (this._dataScope.hasSelectedData() || this._dataScope.active) {
            const selectedColorMap = (0, _colorCubes.getSelectedColorMap)(this._dataScope.currentData(), hasSelectedData, hasActive, this.options);
            (0, _colorCubes.applyColorMapToCubes)([colorContext.colorMap, selectedColorMap], stage.cubeData, this.options.colors.unselectedColorMethod);
          }

          this.preStage(stage, deckProps);
        },
        onPresent: () => {
          if (this._shouldSaveColorContext()) {
            (0, _colorCubes.populateColorContext)(colorContext, this.presenter);
            this.changeColorContexts([colorContext]);
          } else {
            //apply passed colorContext
            this.applyLegendColorContext(colorContext);
          }
        },
        shouldViewstateTransition: () => this.shouldViewstateTransition(insight, this.insight)
      }, this.getView(insight.view)); //future signal changes should save the color context

      this._shouldSaveColorContext = () => !options.discardColorContextUpdates || !options.discardColorContextUpdates();

      this._details.render();

      const result = {
        ordinalMap,
        specResult
      };
      return result;
    });
  }

  overrideAxisLabels(stage) {// if (this._specColumns.x && this._specColumns.x.type === 'date') {
    //     stage.axes.x.forEach(axis => makeDateRange(
    //         axis.tickText,
    //         this.getColumnStats(this._specColumns.x)
    //     ));
    // }
    // if (this._specColumns.y && this._specColumns.y.type === 'date') {
    //     stage.axes.y.forEach(axis => makeDateRange(
    //         axis.tickText,
    //         this.getColumnStats(this._specColumns.y)
    //     ));
    // }
  }

  preStage(stage, deckProps) {
    const onClick = (e, search) => {
      if (this.options.onAxisClick) {
        this.options.onAxisClick(e, search);
      } else {
        this.select(search);
      }
    };

    this.overrideAxisLabels(stage);
    const polygonLayer = (0, _axisSelection.axisSelectionLayer)(this.presenter, this.specCapabilities, this._specColumns, stage, onClick, this.options.colors.axisSelectHighlight, this.options.selectionPolygonZ);
    const order = 1; //after textlayer but before others

    deckProps.layers.splice(order, 0, polygonLayer);
    (0, _legend.finalizeLegend)(this.insight.colorBin, this._specColumns.color, stage.legend, this.options.language);

    if (this.options.onStage) {
      this.options.onStage(stage, deckProps);
    }
  }

  onCubeClick(e, cube) {
    const hasSelectedData = this._dataScope.hasSelectedData();

    if (hasSelectedData && this._dataScope.selection.included.length > 1) {
      //if active is within selection, keep the selection and activate the one.
      const indexWithinSelection = this._dataScope.ordinalIndexWithinSelection(cube.ordinal);

      if (indexWithinSelection.index >= 0) {
        this.activate(indexWithinSelection.datum);

        this._details.populate(this._dataScope.selection, indexWithinSelection.index);

        if (this.options.onSelectionChanged) {
          const sel = this.getSelection();
          this.options.onSelectionChanged(sel.search, indexWithinSelection.index, sel.selectedData);
        }

        return;
      }
    }

    if (hasSelectedData && this._dataScope.selection.included.length === 1 && this._dataScope.selection.included[0][VegaDeckGl.constants.GL_ORDINAL] === cube.ordinal) {
      this.deselect();
      return;
    }

    const search = {
      name: VegaDeckGl.constants.GL_ORDINAL,
      operator: '==',
      value: cube.ordinal
    };
    this.select(search);
  }

  onCubeHover(e, cube) {
    if (this._tooltip) {
      this._tooltip.finalize();

      this._tooltip = null;
    }

    if (!cube) {
      return;
    }

    const currentData = this._dataScope.currentData();

    const index = (0, _ordinal.getDataIndexOfCube)(cube, currentData);

    if (index >= 0) {
      this._tooltip = new _tooltip.Tooltip({
        options: this.options.tooltipOptions,
        item: currentData[index],
        position: e,
        cssPrefix: this.presenter.style.cssPrefix
      });
    }
  }

  onTextHover(e, t) {
    //return true if highlight color is different
    if (!t || !this.options.getTextColor || !this.options.getTextHighlightColor) return false;
    return !VegaDeckGl.util.colorIsEqual(this.options.getTextColor(t), this.options.getTextHighlightColor(t));
  }

  createConfig(c) {
    const {
      getTextColor,
      getTextHighlightColor,
      onTextClick
    } = this.options;
    const defaultPresenterConfig = {
      getTextColor,
      getTextHighlightColor,
      onTextClick,
      onCubeClick: this.onCubeClick.bind(this),
      onCubeHover: this.onCubeHover.bind(this),
      onTextHover: this.onTextHover.bind(this),
      preStage: this.preStage.bind(this),
      onPresent: this.options.onPresent,
      onLayerClick: (info, pickedInfos, e) => {
        if (!info) {
          this.deselect();
        }
      },
      onLegendClick: (e, legend, clickedIndex) => {
        const legendRow = clickedIndex !== null && legend.rows[clickedIndex];

        if (legendRow) {
          if (this.options.onLegendRowClick) {
            this.options.onLegendRowClick(e, legendRow);
          } else {
            this.select(legendRow.search);
          }
        } else if (this.options.onLegendHeaderClick) {
          //header clicked
          this.options.onLegendHeaderClick(e);
        }
      }
    };

    if (this.options.onBeforeCreateLayers) {
      defaultPresenterConfig.preLayer = stage => this.options.onBeforeCreateLayers(stage, this.specCapabilities);
    }

    const config = {
      presenter: this.presenter,
      presenterConfig: Object.assign(defaultPresenterConfig, c)
    };

    if (this.options.transitionDurations) {
      config.presenterConfig.transitionDurations = this.options.transitionDurations;
    }

    return config;
  }
  /**
   * Filter the data and animate.
   * @param search Filter expression, see https://vega.github.io/vega/docs/expressions/
   */


  filter(search) {
    const u = this._dataScope.createUserSelection(search, false);

    return new Promise((resolve, reject) => {
      this._animator.filter(search, u.included, u.excluded).then(() => {
        this._details.clear();

        this._details.clearSelection();

        this._details.populate(this._dataScope.selection);

        resolve();
      });
    });
  }
  /**
   * Remove any filtration and animate.
   */


  reset() {
    return new Promise((resolve, reject) => {
      this._animator.reset().then(() => {
        this._details.clear();

        this._details.clearSelection();

        resolve();
      });
    });
  }
  /**
   * Select cubes by a filter expression.
   * @param search Filter expression, see https://vega.github.io/vega/docs/expressions/
   */


  select(search) {
    return new Promise((resolve, reject) => {
      this._animator.select(search).then(() => {
        this._details.populate(this._dataScope.selection);

        resolve();
      });
    });
  }
  /**
   * Removes any selection.
   */


  deselect() {
    return new Promise((resolve, reject) => {
      this._animator.deselect().then(() => {
        this._details.clearSelection();

        resolve();
      });
    });
  }
  /**
   * Gets the current selection.
   */


  getSelection() {
    if (!this._dataScope) return null;
    const selectionState = {
      search: this._dataScope.selection && this._dataScope.selection.search || null,
      selectedData: this._dataScope.selection && this._dataScope.selection.included || null,
      active: this._dataScope.active
    };
    return selectionState;
  }
  /**
   * Set one data row to the active state.
   */


  activate(datum) {
    return new Promise((resolve, reject) => {
      this._animator.activate(datum).then(() => {
        this._details.render();

        resolve();
      });
    });
  }
  /**
   * Deactivate item.
   */


  deActivate() {
    return new Promise((resolve, reject) => {
      if (this._dataScope && this._dataScope.active) {
        this._animator.deactivate().then(() => {
          this._details.render();

          resolve();
        });
      } else {
        resolve();
      }
    });
  }
  /**
   * Gets the current insight with signal values.
   */


  getInsight() {
    const insight = Object.assign({}, this.insight);
    insight.signalValues = this.getSignalValues();
    return insight;
  }
  /**
   * Gets column stats from current data (filtered or all).
   * @param column Column to get stats for.
   */


  getColumnStats(column) {
    return this._dataScope.hasFilteredData() ? this._dataScope.getFilteredColumnStats(column.name) : column.stats;
  }
  /**
   * Gets current signal values.
   */


  getSignalValues() {
    return (0, _signals.extractSignalValuesFromView)(this.vegaViewGl, this.vegaSpec);
  }

  finalize() {
    if (this._dataScope) this._dataScope.finalize();
    if (this._details) this._details.finalize();
    if (this._tooltip) this._tooltip.finalize();
    if (this.vegaViewGl) this.vegaViewGl.finalize();
    if (this.presenter) this.presenter.finalize();
    if (this.element) this.element.innerHTML = '';
    this.colorContexts = null;
    this.element = null;
    this.options = null;
    this.presenter = null;
    this.vegaSpec = null;
    this.vegaViewGl = null;
    this._animator = null;
    this._dataScope = null;
    this._details = null;
    this._tooltip = null;
  }

}
/**
 * Default Viewer options.
 */


exports.Viewer = Viewer;
Viewer.defaultViewerOptions = _defaults.defaultViewerOptions;
},{"./searchExpression":"AwjT","@msrvida/vega-deck.gl":"IXYG","./animator":"sJX3","./colorCubes":"LWoJ","./signals":"NVlM","./ordinal":"SZT5","./axisSelection":"g7ni","./specs/clone":"IW8t","./dataScope":"MwCS","./defaults":"IHcE","./details":"GYE0","./headers":"MzeS","./legend":"i6xf","tsx-create-element":"m4Jj","./axes":"Fg2j","./colorSchemes":"JMCm","./tooltip":"YL9e"}],"h42l":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.version = void 0;
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const version = '2.1.0';
exports.version = version;
},{}],"tCOI":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "colorSchemes", {
  enumerable: true,
  get: function () {
    return _colorSchemes.colorSchemes;
  }
});
Object.defineProperty(exports, "Viewer", {
  enumerable: true,
  get: function () {
    return _viewer.Viewer;
  }
});
Object.defineProperty(exports, "version", {
  enumerable: true,
  get: function () {
    return _version.version;
  }
});
exports.VegaDeckGl = exports.util = exports.types = exports.searchExpression = exports.constants = exports.use = void 0;

var constants = _interopRequireWildcard(require("./constants"));

exports.constants = constants;

var searchExpression = _interopRequireWildcard(require("./searchExpression"));

exports.searchExpression = searchExpression;

var types = _interopRequireWildcard(require("./types"));

exports.types = types;

var util = _interopRequireWildcard(require("./util"));

exports.util = util;

var VegaDeckGl = _interopRequireWildcard(require("@msrvida/vega-deck.gl"));

exports.VegaDeckGl = VegaDeckGl;

var _colorSchemes = require("./colorSchemes");

var _viewer = require("./viewer");

var _version = require("./version");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const use = VegaDeckGl.use;
exports.use = use;
},{"./constants":"X4RB","./searchExpression":"AwjT","./types":"KliF","./util":"PJe6","@msrvida/vega-deck.gl":"IXYG","./colorSchemes":"JMCm","./viewer":"TOkL","./version":"h42l"}],"yOTr":[function(require,module,exports) {
module.exports = compare;

/*
  primitives: value1 === value2
  functions: value1.toString == value2.toString
  arrays: if length, sequence and values of properties are identical
  objects: if length, names and values of properties are identical
  compare([[1, [2, 3]], [[1, [2, 3]]); // true
  compare([[1, [2, 3], 4], [[1, [2, 3]]); // false
  compare({a: 2, b: 3}, {a: 2, b: 3}); // true
  compare({a: 2, b: 3}, {b: 3, a: 2}); // true
  compare({a: 2, b: 3, c: 4}, {a: 2, b: 3}); // false
  compare({a: 2, b: 3}, {a: 2, b: 3, c: 4}); // false
  compare([[1, [2, {a: 4}], 4], [[1, [2, {a: 4}]]); // true
*/

function compare(value1, value2) {
  if (value1 === value2) {
    return true;
  }
  /* eslint-disable no-self-compare */
  // if both values are NaNs return true
  if ((value1 !== value1) && (value2 !== value2)) {
    return true;
  }
  if ({}.toString.call(value1) != {}.toString.call(value2)) {
    return false;
  }
  if (value1 !== Object(value1)) {
    // non equal primitives
    return false;
  }
  if (!value1) {
    return false;
  }
  if (Array.isArray(value1)) {
    return compareArrays(value1, value2);
  }
  if ({}.toString.call(value1) == '[object Object]') {
    return compareObjects(value1, value2);
  } else {
    return compareNativeSubtypes(value1, value2);
  }
}

function compareNativeSubtypes(value1, value2) {
  // e.g. Function, RegExp, Date
  return value1.toString() === value2.toString();
}

function compareArrays(value1, value2) {
  var len = value1.length;
  if (len != value2.length) {
    return false;
  }
  var alike = true;
  for (var i = 0; i < len; i++) {
    if (!compare(value1[i], value2[i])) {
      alike = false;
      break;
    }
  }
  return alike;
}

function compareObjects(value1, value2) {
  var keys1 = Object.keys(value1).sort();
  var keys2 = Object.keys(value2).sort();
  var len = keys1.length;
  if (len != keys2.length) {
    return false;
  }
  for (var i = 0; i < len; i++) {
    var key1 = keys1[i];
    var key2 = keys2[i];
    if (!(key1 == key2 && compare(value1[key1], value2[key2]))) {
      return false;
    }
  }
  return true;
}

},{}],"gmT8":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.deepCompare = exports.classList = void 0;

var compare = _interopRequireWildcard(require("just-compare"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const classList = (...args) => {
  return args.filter(Boolean).join(' ');
};

exports.classList = classList;
const deepCompare = compare.default || compare;
exports.deepCompare = deepCompare;
},{"just-compare":"yOTr"}],"MpPQ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.SandDanceReact = void 0;

var React = _interopRequireWildcard(require("react"));

var _util = require("./util");

var _reactDom = require("react-dom");

var _sanddance = require("@msrvida/sanddance");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function addNullable(insight, signalValues) {
  const withNulls = Object.assign(Object.assign({
    view: null,
    filter: null
  }, insight), {
    signalValues
  });
  return withNulls;
}

class SandDanceReact extends React.Component {
  areLayoutPropsSame() {
    const currentInsight = this.viewer.getInsight();
    const a = addNullable(currentInsight, Object.assign(Object.assign({}, this.viewer.insight.signalValues), currentInsight.signalValues));
    const b = addNullable(this.props.insight, Object.assign(Object.assign({}, a.signalValues), this.props.insight.signalValues));
    const compare = (0, _util.deepCompare)(a, b);
    return compare && this.props.data === this.lastData;
  }

  needsLayout() {
    return this.props.insight && this.props.data && !this.areLayoutPropsSame();
  }

  layout() {
    this.lastData = this.props.data;
    this.viewer.render(this.props.insight, this.props.data, this.props.renderOptions).then(renderResult => {
      //TODO: show errors if any
      //console.log('viewer render');
      this.props.onView && this.props.onView(renderResult);
    }).catch(e => {
      //console.log('viewer error');
      this.props.onError && this.props.onError(e);
    });
  }

  view() {
    const needsLayout = this.needsLayout();

    if (needsLayout) {
      this.layout();
    }
  }

  componentDidMount() {
    const element = (0, _reactDom.findDOMNode)(this.viewerDiv);
    this.viewer = new _sanddance.Viewer(element, this.props.viewerOptions);

    if (this.props.onMount) {
      if (this.props.onMount(this.viewer.presenter.getElement(_sanddance.VegaDeckGl.PresenterElement.gl))) {
        this.view();
      }
    } else {
      this.view();
    }
  }

  componentDidUpdate() {
    this.viewer.options = _sanddance.VegaDeckGl.util.deepMerge(this.viewer.options, this.props.viewerOptions);
    this.view();
  }

  componentWillUnmount() {
    this.viewer.finalize();
  }

  render() {
    return React.createElement("div", {
      className: "sanddance-ReactViewer",
      ref: div => this.viewerDiv = div
    });
  }

}

exports.SandDanceReact = SandDanceReact;
},{"react":"mpTF","./util":"gmT8","react-dom":"J77C","@msrvida/sanddance":"tCOI"}],"hCSK":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.version = void 0;
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const version = '2.0.0';
exports.version = version;
},{}],"miZu":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "SandDanceReact", {
  enumerable: true,
  get: function () {
    return _viewer.SandDanceReact;
  }
});
Object.defineProperty(exports, "version", {
  enumerable: true,
  get: function () {
    return _version.version;
  }
});
exports.util = exports.SandDance = void 0;

var SandDance = _interopRequireWildcard(require("@msrvida/sanddance"));

exports.SandDance = SandDance;

var util = _interopRequireWildcard(require("./util"));

exports.util = util;

var _viewer = require("./viewer");

var _version = require("./version");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
},{"@msrvida/sanddance":"tCOI","./util":"gmT8","./viewer":"MpPQ","./version":"hCSK"}],"yK94":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.use = use;
exports.base = void 0;

var _sanddanceReact = require("@msrvida/sanddance-react");

const base = {
  fabric: null
};
/**
 * Specify the dependency libraries to use for rendering.
 * @param fabric Office UI Fabric React library.
 */

exports.base = base;

function use(fabric, vega, deck, layers, luma) {
  _sanddanceReact.SandDance.VegaDeckGl.use(vega, deck, layers, luma);

  base.fabric = fabric;
}
},{"@msrvida/sanddance-react":"miZu"}],"RUBm":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.convertToDelimited = convertToDelimited;

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function convertToDelimited(data, delimiter) {
  var fields = Object.keys(data[0]);
  var file = data.map(row => {
    return fields.map(fieldName => {
      const value = row[fieldName];

      if (typeof value === 'number') {
        return value;
      }

      if (typeof value === 'string') {
        if (value.indexOf(delimiter) >= 0) {
          return `"${value.replace(/"/g, '""')}"`;
        } else {
          return value;
        }
      }

      return '';
    }).join(delimiter);
  });
  file.unshift(fields.join(delimiter));
  return file.join('\n');
}
},{}],"UWkG":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.embedHtml = void 0;

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const embedHtml = (title, embed) => `<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>${title}</title>
    <link rel="stylesheet" type="text/css"
        href="https://unpkg.com/@msrvida/sanddance-embed@2/dist/css/sanddance-embed.css" />
    <link rel="stylesheet" type="text/css"
        href="https://unpkg.com/@msrvida/sanddance-explorer@2.2/dist/css/sanddance-explorer.css" />
</head>

<body>
    <script src="https://unpkg.com/react@16/umd/react.production.min.js" crossorigin></script>
    <script src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js" crossorigin></script>
    <script src="https://unpkg.com/deck.gl@6/deckgl.min.js"></script>
    <script src="https://unpkg.com/vega@5.8/build/vega.min.js"></script>
    <script src="https://unpkg.com/office-ui-fabric-react@6.204.4/dist/office-ui-fabric-react.js"></script>
    <script src="https://unpkg.com/@msrvida/sanddance-explorer@2.2/dist/umd/sanddance-explorer.js"></script>
    <script src="https://unpkg.com/@msrvida/sanddance-embed@2/dist/umd/sanddance-embed.js"></script>

    <div id="app"></div>

    ${embed}

</body>

</html>`;

exports.embedHtml = embedHtml;
},{}],"Zz8c":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.strings = void 0;
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const strings = {
  appName: 'SandDance',
  bingsearch: 'Bing',
  bingsearchDescription: term => `Search Bing for "${term}"`,
  buttonClose: 'Close',
  buttonSelect: 'Search & Select',
  buttonColorSchemeMap: 'Map color scheme to filtered data',
  buttonColorSchemeRemap: 'Remap color to filtered data',
  buttonColorSchemeKeep: 'Keep same color scheme',
  buttonCopyToClipboard: 'Copy to clipboard',
  buttonExclude: 'Exclude',
  buttonExport: 'Export',
  buttonExportCount: total => total == 1 ? 'Export 1 row...' : `Export ${total} rows...`,
  buttonIsolate: 'Isolate',
  buttonReset: 'Stop filtering',
  buttonDeselect: 'Clear selection',
  buttonToolbarFloat: 'Float toolbar',
  buttonToolbarDock: 'Dock toolbar',
  buttonToolbarHide: 'Hide toolbar',
  buttonToolbarShow: 'Show toolbar',
  buttonNextDataItem: 'Next data item',
  buttonPrevDataItem: 'Previous data item',
  buttonCreateSnapshot: 'Create snapshot',
  buttonNextSnapshot: 'Next snapshot',
  buttonPrevSnapshot: 'Previous snapshot',
  buttonUpdateSnapshot: 'Update snapshot',
  buttonAddExpression: 'Add expression',
  buttonAddExpressionGroup: 'Add group',
  buttonDeleteExpression: 'Delete',
  buttonDeleteExpressionGroup: 'Delete group',
  buttonClearSnapshots: 'Clear snapshots',
  buttonDeleteSnapshot: 'Delete snapshot',
  buttonEditSnapshot: 'Edit snapshot',
  buttonMoveUp: 'Move up',
  buttonMoveDown: 'Move down',
  buttonShowVegaSpec: 'Show Vega spec',
  buttonLaunchVegaEditor: 'Open Vega Editor',
  buttonCameraHome: 'Center chart in window',
  buttonTooltipMapping: 'Tooltip columns...',
  chartTypeBarChartH: 'Bar',
  chartTypeBarChartV: 'Column',
  chartTypeDensity: 'Density',
  chartTypeGrid: 'Grid',
  chartTypeScatterPlot: 'Scatter',
  chartTypeStacks: 'Stacks',
  chartTypeTreeMap: 'Treemap',
  defaultFileName: 'sanddance-data',
  errorExportFilenameEmpty: 'Filename cannot be blank',
  errorExportFilenameCharacters: characters => `A filename cannot contain any of the following characters: ${characters}`,
  errorColumnMustBeNumeric: 'Numeric column required for this chart type.',
  labelBlank: 'blank',
  labelNull: 'null',
  labelTrue: 'true',
  labelFalse: 'false',
  labelSystemInfo: 'System info',
  labelChartSettings: 'Chart settings',
  labelDataBrowser: 'Data browser',
  labelDataScope: 'Scope',
  labelExport: 'Export Data',
  labelExportFormat: 'File format',
  labelExportCSV: '.CSV - Comma separated values',
  labelExportHTML: '.HTML - A SandDance html page embedding this data',
  labelExportJSON: '.JSON - JavaScript object notation',
  labelExportTSV: '.TSV - Tab separated values',
  labelTools: 'Tools',
  labelVegaSpec: 'Vega specification',
  labelColor: 'Chart color',
  labelError: 'Error',
  labelExportFileName: 'File name',
  labelSnapshots: 'Snapshots',
  labelSnapshotSettingThumbnailWidth: 'Thumbnail image width',
  labelSearch: 'Select by search',
  labelSearchClause: 'Clause',
  labelSearchColumn: 'Field',
  labelSearchOperator: 'Operator',
  labelSearchValue: 'Value',
  labelSearchValuePlaceholder: 'Value to search for',
  labelChart: 'Chart',
  labelChartCanvas: 'Chart canvas',
  labelColumnMapping: 'Column Mapping',
  labelChartTypeOptions: 'Chart options',
  labelColorBin: 'Color binning',
  labelColorOptions: 'Color options',
  labelColorBinExplanation: 'For numeric columns',
  labelColorFieldInfo: (colorColumnName, colorColumnType, categoricalNumeric, distinctValueCount) => `Field <span className="fieldname">${colorColumnName}</span> is of type <span className="fieldtype">${colorColumnType}</span>${categoricalNumeric ? ` and has ${distinctValueCount} distinct values` : ''}.`,
  labelColorFieldIsColorData: colorColumnName => `Field <span className="fieldname">${colorColumnName}</span> contains direct color data.`,
  labelColorBinNone: 'None (continuous)',
  labelColorBinQuantize: 'Quantize',
  labelColorBinQuantile: 'Quantile',
  labelColorFilter: 'Note: Colors will be re-mapped to the filter when viewing this snapshot.',
  labelColorScheme: 'Scheme',
  labelColumnColor: 'Color by',
  labelColumnFacet: 'Facet by',
  labelColumnSort: 'Sort by',
  labelColumnX: 'X Axis',
  labelColumnY: 'Y Axis',
  labelColumnZ: 'Z Axis',
  labelColumnSize: 'Size by',
  labelColumnGroup: 'Group by',
  labelAliasColor: 'Color',
  labelAliasFacet: 'Facet',
  labelAliasSort: 'Sort',
  labelAliasX: 'X Axis',
  labelAliasY: 'Y Axis',
  labelAliasZ: 'Z Axis',
  labelAliasSize: 'Size',
  labelAliasGroup: 'Group',
  labelDataItemIsFiltered: 'Item is filtered from view',
  labelShowLegend: 'Show legend',
  labelShowAxes: 'Show axes',
  labelSnapshotTitle: 'Title',
  labelSnapshotDescription: 'Note (optional)',
  labelTooltipMapping: 'Tooltip columns',
  labelTransitionDurations: 'Transition durations',
  labelTransitionCamera: '2D / 3D view',
  labelTransitionColor: 'Color',
  labelTransitionPosition: 'Position',
  labelTransitionSize: 'Size',
  labelVegaSpecData: 'Data reference',
  labelVegaSpecNotes: 'Note: You may need to change the color scheme to make this visible in Vega.',
  labelYes: 'Yes',
  labelNo: 'No',
  labelConfirmation: 'Are you sure?',
  loading: 'Loading...',
  schemeCategorical: 'Categorical',
  schemeDiverging: 'Diverging',
  schemeDual: 'Dual',
  schemeSequentialMultiHue: 'Sequential Multi Hue',
  schemeSequentialSingleHue: 'Sequential Single Hue',
  selectDataSpanAll: 'All rows',
  selectDataSpanFilter: 'Filtered',
  selectDataSpanSelection: 'Selected',
  selectVegaSpecDataNone: 'None',
  selectVegaSpecDataInline: 'Inline - WARNING this may use substantial browser/clipboard memory for large data sets.',
  selectVegaSpecDataUrl: 'URL',
  record: (current, total) => `${current} of ${total}`,
  searchEQ: '=',
  searchNEQ: '<>',
  searchGT: '>',
  searchGTE: '>=',
  searchLT: '<',
  searchLTE: '<=',
  searchNULL: 'is null or empty',
  searchIN: 'contains',
  searchSW: 'starts with',
  searchWHERE: 'Where',
  searchAND: 'and',
  searchOR: 'or',
  selectAny: '-- any --',
  selectNone: '-- none --',
  selectNumeric: 'Numeric',
  selectNonNumeric: 'Categorical',
  selectDirectColor: 'Direct color',
  selectReference: 'Column mappings',
  tooltipSearch: (column, value) => `Click to search in '${column}' for "${value}"`,
  labelRequired: 'required',
  labelSystem: 'System',
  lavelViewType2d: 'View in 2D',
  labelViewType3d: 'View in 3D',
  labelDataColors: 'Enabled if this data column contains any CSS color values.',
  labelDataNullAll: 'Loading data...',
  labelDataNullFiltered: 'You can filter by first making a selection, then choosing <b>Isolate</b> or <b>Exclude</b> in the top bar.',
  labelDataNullSelection: 'You can select by: <ul><li>clicking the chart axes</li><li>clicking in the legend</li><li>searching</li</ul>',
  labelZeroAll: 'Dataset contains zero rows.',
  labelZeroSearchResults: 'No rows matched your search.',
  signalGroups: [{
    prefix: 'Chart',
    label: 'Chart options'
  }, {
    prefix: 'Mark',
    label: 'Mark options'
  }, {
    prefix: 'RoleColor',
    label: 'Color options'
  }, {
    prefix: 'RoleFacet',
    label: 'Facet options'
  }, {
    prefix: 'RoleSort',
    label: 'Sort options'
  }, {
    prefix: 'RoleX',
    label: 'X axis options'
  }, {
    prefix: 'RoleY',
    label: 'Y axis options'
  }, {
    prefix: 'RoleZ',
    label: 'Z axis options'
  }, {
    prefix: 'Text',
    label: 'Text options'
  }, {
    prefix: '*',
    label: 'Options'
  }]
};
exports.strings = strings;
},{}],"mUYZ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.removeExtensions = removeExtensions;
exports.getEmbedHTML = getEmbedHTML;
exports.DataExportPicker = void 0;

var React = _interopRequireWildcard(require("react"));

var _base = require("../base");

var _exportDelimited = require("../exportDelimited");

var _dataExporterHtml = require("./dataExporterHtml");

var _sanddanceReact = require("@msrvida/sanddance-react");

var _language = require("../language");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const exportTypes = [['json', _language.strings.labelExportJSON], ['csv', _language.strings.labelExportCSV], ['tsv', _language.strings.labelExportTSV], ['html', _language.strings.labelExportHTML]];

class DataExportPicker extends React.Component {
  constructor(props) {
    super(props);
    this.state = this.getInitialState(this.props);
  }

  getInitialState(props) {
    const initialState = {
      initializer: props.initializer,
      dialogHidden: true,
      exportType: exportTypes[0][0],
      fileName: props.initializer.fileName,
      fileNameError: '',
      working: false
    };
    return initialState;
  }

  componentDidUpdate() {
    if (!_sanddanceReact.util.deepCompare(this.props.initializer, this.state.initializer)) {
      this.setState(this.getInitialState(this.props));
    }
  } // Converts to dataExport type and calls dataExportHandler to deal with data


  createExport(exportType, displayName) {
    const final = data => {
      this.props.dataExportHandler(data, exportType, displayName);
      this.close();
    };

    const json = JSON.stringify(this.props.data, columnReplacer);

    switch (exportType) {
      case 'json':
        {
          final(json);
          break;
        }

      case 'csv':
        {
          final((0, _exportDelimited.convertToDelimited)(JSON.parse(json), ','));
          break;
        }

      case 'tsv':
        {
          final((0, _exportDelimited.convertToDelimited)(JSON.parse(json), '\t'));
          break;
        }

      case 'html':
        {
          const csv = (0, _exportDelimited.convertToDelimited)(JSON.parse(json), ',');
          const html = (0, _dataExporterHtml.embedHtml)(`${_language.strings.appName} - ${escape(displayName)}`, embedScript(csv, displayName));
          final(html);
        }
    }
  }

  close() {
    this.setState({
      dialogHidden: true,
      working: false
    });
  }

  render() {
    const closeDialog = () => this.close();

    if (this.state.delayAction) {
      requestAnimationFrame(() => {
        //allow render to complete
        if (this.state.delayAction) {
          this.state.delayAction();
          this.setState({
            delayAction: null
          });
        }
      });
    }

    const disabled = this.state.working || this.state.dialogHidden;
    return React.createElement("div", {
      className: "sanddance-dataExporter"
    }, React.createElement(_base.base.fabric.DefaultButton, {
      className: "search-action search-bottom-action",
      text: _language.strings.buttonExportCount(this.props.data.length),
      onClick: () => this.setState({
        dialogHidden: false
      }),
      disabled: this.props.disabled
    }), React.createElement(_base.base.fabric.Dialog, {
      hidden: this.state.dialogHidden,
      onDismiss: closeDialog,
      dialogContentProps: {
        className: `sanddance-dialog ${this.props.theme}`,
        type: _base.base.fabric.DialogType.normal,
        title: _language.strings.labelExport
      }
    }, React.createElement(_base.base.fabric.TextField, {
      label: _language.strings.labelExportFileName,
      onChange: (e, displayName) => {
        const displayNameError = getFileNameError(displayName);
        this.setState({
          fileName: displayName,
          fileNameError: displayNameError
        });
      },
      errorMessage: this.state.fileNameError,
      value: this.state.fileName
    }), React.createElement(_base.base.fabric.ChoiceGroup, {
      className: "sanddance-form-separate",
      disabled: disabled,
      options: exportTypes.map(([exportType, text]) => {
        return {
          key: exportType,
          text,
          disabled: false,
          checked: exportType === this.state.exportType
        };
      }),
      onChange: (ev, option) => this.setState({
        exportType: option.key
      }),
      label: _language.strings.labelExportFormat
    }), React.createElement(_base.base.fabric.DialogFooter, null, React.createElement(_base.base.fabric.PrimaryButton, {
      disabled: disabled || !!this.state.fileNameError,
      onClick: e => this.setState({
        delayAction: () => this.createExport(this.state.exportType, this.state.fileName),
        working: true
      }),
      text: _language.strings.buttonExport
    }), React.createElement(_base.base.fabric.DefaultButton, {
      onClick: closeDialog,
      text: _language.strings.buttonClose
    }))));
  }

}

exports.DataExportPicker = DataExportPicker;
const illegalChars = '\\/:*?"<>|';

function getFileNameError(displayName) {
  if (!displayName) {
    return _language.strings.errorExportFilenameEmpty;
  }

  for (let i = 0; i < illegalChars.length; i++) {
    if (displayName.indexOf(illegalChars[i]) >= 0) {
      return _language.strings.errorExportFilenameCharacters(illegalChars);
    }
  }
}

function removeExtensions(fileName) {
  exportTypes.forEach(([exportType]) => {
    const re = new RegExp(`\\.${exportType}`, 'ig');
    fileName = fileName.replace(re, '');
  });
  return fileName;
}

function columnReplacer(name, value) {
  if (_sanddanceReact.SandDance.util.isInternalFieldName(name, true)) {
    return undefined;
  }

  return value === null ? '' : value;
}

function embedScript(csv, displayName, snapshots) {
  const dataFile = {
    type: 'csv',
    displayName,
    snapshots
  };
  return `<pre id='csv-data' style='display:none'>${csv}</pre>
    <script>SandDanceEmbed.load(Object.assign({rawText: document.getElementById('csv-data').innerText}, ${JSON.stringify(dataFile)}))</script>`;
}

function getEmbedHTML(data, displayName, snapshots) {
  const json = JSON.stringify(data, columnReplacer);
  const csv = (0, _exportDelimited.convertToDelimited)(JSON.parse(json), ',');
  const html = (0, _dataExporterHtml.embedHtml)(`${_language.strings.appName} - ${escape(displayName)}`, embedScript(csv, displayName, snapshots));
  return html;
}
},{"react":"mpTF","../base":"yK94","../exportDelimited":"RUBm","./dataExporterHtml":"UWkG","@msrvida/sanddance-react":"miZu","../language":"Zz8c"}],"Eyva":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.SideTabId = void 0;
var SideTabId;
exports.SideTabId = SideTabId;

(function (SideTabId) {
  SideTabId[SideTabId["ChartType"] = 0] = "ChartType";
  SideTabId[SideTabId["Data"] = 1] = "Data";
  SideTabId[SideTabId["Search"] = 2] = "Search";
  SideTabId[SideTabId["Color"] = 3] = "Color";
  SideTabId[SideTabId["Snapshots"] = 4] = "Snapshots";
  SideTabId[SideTabId["Settings"] = 5] = "Settings";
  SideTabId[SideTabId["Pin"] = 6] = "Pin";
  SideTabId[SideTabId["Collapse"] = 7] = "Collapse";
})(SideTabId || (exports.SideTabId = SideTabId = {}));
},{}],"PlI7":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getCanvas = getCanvas;
exports.removeTabIndex = removeTabIndex;
exports.capabilities = void 0;

var _sanddanceReact = require("@msrvida/sanddance-react");

var PresenterElement = _sanddanceReact.SandDance.VegaDeckGl.PresenterElement;

function getCanvas(viewer) {
  var tags = viewer.presenter.getElement(PresenterElement.gl).getElementsByTagName('canvas');

  if (tags) {
    return tags[0];
  }
}

function removeTabIndex(viewer) {
  var canvas = getCanvas(viewer);

  if (canvas) {
    canvas.tabIndex = -1;
  }
}

const capabilities = {
  webgl: !!document.createElement('canvas').getContext('webgl'),
  webgl2: !!document.createElement('canvas').getContext('webgl2')
};
exports.capabilities = capabilities;
},{"@msrvida/sanddance-react":"miZu"}],"wxrq":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getColorSettingsFromThemePalette = getColorSettingsFromThemePalette;
exports.themePalettes = void 0;

var _sanddanceReact = require("@msrvida/sanddance-react");

const themePalettes = {};
exports.themePalettes = themePalettes;
themePalettes[''] = {
  themePrimary: '#0078d4',
  themeLighterAlt: '#eff6fc',
  themeLighter: '#deecf9',
  themeLight: '#c7e0f4',
  themeTertiary: '#71afe5',
  themeSecondary: '#2b88d8',
  themeDarkAlt: '#106ebe',
  themeDark: '#005a9e',
  themeDarker: '#004578',
  neutralLighterAlt: '#f8f8f8',
  neutralLighter: '#f4f4f4',
  neutralLight: '#eaeaea',
  neutralQuaternaryAlt: '#dadada',
  neutralQuaternary: '#d0d0d0',
  neutralTertiaryAlt: '#c8c8c8',
  neutralTertiary: '#c2c2c2',
  neutralSecondary: '#858585',
  neutralPrimaryAlt: '#4b4b4b',
  neutralPrimary: '#333333',
  neutralDark: '#272727',
  black: '#1d1d1d',
  white: '#ffffff'
};
themePalettes['dark-theme'] = {
  themePrimary: '#00b4f0',
  themeLighterAlt: '#00070a',
  themeLighter: '#001d26',
  themeLight: '#003648',
  themeTertiary: '#006c90',
  themeSecondary: '#009ed3',
  themeDarkAlt: '#18bbf1',
  themeDark: '#3ac5f3',
  themeDarker: '#6cd4f6',
  neutralLighterAlt: '#0b0b0b',
  neutralLighter: '#151515',
  neutralLight: '#252525',
  neutralQuaternaryAlt: '#2f2f2f',
  neutralQuaternary: '#373737',
  neutralTertiaryAlt: '#595959',
  neutralTertiary: '#929292',
  neutralSecondary: '#a7a7a7',
  neutralPrimaryAlt: '#b4b4b4',
  neutralPrimary: '#cccccc',
  neutralDark: '#d8d8d8',
  black: '#f5f5f5',
  white: '#000000'
};

function getColorSettingsFromThemePalette(themePalette) {
  const {
    colorFromString
  } = _sanddanceReact.SandDance.VegaDeckGl.util;
  return {
    axisLine: colorFromString(themePalette.black),
    axisText: colorFromString(themePalette.black),
    hoveredCube: colorFromString(themePalette.black),
    clickableText: colorFromString(themePalette.themeDark),
    clickableTextHighlight: colorFromString(themePalette.themeSecondary)
  };
}
},{"@msrvida/sanddance-react":"miZu"}],"tNGe":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.IconButton = IconButton;

var React = _interopRequireWildcard(require("react"));

var _base = require("../base");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function IconButton(props) {
  return React.createElement(_base.base.fabric.IconButton, Object.assign({}, props, {
    styles: {
      rootHovered: {
        color: props.themePalette.themePrimary
      },
      menuIcon: {
        display: 'none'
      }
    },
    iconProps: {
      iconName: props.iconName
    },
    menuProps: props.menuProps
  }));
}
},{"react":"mpTF","../base":"yK94"}],"ZSSH":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.applyColorButtons = applyColorButtons;

var React = _interopRequireWildcard(require("react"));

var ReactDOM = _interopRequireWildcard(require("react-dom"));

var _iconButton = require("./controls/iconButton");

var _sanddanceReact = require("@msrvida/sanddance-react");

var _language = require("./language");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const className = 'sanddance-panel-tools';

function ensureToolbar(panel) {
  const existing = panel.getElementsByClassName(className);

  if (existing.length > 0) {
    return existing[0];
  } else {
    const div = _sanddanceReact.SandDance.VegaDeckGl.util.addDiv(panel, className);

    panel.insertAdjacentElement('afterbegin', div);
    return div;
  }
}

function applyColorButtons(presenter, showLegend, props) {
  const panel = presenter.getElement(_sanddanceReact.SandDance.VegaDeckGl.PresenterElement.panel);
  const div = ensureToolbar(panel);
  ReactDOM.render(ColorMap(props), div);
  panel.style.display = showLegend ? '' : 'none';
}

function ColorMap(props) {
  const menuProps = {
    items: [{
      key: 'new',
      text: _language.strings.buttonColorSchemeRemap,
      disabled: !props.canRemap || props.isRemap,
      onClick: () => props.colorMapHandler(true)
    }, {
      key: 'old',
      text: _language.strings.buttonColorSchemeKeep,
      disabled: !props.canRemap || !props.isRemap,
      onClick: () => props.colorMapHandler(false)
    }]
  };
  return React.createElement("div", null, React.createElement(_iconButton.IconButton, {
    themePalette: props.themePalette,
    title: _language.strings.buttonColorSchemeMap,
    onClick: null,
    iconName: props.canRemap ? 'FiltersSolid' : 'Filters',
    menuProps: menuProps
  }));
}
},{"react":"mpTF","react-dom":"J77C","./controls/iconButton":"tNGe","@msrvida/sanddance-react":"miZu","./language":"Zz8c"}],"AKGR":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.bestColorScheme = bestColorScheme;

function bestColorScheme(newColumn, oldColumn, oldScheme) {
  if (oldColumn && oldColumn.quantitative === newColumn.quantitative && defaultColorScheme(oldColumn) === defaultColorScheme(newColumn)) {
    return oldScheme;
  }

  return defaultColorScheme(newColumn);
}

function defaultColorScheme(c) {
  if (c.quantitative) {
    return 'redyellowgreen';
  } else if (c.stats.distinctValueCount === 2) {
    return 'dual_redgreen';
  } else if (c.stats.distinctValueCount <= 10) {
    return 'category10';
  }

  return 'category20';
}
},{}],"xuEz":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Dropdown = Dropdown;
exports.dropdownWidth = void 0;

var React = _interopRequireWildcard(require("react"));

var _base = require("../base");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const dropdownWidth = 200;
exports.dropdownWidth = dropdownWidth;

function Dropdown(props) {
  const newProps = Object.assign({}, props);
  let selectedKey = null;

  if (newProps.options && newProps.options.length > 1) {
    const selectedOptions = newProps.options.filter(option => option.selected);

    if (selectedOptions && selectedOptions.length > 0) {
      selectedKey = selectedOptions[0].key;
    }
  }

  if (newProps.collapseLabel) {
    newProps.onRenderTitle = (a, b) => {
      return React.createElement("span", null, newProps.label, ": ", a[0].text);
    };
  }

  return React.createElement(_base.base.fabric.Dropdown, Object.assign({
    dropdownWidth: dropdownWidth
  }, newProps, {
    label: newProps.collapseLabel ? null : newProps.label,
    selectedKey: selectedKey
  }));
}
},{"react":"mpTF","../base":"yK94"}],"KVvK":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Signal = Signal;

var React = _interopRequireWildcard(require("react"));

var _base = require("../base");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function Signal(props) {
  if (!props.explorer.viewer || !props.signal) {
    return null;
  }

  if (props.signal.bind) {
    const input = props.signal.bind.input;

    if (input) {
      const fn = map[input];

      if (fn) {
        const prefix = props.prefix ? `${props.prefix} ` : '';
        let initialValue;

        try {
          initialValue = props.explorer.viewer.vegaViewGl.signal(props.signal.name);
        } catch (error) {// continue regardless of error
        }

        const control = fn(prefix, props.signal.bind, initialValue, value => {
          props.onChange && props.onChange(value);
          props.explorer.signal(props.signal.name, value);
        }, props.disabled);
        return React.createElement("div", {
          className: "sanddance-signal"
        }, control);
      }
    }
  }

  return null;
}

const map = {};

map['range'] = (prefix, bind, initialValue, onChange, disabled) => {
  return React.createElement(_base.base.fabric.Slider, {
    label: prefix + bind.name,
    max: bind.max,
    min: bind.min,
    step: bind.step,
    value: initialValue,
    onChange: onChange,
    disabled: disabled
  });
};

map['select'] = (prefix, bind, initialValue, onChange, disabled) => {
  const options = bind.options.map((o, i) => {
    const option = {
      key: o,
      text: o
    };
    return option;
  });
  return React.createElement(_base.base.fabric.Dropdown, {
    defaultSelectedKey: initialValue,
    label: prefix + bind.name,
    options: options,
    onChange: (e, o) => onChange(o.text),
    disabled: disabled
  });
};

map['checkbox'] = (prefix, bind, initialValue, onChange, disabled) => {
  return React.createElement(_base.base.fabric.Toggle, {
    defaultChecked: initialValue,
    label: prefix + bind.name,
    onChange: (e, checked) => onChange(checked),
    disabled: disabled
  });
}; //TODO other signal types
},{"react":"mpTF","../base":"yK94"}],"uNUJ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ColumnMap = ColumnMap;

var React = _interopRequireWildcard(require("react"));

var _base = require("../base");

var _dropdown = require("./dropdown");

var _sanddanceReact = require("@msrvida/sanddance-react");

var _signal = require("./signal");

var _language = require("../language");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const maxFacets = 50;
const roleLabels = {
  color: _language.strings.labelColumnColor,
  facet: _language.strings.labelColumnFacet,
  group: _language.strings.labelColumnGroup,
  size: _language.strings.labelColumnSize,
  sort: _language.strings.labelColumnSort,
  uid: null,
  x: _language.strings.labelColumnX,
  y: _language.strings.labelColumnY,
  z: _language.strings.labelColumnZ
};
const aliasLabels = {
  color: _language.strings.labelAliasColor,
  facet: _language.strings.labelAliasFacet,
  group: _language.strings.labelAliasGroup,
  size: _language.strings.labelAliasSize,
  sort: _language.strings.labelAliasSort,
  uid: null,
  x: _language.strings.labelAliasX,
  y: _language.strings.labelAliasY,
  z: _language.strings.labelAliasZ
};

function filterColumnList(context, columns) {
  switch (context) {
    case 'facet':
      return columns.filter(column => column.quantitative || column.stats.distinctValueCount && column.stats.distinctValueCount < maxFacets);

    default:
      return columns.slice();
  }
}

function optionsForSpecColumn(sectionName, columns, role, selectedColumnName) {
  const filtered = filterColumnList(role, columns);
  const options = filtered.map(column => {
    const option = {
      key: `column:${column.name}`,
      text: column.name,
      data: column,
      selected: selectedColumnName === column.name
    };
    return option;
  });

  if (options.length) {
    const option = {
      key: sectionName,
      text: sectionName,
      itemType: _base.base.fabric.DropdownMenuItemType.Header
    };
    options.unshift(option);
  }

  return options;
}

function optionsForReference(sectionName, specRoles) {
  const options = specRoles.map(specRole => {
    const option = {
      key: `role:${specRole.role}`,
      text: aliasLabels[specRole.role],
      data: specRole.role
    };
    return option;
  }).sort((a, b) => a.text.localeCompare(b.text));

  if (options.length) {
    const option = {
      key: sectionName,
      text: sectionName,
      itemType: _base.base.fabric.DropdownMenuItemType.Header
    };
    options.unshift(option);
  }

  return options;
}

function selectFirst(options) {
  for (let i = 0; i < options.length; i++) {
    if (options[i].itemType === _base.base.fabric.DropdownMenuItemType.Header) continue;
    options[i].selected = true;
    return;
  }
}

function ColumnMap(props) {
  if (!props.specRole) return null;
  let categoricalColumns;
  let directColorColumns;
  let directColorGroup;
  let referenceGroup = [];

  if (props.specRole.role === 'color') {
    categoricalColumns = props.categoricalColumns.filter(c => !c.isColorData);
    directColorColumns = props.categoricalColumns.filter(c => c.isColorData);
    directColorGroup = optionsForSpecColumn(_language.strings.selectDirectColor, directColorColumns, 'color', props.selectedColumnName);
  } else {
    categoricalColumns = props.categoricalColumns;
  }

  if (props.specRole.role === 'sort') {
    const others = props.specCapabilities.roles.filter(specRole => specRole.role !== props.specRole.role);
    referenceGroup = optionsForReference(_language.strings.selectReference, others);
  }

  const quantitativeGroup = optionsForSpecColumn(_language.strings.selectNumeric, props.quantitativeColumns, props.specRole.role, props.selectedColumnName);
  const categoricGroup = props.specRole.excludeCategoric ? null : optionsForSpecColumn(_language.strings.selectNonNumeric, categoricalColumns, props.specRole.role, props.selectedColumnName);
  const options = referenceGroup.concat(quantitativeGroup).concat(categoricGroup).concat(directColorGroup).filter(Boolean);

  if (props.specRole.allowNone) {
    options.unshift({
      key: -1,
      text: _language.strings.selectNone
    });
  }

  const hasSelection = options.reduce((p, c) => {
    return p || c.selected;
  }, false);

  if (!hasSelection) {
    selectFirst(options);
  }

  let signals;

  if (props.explorer.viewer && props.explorer.viewer.vegaSpec) {
    if (props.specRole.signals) {
      signals = props.explorer.viewer.vegaSpec.signals.filter(s => props.specRole.signals.indexOf(s.name) >= 0);
    }
  }

  const label = roleLabels[props.specRole.role];
  return React.createElement("div", {
    className: "sanddance-columnMap"
  }, React.createElement(_dropdown.Dropdown, {
    componentRef: props.componentRef,
    collapseLabel: props.collapseLabel,
    disabled: props.disabled,
    label: label,
    options: options,
    onChange: (e, o) => props.changeColumnMapping(props.specRole.role, typeof o.data === 'string' ? o.data : _sanddanceReact.SandDance.VegaDeckGl.util.clone(o.data)),
    onDismiss: props.onDismiss
  }), !props.hideSignals && signals && signals.map((signal, i) => React.createElement(_signal.Signal, {
    key: i,
    explorer: props.explorer,
    signal: signal,
    onChange: value => props.onChangeSignal && props.onChangeSignal(signal.name, value)
  })));
}
},{"react":"mpTF","../base":"yK94","./dropdown":"xuEz","@msrvida/sanddance-react":"miZu","./signal":"KVvK","../language":"Zz8c"}],"ajeQ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Dialog = Dialog;

var React = _interopRequireWildcard(require("react"));

var _base = require("../base");

var _language = require("../language");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function Dialog(props) {
  return React.createElement(_base.base.fabric.Dialog, Object.assign({}, props, {
    dialogContentProps: {
      type: _base.base.fabric.DialogType.normal,
      title: props.title
    }
  }), props.children, React.createElement(_base.base.fabric.DialogFooter, null, props.buttons, React.createElement(_base.base.fabric.DefaultButton, {
    onClick: props.onDismiss,
    text: _language.strings.buttonClose
  })));
}
},{"react":"mpTF","../base":"yK94","../language":"Zz8c"}],"gj41":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Group = Group;

var React = _interopRequireWildcard(require("react"));

var _sanddanceReact = require("@msrvida/sanddance-react");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function Group(props) {
  return React.createElement("div", {
    className: _sanddanceReact.util.classList('sanddance-group', props.className)
  }, React.createElement("div", {
    className: "group-head"
  }, React.createElement("label", null, props.label), props.labelCount && React.createElement("span", {
    className: "count"
  }, "(", props.labelCount, ")")), props.children && React.createElement("div", {
    className: "group-body"
  }, props.children));
}
},{"react":"mpTF","@msrvida/sanddance-react":"miZu"}],"sVz9":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ToggleColumns = ToggleColumns;

var React = _interopRequireWildcard(require("react"));

var _base = require("../base");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function ToggleColumns(props) {
  return React.createElement("div", null, props.allColumns.map((c, i) => React.createElement("div", {
    key: c.name
  }, React.createElement("label", null, React.createElement(_base.base.fabric.Toggle, {
    checked: props.exclusions.indexOf(c.name) < 0,
    inlineLabel: true,
    label: c.name,
    onChange: () => props.toggleExclusion(c.name)
  })))));
}
},{"react":"mpTF","../base":"yK94"}],"frKj":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Chart = void 0;

var React = _interopRequireWildcard(require("react"));

var _base = require("../base");

var _columnMap = require("../controls/columnMap");

var _dialog = require("../controls/dialog");

var _group = require("../controls/group");

var _signal = require("../controls/signal");

var _language = require("../language");

var _toggleColumns = require("../controls/toggleColumns");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
class Chart extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      showTooltipDialog: false
    };
  }

  render() {
    const props = this.props;
    const signals = props.explorer.viewer && props.explorer.viewer.vegaSpec && props.specCapabilities && props.specCapabilities.signals && props.explorer.viewer.vegaSpec.signals.filter(s => props.specCapabilities.signals.indexOf(s.name) >= 0);
    return React.createElement("div", null, React.createElement(_group.Group, {
      label: _language.strings.labelChart
    }, React.createElement("div", {
      className: "calculator"
    }, React.createElement(_base.base.fabric.ChoiceGroup, {
      className: "sanddance-chart-type",
      options: [{
        key: 'grid',
        text: _language.strings.chartTypeGrid
      }, {
        key: 'scatterplot',
        text: _language.strings.chartTypeScatterPlot
      }, {
        key: 'density',
        text: _language.strings.chartTypeDensity
      }, {
        key: 'barchartV',
        text: _language.strings.chartTypeBarChartV
      }, {
        key: 'barchartH',
        text: _language.strings.chartTypeBarChartH
      }, {
        key: 'treemap',
        text: _language.strings.chartTypeTreeMap
      }, {
        key: 'stacks',
        text: _language.strings.chartTypeStacks
      }].map(o => {
        return Object.assign(Object.assign({}, o), {
          checked: props.chart === o.key,
          disabled: props.disabled
        });
      }),
      onChange: (e, o) => props.onChangeChartType(o.key)
    }))), signals && React.createElement(_group.Group, {
      label: _language.strings.labelChartTypeOptions
    }, signals.map((signal, i) => React.createElement(_signal.Signal, {
      key: i,
      signal: signal,
      explorer: props.explorer,
      disabled: props.disabled
    }))), React.createElement(_group.Group, {
      label: _language.strings.labelColumnMapping
    }, React.createElement("div", null, props.specCapabilities && props.specCapabilities.roles.map((specRole, i) => {
      const specColumnInRole = props.insightColumns[specRole.role];
      const selectedColumnName = specColumnInRole;
      let disabled = props.disabled || props.view === '2d' && specRole.role === 'z';
      return React.createElement(_columnMap.ColumnMap, Object.assign({}, props, {
        collapseLabel: props.collapseLabels,
        disabled: disabled,
        selectedColumnName: selectedColumnName,
        specRole: specRole,
        key: i,
        onChangeSignal: (name, value) => props.onChangeSignal(specRole.role, selectedColumnName, name, value)
      }));
    }), React.createElement("div", {
      className: "sanddance-tooltipMap"
    }, React.createElement(_base.base.fabric.DefaultButton, {
      text: _language.strings.buttonTooltipMapping,
      onClick: () => this.setState({
        showTooltipDialog: true
      })
    })))), React.createElement(_dialog.Dialog, {
      hidden: !this.state.showTooltipDialog,
      onDismiss: () => this.setState({
        showTooltipDialog: false
      }),
      title: _language.strings.labelTooltipMapping
    }, React.createElement(_toggleColumns.ToggleColumns, {
      allColumns: props.allColumns,
      exclusions: props.tooltipExclusions,
      toggleExclusion: props.toggleTooltipExclusion
    })));
  }

}

exports.Chart = Chart;
},{"react":"mpTF","../base":"yK94","../controls/columnMap":"uNUJ","../controls/dialog":"ajeQ","../controls/group":"gj41","../controls/signal":"KVvK","../language":"Zz8c","../controls/toggleColumns":"sVz9"}],"aSbm":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.schemeOption = schemeOption;
exports.schemesJSX = void 0;

function schemeOption(selected, scheme) {
  return {
    key: scheme,
    text: scheme,
    selected: selected === scheme,
    scheme: scheme,
    children: schemesJSX[scheme]
  };
}

const schemesJSX = {};
exports.schemesJSX = schemesJSX;
},{}],"zSP9":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.categorical = categorical;

var React = _interopRequireWildcard(require("react"));

var _scheme = require("./scheme");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const p8 = `${100 / 8}%`;
const p9 = `${100 / 9}%`;
const p10 = `${100 / 10}%`;
const p12 = `${100 / 12}%`;
const p20 = `${100 / 20}%`;
_scheme.schemesJSX['accent'] = React.createElement("div", {
  className: "swatch"
}, React.createElement("div", {
  title: "#7fc97f",
  style: {
    width: p8,
    background: 'rgb(127, 201, 127)'
  }
}), React.createElement("div", {
  title: "#beaed4",
  style: {
    width: p8,
    background: 'rgb(190, 174, 212)'
  }
}), React.createElement("div", {
  title: "#fdc086",
  style: {
    width: p8,
    background: 'rgb(253, 192, 134)'
  }
}), React.createElement("div", {
  title: "#ffff99",
  style: {
    width: p8,
    background: 'rgb(255, 255, 153)'
  }
}), React.createElement("div", {
  title: "#386cb0",
  style: {
    width: p8,
    background: 'rgb(56, 108, 176)'
  }
}), React.createElement("div", {
  title: "#f0027f",
  style: {
    width: p8,
    background: 'rgb(240, 2, 127)'
  }
}), React.createElement("div", {
  title: "#bf5b17",
  style: {
    width: p8,
    background: 'rgb(191, 91, 23)'
  }
}), React.createElement("div", {
  title: "#666666",
  style: {
    width: p8,
    background: 'rgb(102, 102, 102)'
  }
}));
_scheme.schemesJSX['category10'] = React.createElement("div", {
  className: "swatch"
}, React.createElement("div", {
  title: "#1f77b4",
  style: {
    width: p10,
    background: 'rgb(31, 119, 180)'
  }
}), React.createElement("div", {
  title: "#ff7f0e",
  style: {
    width: p10,
    background: 'rgb(255, 127, 14)'
  }
}), React.createElement("div", {
  title: "#2ca02c",
  style: {
    width: p10,
    background: 'rgb(44, 160, 44)'
  }
}), React.createElement("div", {
  title: "#d62728",
  style: {
    width: p10,
    background: 'rgb(214, 39, 40)'
  }
}), React.createElement("div", {
  title: "#9467bd",
  style: {
    width: p10,
    background: 'rgb(148, 103, 189)'
  }
}), React.createElement("div", {
  title: "#8c564b",
  style: {
    width: p10,
    background: 'rgb(140, 86, 75)'
  }
}), React.createElement("div", {
  title: "#e377c2",
  style: {
    width: p10,
    background: 'rgb(227, 119, 194)'
  }
}), React.createElement("div", {
  title: "#7f7f7f",
  style: {
    width: p10,
    background: 'rgb(127, 127, 127)'
  }
}), React.createElement("div", {
  title: "#bcbd22",
  style: {
    width: p10,
    background: 'rgb(188, 189, 34)'
  }
}), React.createElement("div", {
  title: "#17becf",
  style: {
    width: p10,
    background: 'rgb(23, 190, 207)'
  }
}));
_scheme.schemesJSX['category20'] = React.createElement("div", {
  className: "swatch"
}, React.createElement("div", {
  title: "#1f77b4",
  style: {
    width: p20,
    background: 'rgb(31, 119, 180)'
  }
}), React.createElement("div", {
  title: "#aec7e8",
  style: {
    width: p20,
    background: 'rgb(174, 199, 232)'
  }
}), React.createElement("div", {
  title: "#ff7f0e",
  style: {
    width: p20,
    background: 'rgb(255, 127, 14)'
  }
}), React.createElement("div", {
  title: "#ffbb78",
  style: {
    width: p20,
    background: 'rgb(255, 187, 120)'
  }
}), React.createElement("div", {
  title: "#2ca02c",
  style: {
    width: p20,
    background: 'rgb(44, 160, 44)'
  }
}), React.createElement("div", {
  title: "#98df8a",
  style: {
    width: p20,
    background: 'rgb(152, 223, 138)'
  }
}), React.createElement("div", {
  title: "#d62728",
  style: {
    width: p20,
    background: 'rgb(214, 39, 40)'
  }
}), React.createElement("div", {
  title: "#ff9896",
  style: {
    width: p20,
    background: 'rgb(255, 152, 150)'
  }
}), React.createElement("div", {
  title: "#9467bd",
  style: {
    width: p20,
    background: 'rgb(148, 103, 189)'
  }
}), React.createElement("div", {
  title: "#c5b0d5",
  style: {
    width: p20,
    background: 'rgb(197, 176, 213)'
  }
}), React.createElement("div", {
  title: "#8c564b",
  style: {
    width: p20,
    background: 'rgb(140, 86, 75)'
  }
}), React.createElement("div", {
  title: "#c49c94",
  style: {
    width: p20,
    background: 'rgb(196, 156, 148)'
  }
}), React.createElement("div", {
  title: "#e377c2",
  style: {
    width: p20,
    background: 'rgb(227, 119, 194)'
  }
}), React.createElement("div", {
  title: "#f7b6d2",
  style: {
    width: p20,
    background: 'rgb(247, 182, 210)'
  }
}), React.createElement("div", {
  title: "#7f7f7f",
  style: {
    width: p20,
    background: 'rgb(127, 127, 127)'
  }
}), React.createElement("div", {
  title: "#c7c7c7",
  style: {
    width: p20,
    background: 'rgb(199, 199, 199)'
  }
}), React.createElement("div", {
  title: "#bcbd22",
  style: {
    width: p20,
    background: 'rgb(188, 189, 34)'
  }
}), React.createElement("div", {
  title: "#dbdb8d",
  style: {
    width: p20,
    background: 'rgb(219, 219, 141)'
  }
}), React.createElement("div", {
  title: "#17becf",
  style: {
    width: p20,
    background: 'rgb(23, 190, 207)'
  }
}), React.createElement("div", {
  title: "#9edae5",
  style: {
    width: p20,
    background: 'rgb(158, 218, 229)'
  }
}));
_scheme.schemesJSX['category20b'] = React.createElement("div", {
  className: "swatch"
}, React.createElement("div", {
  title: "#393b79",
  style: {
    width: p20,
    background: 'rgb(57, 59, 121)'
  }
}), React.createElement("div", {
  title: "#5254a3",
  style: {
    width: p20,
    background: 'rgb(82, 84, 163)'
  }
}), React.createElement("div", {
  title: "#6b6ecf",
  style: {
    width: p20,
    background: 'rgb(107, 110, 207)'
  }
}), React.createElement("div", {
  title: "#9c9ede",
  style: {
    width: p20,
    background: 'rgb(156, 158, 222)'
  }
}), React.createElement("div", {
  title: "#637939",
  style: {
    width: p20,
    background: 'rgb(99, 121, 57)'
  }
}), React.createElement("div", {
  title: "#8ca252",
  style: {
    width: p20,
    background: 'rgb(140, 162, 82)'
  }
}), React.createElement("div", {
  title: "#b5cf6b",
  style: {
    width: p20,
    background: 'rgb(181, 207, 107)'
  }
}), React.createElement("div", {
  title: "#cedb9c",
  style: {
    width: p20,
    background: 'rgb(206, 219, 156)'
  }
}), React.createElement("div", {
  title: "#8c6d31",
  style: {
    width: p20,
    background: 'rgb(140, 109, 49)'
  }
}), React.createElement("div", {
  title: "#bd9e39",
  style: {
    width: p20,
    background: 'rgb(189, 158, 57)'
  }
}), React.createElement("div", {
  title: "#e7ba52",
  style: {
    width: p20,
    background: 'rgb(231, 186, 82)'
  }
}), React.createElement("div", {
  title: "#e7cb94",
  style: {
    width: p20,
    background: 'rgb(231, 203, 148)'
  }
}), React.createElement("div", {
  title: "#843c39",
  style: {
    width: p20,
    background: 'rgb(132, 60, 57)'
  }
}), React.createElement("div", {
  title: "#ad494a",
  style: {
    width: p20,
    background: 'rgb(173, 73, 74)'
  }
}), React.createElement("div", {
  title: "#d6616b",
  style: {
    width: p20,
    background: 'rgb(214, 97, 107)'
  }
}), React.createElement("div", {
  title: "#e7969c",
  style: {
    width: p20,
    background: 'rgb(231, 150, 156)'
  }
}), React.createElement("div", {
  title: "#7b4173",
  style: {
    width: p20,
    background: 'rgb(123, 65, 115)'
  }
}), React.createElement("div", {
  title: "#a55194",
  style: {
    width: p20,
    background: 'rgb(165, 81, 148)'
  }
}), React.createElement("div", {
  title: "#ce6dbd",
  style: {
    width: p20,
    background: 'rgb(206, 109, 189)'
  }
}), React.createElement("div", {
  title: "#de9ed6",
  style: {
    width: p20,
    background: 'rgb(222, 158, 214)'
  }
}));
_scheme.schemesJSX['category20c'] = React.createElement("div", {
  className: "swatch"
}, React.createElement("div", {
  title: "#3182bd",
  style: {
    width: p20,
    background: 'rgb(49, 130, 189)'
  }
}), React.createElement("div", {
  title: "#6baed6",
  style: {
    width: p20,
    background: 'rgb(107, 174, 214)'
  }
}), React.createElement("div", {
  title: "#9ecae1",
  style: {
    width: p20,
    background: 'rgb(158, 202, 225)'
  }
}), React.createElement("div", {
  title: "#c6dbef",
  style: {
    width: p20,
    background: 'rgb(198, 219, 239)'
  }
}), React.createElement("div", {
  title: "#e6550d",
  style: {
    width: p20,
    background: 'rgb(230, 85, 13)'
  }
}), React.createElement("div", {
  title: "#fd8d3c",
  style: {
    width: p20,
    background: 'rgb(253, 141, 60)'
  }
}), React.createElement("div", {
  title: "#fdae6b",
  style: {
    width: p20,
    background: 'rgb(253, 174, 107)'
  }
}), React.createElement("div", {
  title: "#fdd0a2",
  style: {
    width: p20,
    background: 'rgb(253, 208, 162)'
  }
}), React.createElement("div", {
  title: "#31a354",
  style: {
    width: p20,
    background: 'rgb(49, 163, 84)'
  }
}), React.createElement("div", {
  title: "#74c476",
  style: {
    width: p20,
    background: 'rgb(116, 196, 118)'
  }
}), React.createElement("div", {
  title: "#a1d99b",
  style: {
    width: p20,
    background: 'rgb(161, 217, 155)'
  }
}), React.createElement("div", {
  title: "#c7e9c0",
  style: {
    width: p20,
    background: 'rgb(199, 233, 192)'
  }
}), React.createElement("div", {
  title: "#756bb1",
  style: {
    width: p20,
    background: 'rgb(117, 107, 177)'
  }
}), React.createElement("div", {
  title: "#9e9ac8",
  style: {
    width: p20,
    background: 'rgb(158, 154, 200)'
  }
}), React.createElement("div", {
  title: "#bcbddc",
  style: {
    width: p20,
    background: 'rgb(188, 189, 220)'
  }
}), React.createElement("div", {
  title: "#dadaeb",
  style: {
    width: p20,
    background: 'rgb(218, 218, 235)'
  }
}), React.createElement("div", {
  title: "#636363",
  style: {
    width: p20,
    background: 'rgb(99, 99, 99)'
  }
}), React.createElement("div", {
  title: "#969696",
  style: {
    width: p20,
    background: 'rgb(150, 150, 150)'
  }
}), React.createElement("div", {
  title: "#bdbdbd",
  style: {
    width: p20,
    background: 'rgb(189, 189, 189)'
  }
}), React.createElement("div", {
  title: "#d9d9d9",
  style: {
    width: p20,
    background: 'rgb(217, 217, 217)'
  }
}));
_scheme.schemesJSX['dark2'] = React.createElement("div", {
  className: "swatch"
}, React.createElement("div", {
  title: "#1b9e77",
  style: {
    width: p8,
    background: 'rgb(27, 158, 119)'
  }
}), React.createElement("div", {
  title: "#d95f02",
  style: {
    width: p8,
    background: 'rgb(217, 95, 2)'
  }
}), React.createElement("div", {
  title: "#7570b3",
  style: {
    width: p8,
    background: 'rgb(117, 112, 179)'
  }
}), React.createElement("div", {
  title: "#e7298a",
  style: {
    width: p8,
    background: 'rgb(231, 41, 138)'
  }
}), React.createElement("div", {
  title: "#66a61e",
  style: {
    width: p8,
    background: 'rgb(102, 166, 30)'
  }
}), React.createElement("div", {
  title: "#e6ab02",
  style: {
    width: p8,
    background: 'rgb(230, 171, 2)'
  }
}), React.createElement("div", {
  title: "#a6761d",
  style: {
    width: p8,
    background: 'rgb(166, 118, 29)'
  }
}), React.createElement("div", {
  title: "#666666",
  style: {
    width: p8,
    background: 'rgb(102, 102, 102)'
  }
}));
_scheme.schemesJSX['paired'] = React.createElement("div", {
  className: "swatch"
}, React.createElement("div", {
  title: "#a6cee3",
  style: {
    width: p12,
    background: 'rgb(166, 206, 227)'
  }
}), React.createElement("div", {
  title: "#1f78b4",
  style: {
    width: p12,
    background: 'rgb(31, 120, 180)'
  }
}), React.createElement("div", {
  title: "#b2df8a",
  style: {
    width: p12,
    background: 'rgb(178, 223, 138)'
  }
}), React.createElement("div", {
  title: "#33a02c",
  style: {
    width: p12,
    background: 'rgb(51, 160, 44)'
  }
}), React.createElement("div", {
  title: "#fb9a99",
  style: {
    width: p12,
    background: 'rgb(251, 154, 153)'
  }
}), React.createElement("div", {
  title: "#e31a1c",
  style: {
    width: p12,
    background: 'rgb(227, 26, 28)'
  }
}), React.createElement("div", {
  title: "#fdbf6f",
  style: {
    width: p12,
    background: 'rgb(253, 191, 111)'
  }
}), React.createElement("div", {
  title: "#ff7f00",
  style: {
    width: p12,
    background: 'rgb(255, 127, 0)'
  }
}), React.createElement("div", {
  title: "#cab2d6",
  style: {
    width: p12,
    background: 'rgb(202, 178, 214)'
  }
}), React.createElement("div", {
  title: "#6a3d9a",
  style: {
    width: p12,
    background: 'rgb(106, 61, 154)'
  }
}), React.createElement("div", {
  title: "#ffff99",
  style: {
    width: p12,
    background: 'rgb(255, 255, 153)'
  }
}), React.createElement("div", {
  title: "#b15928",
  style: {
    width: p12,
    background: 'rgb(177, 89, 40)'
  }
}));
_scheme.schemesJSX['pastel1'] = React.createElement("div", {
  className: "swatch"
}, React.createElement("div", {
  title: "#fbb4ae",
  style: {
    width: p9,
    background: 'rgb(251, 180, 174)'
  }
}), React.createElement("div", {
  title: "#b3cde3",
  style: {
    width: p9,
    background: 'rgb(179, 205, 227)'
  }
}), React.createElement("div", {
  title: "#ccebc5",
  style: {
    width: p9,
    background: 'rgb(204, 235, 197)'
  }
}), React.createElement("div", {
  title: "#decbe4",
  style: {
    width: p9,
    background: 'rgb(222, 203, 228)'
  }
}), React.createElement("div", {
  title: "#fed9a6",
  style: {
    width: p9,
    background: 'rgb(254, 217, 166)'
  }
}), React.createElement("div", {
  title: "#ffffcc",
  style: {
    width: p9,
    background: 'rgb(255, 255, 204)'
  }
}), React.createElement("div", {
  title: "#e5d8bd",
  style: {
    width: p9,
    background: 'rgb(229, 216, 189)'
  }
}), React.createElement("div", {
  title: "#fddaec",
  style: {
    width: p9,
    background: 'rgb(253, 218, 236)'
  }
}), React.createElement("div", {
  title: "#f2f2f2",
  style: {
    width: p9,
    background: 'rgb(242, 242, 242)'
  }
}));
_scheme.schemesJSX['pastel2'] = React.createElement("div", {
  className: "swatch"
}, React.createElement("div", {
  title: "#b3e2cd",
  style: {
    width: p8,
    background: 'rgb(179, 226, 205)'
  }
}), React.createElement("div", {
  title: "#fdcdac",
  style: {
    width: p8,
    background: 'rgb(253, 205, 172)'
  }
}), React.createElement("div", {
  title: "#cbd5e8",
  style: {
    width: p8,
    background: 'rgb(203, 213, 232)'
  }
}), React.createElement("div", {
  title: "#f4cae4",
  style: {
    width: p8,
    background: 'rgb(244, 202, 228)'
  }
}), React.createElement("div", {
  title: "#e6f5c9",
  style: {
    width: p8,
    background: 'rgb(230, 245, 201)'
  }
}), React.createElement("div", {
  title: "#fff2ae",
  style: {
    width: p8,
    background: 'rgb(255, 242, 174)'
  }
}), React.createElement("div", {
  title: "#f1e2cc",
  style: {
    width: p8,
    background: 'rgb(241, 226, 204)'
  }
}), React.createElement("div", {
  title: "#cccccc",
  style: {
    width: p8,
    background: 'rgb(204, 204, 204)'
  }
}));
_scheme.schemesJSX['set1'] = React.createElement("div", {
  className: "swatch"
}, React.createElement("div", {
  title: "#e41a1c",
  style: {
    width: p9,
    background: 'rgb(228, 26, 28)'
  }
}), React.createElement("div", {
  title: "#377eb8",
  style: {
    width: p9,
    background: 'rgb(55, 126, 184)'
  }
}), React.createElement("div", {
  title: "#4daf4a",
  style: {
    width: p9,
    background: 'rgb(77, 175, 74)'
  }
}), React.createElement("div", {
  title: "#984ea3",
  style: {
    width: p9,
    background: 'rgb(152, 78, 163)'
  }
}), React.createElement("div", {
  title: "#ff7f00",
  style: {
    width: p9,
    background: 'rgb(255, 127, 0)'
  }
}), React.createElement("div", {
  title: "#ffff33",
  style: {
    width: p9,
    background: 'rgb(255, 255, 51)'
  }
}), React.createElement("div", {
  title: "#a65628",
  style: {
    width: p9,
    background: 'rgb(166, 86, 40)'
  }
}), React.createElement("div", {
  title: "#f781bf",
  style: {
    width: p9,
    background: 'rgb(247, 129, 191)'
  }
}), React.createElement("div", {
  title: "#999999",
  style: {
    width: p9,
    background: 'rgb(153, 153, 153)'
  }
}));
_scheme.schemesJSX['set2'] = React.createElement("div", {
  className: "swatch"
}, React.createElement("div", {
  title: "#66c2a5",
  style: {
    width: p8,
    background: 'rgb(102, 194, 165)'
  }
}), React.createElement("div", {
  title: "#fc8d62",
  style: {
    width: p8,
    background: 'rgb(252, 141, 98)'
  }
}), React.createElement("div", {
  title: "#8da0cb",
  style: {
    width: p8,
    background: 'rgb(141, 160, 203)'
  }
}), React.createElement("div", {
  title: "#e78ac3",
  style: {
    width: p8,
    background: 'rgb(231, 138, 195)'
  }
}), React.createElement("div", {
  title: "#a6d854",
  style: {
    width: p8,
    background: 'rgb(166, 216, 84)'
  }
}), React.createElement("div", {
  title: "#ffd92f",
  style: {
    width: p8,
    background: 'rgb(255, 217, 47)'
  }
}), React.createElement("div", {
  title: "#e5c494",
  style: {
    width: p8,
    background: 'rgb(229, 196, 148)'
  }
}), React.createElement("div", {
  title: "#b3b3b3",
  style: {
    width: p8,
    background: 'rgb(179, 179, 179)'
  }
}));
_scheme.schemesJSX['set3'] = React.createElement("div", {
  className: "swatch"
}, React.createElement("div", {
  title: "#8dd3c7",
  style: {
    width: p12,
    background: 'rgb(141, 211, 199)'
  }
}), React.createElement("div", {
  title: "#ffffb3",
  style: {
    width: p12,
    background: 'rgb(255, 255, 179)'
  }
}), React.createElement("div", {
  title: "#bebada",
  style: {
    width: p12,
    background: 'rgb(190, 186, 218)'
  }
}), React.createElement("div", {
  title: "#fb8072",
  style: {
    width: p12,
    background: 'rgb(251, 128, 114)'
  }
}), React.createElement("div", {
  title: "#80b1d3",
  style: {
    width: p12,
    background: 'rgb(128, 177, 211)'
  }
}), React.createElement("div", {
  title: "#fdb462",
  style: {
    width: p12,
    background: 'rgb(253, 180, 98)'
  }
}), React.createElement("div", {
  title: "#b3de69",
  style: {
    width: p12,
    background: 'rgb(179, 222, 105)'
  }
}), React.createElement("div", {
  title: "#fccde5",
  style: {
    width: p12,
    background: 'rgb(252, 205, 229)'
  }
}), React.createElement("div", {
  title: "#d9d9d9",
  style: {
    width: p12,
    background: 'rgb(217, 217, 217)'
  }
}), React.createElement("div", {
  title: "#bc80bd",
  style: {
    width: p12,
    background: 'rgb(188, 128, 189)'
  }
}), React.createElement("div", {
  title: "#ccebc5",
  style: {
    width: p12,
    background: 'rgb(204, 235, 197)'
  }
}), React.createElement("div", {
  title: "#ffed6f",
  style: {
    width: p12,
    background: 'rgb(255, 237, 111)'
  }
}));
_scheme.schemesJSX['tableau10'] = React.createElement("div", {
  className: "swatch"
}, React.createElement("div", {
  title: "#4c78a8",
  style: {
    width: p10,
    background: 'rgb(76, 120, 168)'
  }
}), React.createElement("div", {
  title: "#f58518",
  style: {
    width: p10,
    background: 'rgb(245, 133, 24)'
  }
}), React.createElement("div", {
  title: "#e45756",
  style: {
    width: p10,
    background: 'rgb(228, 87, 86)'
  }
}), React.createElement("div", {
  title: "#72b7b2",
  style: {
    width: p10,
    background: 'rgb(114, 183, 178)'
  }
}), React.createElement("div", {
  title: "#54a24b",
  style: {
    width: p10,
    background: 'rgb(84, 162, 75)'
  }
}), React.createElement("div", {
  title: "#eeca3b",
  style: {
    width: p10,
    background: 'rgb(238, 202, 59)'
  }
}), React.createElement("div", {
  title: "#b279a2",
  style: {
    width: p10,
    background: 'rgb(178, 121, 162)'
  }
}), React.createElement("div", {
  title: "#ff9da6",
  style: {
    width: p10,
    background: 'rgb(255, 157, 166)'
  }
}), React.createElement("div", {
  title: "#9d755d",
  style: {
    width: p10,
    background: 'rgb(157, 117, 93)'
  }
}), React.createElement("div", {
  title: "#bab0ac",
  style: {
    width: p10,
    background: 'rgb(186, 176, 172)'
  }
}));
_scheme.schemesJSX['tableau20'] = React.createElement("div", {
  className: "swatch"
}, React.createElement("div", {
  title: "#4c78a8",
  style: {
    width: p20,
    background: 'rgb(76, 120, 168)'
  }
}), React.createElement("div", {
  title: "#9ecae9",
  style: {
    width: p20,
    background: 'rgb(158, 202, 233)'
  }
}), React.createElement("div", {
  title: "#f58518",
  style: {
    width: p20,
    background: 'rgb(245, 133, 24)'
  }
}), React.createElement("div", {
  title: "#ffbf79",
  style: {
    width: p20,
    background: 'rgb(255, 191, 121)'
  }
}), React.createElement("div", {
  title: "#54a24b",
  style: {
    width: p20,
    background: 'rgb(84, 162, 75)'
  }
}), React.createElement("div", {
  title: "#88d27a",
  style: {
    width: p20,
    background: 'rgb(136, 210, 122)'
  }
}), React.createElement("div", {
  title: "#b79a20",
  style: {
    width: p20,
    background: 'rgb(183, 154, 32)'
  }
}), React.createElement("div", {
  title: "#f2cf5b",
  style: {
    width: p20,
    background: 'rgb(242, 207, 91)'
  }
}), React.createElement("div", {
  title: "#439894",
  style: {
    width: p20,
    background: 'rgb(67, 152, 148)'
  }
}), React.createElement("div", {
  title: "#83bcb6",
  style: {
    width: p20,
    background: 'rgb(131, 188, 182)'
  }
}), React.createElement("div", {
  title: "#e45756",
  style: {
    width: p20,
    background: 'rgb(228, 87, 86)'
  }
}), React.createElement("div", {
  title: "#ff9d98",
  style: {
    width: p20,
    background: 'rgb(255, 157, 152)'
  }
}), React.createElement("div", {
  title: "#79706e",
  style: {
    width: p20,
    background: 'rgb(121, 112, 110)'
  }
}), React.createElement("div", {
  title: "#bab0ac",
  style: {
    width: p20,
    background: 'rgb(186, 176, 172)'
  }
}), React.createElement("div", {
  title: "#d67195",
  style: {
    width: p20,
    background: 'rgb(214, 113, 149)'
  }
}), React.createElement("div", {
  title: "#fcbfd2",
  style: {
    width: p20,
    background: 'rgb(252, 191, 210)'
  }
}), React.createElement("div", {
  title: "#b279a2",
  style: {
    width: p20,
    background: 'rgb(178, 121, 162)'
  }
}), React.createElement("div", {
  title: "#d6a5c9",
  style: {
    width: p20,
    background: 'rgb(214, 165, 201)'
  }
}), React.createElement("div", {
  title: "#9e765f",
  style: {
    width: p20,
    background: 'rgb(158, 118, 95)'
  }
}), React.createElement("div", {
  title: "#d8b5a5",
  style: {
    width: p20,
    background: 'rgb(216, 181, 165)'
  }
}));

function categorical(selected) {
  return [(0, _scheme.schemeOption)(selected, 'accent'), (0, _scheme.schemeOption)(selected, 'category10'), (0, _scheme.schemeOption)(selected, 'category20'), (0, _scheme.schemeOption)(selected, 'category20b'), (0, _scheme.schemeOption)(selected, 'category20c'), (0, _scheme.schemeOption)(selected, 'dark2'), (0, _scheme.schemeOption)(selected, 'paired'), (0, _scheme.schemeOption)(selected, 'pastel1'), (0, _scheme.schemeOption)(selected, 'pastel2'), (0, _scheme.schemeOption)(selected, 'set1'), (0, _scheme.schemeOption)(selected, 'set2'), (0, _scheme.schemeOption)(selected, 'set3'), (0, _scheme.schemeOption)(selected, 'tableau10'), (0, _scheme.schemeOption)(selected, 'tableau20')];
}
},{"react":"mpTF","./scheme":"aSbm"}],"spyH":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.diverging = diverging;

var React = _interopRequireWildcard(require("react"));

var _scheme = require("./scheme");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
_scheme.schemesJSX['blueorange'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-blueorange"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "rgb(5, 48, 97)"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "rgb(34, 101, 163)"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "rgb(75, 148, 196)"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "rgb(143, 194, 221)"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "rgb(205, 227, 238)"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "rgb(242, 240, 235)"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "rgb(253, 221, 179)"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "rgb(248, 182, 100)"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "rgb(221, 132, 31)"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "rgb(178, 90, 9)"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "rgb(127, 59, 8)"
}))), React.createElement("rect", {
  fill: "url(#gradient-blueorange)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));
_scheme.schemesJSX['brownbluegreen'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-brownbluegreen"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "rgb(84, 48, 5)"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "rgb(139, 84, 15)"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "rgb(188, 132, 53)"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "rgb(222, 190, 123)"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "rgb(242, 228, 192)"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "rgb(238, 241, 234)"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "rgb(195, 231, 226)"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "rgb(127, 201, 191)"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "rgb(57, 152, 143)"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "rgb(10, 103, 95)"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "rgb(0, 60, 48)"
}))), React.createElement("rect", {
  fill: "url(#gradient-brownbluegreen)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));
_scheme.schemesJSX['purplegreen'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-purplegreen"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "rgb(64, 0, 75)"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "rgb(115, 47, 128)"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "rgb(154, 109, 170)"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "rgb(193, 164, 205)"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "rgb(228, 210, 230)"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "rgb(239, 240, 239)"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "rgb(214, 238, 209)"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "rgb(162, 215, 158)"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "rgb(92, 173, 101)"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "rgb(33, 120, 57)"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "rgb(0, 68, 27)"
}))), React.createElement("rect", {
  fill: "url(#gradient-purplegreen)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));
_scheme.schemesJSX['pinkyellowgreen'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-pinkyellowgreen"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "rgb(142, 1, 82)"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "rgb(192, 38, 126)"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "rgb(221, 114, 173)"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "rgb(240, 179, 214)"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "rgb(250, 221, 237)"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "rgb(245, 243, 239)"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "rgb(225, 242, 202)"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "rgb(182, 222, 135)"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "rgb(128, 187, 71)"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "rgb(79, 145, 37)"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "rgb(39, 100, 25)"
}))), React.createElement("rect", {
  fill: "url(#gradient-pinkyellowgreen)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));
_scheme.schemesJSX['purpleorange'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-purpleorange"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "rgb(45, 0, 75)"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "rgb(85, 45, 132)"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "rgb(129, 112, 172)"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "rgb(176, 170, 208)"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "rgb(215, 215, 233)"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "rgb(243, 238, 234)"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "rgb(253, 221, 179)"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "rgb(248, 182, 100)"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "rgb(221, 132, 31)"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "rgb(178, 90, 9)"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "rgb(127, 59, 8)"
}))), React.createElement("rect", {
  fill: "url(#gradient-purpleorange)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));
_scheme.schemesJSX['redblue'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-redblue"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "rgb(103, 0, 31)"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "rgb(172, 32, 47)"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "rgb(213, 96, 80)"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "rgb(241, 163, 133)"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "rgb(251, 215, 196)"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "rgb(242, 239, 238)"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "rgb(205, 227, 238)"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "rgb(143, 194, 221)"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "rgb(75, 148, 196)"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "rgb(34, 101, 163)"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "rgb(5, 48, 97)"
}))), React.createElement("rect", {
  fill: "url(#gradient-redblue)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));
_scheme.schemesJSX['redgrey'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-redgrey"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "rgb(103, 0, 31)"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "rgb(172, 32, 47)"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "rgb(213, 96, 80)"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "rgb(241, 163, 133)"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "rgb(252, 216, 197)"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "rgb(250, 244, 241)"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "rgb(223, 223, 223)"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "rgb(184, 184, 184)"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "rgb(134, 134, 134)"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "rgb(78, 78, 78)"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "rgb(26, 26, 26)"
}))), React.createElement("rect", {
  fill: "url(#gradient-redgrey)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));
_scheme.schemesJSX['redyellowblue'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-redyellowblue"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "rgb(165, 0, 38)"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "rgb(212, 50, 44)"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "rgb(241, 110, 67)"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "rgb(252, 172, 100)"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "rgb(254, 221, 144)"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "rgb(250, 248, 193)"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "rgb(220, 241, 236)"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "rgb(171, 214, 232)"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "rgb(117, 171, 208)"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "rgb(74, 116, 180)"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "rgb(49, 54, 149)"
}))), React.createElement("rect", {
  fill: "url(#gradient-redyellowblue)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));
_scheme.schemesJSX['redyellowgreen'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-redyellowgreen"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "rgb(165, 0, 38)"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "rgb(212, 50, 44)"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "rgb(241, 110, 67)"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "rgb(252, 172, 99)"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "rgb(254, 221, 141)"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "rgb(249, 247, 174)"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "rgb(215, 238, 142)"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "rgb(164, 216, 110)"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "rgb(100, 188, 97)"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "rgb(34, 150, 79)"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "rgb(0, 104, 55)"
}))), React.createElement("rect", {
  fill: "url(#gradient-redyellowgreen)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));
_scheme.schemesJSX['spectral'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-spectral"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "rgb(158, 1, 66)"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "rgb(209, 60, 75)"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "rgb(240, 112, 74)"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "rgb(252, 172, 99)"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "rgb(254, 221, 141)"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "rgb(251, 248, 176)"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "rgb(224, 243, 161)"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "rgb(169, 221, 162)"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "rgb(105, 189, 169)"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "rgb(66, 136, 181)"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "rgb(94, 79, 162)"
}))), React.createElement("rect", {
  fill: "url(#gradient-spectral)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));

function diverging(selected) {
  return [(0, _scheme.schemeOption)(selected, 'blueorange'), (0, _scheme.schemeOption)(selected, 'brownbluegreen'), (0, _scheme.schemeOption)(selected, 'purplegreen'), (0, _scheme.schemeOption)(selected, 'pinkyellowgreen'), (0, _scheme.schemeOption)(selected, 'purpleorange'), (0, _scheme.schemeOption)(selected, 'redblue'), (0, _scheme.schemeOption)(selected, 'redgrey'), (0, _scheme.schemeOption)(selected, 'redyellowblue'), (0, _scheme.schemeOption)(selected, 'redyellowgreen'), (0, _scheme.schemeOption)(selected, 'spectral')];
}
},{"react":"mpTF","./scheme":"aSbm"}],"Tvyq":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.dual = dual;

var React = _interopRequireWildcard(require("react"));

var _sanddanceReact = require("@msrvida/sanddance-react");

var _scheme = require("./scheme");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
_sanddanceReact.SandDance.colorSchemes.filter(cs => cs.colors.length === 2).map((binaryScheme, i) => {
  _scheme.schemesJSX[binaryScheme.scheme] = React.createElement("div", {
    className: "swatch"
  }, binaryScheme.colors.map((color, j) => React.createElement("div", {
    key: j,
    title: color,
    style: {
      width: '50%',
      backgroundColor: color
    }
  })));
});

function dual(selected) {
  return _sanddanceReact.SandDance.colorSchemes.filter(cs => cs.colors.length === 2).map((binaryScheme, i) => (0, _scheme.schemeOption)(selected, binaryScheme.scheme));
}
},{"react":"mpTF","@msrvida/sanddance-react":"miZu","./scheme":"aSbm"}],"Lqbl":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.sequentialMultiHue = sequentialMultiHue;

var React = _interopRequireWildcard(require("react"));

var _scheme = require("./scheme");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
_scheme.schemesJSX['viridis'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-viridis"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "#440154"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "#482475"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "#414487"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "#355f8d"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "#2a788e"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "#21918c"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "#22a884"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "#44bf70"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "#7ad151"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "#bddf26"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "#fde725"
}))), React.createElement("rect", {
  fill: "url(#gradient-viridis)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));
_scheme.schemesJSX['inferno'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-inferno"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "#000004"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "#160b39"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "#420a68"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "#6a176e"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "#932667"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "#bc3754"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "#dd513a"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "#f37819"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "#fca50a"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "#f6d746"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "#fcffa4"
}))), React.createElement("rect", {
  fill: "url(#gradient-inferno)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));
_scheme.schemesJSX['magma'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-magma"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "#000004"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "#140e36"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "#3b0f70"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "#641a80"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "#8c2981"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "#b73779"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "#de4968"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "#f7705c"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "#fe9f6d"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "#fecf92"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "#fcfdbf"
}))), React.createElement("rect", {
  fill: "url(#gradient-magma)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));
_scheme.schemesJSX['plasma'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-plasma"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "#0d0887"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "#41049d"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "#6a00a8"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "#8f0da4"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "#b12a90"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "#cc4778"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "#e16462"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "#f2844b"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "#fca636"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "#fcce25"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "#f0f921"
}))), React.createElement("rect", {
  fill: "url(#gradient-plasma)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));
_scheme.schemesJSX['bluegreen'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-bluegreen"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "rgb(247, 252, 253)"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "rgb(232, 246, 249)"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "rgb(213, 239, 237)"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "rgb(183, 228, 218)"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "rgb(143, 211, 193)"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "rgb(104, 194, 163)"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "rgb(73, 177, 127)"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "rgb(47, 153, 89)"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "rgb(21, 127, 60)"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "rgb(3, 100, 41)"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "rgb(0, 68, 27)"
}))), React.createElement("rect", {
  fill: "url(#gradient-bluegreen)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));
_scheme.schemesJSX['bluepurple'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-bluepurple"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "rgb(247, 252, 253)"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "rgb(228, 238, 245)"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "rgb(204, 221, 236)"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "rgb(178, 202, 225)"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "rgb(156, 179, 213)"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "rgb(143, 149, 198)"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "rgb(140, 116, 181)"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "rgb(137, 82, 165)"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "rgb(133, 45, 143)"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "rgb(115, 15, 113)"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "rgb(77, 0, 75)"
}))), React.createElement("rect", {
  fill: "url(#gradient-bluepurple)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));
_scheme.schemesJSX['greenblue'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-greenblue"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "rgb(247, 252, 240)"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "rgb(229, 245, 223)"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "rgb(211, 238, 206)"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "rgb(189, 229, 191)"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "rgb(158, 217, 187)"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "rgb(123, 203, 196)"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "rgb(88, 183, 205)"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "rgb(57, 156, 198)"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "rgb(29, 126, 183)"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "rgb(11, 96, 161)"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "rgb(8, 64, 129)"
}))), React.createElement("rect", {
  fill: "url(#gradient-greenblue)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));
_scheme.schemesJSX['orangered'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-orangered"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "rgb(255, 247, 236)"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "rgb(254, 235, 207)"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "rgb(253, 220, 175)"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "rgb(253, 202, 148)"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "rgb(253, 176, 122)"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "rgb(250, 142, 93)"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "rgb(241, 108, 73)"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "rgb(224, 69, 48)"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "rgb(200, 29, 19)"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "rgb(167, 4, 3)"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "rgb(127, 0, 0)"
}))), React.createElement("rect", {
  fill: "url(#gradient-orangered)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));
_scheme.schemesJSX['purplebluegreen'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-purplebluegreen"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "rgb(255, 247, 251)"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "rgb(239, 231, 242)"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "rgb(219, 216, 234)"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "rgb(190, 201, 226)"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "rgb(152, 185, 217)"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "rgb(105, 168, 207)"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "rgb(64, 150, 192)"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "rgb(25, 135, 159)"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "rgb(3, 120, 119)"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "rgb(1, 99, 83)"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "rgb(1, 70, 54)"
}))), React.createElement("rect", {
  fill: "url(#gradient-purplebluegreen)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));
_scheme.schemesJSX['purpleblue'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-purpleblue"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "rgb(255, 247, 251)"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "rgb(239, 234, 244)"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "rgb(219, 218, 235)"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "rgb(191, 201, 226)"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "rgb(155, 185, 217)"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "rgb(114, 168, 207)"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "rgb(67, 148, 195)"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "rgb(26, 125, 182)"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "rgb(6, 103, 161)"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "rgb(4, 82, 129)"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "rgb(2, 56, 88)"
}))), React.createElement("rect", {
  fill: "url(#gradient-purpleblue)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));
_scheme.schemesJSX['purplered'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-purplered"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "rgb(247, 244, 249)"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "rgb(234, 227, 240)"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "rgb(220, 201, 226)"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "rgb(208, 170, 210)"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "rgb(208, 138, 194)"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "rgb(221, 99, 174)"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "rgb(227, 56, 144)"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "rgb(215, 28, 108)"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "rgb(183, 11, 79)"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "rgb(143, 2, 58)"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "rgb(103, 0, 31)"
}))), React.createElement("rect", {
  fill: "url(#gradient-purplered)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));
_scheme.schemesJSX['redpurple'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-redpurple"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "rgb(255, 247, 243)"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "rgb(253, 228, 225)"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "rgb(252, 207, 204)"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "rgb(251, 181, 188)"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "rgb(249, 147, 176)"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "rgb(243, 105, 163)"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "rgb(224, 62, 152)"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "rgb(192, 23, 136)"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "rgb(153, 3, 124)"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "rgb(112, 1, 116)"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "rgb(73, 0, 106)"
}))), React.createElement("rect", {
  fill: "url(#gradient-redpurple)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));
_scheme.schemesJSX['yellowgreenblue'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-yellowgreenblue"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "rgb(255, 255, 217)"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "rgb(239, 249, 189)"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "rgb(213, 238, 179)"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "rgb(169, 221, 183)"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "rgb(115, 201, 189)"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "rgb(69, 180, 194)"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "rgb(40, 151, 191)"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "rgb(32, 115, 178)"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "rgb(35, 78, 160)"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "rgb(28, 49, 133)"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "rgb(8, 29, 88)"
}))), React.createElement("rect", {
  fill: "url(#gradient-yellowgreenblue)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));
_scheme.schemesJSX['yellowgreen'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-yellowgreen"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "rgb(255, 255, 229)"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "rgb(247, 252, 196)"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "rgb(228, 244, 172)"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "rgb(199, 232, 155)"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "rgb(162, 216, 138)"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "rgb(120, 197, 120)"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "rgb(78, 175, 99)"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "rgb(47, 148, 78)"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "rgb(21, 121, 63)"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "rgb(3, 96, 52)"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "rgb(0, 69, 41)"
}))), React.createElement("rect", {
  fill: "url(#gradient-yellowgreen)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));
_scheme.schemesJSX['yelloworangebrown'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-yelloworangebrown"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "rgb(255, 255, 229)"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "rgb(255, 248, 196)"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "rgb(254, 234, 161)"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "rgb(254, 214, 118)"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "rgb(254, 186, 74)"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "rgb(251, 153, 44)"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "rgb(238, 121, 24)"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "rgb(216, 91, 10)"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "rgb(183, 67, 4)"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "rgb(143, 50, 4)"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "rgb(102, 37, 6)"
}))), React.createElement("rect", {
  fill: "url(#gradient-yelloworangebrown)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));
_scheme.schemesJSX['yelloworangered'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-yelloworangered"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "rgb(255, 255, 204)"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "rgb(255, 240, 169)"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "rgb(254, 224, 135)"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "rgb(254, 201, 101)"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "rgb(254, 171, 75)"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "rgb(253, 137, 60)"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "rgb(250, 92, 46)"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "rgb(236, 48, 35)"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "rgb(211, 17, 33)"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "rgb(175, 2, 37)"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "rgb(128, 0, 38)"
}))), React.createElement("rect", {
  fill: "url(#gradient-yelloworangered)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));

function sequentialMultiHue(selected) {
  return [(0, _scheme.schemeOption)(selected, 'viridis'), (0, _scheme.schemeOption)(selected, 'inferno'), (0, _scheme.schemeOption)(selected, 'magma'), (0, _scheme.schemeOption)(selected, 'plasma'), (0, _scheme.schemeOption)(selected, 'bluegreen'), (0, _scheme.schemeOption)(selected, 'bluepurple'), (0, _scheme.schemeOption)(selected, 'greenblue'), (0, _scheme.schemeOption)(selected, 'orangered'), (0, _scheme.schemeOption)(selected, 'purplebluegreen'), (0, _scheme.schemeOption)(selected, 'purpleblue'), (0, _scheme.schemeOption)(selected, 'purplered'), (0, _scheme.schemeOption)(selected, 'redpurple'), (0, _scheme.schemeOption)(selected, 'yellowgreenblue'), (0, _scheme.schemeOption)(selected, 'yellowgreen'), (0, _scheme.schemeOption)(selected, 'yelloworangebrown'), (0, _scheme.schemeOption)(selected, 'yelloworangered')];
}
},{"react":"mpTF","./scheme":"aSbm"}],"rue9":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.sequentialSingleHue = sequentialSingleHue;

var React = _interopRequireWildcard(require("react"));

var _scheme = require("./scheme");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
_scheme.schemesJSX['blues'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-blues"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "rgb(247, 251, 255)"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "rgb(227, 238, 249)"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "rgb(207, 225, 242)"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "rgb(181, 212, 233)"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "rgb(147, 195, 223)"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "rgb(109, 174, 213)"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "rgb(75, 151, 201)"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "rgb(47, 126, 188)"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "rgb(24, 100, 170)"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "rgb(10, 74, 144)"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "rgb(8, 48, 107)"
}))), React.createElement("rect", {
  fill: "url(#gradient-blues)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));
_scheme.schemesJSX['greens'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-greens"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "rgb(247, 252, 245)"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "rgb(232, 246, 227)"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "rgb(211, 238, 205)"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "rgb(183, 226, 177)"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "rgb(151, 212, 148)"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "rgb(115, 195, 120)"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "rgb(77, 175, 98)"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "rgb(47, 152, 79)"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "rgb(21, 127, 59)"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "rgb(3, 100, 41)"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "rgb(0, 68, 27)"
}))), React.createElement("rect", {
  fill: "url(#gradient-greens)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));
_scheme.schemesJSX['greys'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-greys"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "rgb(255, 255, 255)"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "rgb(242, 242, 242)"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "rgb(226, 226, 226)"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "rgb(206, 206, 206)"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "rgb(180, 180, 180)"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "rgb(151, 151, 151)"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "rgb(122, 122, 122)"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "rgb(95, 95, 95)"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "rgb(64, 64, 64)"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "rgb(30, 30, 30)"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "rgb(0, 0, 0)"
}))), React.createElement("rect", {
  fill: "url(#gradient-greys)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));
_scheme.schemesJSX['purples'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-purples"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "rgb(252, 251, 253)"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "rgb(241, 239, 246)"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "rgb(226, 225, 239)"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "rgb(206, 206, 229)"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "rgb(182, 181, 216)"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "rgb(158, 155, 201)"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "rgb(135, 130, 188)"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "rgb(115, 99, 172)"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "rgb(97, 64, 155)"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "rgb(80, 31, 140)"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "rgb(63, 0, 125)"
}))), React.createElement("rect", {
  fill: "url(#gradient-purples)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));
_scheme.schemesJSX['reds'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-reds"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "rgb(255, 245, 240)"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "rgb(254, 227, 214)"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "rgb(253, 201, 180)"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "rgb(252, 170, 142)"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "rgb(252, 138, 107)"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "rgb(249, 105, 76)"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "rgb(239, 69, 51)"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "rgb(217, 39, 35)"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "rgb(187, 21, 26)"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "rgb(151, 11, 19)"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "rgb(103, 0, 13)"
}))), React.createElement("rect", {
  fill: "url(#gradient-reds)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));
_scheme.schemesJSX['oranges'] = React.createElement("svg", {
  viewBox: "0,0,1,1",
  preserveAspectRatio: "none"
}, React.createElement("defs", null, React.createElement("linearGradient", {
  id: "gradient-oranges"
}, React.createElement("stop", {
  offset: "0%",
  stopColor: "rgb(255, 245, 235)"
}), React.createElement("stop", {
  offset: "10%",
  stopColor: "rgb(254, 232, 211)"
}), React.createElement("stop", {
  offset: "20%",
  stopColor: "rgb(253, 216, 179)"
}), React.createElement("stop", {
  offset: "30%",
  stopColor: "rgb(253, 194, 140)"
}), React.createElement("stop", {
  offset: "40%",
  stopColor: "rgb(253, 167, 98)"
}), React.createElement("stop", {
  offset: "50%",
  stopColor: "rgb(251, 141, 61)"
}), React.createElement("stop", {
  offset: "60%",
  stopColor: "rgb(242, 112, 29)"
}), React.createElement("stop", {
  offset: "70%",
  stopColor: "rgb(226, 86, 9)"
}), React.createElement("stop", {
  offset: "80%",
  stopColor: "rgb(196, 65, 3)"
}), React.createElement("stop", {
  offset: "90%",
  stopColor: "rgb(159, 51, 3)"
}), React.createElement("stop", {
  offset: "100%",
  stopColor: "rgb(127, 39, 4)"
}))), React.createElement("rect", {
  fill: "url(#gradient-oranges)",
  x: "0",
  y: "0",
  width: "1",
  height: "1"
}));

function sequentialSingleHue(selected) {
  return [(0, _scheme.schemeOption)(selected, 'blues'), (0, _scheme.schemeOption)(selected, 'greens'), (0, _scheme.schemeOption)(selected, 'greys'), (0, _scheme.schemeOption)(selected, 'purples'), (0, _scheme.schemeOption)(selected, 'reds'), (0, _scheme.schemeOption)(selected, 'oranges')];
}
},{"react":"mpTF","./scheme":"aSbm"}],"lmPN":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Palette = Palette;

var React = _interopRequireWildcard(require("react"));

var _base = require("../base");

var _categorical = require("./categorical");

var _diverging = require("./diverging");

var _dropdown = require("../controls/dropdown");

var _dual = require("./dual");

var _scheme = require("./scheme");

var _sanddanceReact = require("@msrvida/sanddance-react");

var _sequentialMultiHue = require("./sequentialMultiHue");

var _sequentialSingleHue = require("./sequentialSingleHue");

var _language = require("../language");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const maxDistinctColors = 20;

function Palette(props) {
  const {
    distinctValueCount
  } = props.colorColumn.stats;
  let isDual = distinctValueCount === 2;
  const categoricalNumeric = distinctValueCount > 0 && distinctValueCount < maxDistinctColors;
  let isQualitative = false;
  let isQuantitative = false;

  switch (props.colorColumn.type) {
    case 'boolean':
    case 'string':
      isQualitative = true;
      break;

    case 'number':
      isQuantitative = true;
      break;

    case 'date':
    case 'integer':
      isQuantitative = true;
      isQualitative = categoricalNumeric;
  }

  const selected = props.scheme;
  const options = [];

  function menu(name, opts) {
    options.push({
      key: name,
      text: name,
      itemType: _base.base.fabric.DropdownMenuItemType.Header
    });
    options.push.apply(options, opts);
  }

  isQualitative && menu(_language.strings.schemeCategorical, (0, _categorical.categorical)(selected));
  isQuantitative && menu(_language.strings.schemeSequentialSingleHue, (0, _sequentialSingleHue.sequentialSingleHue)(selected));
  isQuantitative && menu(_language.strings.schemeSequentialMultiHue, (0, _sequentialMultiHue.sequentialMultiHue)(selected));
  isQuantitative && menu(_language.strings.schemeDiverging, (0, _diverging.diverging)(selected));
  isDual && menu(_language.strings.schemeDual, (0, _dual.dual)(selected));
  return React.createElement("div", {
    className: "sanddance-palette"
  }, React.createElement("div", {
    className: "sanddance-explanation",
    dangerouslySetInnerHTML: {
      __html: _language.strings.labelColorFieldInfo(props.colorColumn.name, props.colorColumn.type, categoricalNumeric, distinctValueCount)
    }
  }), React.createElement(_dropdown.Dropdown, {
    collapseLabel: props.collapseLabel,
    disabled: props.disabled,
    dropdownWidth: 400,
    label: _language.strings.labelColorScheme,
    onRenderOption: option => {
      if (option.itemType === _base.base.fabric.DropdownMenuItemType.Header) {
        return React.createElement("span", null, option.text);
      } else {
        return React.createElement("div", {
          className: "sanddance-scheme option"
        }, React.createElement("span", {
          className: "name"
        }, option.scheme), option.children);
      }
    },
    options: options,
    onChange: (e, o) => {
      props.changeColorScheme(o.scheme);
    }
  }), React.createElement("div", {
    className: _sanddanceReact.util.classList('sanddance-scheme', props.disabled && 'disabled')
  }, props.scheme && _scheme.schemesJSX[props.scheme]));
}
},{"react":"mpTF","../base":"yK94","./categorical":"zSP9","./diverging":"spyH","../controls/dropdown":"xuEz","./dual":"Tvyq","./scheme":"aSbm","@msrvida/sanddance-react":"miZu","./sequentialMultiHue":"Lqbl","./sequentialSingleHue":"rue9","../language":"Zz8c"}],"Mhm6":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Color = Color;

var React = _interopRequireWildcard(require("react"));

var _base = require("../base");

var _columnMap = require("../controls/columnMap");

var _palettes = require("../palettes");

var _signal = require("../controls/signal");

var _language = require("../language");

var _group = require("../controls/group");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function Color(props) {
  const colorColumn = props.dataContent.columns.filter(c => c.name === props.colorColumn)[0];
  const disabledColorBin = !colorColumn || !colorColumn.quantitative || props.directColor;
  const colorBin = props.colorBin || 'quantize';
  return React.createElement("div", {
    className: "sanddance-color-dialog"
  }, React.createElement(_group.Group, {
    label: _language.strings.labelColor
  }, React.createElement(_columnMap.ColumnMap, Object.assign({}, props, {
    collapseLabel: props.compactUI,
    selectedColumnName: props.colorColumn,
    specRole: props.specCapabilities && props.specCapabilities.roles.filter(r => r.role === 'color')[0],
    key: 0
  })), colorColumn && colorColumn.isColorData && React.createElement("div", {
    className: "sanddance-explanation",
    dangerouslySetInnerHTML: {
      __html: _language.strings.labelColorFieldIsColorData(colorColumn.name)
    }
  }), colorColumn && !colorColumn.isColorData && React.createElement(_palettes.Palette, {
    collapseLabel: props.compactUI,
    scheme: props.scheme,
    colorColumn: colorColumn,
    changeColorScheme: scheme => {
      props.onColorSchemeChange(scheme);
    },
    disabled: props.disabled || props.directColor || colorColumn && colorColumn.isColorData
  }), colorColumn && !colorColumn.isColorData && React.createElement(_signal.Signal, {
    disabled: props.disabled || !colorColumn || props.directColor || colorColumn && colorColumn.isColorData,
    signal: props.colorReverseSignal,
    explorer: props.explorer,
    onChange: props.onColorReverseChange
  })), colorColumn && !colorColumn.isColorData && React.createElement(_group.Group, {
    label: _language.strings.labelColorBin
  }, React.createElement("div", {
    className: "sanddance-explanation"
  }, _language.strings.labelColorBinExplanation), React.createElement(_base.base.fabric.ChoiceGroup, {
    options: [{
      key: 'continuous',
      text: _language.strings.labelColorBinNone,
      checked: colorBin === 'continuous',
      disabled: disabledColorBin
    }, {
      key: 'quantize',
      text: _language.strings.labelColorBinQuantize,
      checked: colorBin === 'quantize',
      disabled: disabledColorBin
    }, {
      key: 'quantile',
      text: _language.strings.labelColorBinQuantile,
      checked: colorBin === 'quantile',
      disabled: disabledColorBin
    }],
    onChange: (e, o) => {
      props.onColorBinChange(o.key);
    }
  }), React.createElement(_signal.Signal, {
    disabled: props.disabled || disabledColorBin || props.colorBin === 'continuous',
    signal: props.colorBinSignal,
    explorer: props.explorer,
    onChange: props.onColorBinCountChange
  })), colorColumn && !colorColumn.isColorData && React.createElement(_group.Group, {
    label: _language.strings.labelColorOptions
  }, React.createElement(_base.base.fabric.Toggle, {
    label: _language.strings.selectDirectColor,
    disabled: !colorColumn.stats.hasColorData,
    checked: !!(colorColumn.stats.hasColorData && props.directColor),
    onChange: (e, checked) => props.onDirectColorChange(checked)
  }), React.createElement("div", {
    className: "sanddance-explanation",
    dangerouslySetInnerHTML: {
      __html: _language.strings.labelDataColors
    }
  })));
}
},{"react":"mpTF","../base":"yK94","../controls/columnMap":"uNUJ","../palettes":"lmPN","../controls/signal":"KVvK","../language":"Zz8c","../controls/group":"gj41"}],"A1e3":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.initPrefs = initPrefs;
exports.saveSignalValuePref = saveSignalValuePref;
exports.copyPrefToNewState = copyPrefToNewState;
exports.savePref = savePref;

var _sanddanceReact = require("@msrvida/sanddance-react");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function initPrefs(prefs, partialInsight) {
  if (partialInsight) {
    const specTypePrefs = prefs[partialInsight.chart] || {};
    prefs[partialInsight.chart] = specTypePrefs;

    for (let _role in partialInsight.columns) {
      let role = _role;

      if (role === 'color' || role === 'x') {
        let rolePrefs = specTypePrefs[role] || {};
        specTypePrefs[role] = rolePrefs;
        let column = partialInsight.columns[role];

        let copySignalValue = signalName => {
          if (partialInsight.signalValues && partialInsight.signalValues[signalName] && rolePrefs[column]) {
            const signalValues = rolePrefs[column].signalValues || {};
            signalValues[signalName] = partialInsight.signalValues[signalName];
            rolePrefs[column].signalValues = signalValues;
          }
        };

        switch (role) {
          case 'color':
            rolePrefs[column] = {
              scheme: partialInsight.scheme,
              colorBin: partialInsight.colorBin
            };
            copySignalValue(_sanddanceReact.SandDance.constants.SignalNames.ColorBinCount);
            break;

          case 'x':
            copySignalValue(_sanddanceReact.SandDance.constants.SignalNames.XBins);
            break;
        }
      }
    }
  }
}

function saveSignalValuePref(prefs, chart, role, column, signalName, signalValue) {
  const partialInsight = savePref(prefs, chart, role, column, {
    signalValues: {}
  });
  partialInsight.signalValues[signalName] = signalValue;
}

function copyPrefToNewState(prefs, chart, role, columnName) {
  const specTypePrefs = _sanddanceReact.SandDance.VegaDeckGl.util.deepMerge({}, prefs['*'], prefs[chart]);

  const rolePrefs = _sanddanceReact.SandDance.VegaDeckGl.util.deepMerge({}, specTypePrefs['*'], specTypePrefs[role]);

  const partialInsight = _sanddanceReact.SandDance.VegaDeckGl.util.deepMerge({}, rolePrefs['*'], rolePrefs[columnName]);

  return partialInsight;
}

function savePref(prefs, chart, role, column, partialInsight) {
  const SpecTypePrefs = prefs[chart] || {};
  prefs[chart] = SpecTypePrefs;
  const rolePrefs = SpecTypePrefs[role] || {};
  SpecTypePrefs[role] = rolePrefs;
  rolePrefs[column] = _sanddanceReact.SandDance.VegaDeckGl.util.deepMerge({}, rolePrefs[column], partialInsight);
  return rolePrefs[column];
}
},{"@msrvida/sanddance-react":"miZu"}],"VDe2":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.DataItem = DataItem;

var React = _interopRequireWildcard(require("react"));

var _sanddanceReact = require("@msrvida/sanddance-react");

var _language = require("../language");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function isNumber(value) {
  if (typeof value === 'number') return true;
  if (!isNaN(value)) return true;
  return false;
}

function isBoolean(value) {
  if (typeof value === 'boolean') return true;

  if (typeof value === 'string') {
    switch (value.toLowerCase()) {
      case true + '':
      case false + '':
        return true;
    }
  }

  return false;
}

function bingSearchLink(column, value) {
  if (isNumber(value)) return null;
  if (isBoolean(value)) return null;
  if (column && column.stats.distinctValueCount === 2) return null;
  return React.createElement("div", {
    className: 'bing-search'
  }, React.createElement("a", {
    href: `https://www.bing.com/search?q=${encodeURIComponent(value)}`,
    target: '_blank',
    title: _language.strings.bingsearchDescription(value),
    "aria-label": _language.strings.bingsearchDescription(value)
  }, _language.strings.bingsearch));
}

function displayValue(value) {
  switch (value) {
    case '':
      {
        return {
          special: true,
          display: _language.strings.labelBlank
        };
      }

    case null:
      {
        return {
          special: true,
          display: _language.strings.labelNull
        };
      }

    case true:
      {
        return {
          special: true,
          display: _language.strings.labelTrue
        };
      }

    case false:
      {
        return {
          special: true,
          display: _language.strings.labelFalse
        };
      }

    default:
      {
        if (typeof value === 'object') {
          if (value instanceof Date) {
            const d = value;
            return displayValue(d.input);
          }

          return {
            special: false,
            display: value.toLocaleString()
          };
        }

        return {
          special: false,
          display: value
        };
      }
  }
}

function displayValueElement(nvp) {
  const d = displayValue(nvp.value);

  if (d.special) {
    return React.createElement("i", null, d.display);
  }

  return d.display;
}

const KeyCodes = {
  ENTER: 13
};

function DataItem(props) {
  if (!props.item) {
    return null;
  }

  const nameValuePairs = [];

  for (let columnName in props.item) {
    if (columnName === _sanddanceReact.SandDance.VegaDeckGl.constants.GL_ORDINAL && !props.showSystemFields) {
      continue;
    }

    if (_sanddanceReact.SandDance.util.isInternalFieldName(columnName)) {
      continue;
    }

    let nameValuePair = {
      columnName,
      value: props.item[columnName]
    };

    if (!props.bingSearchDisabled) {
      nameValuePair.bingSearch = bingSearchLink(props.columns.filter(c => c.name === columnName)[0], props.item[columnName]);
    }

    nameValuePairs.push(nameValuePair);
  }

  return React.createElement("div", {
    className: "sanddance-dataItem"
  }, nameValuePairs.map((nameValuePair, i) => {
    const ex = {
      key: 0,
      name: nameValuePair.columnName,
      operator: '==',
      value: nameValuePair.value
    };

    if (nameValuePair.value === null || nameValuePair.value === '') {
      ex.operator = 'isnullorEmpty';
      delete ex.value;
    }

    const searchClick = e => {
      const search = {
        key: 0,
        expressions: [ex]
      };
      props.onSearch(e, [search]);
    };

    const title = _language.strings.tooltipSearch(nameValuePair.columnName, displayValue(nameValuePair.value).display);

    return React.createElement("div", {
      key: i,
      onClick: !props.disabled ? searchClick : null,
      title: title,
      onKeyUp: e => {
        if (e.keyCode === KeyCodes.ENTER) {
          searchClick(e);
        }
      },
      tabIndex: 0,
      className: "name-value"
    }, React.createElement("div", {
      className: "column-name"
    }, nameValuePair.columnName), React.createElement("div", {
      className: "column-value"
    }, displayValueElement(nameValuePair)), nameValuePair.bingSearch);
  }));
}
},{"react":"mpTF","@msrvida/sanddance-react":"miZu","../language":"Zz8c"}],"Y7Nu":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Button = Button;

var React = _interopRequireWildcard(require("react"));

var _base = require("../base");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function Button(props) {
  return React.createElement(_base.base.fabric.DefaultButton, Object.assign({}, props, {
    styles: {
      root: {
        backgroundColor: 'transparent',
        height: '30px',
        width: props.width,
        padding: 0
      },
      rootDisabled: {
        backgroundColor: 'transparent'
      },
      icon: {
        color: props.themePalette.themePrimary
      },
      label: {
        fontWeight: '400',
        textAlign: props.textAlign || 'left'
      }
    },
    iconProps: {
      iconName: props.iconName
    }
  }));
}
},{"react":"mpTF","../base":"yK94"}],"RMp2":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

// 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, formatDecimal(1.23) returns ["123", 0].
function _default(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)];
}
},{}],"D7f5":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _formatDecimal = _interopRequireDefault(require("./formatDecimal.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(x) {
  return x = (0, _formatDecimal.default)(Math.abs(x)), x ? x[1] : NaN;
}
},{"./formatDecimal.js":"RMp2"}],"Ylox":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(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);
  };
}
},{}],"Rlk1":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(numerals) {
  return function (value) {
    return value.replace(/[0-9]/g, function (i) {
      return numerals[+i];
    });
  };
}
},{}],"t9Q3":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = formatSpecifier;
exports.FormatSpecifier = 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;
};
},{}],"ZJU7":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.
function _default(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 (i0 > 0) {
          if (!+s[i]) break out;
          i0 = 0;
        }

        break;
    }
  }

  return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;
}
},{}],"Pb7s":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.prefixExponent = void 0;

var _formatDecimal = _interopRequireDefault(require("./formatDecimal.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var prefixExponent;
exports.prefixExponent = prefixExponent;

function _default(x, p) {
  var d = (0, _formatDecimal.default)(x, p);
  if (!d) return x + "";
  var coefficient = d[0],
      exponent = d[1],
      i = exponent - (exports.prefixExponent = 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") + (0, _formatDecimal.default)(x, Math.max(0, p + i - 1))[0]; // less than 1y!
}
},{"./formatDecimal.js":"RMp2"}],"fsD0":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _formatDecimal = _interopRequireDefault(require("./formatDecimal.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(x, p) {
  var d = (0, _formatDecimal.default)(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");
}
},{"./formatDecimal.js":"RMp2"}],"QYLM":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _formatPrefixAuto = _interopRequireDefault(require("./formatPrefixAuto.js"));

var _formatRounded = _interopRequireDefault(require("./formatRounded.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _default = {
  "%": function (x, p) {
    return (x * 100).toFixed(p);
  },
  "b": function (x) {
    return Math.round(x).toString(2);
  },
  "c": function (x) {
    return x + "";
  },
  "d": function (x) {
    return Math.round(x).toString(10);
  },
  "e": function (x, p) {
    return x.toExponential(p);
  },
  "f": function (x, p) {
    return x.toFixed(p);
  },
  "g": function (x, p) {
    return x.toPrecision(p);
  },
  "o": function (x) {
    return Math.round(x).toString(8);
  },
  "p": function (x, p) {
    return (0, _formatRounded.default)(x * 100, p);
  },
  "r": _formatRounded.default,
  "s": _formatPrefixAuto.default,
  "X": function (x) {
    return Math.round(x).toString(16).toUpperCase();
  },
  "x": function (x) {
    return Math.round(x).toString(16);
  }
};
exports.default = _default;
},{"./formatPrefixAuto.js":"Pb7s","./formatRounded.js":"fsD0"}],"LuEH":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(x) {
  return x;
}
},{}],"sPoU":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _exponent = _interopRequireDefault(require("./exponent.js"));

var _formatGroup = _interopRequireDefault(require("./formatGroup.js"));

var _formatNumerals = _interopRequireDefault(require("./formatNumerals.js"));

var _formatSpecifier = _interopRequireDefault(require("./formatSpecifier.js"));

var _formatTrim = _interopRequireDefault(require("./formatTrim.js"));

var _formatTypes = _interopRequireDefault(require("./formatTypes.js"));

var _formatPrefixAuto = require("./formatPrefixAuto.js");

var _identity = _interopRequireDefault(require("./identity.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var map = Array.prototype.map,
    prefixes = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];

function _default(locale) {
  var group = locale.grouping === undefined || locale.thousands === undefined ? _identity.default : (0, _formatGroup.default)(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.default : (0, _formatNumerals.default)(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 = (0, _formatSpecifier.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.default[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.default[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; // Perform the initial formatting.

        var valueNegative = value < 0;
        value = isNaN(value) ? nan : formatType(Math.abs(value), precision); // Trim insignificant zeros.

        if (trim) value = (0, _formatTrim.default)(value); // If a negative value rounds to zero during formatting, treat as positive.

        if (valueNegative && +value === 0) valueNegative = false; // Compute the prefix and suffix.

        valuePrefix = (valueNegative ? sign === "(" ? sign : minus : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
        valueSuffix = (type === "s" ? prefixes[8 + _formatPrefixAuto.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 = (0, _formatSpecifier.default)(specifier), specifier.type = "f", specifier)),
        e = Math.max(-8, Math.min(8, Math.floor((0, _exponent.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
  };
}
},{"./exponent.js":"D7f5","./formatGroup.js":"Ylox","./formatNumerals.js":"Rlk1","./formatSpecifier.js":"t9Q3","./formatTrim.js":"ZJU7","./formatTypes.js":"QYLM","./formatPrefixAuto.js":"Pb7s","./identity.js":"LuEH"}],"GuaF":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = defaultLocale;
exports.formatPrefix = exports.format = void 0;

var _locale = _interopRequireDefault(require("./locale.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var locale;
var format;
exports.format = format;
var formatPrefix;
exports.formatPrefix = formatPrefix;
defaultLocale({
  decimal: ".",
  thousands: ",",
  grouping: [3],
  currency: ["$", ""],
  minus: "-"
});

function defaultLocale(definition) {
  locale = (0, _locale.default)(definition);
  exports.format = format = locale.format;
  exports.formatPrefix = formatPrefix = locale.formatPrefix;
  return locale;
}
},{"./locale.js":"sPoU"}],"i4Ps":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _exponent = _interopRequireDefault(require("./exponent.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(step) {
  return Math.max(0, -(0, _exponent.default)(Math.abs(step)));
}
},{"./exponent.js":"D7f5"}],"s0Fa":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _exponent = _interopRequireDefault(require("./exponent.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(step, value) {
  return Math.max(0, Math.max(-8, Math.min(8, Math.floor((0, _exponent.default)(value) / 3))) * 3 - (0, _exponent.default)(Math.abs(step)));
}
},{"./exponent.js":"D7f5"}],"fgNA":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _exponent = _interopRequireDefault(require("./exponent.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(step, max) {
  step = Math.abs(step), max = Math.abs(max) - step;
  return Math.max(0, (0, _exponent.default)(max) - (0, _exponent.default)(step)) + 1;
}
},{"./exponent.js":"D7f5"}],"Oea0":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "formatDefaultLocale", {
  enumerable: true,
  get: function () {
    return _defaultLocale.default;
  }
});
Object.defineProperty(exports, "format", {
  enumerable: true,
  get: function () {
    return _defaultLocale.format;
  }
});
Object.defineProperty(exports, "formatPrefix", {
  enumerable: true,
  get: function () {
    return _defaultLocale.formatPrefix;
  }
});
Object.defineProperty(exports, "formatLocale", {
  enumerable: true,
  get: function () {
    return _locale.default;
  }
});
Object.defineProperty(exports, "formatSpecifier", {
  enumerable: true,
  get: function () {
    return _formatSpecifier.default;
  }
});
Object.defineProperty(exports, "FormatSpecifier", {
  enumerable: true,
  get: function () {
    return _formatSpecifier.FormatSpecifier;
  }
});
Object.defineProperty(exports, "precisionFixed", {
  enumerable: true,
  get: function () {
    return _precisionFixed.default;
  }
});
Object.defineProperty(exports, "precisionPrefix", {
  enumerable: true,
  get: function () {
    return _precisionPrefix.default;
  }
});
Object.defineProperty(exports, "precisionRound", {
  enumerable: true,
  get: function () {
    return _precisionRound.default;
  }
});

var _defaultLocale = _interopRequireWildcard(require("./defaultLocale.js"));

var _locale = _interopRequireDefault(require("./locale.js"));

var _formatSpecifier = _interopRequireWildcard(require("./formatSpecifier.js"));

var _precisionFixed = _interopRequireDefault(require("./precisionFixed.js"));

var _precisionPrefix = _interopRequireDefault(require("./precisionPrefix.js"));

var _precisionRound = _interopRequireDefault(require("./precisionRound.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
},{"./defaultLocale.js":"GuaF","./locale.js":"sPoU","./formatSpecifier.js":"t9Q3","./precisionFixed.js":"i4Ps","./precisionPrefix.js":"s0Fa","./precisionRound.js":"fgNA"}],"PlDJ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.DataScope = DataScope;
exports.DataScopeId = void 0;

var React = _interopRequireWildcard(require("react"));

var _button = require("./button");

var _d3Format = require("d3-format");

var _language = require("../language");

var _sanddanceReact = require("@msrvida/sanddance-react");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
var DataScopeId;
exports.DataScopeId = DataScopeId;

(function (DataScopeId) {
  DataScopeId[DataScopeId["AllData"] = 0] = "AllData";
  DataScopeId[DataScopeId["SelectedData"] = 1] = "SelectedData";
  DataScopeId[DataScopeId["FilteredData"] = 2] = "FilteredData";
})(DataScopeId || (exports.DataScopeId = DataScopeId = {}));

const shortFormat = (0, _d3Format.format)('.2~s');

function short(n) {
  return n === -1 ? '--' : n ? n < 1000 ? n.toString() : shortFormat(n) : '0';
}

function DataScope(props) {
  const dataCount = Object.assign({
    all: -1,
    filtered: -1,
    selected: -1
  }, props.dataCount);
  return props.compact ? React.createElement("div", {
    className: _sanddanceReact.util.classList('sanddance-datascope', 'compact'),
    onClick: props.onCompactClick
  }, React.createElement(Compact, Object.assign({}, props, {
    dataScopeId: DataScopeId.AllData,
    text: _language.strings.selectDataSpanAll,
    count: dataCount.all
  })), React.createElement(Compact, Object.assign({}, props, {
    dataScopeId: DataScopeId.FilteredData,
    text: _language.strings.selectDataSpanFilter,
    count: dataCount.filtered
  })), React.createElement(Compact, Object.assign({}, props, {
    dataScopeId: DataScopeId.SelectedData,
    text: _language.strings.selectDataSpanSelection,
    count: dataCount.selected
  }))) : React.createElement("div", {
    className: _sanddanceReact.util.classList('sanddance-datascope', 'extended', props.active && 'active')
  }, React.createElement("div", null, React.createElement("div", null, props.dataSet), React.createElement("div", {
    className: "datascope-buttons"
  }, React.createElement(DataScopeButton, Object.assign({}, props, {
    dataScopeId: DataScopeId.AllData,
    text: _language.strings.selectDataSpanAll,
    count: dataCount.all
  })), React.createElement(DataScopeButton, Object.assign({}, props, {
    dataScopeId: DataScopeId.FilteredData,
    text: _language.strings.selectDataSpanFilter,
    count: dataCount.filtered
  })), React.createElement(DataScopeButton, Object.assign({}, props, {
    dataScopeId: DataScopeId.SelectedData,
    text: _language.strings.selectDataSpanSelection,
    count: dataCount.selected
  })))));
}

function Compact(props) {
  return React.createElement("div", {
    title: props.text,
    onClick: () => {
      props.onDataScopeClick(props.dataScopeId);
    }
  }, short(props.count));
}

function DataScopeButton(props) {
  return React.createElement(_button.Button, {
    themePalette: props.themePalette,
    className: _sanddanceReact.util.classList('datascope-button', props.selectedDataScope === props.dataScopeId && 'selected'),
    disabled: props.disabled,
    text: props.text,
    onClick: () => {
      props.onDataScopeClick(props.dataScopeId);
    },
    onRenderText: () => {
      return React.createElement("div", {
        title: props.count > 0 ? props.count.toString() : ''
      }, React.createElement("label", null, props.text), React.createElement("div", null, short(props.count)));
    },
    onRenderIcon: () => null
  });
}
},{"react":"mpTF","./button":"Y7Nu","d3-format":"Oea0","../language":"Zz8c","@msrvida/sanddance-react":"miZu"}],"NTik":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.DataBrowser = DataBrowser;

var React = _interopRequireWildcard(require("react"));

var _dataExporter = require("../controls/dataExporter");

var _dataItem = require("../controls/dataItem");

var _dataScope = require("../controls/dataScope");

var _dropdown = require("../controls/dropdown");

var _group = require("../controls/group");

var _iconButton = require("../controls/iconButton");

var _language = require("../language");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function DataBrowser(props) {
  function activateRecord(newIndex) {
    props.onActivate(props.data[newIndex], newIndex);
  }

  const {
    index
  } = props;
  const length = props.data && props.data.length || 0;
  return React.createElement(_group.Group, {
    label: _language.strings.labelDataBrowser,
    className: "sanddance-dataIndex"
  }, React.createElement(_dropdown.Dropdown, {
    label: _language.strings.labelDataScope,
    collapseLabel: true,
    options: [{
      key: _dataScope.DataScopeId.AllData,
      text: _language.strings.selectDataSpanAll,
      isSelected: props.selectedDataScope === _dataScope.DataScopeId.AllData
    }, {
      key: _dataScope.DataScopeId.FilteredData,
      text: _language.strings.selectDataSpanFilter,
      isSelected: props.selectedDataScope === _dataScope.DataScopeId.FilteredData
    }, {
      key: _dataScope.DataScopeId.SelectedData,
      text: _language.strings.selectDataSpanSelection,
      isSelected: props.selectedDataScope === _dataScope.DataScopeId.SelectedData
    }],
    onChange: (e, o) => {
      props.onDataScopeClick(o.key);
    }
  }), !props.data && React.createElement("div", {
    dangerouslySetInnerHTML: {
      __html: props.nullMessage
    }
  }), props.data && !props.data.length && React.createElement("div", null, props.zeroMessage), !!length && React.createElement("div", null, React.createElement("div", {
    className: "index"
  }, React.createElement(_iconButton.IconButton, {
    themePalette: props.themePalette,
    iconName: "ChevronLeftMed",
    onClick: e => activateRecord(index <= 0 ? length - 1 : index - 1),
    disabled: props.disabled || length === 1,
    title: _language.strings.buttonPrevDataItem
  }), React.createElement("span", null, _language.strings.record(index + 1, length)), React.createElement(_iconButton.IconButton, {
    themePalette: props.themePalette,
    iconName: "ChevronRightMed",
    onClick: e => activateRecord(index >= length - 1 ? 0 : index + 1),
    disabled: props.disabled || length === 1,
    title: _language.strings.buttonNextDataItem
  })), !props.itemVisible && React.createElement("div", {
    className: "item-filtered"
  }, _language.strings.labelDataItemIsFiltered), React.createElement(_dataItem.DataItem, {
    columns: props.columns,
    item: props.data[index],
    disabled: props.disabled,
    onSearch: props.onSearch,
    bingSearchDisabled: props.bingSearchDisabled
  })), props.dataExportHandler && props.data && React.createElement(_dataExporter.DataExportPicker, {
    theme: props.theme,
    initializer: {
      fileName: `${(0, _dataExporter.removeExtensions)(props.displayName)} (${props.data.length})`
    },
    data: props.data,
    dataExportHandler: props.dataExportHandler,
    disabled: props.disabled
  }));
}
},{"react":"mpTF","../controls/dataExporter":"mUYZ","../controls/dataItem":"VDe2","../controls/dataScope":"PlDJ","../controls/dropdown":"xuEz","../controls/group":"gj41","../controls/iconButton":"tNGe","../language":"Zz8c"}],"JNef":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.snapshotThumbWidth = exports.defaultViewerOptions = exports.fontFamily = void 0;

var _themes = require("./themes");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const fontFamily = 'Segoe UI, sans-serif';
exports.fontFamily = fontFamily;
const defaultViewerOptions = {
  colors: (0, _themes.getColorSettingsFromThemePalette)(_themes.themePalettes['']),
  fontFamily
};
exports.defaultViewerOptions = defaultViewerOptions;
const snapshotThumbWidth = 300;
exports.snapshotThumbWidth = snapshotThumbWidth;
},{"./themes":"wxrq"}],"TZAL":[function(require,module,exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.maxCategoricalColors = 20;
var Recommender = /** @class */ (function () {
    function Recommender(columns, data) {
    }
    return Recommender;
}());
exports.Recommender = Recommender;
function defaultColorScheme(c) {
    if (c.quantitative) {
        return 'redyellowgreen';
    }
    else if (c.stats.distinctValueCount === 2) {
        return 'dual_redgreen';
    }
    else if (c.stats.distinctValueCount <= 10) {
        return 'category10';
    }
    return 'category20';
}
exports.defaultColorScheme = defaultColorScheme;

},{}],"EzyA":[function(require,module,exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var recommender_1 = require("./recommender");
var maxDistinctVal = 20;
var minDistinctVal = 2;
var BarChartRecommenderSummary = /** @class */ (function () {
    function BarChartRecommenderSummary(columns, data) {
        var score = -1;
        for (var i = 0; i < columns.length; i++) {
            var recommendation = new BarChartRecommender(columns[i], data).recommend();
            if (recommendation.score > score) {
                this.best = recommendation;
                score = recommendation.score;
            }
            if (score === 1)
                break;
        }
        for (var k = 0; k < columns.length; k++) {
            var column = columns[k];
            if (column.name === this.best.columns.x || column.stats.isSequential)
                continue;
            if (column.quantitative || (column.stats.distinctValueCount < recommender_1.maxCategoricalColors && column.stats.distinctValueCount > 1)) {
                this.best.columns.color = this.best.columns.sort = column.name;
                this.best.scheme = recommender_1.defaultColorScheme(column);
                if (column.quantitative) {
                    this.best.colorBin = 'quantile';
                }
                break;
            }
        }
    }
    BarChartRecommenderSummary.prototype.recommend = function () {
        return this.best;
    };
    return BarChartRecommenderSummary;
}());
exports.BarChartRecommenderSummary = BarChartRecommenderSummary;
var BarChartRecommender = /** @class */ (function () {
    function BarChartRecommender(column, data) {
        this.score = 0;
        this.column = column;
        //the total score for bar chart is 1
        this.rules = [
            function (column) {
                if (column.stats.isSequential)
                    return false;
                else if (column.quantitative) {
                    return true;
                }
                else if (!column.quantitative && column.stats.distinctValueCount <= maxDistinctVal && column.stats.distinctValueCount >= minDistinctVal) {
                    return true;
                }
                else {
                    return false;
                }
            }
        ];
        for (var i = 0; i < this.rules.length; i++) {
            if (this.rules[i](column))
                this.score++;
        }
    }
    BarChartRecommender.prototype.recommend = function () {
        var rec = {
            chart: 'barchart',
            columns: {
                x: this.column.name
            },
            score: this.score,
            scheme: undefined,
            view: '2d'
        };
        return rec;
    };
    return BarChartRecommender;
}());
exports.BarChartRecommender = BarChartRecommender;

},{"./recommender":"TZAL"}],"BBT4":[function(require,module,exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//TODO: languages other than english
var longitudeNames = ['lon', 'long', 'longitude'];
var latitudeNames = ['lat', 'latitude'];
function isSpec(names, limits, column, data) {
    var is = false;
    var cname = column.name.toLowerCase();
    for (var i = 0; i < names.length; i++) {
        if (names[i] === cname) {
            is = true;
            break;
        }
    }
    if (data) {
        //TODO: spin through data to see if it is within limits
    }
    return is;
}
function isLongitude(column, data) {
    return isSpec(longitudeNames, [-180, 180], column, data);
}
exports.isLongitude = isLongitude;
function isLatitude(column, data) {
    return isSpec(latitudeNames, [-90, 90], column, data);
}
exports.isLatitude = isLatitude;
function isGeo(column, data) {
    return isLatitude(column, data) || isLongitude(column, data);
}
exports.isGeo = isGeo;

},{}],"GxdV":[function(require,module,exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var recommender_1 = require("./recommender");
var geo_1 = require("./geo");
var ScatterPlotRecommenderSummary = /** @class */ (function () {
    function ScatterPlotRecommenderSummary(columns, data) {
        var rec = {
            chart: 'scatterplot',
            score: undefined,
            columns: {},
            scheme: undefined,
            view: '2d'
        };
        columns.forEach(function (column) {
            if (!rec.columns.x) {
                if (column.name.toLowerCase() === 'x') {
                    return rec.columns.x = column.name;
                }
                else if (geo_1.isLongitude(column)) {
                    return rec.columns.x = column.name;
                }
            }
            if (!rec.columns.y) {
                if (column.name.toLowerCase() === 'y') {
                    return rec.columns.y = column.name;
                }
                else if (geo_1.isLatitude(column)) {
                    return rec.columns.y = column.name;
                }
            }
            if (!rec.columns.color && !column.stats.isSequential) {
                if (column.quantitative || column.stats.distinctValueCount < recommender_1.maxCategoricalColors) {
                    rec.columns.color = rec.columns.sort = column.name;
                    rec.scheme = recommender_1.defaultColorScheme(column);
                    if (column.quantitative) {
                        rec.colorBin = 'quantile';
                    }
                    return;
                }
            }
        });
        if (rec.columns.x && rec.columns.y) {
            this.best = rec;
        }
    }
    ScatterPlotRecommenderSummary.prototype.recommend = function () {
        return this.best;
    };
    return ScatterPlotRecommenderSummary;
}());
exports.ScatterPlotRecommenderSummary = ScatterPlotRecommenderSummary;

},{"./recommender":"TZAL","./geo":"BBT4"}],"CDHO":[function(require,module,exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var geo_1 = require("./geo");
function preferredColumnForTreemapSize(columns, strict) {
    for (var i = 0; i < columns.length; i++) {
        var c = columns[i];
        if (c.quantitative) {
            if (strict && c.stats.hasNegative)
                continue;
            if (strict && c.stats.isSequential)
                continue;
            if (strict && geo_1.isGeo(c))
                continue;
            return c.name;
        }
    }
}
exports.preferredColumnForTreemapSize = preferredColumnForTreemapSize;

},{"./geo":"BBT4"}],"hrya":[function(require,module,exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var barChart_1 = require("./barChart");
var scatterPlot_1 = require("./scatterPlot");
var RecommenderSummary = /** @class */ (function () {
    function RecommenderSummary(columns, data) {
        var quickRec = new scatterPlot_1.ScatterPlotRecommenderSummary(columns, data).recommend();
        if (quickRec) {
            this.rec = quickRec;
        }
        else {
            var barChartrec = new barChart_1.BarChartRecommenderSummary(columns, data).recommend();
            if (barChartrec && barChartrec.score >= 1) {
                this.rec = barChartrec;
            }
            else {
                this.rec = {
                    chart: 'grid',
                    columns: {},
                    score: 1
                };
            }
        }
    }
    RecommenderSummary.prototype.recommend = function () {
        return this.rec;
    };
    return RecommenderSummary;
}());
exports.RecommenderSummary = RecommenderSummary;

},{"./barChart":"EzyA","./scatterPlot":"GxdV"}],"CmqI":[function(require,module,exports) {
"use strict";
function __export(m) {
    for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
__export(require("./barChart"));
__export(require("./geo"));
__export(require("./scatterPlot"));
__export(require("./treemap"));
__export(require("./recommenderSummary"));

},{"./barChart":"EzyA","./geo":"BBT4","./scatterPlot":"GxdV","./treemap":"CDHO","./recommenderSummary":"hrya"}],"CiZM":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ensureColumnsExist = ensureColumnsExist;
exports.ensureColumnsPopulated = ensureColumnsPopulated;

var _chartRecommender = require("@msrvida/chart-recommender");

var _sanddanceReact = require("@msrvida/sanddance-react");

var _language = require("./language");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function ensureColumnsExist(insightColumns, actualColumns, transform) {
  //ensure columns exist
  for (let role in insightColumns) {
    let columnName = insightColumns[role];
    let column = actualColumns.filter(c => c.name === columnName)[0];
    let transformColumn = transform ? transform.filter(t => {
      switch (t.type) {
        case 'formula':
          {
            return t.as === columnName;
          }
      }
    })[0] : null;

    if (!(column || transformColumn)) {
      delete insightColumns[role];
    }
  }
}

function ensureColumnsPopulated(chart, insightColumns, actualColumns) {
  //ensure columns are populated
  const firstColumn = actualColumns.filter(c => !_sanddanceReact.SandDance.util.isInternalFieldName(c.name))[0];
  const firstColumnName = firstColumn && firstColumn.name;

  const ensureColumn = role => {
    if (!insightColumns[role]) {
      insightColumns[role] = firstColumnName;
    }
  };

  switch (chart) {
    case 'barchart':
    case 'barchartV':
      ensureColumn('x');
      break;

    case 'barchartH':
      ensureColumn('y');
      break;

    case 'density':
    case 'scatterplot':
    case 'stacks':
      ensureColumn('x');
      ensureColumn('y');
      break;

    case 'treemap':
      if (!insightColumns.size) {
        insightColumns.size = (0, _chartRecommender.preferredColumnForTreemapSize)(actualColumns, true);

        if (!insightColumns.size) {
          insightColumns.size = (0, _chartRecommender.preferredColumnForTreemapSize)(actualColumns, false);
        }
      }

      if (!insightColumns.size) {
        //error - no numeric column
        return [_language.strings.errorColumnMustBeNumeric];
      }

      break;
  }
}
},{"@msrvida/chart-recommender":"CmqI","@msrvida/sanddance-react":"miZu","./language":"Zz8c"}],"j8xV":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getPosition = getPosition;

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function hasClientXY(e) {
  if (e && e.clientX !== undefined && e.clientX !== undefined) {
    return {
      top: e.clientY,
      left: e.clientX
    };
  }
}

function getPosition(e) {
  let xy = hasClientXY(e);

  if (xy) {
    return xy;
  }

  const te = e;

  if (te) {
    for (let i = 0; i < te.touches.length; i++) {
      let xy = hasClientXY(te.touches[i]);

      if (xy) {
        return xy;
      }
    }
  }
}
},{}],"jGjD":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getValidOperators = getValidOperators;
exports.getText = getText;
exports.SearchTerm = SearchTerm;
exports.maxAutocomplete = void 0;

var React = _interopRequireWildcard(require("react"));

var _base = require("../base");

var _dropdown = require("./dropdown");

var _language = require("../language");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const maxAutocomplete = 100;
exports.maxAutocomplete = maxAutocomplete;

function getValidOperators(column) {
  const type = column && column.type;

  switch (type) {
    case 'boolean':
      return [['==', _language.strings.searchEQ], ['!=', _language.strings.searchNEQ], ['isnullorEmpty', _language.strings.searchNULL]];

    case 'date':
    case 'integer':
    case 'number':
      return [['==', _language.strings.searchEQ], ['!=', _language.strings.searchNEQ], ['>', _language.strings.searchGT], ['>=', _language.strings.searchGTE], ['<', _language.strings.searchLT], ['<=', _language.strings.searchLTE], ['isnullorEmpty', _language.strings.searchNULL]];

    case 'string':
    default:
      return [['==', _language.strings.searchEQ], ['!=', _language.strings.searchNEQ], ['>', _language.strings.searchGT], ['>=', _language.strings.searchGTE], ['<', _language.strings.searchLT], ['<=', _language.strings.searchLTE], ['contains', _language.strings.searchIN], ['starts', _language.strings.searchSW], ['isnullorEmpty', _language.strings.searchNULL]];
  }
}

function getExpressionClauses(currClause, disableOR) {
  const keys = [['&&', _language.strings.searchAND]];

  if (!disableOR) {
    keys.push(['||', _language.strings.searchOR]);
  }

  return keys.map((key, i) => {
    const [clause, text] = key;
    const selected = currClause == clause; //deliberate double equal 

    const option = {
      key: i,
      text,
      data: clause,
      selected
    };
    return option;
  });
}

function getOperators(ex, column) {
  let anySelected = false;
  const validOperators = getValidOperators(column);
  const options = validOperators.map(validoperator => {
    const [op, text] = validoperator;
    const selected = ex.operator === op;
    anySelected = anySelected || selected;
    const option = {
      key: op,
      text,
      data: op,
      selected
    };
    return option;
  });

  if (!anySelected) {
    options[0].selected = true;
  }

  return options;
}

function getDistinctValues(data, columnName) {
  const distinctMap = {};

  for (let i = 0; i < data.length; i++) {
    let row = data[i];
    let value = row[columnName];
    distinctMap[value] = true;
  }

  return Object.keys(distinctMap).sort();
}

function getValues(ex, column, data, autoCompleteDistinctValues) {
  const stats = column && column.stats;

  if (stats && stats.distinctValueCount < maxAutocomplete) {
    if (!autoCompleteDistinctValues[column.name]) {
      autoCompleteDistinctValues[column.name] = getDistinctValues(data, column.name);
    }

    return autoCompleteDistinctValues[column.name].map((v, i) => ({
      key: i,
      text: v
    }));
  }

  return [];
}

function getText(ex) {
  if (ex.operator === 'isnullorEmpty') return '';
  return typeof ex.value === 'string' ? ex.value : ex.value == null ? '' : ex.value.toString();
}

function SearchTerm(props) {
  const ex = props.searchExpression;
  const possibleValues = getValues(ex, props.column, props.data, props.autoCompleteDistinctValues); //TODO better date handling with calendar picker

  return React.createElement("div", null, props.index > 0 && React.createElement(_dropdown.Dropdown, {
    collapseLabel: props.collapseLabels,
    className: "search-field",
    label: _language.strings.labelSearchClause,
    dropdownWidth: 120,
    disabled: !ex.unlocked || props.disableOR,
    options: getExpressionClauses(ex.clause, props.disableOR),
    onChange: (e, o) => props.onUpdateExpression({
      clause: o.data
    }, props.index)
  }), React.createElement(_dropdown.Dropdown, {
    collapseLabel: props.collapseLabels,
    className: "search-field",
    label: _language.strings.labelSearchColumn,
    options: [{
      key: '',
      text: _language.strings.selectAny,
      data: null,
      selected: ex.name === null
    }].concat(props.columns.map((c, i) => ({
      key: c.name,
      text: c.name,
      data: c,
      selected: c.name === ex.name
    }))),
    onChange: (e, o) => props.onUpdateExpression({
      name: o.data && o.data.name || null
    }, props.index)
  }), React.createElement(_dropdown.Dropdown, {
    collapseLabel: props.collapseLabels,
    className: "search-field",
    label: _language.strings.labelSearchOperator,
    dropdownWidth: 120,
    options: getOperators(ex, props.column),
    onChange: (e, o) => props.onUpdateExpression({
      operator: o.data
    }, props.index)
  }), possibleValues.length > 0 && React.createElement(_base.base.fabric.ComboBox, {
    className: "search-field",
    label: props.collapseLabels ? null : _language.strings.labelSearchValue,
    placeholder: _language.strings.labelSearchValuePlaceholder,
    disabled: ex.operator === 'isnullorEmpty',
    dropdownWidth: _dropdown.dropdownWidth,
    allowFreeform: true,
    autoComplete: "on",
    errorMessage: ex.errorMessage,
    text: getText(ex),
    options: getValues(ex, props.column, props.data, props.autoCompleteDistinctValues),
    onChange: (e, o, i, value) => {
      if (o) {
        value = o.text;
      }

      props.onUpdateExpression({
        value
      }, props.index);
    }
  }), possibleValues.length === 0 && React.createElement(_base.base.fabric.TextField, {
    className: "search-field",
    label: props.collapseLabels ? null : _language.strings.labelSearchValue,
    placeholder: _language.strings.labelSearchValuePlaceholder,
    disabled: ex.operator === 'isnullorEmpty',
    errorMessage: ex.errorMessage,
    value: getText(ex),
    onChange: (e, v) => props.onUpdateExpression({
      value: v
    }, props.index)
  }));
}
},{"react":"mpTF","../base":"yK94","./dropdown":"xuEz","../language":"Zz8c"}],"RsgD":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Search = void 0;

var React = _interopRequireWildcard(require("react"));

var _searchTerm = require("../controls/searchTerm");

var _base = require("../base");

var _button = require("../controls/button");

var _dropdown = require("../controls/dropdown");

var _group = require("../controls/group");

var _sanddanceReact = require("@msrvida/sanddance-react");

var _language = require("../language");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const maxClauses = 5;

function getColumnWithName(columnName, columns) {
  for (var i = 0; i < columns.length; i++) {
    if (columns[i].name === columnName) return columns[i];
  }
}

function validateExpression(ex) {
  if (ex.operator === 'isnullorEmpty') {
    ex.errorMessage = null;
    return;
  }

  const s = (0, _searchTerm.getText)(ex);

  if (s.length === 0) {
    ex.errorMessage = _language.strings.labelRequired;
  } else {
    ex.errorMessage = null;
  }
}

function clearExpressionValidation(ex) {
  if (ex.operator === 'isnullorEmpty') {
    ex.errorMessage = null;
    return;
  }

  const s = (0, _searchTerm.getText)(ex);

  if (s.length !== 0) {
    ex.errorMessage = null;
  }
}

function getGroupClauses(currClause, index, disableGroupOR) {
  let keys;

  if (index === 0) {
    keys = [[null, _language.strings.searchWHERE]];
  } else {
    keys = [['&&', _language.strings.searchAND]];

    if (!disableGroupOR) {
      keys.push(['||', _language.strings.searchOR]);
    }
  }

  return keys.map((key, i) => {
    const [clause, text] = key;
    const selected = currClause == clause; //deliberate double equal 

    const option = {
      key: i,
      text,
      data: clause,
      selected
    };
    return option;
  });
}

class Search extends React.Component {
  constructor(props) {
    super(props);
    this.state = this.getInitialState(this.props);
  }

  getInitialState(props) {
    const initialState = {
      groups: props.initializer.search || [this.newGroup(0, null)],
      sortedColumns: [...props.initializer.columns].sort((a, b) => a.name.localeCompare(b.name)),
      initializer: props.initializer
    };
    initialState.groups.forEach(group => {
      group.expressions.forEach(ex => ex.unlocked = group.expressions.length <= 2);
    });
    return initialState;
  }

  componentDidUpdate() {
    if (!_sanddanceReact.util.deepCompare(this.props.initializer, this.state.initializer)) {
      this.setState(this.getInitialState(this.props));
    }
  }

  validateAndSearch() {
    const groups = [...this.state.groups];
    groups.forEach(group => {
      group.expressions.forEach(validateExpression);
      const errors = group.expressions.reduce((p, c) => p || c.errorMessage, '');

      if (errors) {
        this.setState({
          groups
        });
      } else {
        this.props.onSelect(this.state.groups);
      }
    });
  }

  newGroup(key, clause) {
    const group = {
      key,
      clause,
      expressions: [this.newExpression(0, null)]
    };
    return group;
  }

  updateGroup(partialGroup, groupIndex) {
    const groups = [...this.state.groups];
    const group = Object.assign(Object.assign({}, groups[groupIndex]), partialGroup);
    groups[groupIndex] = group;
    this.setState({
      groups
    });
  }

  addGroup() {
    const groups = [...this.state.groups];
    const maxKey = groups.reduce((max, p) => p.key > max ? p.key : max, groups[0].key);
    const newGroup = this.newGroup(maxKey + 1, '&&');
    groups.push(newGroup);
    this.setState({
      groups
    });
  }

  deleteGroup(groupIndex) {
    const groups = [...this.state.groups];
    groups.splice(groupIndex, 1);
    this.setState({
      groups
    });
  }

  newExpression(key, clause) {
    const ex = {
      key,
      clause,
      name: null,
      operator: 'contains',
      value: ''
    };
    return ex;
  }

  addExpression(groupIndex) {
    const groups = [...this.state.groups];
    const group = groups[groupIndex];
    const maxKey = group.expressions.reduce((max, p) => p.key > max ? p.key : max, group.expressions[0].key);
    const newEx = this.newExpression(maxKey + 1, '&&');
    group.expressions.push(newEx);

    if (group.expressions.length === 2) {
      newEx.unlocked = true;
    } else {
      group.expressions.forEach(ex => ex.unlocked = false);
      newEx.clause = group.expressions[1].clause;
    }

    this.setState({
      groups
    });
  }

  updateExpression(partialEx, groupIndex, index) {
    const groups = [...this.state.groups];
    const group = groups[groupIndex];

    const ex = _sanddanceReact.SandDance.VegaDeckGl.util.clone(group.expressions[index]);

    if (ex.name !== partialEx.name) {
      //choose an appropriate operator when switching data type
      const oldColumn = getColumnWithName(ex.name, this.state.sortedColumns);
      const newColumn = getColumnWithName(partialEx.name, this.state.sortedColumns);
      const oldType = oldColumn && oldColumn.type;
      const newType = newColumn && newColumn.type;

      if (oldType !== newType) {
        const newOperators = (0, _searchTerm.getValidOperators)(newColumn).map(validOperator => validOperator[0]); //see if old operator is compatible

        if (newOperators.indexOf(ex.operator) < 0) {
          //not compatible, so choose "equal"
          partialEx.operator = '==';
        }
      }
    }

    Object.assign(ex, partialEx);
    clearExpressionValidation(ex);
    group.expressions[index] = ex;
    this.setState({
      groups
    });
  }

  deleteExpression(groupIndex, index) {
    const groups = [...this.state.groups];
    const group = groups[groupIndex];
    const expressions = [...group.expressions];
    expressions.splice(index, 1);

    if (expressions.length === 2) {
      expressions[1].unlocked = true;
    }

    group.expressions = expressions;
    this.setState({
      groups
    });
  }

  render() {
    return React.createElement(_group.Group, {
      className: "sanddance-search",
      label: _language.strings.labelSearch
    }, React.createElement("div", null, this.state.groups.map((group, groupIndex) => React.createElement("div", {
      className: "sanddance-search-group",
      key: group.key
    }, React.createElement(_dropdown.Dropdown, {
      collapseLabel: this.props.collapseLabels,
      className: "search-group-clause",
      label: _language.strings.labelSearchClause,
      disabled: groupIndex === 0 || this.props.disableGroupOR,
      dropdownWidth: 120,
      options: getGroupClauses(group.clause, groupIndex, this.props.disableGroupOR),
      onChange: (e, o) => this.updateGroup({
        clause: o.data
      }, groupIndex)
    }), React.createElement("div", null, group.expressions.map((ex, i) => React.createElement("div", {
      className: "sanddance-search-expression",
      key: ex.key
    }, React.createElement(_searchTerm.SearchTerm, {
      collapseLabels: this.props.collapseLabels,
      onUpdateExpression: (ex, i) => this.updateExpression(ex, groupIndex, i),
      autoCompleteDistinctValues: this.props.autoCompleteDistinctValues,
      index: i,
      columns: this.state.sortedColumns,
      data: this.props.data,
      searchExpression: ex,
      disableOR: this.props.disableExpressionOR,
      column: getColumnWithName(ex.name, this.state.sortedColumns)
    }), group.expressions.length > 1 && React.createElement(_button.Button, {
      themePalette: this.props.themePalette,
      className: "search-action",
      iconName: "Cancel",
      onClick: () => this.deleteExpression(groupIndex, i),
      text: _language.strings.buttonDeleteExpression
    })))), group.expressions.length < maxClauses && React.createElement("div", null, React.createElement(_button.Button, {
      themePalette: this.props.themePalette,
      className: "search-action",
      iconName: "Add",
      onClick: () => this.addExpression(groupIndex),
      text: _language.strings.buttonAddExpression
    })), this.state.groups.length > 1 && React.createElement(_button.Button, {
      themePalette: this.props.themePalette,
      className: "search-action",
      iconName: "Cancel",
      onClick: () => this.deleteGroup(groupIndex),
      text: _language.strings.buttonDeleteExpressionGroup
    }))), this.state.groups.length < maxClauses && React.createElement("div", null, React.createElement(_button.Button, {
      themePalette: this.props.themePalette,
      className: "search-action search-bottom-action",
      iconName: "Add",
      onClick: () => this.addGroup(),
      text: _language.strings.buttonAddExpressionGroup
    }))), React.createElement(_base.base.fabric.PrimaryButton, {
      className: "search-action search-bottom-action",
      text: _language.strings.buttonSelect,
      onClick: () => this.validateAndSearch()
    }));
  }

}

exports.Search = Search;
},{"react":"mpTF","../controls/searchTerm":"jGjD","../base":"yK94","../controls/button":"Y7Nu","../controls/dropdown":"xuEz","../controls/group":"gj41","@msrvida/sanddance-react":"miZu","../language":"Zz8c"}],"sKvG":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.loadDataArray = exports.loadDataFile = void 0;

var _sanddanceReact = require("@msrvida/sanddance-react");

const loadDataFile = dataFile => new Promise((resolve, reject) => {
  const vega = _sanddanceReact.SandDance.VegaDeckGl.base.vega;
  const loader = vega.loader();

  function handleRawText(text) {
    let data;

    try {
      data = vega.read(text, {
        type: dataFile.type,
        parse: {}
      });
    } catch (e) {
      reject(e);
    }

    if (data) {
      loadDataArray(data, dataFile.type).then(dc => {
        if (dataFile.snapshotsUrl) {
          fetch(dataFile.snapshotsUrl).then(response => response.json()).then(snapshots => {
            dc.snapshots = snapshots;
            resolve(dc);
          }).catch(reject);
        } else if (dataFile.snapshots) {
          dc.snapshots = dataFile.snapshots;
          resolve(dc);
        } else {
          resolve(dc);
        }
      }).catch(reject);
    }
  }

  if (dataFile.dataUrl) {
    loader.load(dataFile.dataUrl).then(handleRawText).catch(reject);
  } else if (dataFile.rawText) {
    handleRawText(dataFile.rawText);
  } else {
    reject('dataFile object must have either dataUrl or rawText property set.');
  }
});

exports.loadDataFile = loadDataFile;

const loadDataArray = (data, type) => new Promise((resolve, reject) => {
  const parse = type === 'csv' || type === 'tsv';

  if (parse) {
    //convert empty strings to null so that vega.inferType will get dates
    data.forEach(row => {
      for (let column in row) {
        if (row[column] === '') {
          row[column] = null;
        }
      }
    });
  }

  const columns = _sanddanceReact.SandDance.util.getColumnsFromData(data).sort((a, b) => a.name.localeCompare(b.name));

  if (parse) {
    const booleanColumns = columns.filter(c => c.type === 'boolean');
    const dateColumns = columns.filter(c => c.type === 'date');
    const numericColumns = columns.filter(c => c.type === 'integer' || c.type === 'number');
    data.forEach(obj => {
      booleanColumns.forEach(c => {
        obj[c.name] = ('' + obj[c.name]).toLowerCase() === 'true';
      });
      dateColumns.forEach(c => {
        const input = obj[c.name];

        if (input !== null) {
          const d = new Date(input);
          d.input = input;
          obj[c.name] = d;
        }
      });
      numericColumns.forEach(c => {
        const n = parseFloat(obj[c.name]);
        obj[c.name] = isNaN(n) ? null : n;
      });
    });
  }

  resolve({
    data,
    columns
  });
});

exports.loadDataArray = loadDataArray;
},{"@msrvida/sanddance-react":"miZu"}],"RpYO":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.onBeforeCreateLayers = onBeforeCreateLayers;
exports.PositionedColumnMap = void 0;

var React = _interopRequireWildcard(require("react"));

var _columnMap = require("./controls/columnMap");

var _sanddanceReact = require("@msrvida/sanddance-react");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function onBeforeCreateLayers(stage, specCapabilities) {
  for (let axisName in stage.axes) {
    specCapabilities.roles.forEach(specRole => {
      if (specRole.role === axisName) {
        let axes = stage.axes[axisName];
        axes.forEach(axis => {
          if (axis.title) {
            const textItem = axis.title;
            textItem.specRole = specRole;
          }
        });
      }
    });
  }
}

function px(n) {
  return n + 'px';
}

class PositionedColumnMap extends React.Component {
  constructor(props) {
    super(props);
    const {
      left,
      top
    } = props;
    this.state = {
      left,
      top
    };
    this.dropdownRef = React.createRef();
  }

  focus() {
    if (!this.focused) {
      this.focused = true;
      this.dropdownRef.current.focus(true);
    }
  }

  componentDidMount() {
    const size = _sanddanceReact.SandDance.VegaDeckGl.util.outerSize(this.div);

    const over = {
      left: Math.max(0, this.state.left + size.width - this.props.container.offsetWidth),
      top: Math.max(0, this.state.top + size.height - this.props.container.offsetHeight)
    };

    if (over.left || over.top) {
      let {
        left,
        top
      } = this.state;
      left -= over.left;
      top -= over.top;
      this.setState({
        left,
        top
      });
    } else {
      this.focus();
    }
  }

  componentDidUpdate() {
    this.focus();
  }

  render() {
    return React.createElement("div", {
      ref: div => {
        if (div) this.div = div;
      },
      className: "sanddance-columnMap-absolute",
      style: {
        position: 'absolute',
        left: px(this.state.left),
        top: px(this.state.top)
      }
    }, React.createElement(_columnMap.ColumnMap, Object.assign({}, this.props, {
      componentRef: this.dropdownRef,
      hideSignals: true
    })));
  }

}

exports.PositionedColumnMap = PositionedColumnMap;
},{"react":"mpTF","./controls/columnMap":"uNUJ","@msrvida/sanddance-react":"miZu"}],"GBPQ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.version = void 0;
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const version = '2.2.2';
exports.version = version;
},{}],"d6VM":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Settings = void 0;

var React = _interopRequireWildcard(require("react"));

var SandDanceReact = _interopRequireWildcard(require("@msrvida/sanddance-react"));

var _base = require("../base");

var _canvas = require("../canvas");

var _dialog = require("../controls/dialog");

var _dropdown = require("../controls/dropdown");

var _group = require("../controls/group");

var _signal = require("../controls/signal");

var _language = require("../language");

var _version = require("../version");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
var SandDance = SandDanceReact.SandDance;
var DataRefType;

(function (DataRefType) {
  DataRefType[DataRefType["none"] = 0] = "none";
  DataRefType[DataRefType["inline"] = 1] = "inline";
  DataRefType[DataRefType["url"] = 2] = "url";
})(DataRefType || (DataRefType = {}));

function filterSignals(signal) {
  switch (signal.name) {
    case SandDance.constants.SignalNames.XBins:
    case SandDance.constants.SignalNames.YBins:
    case SandDance.constants.SignalNames.ColorBinCount:
    case SandDance.constants.SignalNames.ColorReverse:
    case SandDance.constants.SignalNames.PointSize:
    case SandDance.constants.SignalNames.TreeMapMethod:
      return false;

    default:
      return !!signal.bind;
  }
}

function cloneData(vegaSpec) {
  const data0 = vegaSpec.data[0];
  const valuesData = data0;
  const values = valuesData.values;
  delete valuesData.values;
  const data = SandDance.VegaDeckGl.util.clone(vegaSpec.data);
  valuesData.values = values;
  return {
    data,
    values
  };
}

function cloneScales(vegaSpec) {
  return SandDance.VegaDeckGl.util.clone(vegaSpec.scales);
}

function serializeSpec(vegaSpec, datafile, dataRefType, transform, scheme) {
  const scales = cloneScales(vegaSpec);
  const colorScale = scales.filter(scale => scale.name === SandDance.constants.ScaleNames.Color)[0];

  if (scheme.indexOf('dual_') >= 0) {
    colorScale.range = SandDance.colorSchemes.filter(cs => cs.scheme === scheme)[0].colors;
  }

  const clone = cloneData(vegaSpec);
  const data0 = clone.data[0];

  if (dataRefType === DataRefType.inline) {
    const valuesData = data0;
    valuesData.format = {
      parse: 'auto',
      type: 'json'
    };
    valuesData.values = clone.values;
  } else if (dataRefType === DataRefType.none) {
    const valuesData = data0;
    valuesData.values = [];

    if (transform) {
      if (valuesData.transform) {
        valuesData.transform.push.apply(valuesData.transform, transform);
      } else {
        valuesData.transform = transform;
      }
    }
  } else if (dataRefType === DataRefType.url) {
    const urlData = data0;
    urlData.url = datafile.dataUrl;
    urlData.format = {
      parse: 'auto',
      type: datafile.type
    };

    if (transform) {
      if (urlData.transform) {
        urlData.transform.push.apply(urlData.transform, transform);
      } else {
        urlData.transform = transform;
      }
    }
  }

  return Object.assign(Object.assign({}, vegaSpec), {
    data: clone.data,
    scales
  });
}

function defaultDataRefType(datafile) {
  if (datafile.dataUrl) {
    return DataRefType.url;
  }

  return DataRefType.none;
}

function initState(props) {
  return {
    showSystemDialog: false,
    showVegaDialog: false,
    dataRefType: defaultDataRefType(props.dataFile),
    spec: null
  };
}

function signalGroupKey(key) {
  for (let i = 0; i < _language.strings.signalGroups.length; i++) {
    if (_language.strings.signalGroups[i].prefix === key) {
      return key;
    }
  }

  return '*';
}

function vegaSignalGroups(vegaSignals) {
  const signalGroupMap = {};
  vegaSignals.forEach(vs => {
    const split = vs.name.split('_');
    const key = signalGroupKey(split[0]);
    signalGroupMap[key] = signalGroupMap[key] || [];
    signalGroupMap[key].push(vs);
  });
  return signalGroupMap;
}

class Settings extends React.Component {
  constructor(props) {
    super(props);
    this.state = initState(props);
  }

  render() {
    const {
      props,
      state
    } = this;
    if (!props.explorer.viewer || !props.explorer.viewer.vegaSpec) return null;
    const options = [{
      key: DataRefType.none,
      text: _language.strings.selectVegaSpecDataNone,
      selected: this.state.dataRefType === DataRefType.none,
      data: DataRefType.none
    }, !props.dataFile.rawText && {
      key: DataRefType.url,
      text: _language.strings.selectVegaSpecDataUrl,
      selected: this.state.dataRefType === DataRefType.url,
      data: DataRefType.url
    }, {
      key: DataRefType.inline,
      text: _language.strings.selectVegaSpecDataInline,
      selected: this.state.dataRefType === DataRefType.inline,
      data: DataRefType.inline
    }].filter(Boolean);
    const signalGroupMap = vegaSignalGroups(props.explorer.viewer.vegaSpec.signals);
    return React.createElement("div", null, _language.strings.signalGroups.map(sg => {
      const vegaSignals = signalGroupMap[sg.prefix];

      if (vegaSignals) {
        const filteredVegaSignals = vegaSignals.filter(filterSignals);

        if (filteredVegaSignals.length > 0) {
          return React.createElement(_group.Group, {
            key: sg.prefix,
            label: sg.label
          }, filteredVegaSignals.map((signal, i) => React.createElement(_signal.Signal, {
            key: i,
            signal: signal,
            explorer: props.explorer
          })));
        }
      }
    }), React.createElement(_group.Group, {
      label: _language.strings.labelChartCanvas
    }, React.createElement(_base.base.fabric.Toggle, {
      label: _language.strings.labelShowAxes,
      defaultChecked: !props.hideAxes,
      onChange: (e, checked) => props.onToggleAxes(!checked)
    }), React.createElement(_base.base.fabric.Toggle, {
      label: _language.strings.labelShowLegend,
      defaultChecked: !props.hideLegend,
      onChange: (e, checked) => props.onToggleLegend(!checked)
    })), React.createElement(_group.Group, {
      label: _language.strings.labelTools
    }, React.createElement(_base.base.fabric.DefaultButton, {
      text: _language.strings.buttonShowVegaSpec,
      onClick: () => this.setState({
        showVegaDialog: true,
        spec: serializeSpec(props.explorer.viewer.vegaSpec, props.dataFile, this.state.dataRefType, props.explorer.viewer.getInsight().transform, this.props.scheme)
      })
    })), React.createElement(_group.Group, {
      label: _language.strings.labelSnapshots
    }, React.createElement(_base.base.fabric.Slider, {
      label: _language.strings.labelSnapshotSettingThumbnailWidth,
      onChange: value => {
        this.props.explorer.snapshotThumbWidth = value;
      },
      min: 100,
      max: 800,
      defaultValue: this.props.explorer.snapshotThumbWidth
    })), React.createElement(_group.Group, {
      label: _language.strings.labelTransitionDurations
    }, React.createElement(_base.base.fabric.Slider, {
      label: _language.strings.labelTransitionColor,
      onChange: value => {
        this.props.explorer.viewerOptions.transitionDurations.color = value;
      },
      min: 0,
      max: 10000,
      defaultValue: this.props.explorer.viewerOptions.transitionDurations.color
    }), React.createElement(_base.base.fabric.Slider, {
      label: _language.strings.labelTransitionPosition,
      onChange: value => {
        this.props.explorer.viewerOptions.transitionDurations.position = value;
      },
      min: 0,
      max: 10000,
      defaultValue: this.props.explorer.viewerOptions.transitionDurations.position
    }), React.createElement(_base.base.fabric.Slider, {
      label: _language.strings.labelTransitionSize,
      onChange: value => {
        this.props.explorer.viewerOptions.transitionDurations.size = value;
      },
      min: 0,
      max: 10000,
      defaultValue: this.props.explorer.viewerOptions.transitionDurations.size
    }), React.createElement(_base.base.fabric.Slider, {
      label: _language.strings.labelTransitionCamera,
      onChange: value => {
        this.props.explorer.viewerOptions.transitionDurations.view = value;
      },
      min: 0,
      max: 10000,
      defaultValue: this.props.explorer.viewerOptions.transitionDurations.view
    })), props.additionalSettings && props.additionalSettings.map((g, i) => React.createElement(_group.Group, {
      key: i,
      label: g.groupLabel
    }, g.children)), React.createElement(_group.Group, {
      label: _language.strings.labelSystem
    }, React.createElement(_base.base.fabric.DefaultButton, {
      text: _language.strings.labelSystemInfo,
      onClick: () => this.setState({
        showSystemDialog: true
      })
    })), React.createElement(_dialog.Dialog, {
      hidden: !state.showVegaDialog,
      onDismiss: () => this.setState(initState(this.props)),
      minWidth: "80%",
      title: _language.strings.labelVegaSpec,
      buttons: [React.createElement(_base.base.fabric.PrimaryButton, {
        key: "copy",
        iconProps: {
          iconName: 'Copy'
        },
        text: _language.strings.buttonCopyToClipboard,
        onClick: () => {
          var pre = document.getElementById('sanddance-vega-spec');
          var range = document.createRange();
          range.selectNode(pre);
          const selection = window.getSelection();
          selection.removeAllRanges();
          selection.addRange(range);
          document.execCommand('copy');
        }
      }), React.createElement(_base.base.fabric.DefaultButton, {
        key: "edit",
        iconProps: {
          iconName: 'OpenInNewWindow'
        },
        text: _language.strings.buttonLaunchVegaEditor,
        onClick: () => {
          window.open('https://vega.github.io/editor/', '_blank');
        }
      })]
    }, React.createElement(_dropdown.Dropdown, {
      label: _language.strings.labelVegaSpecData,
      options: options,
      onChange: (e, o) => this.setState({
        dataRefType: o.data,
        spec: serializeSpec(props.explorer.viewer.vegaSpec, props.dataFile, o.data, props.explorer.viewer.getInsight().transform, this.props.scheme)
      })
    }), React.createElement("pre", {
      id: "sanddance-vega-spec"
    }, JSON.stringify(this.state.spec, null, 2)), React.createElement("div", null, _language.strings.labelVegaSpecNotes)), React.createElement(_dialog.Dialog, {
      hidden: !state.showSystemDialog,
      onDismiss: () => this.setState(initState(this.props)),
      title: _language.strings.labelSystemInfo
    }, React.createElement("ul", null, this.props.children, React.createElement("li", null, "SandDanceExplorer version: ", _version.version), React.createElement("li", null, "SandDanceReact version: ", SandDanceReact.version), React.createElement("li", null, "SandDance version: ", SandDance.version), React.createElement("li", null, "WebGL enabled: ", _canvas.capabilities.webgl ? _language.strings.labelYes : _language.strings.labelNo), React.createElement("li", null, "WebGL2 enabled: ", _canvas.capabilities.webgl2 ? _language.strings.labelYes : _language.strings.labelNo))));
  }

}

exports.Settings = Settings;
},{"react":"mpTF","@msrvida/sanddance-react":"miZu","../base":"yK94","../canvas":"PlI7","../controls/dialog":"ajeQ","../controls/dropdown":"xuEz","../controls/group":"gj41","../controls/signal":"KVvK","../language":"Zz8c","../version":"GBPQ"}],"qTvm":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Scrollable = Scrollable;

var React = _interopRequireWildcard(require("react"));

var _sanddanceReact = require("@msrvida/sanddance-react");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function Scrollable(props) {
  return React.createElement("div", {
    className: _sanddanceReact.util.classList('scrollable-container', props.className),
    role: props.role
  }, React.createElement("div", {
    className: "scrollable"
  }, props.children));
}
},{"react":"mpTF","@msrvida/sanddance-react":"miZu"}],"BOsx":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Sidebar = Sidebar;
exports.Sidebutton = Sidebutton;

var React = _interopRequireWildcard(require("react"));

var _base = require("../base");

var _dataScope = require("./dataScope");

var _iconButton = require("./iconButton");

var _scrollable = require("./scrollable");

var _interfaces = require("../interfaces");

var _language = require("../language");

var _sanddanceReact = require("@msrvida/sanddance-react");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function Sidebar(props) {
  const sidebuttons = [{
    sideTabId: _interfaces.SideTabId.ChartType,
    iconName: 'BIDashboard',
    title: _language.strings.labelChart
  }, {
    sideTabId: _interfaces.SideTabId.Color,
    iconName: 'Color',
    title: _language.strings.labelColor
  }, {
    sideTabId: _interfaces.SideTabId.Data,
    iconName: 'Table',
    title: _language.strings.labelDataBrowser
  }, {
    sideTabId: _interfaces.SideTabId.Search,
    iconName: 'Search',
    title: _language.strings.labelSearch
  }, {
    sideTabId: _interfaces.SideTabId.Snapshots,
    iconName: 'Camera',
    title: _language.strings.labelSnapshots
  }, {
    sideTabId: _interfaces.SideTabId.Settings,
    iconName: 'Settings',
    title: _language.strings.labelChartSettings
  }];
  return React.createElement("div", {
    className: _sanddanceReact.util.classList('sanddance-sidebar', 'calculator', props.pinned && 'pinned', props.closed && 'closed')
  }, React.createElement("div", {
    className: "sidebar-content"
  }, React.createElement(_dataScope.DataScope, Object.assign({}, props.dataScopeProps)), React.createElement("div", {
    className: "vbuttons",
    role: 'tablist'
  }, React.createElement("div", {
    className: "sidebar-dialogs"
  }, sidebuttons.map((sidebutton, i) => React.createElement(Sidebutton, Object.assign({
    key: i
  }, props, sidebutton, {
    themePalette: props.themePalette
  })))), !props.hideSidebarControls && React.createElement("div", {
    className: "sidebar-controls"
  }, React.createElement(Sidebutton, Object.assign({}, props, {
    sideTabId: _interfaces.SideTabId.Pin,
    iconName: props.pinned ? 'Pinned' : 'Pin',
    title: props.pinned ? _language.strings.buttonToolbarFloat : _language.strings.buttonToolbarDock
  })), React.createElement(Sidebutton, Object.assign({}, props, {
    sideTabId: _interfaces.SideTabId.Collapse,
    iconName: props.closed ? 'DoubleChevronRight12' : 'DoubleChevronLeft12',
    title: props.closed ? _language.strings.buttonToolbarShow : _language.strings.buttonToolbarHide
  })))), React.createElement(_scrollable.Scrollable, {
    role: 'tabpanel'
  }, React.createElement("div", {
    className: "sidetab"
  }, props.children)), props.calculating && React.createElement("div", {
    className: "calculating"
  }, React.createElement(_base.base.fabric.Spinner, {
    size: _base.base.fabric.SpinnerSize.large
  }))));
}

function Sidebutton(props) {
  const selected = !props.closed && props.selectedSideTab === props.sideTabId;
  return React.createElement("div", {
    className: _sanddanceReact.util.classList('vbutton', selected && 'selected'),
    role: 'tab',
    "aria-selected": selected
  }, props.badgeText && React.createElement("div", {
    className: "count"
  }, props.badgeText), React.createElement(_iconButton.IconButton, {
    themePalette: props.themePalette,
    className: "vbutton",
    iconName: props.iconName,
    title: props.title,
    onClick: () => {
      props.onSideTabClick(props.sideTabId);
    }
  }));
}
},{"react":"mpTF","../base":"yK94","./dataScope":"PlDJ","./iconButton":"tNGe","./scrollable":"qTvm","../interfaces":"Eyva","../language":"Zz8c","@msrvida/sanddance-react":"miZu"}],"GbMR":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.SnapshotEditor = void 0;

var React = _interopRequireWildcard(require("react"));

var _base = require("../base");

var _dialog = require("../controls/dialog");

var _canvas = require("../canvas");

var _sanddanceReact = require("@msrvida/sanddance-react");

var _language = require("../language");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
class SnapshotEditor extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      showEditFormDialog: false,
      title: '',
      description: '',
      image: null,
      bgColor: null,
      insight: null,
      editIndex: -1
    };
  }

  resize(src, thumbWidth) {
    if (!src) return;
    var img = new Image();

    img.onload = () => {
      var canvas = document.createElement('canvas'),
          ctx = canvas.getContext('2d');
      const ratio = img.width / thumbWidth;
      canvas.height = img.height / ratio;
      canvas.width = thumbWidth;
      ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
      const image = canvas.toDataURL();
      this.setState({
        image
      });
    };

    img.src = src;
  }

  editSnapshot(snapshot, editIndex = -1) {
    if (snapshot) {
      this.setState(Object.assign(Object.assign({
        showEditFormDialog: true
      }, snapshot), {
        editIndex
      }));
    } else {
      this.props.explorer.viewer.deselect().then(() => {
        const canvas = (0, _canvas.getCanvas)(this.props.explorer.viewer);
        const bgColor = canvas && window.getComputedStyle(canvas).backgroundColor;

        const insight = _sanddanceReact.SandDance.VegaDeckGl.util.clone(this.props.explorer.viewer.getInsight());

        delete insight.size;
        const title = this.props.getTitle && this.props.getTitle(insight) || '';
        const description = this.props.getDescription && this.props.getDescription(insight) || '';
        this.setState({
          showEditFormDialog: true,
          bgColor,
          title,
          description,
          insight,
          image: null,
          editIndex
        }); //allow deselection to render

        setTimeout(() => {
          this.resize(canvas && canvas.toDataURL('image/png'), this.props.explorer.snapshotThumbWidth);
        }, 500);
      });
    }
  }

  render() {
    return React.createElement(_dialog.Dialog, {
      modalProps: {
        className: _sanddanceReact.util.classList('sanddance-snapshot-dialog', this.props.explorer.props.theme)
      },
      minWidth: `${this.props.explorer.snapshotThumbWidth + 64}px`,
      hidden: !this.state.showEditFormDialog,
      onDismiss: () => this.setState({
        showEditFormDialog: false
      }),
      title: this.state.editIndex >= 0 ? _language.strings.buttonEditSnapshot : _language.strings.buttonCreateSnapshot,
      buttons: React.createElement(_base.base.fabric.PrimaryButton, {
        disabled: !this.state.image || !this.state.title,
        key: 0,
        onClick: e => {
          const snapshot = {
            title: this.state.title,
            description: this.state.description,
            insight: this.state.insight,
            image: this.state.image,
            bgColor: this.state.bgColor
          };
          this.props.modifySnapShot && this.props.modifySnapShot(snapshot);
          this.props.onWriteSnapshot(snapshot, this.state.editIndex);
          this.setState({
            showEditFormDialog: false,
            title: '',
            description: '',
            image: null
          });
        },
        text: this.state.editIndex >= 0 ? _language.strings.buttonUpdateSnapshot : _language.strings.buttonCreateSnapshot
      })
    }, React.createElement(_base.base.fabric.TextField, {
      label: _language.strings.labelSnapshotTitle,
      onChange: (e, title) => this.setState({
        title
      }),
      value: this.state.title
    }), React.createElement(_base.base.fabric.TextField, {
      label: _language.strings.labelSnapshotDescription,
      onChange: (e, description) => this.setState({
        description
      }),
      value: this.state.description,
      multiline: true
    }), React.createElement("div", {
      className: 'thumbnail'
    }, !this.state.image && React.createElement(_base.base.fabric.Spinner, null), this.state.image && React.createElement("img", {
      src: this.state.image,
      style: {
        backgroundColor: this.state.bgColor
      }
    })), this.props.explorer.viewer && this.props.explorer.viewer.colorContexts && this.props.explorer.viewer.colorContexts.length > 1 && React.createElement("div", null, _language.strings.labelColorFilter));
  }

}

exports.SnapshotEditor = SnapshotEditor;
},{"react":"mpTF","../base":"yK94","../controls/dialog":"ajeQ","../canvas":"PlI7","@msrvida/sanddance-react":"miZu","../language":"Zz8c"}],"semr":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Snapshots = void 0;

var React = _interopRequireWildcard(require("react"));

var _base = require("../base");

var _dialog = require("../controls/dialog");

var _group = require("../controls/group");

var _iconButton = require("../controls/iconButton");

var _sanddanceReact = require("@msrvida/sanddance-react");

var _language = require("../language");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
class Snapshots extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      confirmation: null,
      title: '',
      description: '',
      image: null,
      bgColor: null,
      insight: null
    };
  }

  render() {
    const items = [{
      key: 'clear',
      text: _language.strings.buttonClearSnapshots,
      onClick: () => this.setState({
        confirmation: {
          buttonText: _language.strings.buttonClearSnapshots,
          handler: () => this.props.onClearSnapshots()
        }
      }),
      disabled: this.props.snapshots.length === 0
    }];

    if (this.props.getTopActions) {
      items.push.apply(items, this.props.getTopActions(this.props.snapshots));
    }

    return React.createElement(_group.Group, {
      className: "sanddance-snapshots",
      label: _language.strings.labelSnapshots
    }, React.createElement("div", null, React.createElement(_base.base.fabric.PrimaryButton, {
      text: _language.strings.buttonCreateSnapshot,
      onClick: e => this.props.editor.editSnapshot(),
      split: true,
      menuProps: {
        items
      }
    }), this.props.getChildren && this.props.getChildren(this.props.snapshots), this.state.confirmation && React.createElement(_dialog.Dialog, {
      hidden: false,
      buttons: React.createElement(_base.base.fabric.PrimaryButton, {
        key: 0,
        onClick: e => {
          this.setState({
            confirmation: null
          });
          this.state.confirmation.handler();
        },
        text: this.state.confirmation.buttonText
      }),
      onDismiss: () => this.setState({
        confirmation: null
      })
    }, _language.strings.labelConfirmation), React.createElement("div", null, this.props.snapshots.map((snapshot, i) => {
      const actions = this.props.getActions && this.props.getActions(snapshot, i) || [];
      actions.push({
        iconButtonProps: {
          themePalette: this.props.themePalette,
          title: _language.strings.buttonEditSnapshot,
          onClick: e => this.props.editor.editSnapshot(snapshot, i),
          iconName: 'Edit'
        }
      });

      if (this.props.snapshots.length > 1) {
        actions.push({
          iconButtonProps: {
            disabled: i === 0,
            themePalette: this.props.themePalette,
            title: _language.strings.buttonMoveUp,
            onClick: e => this.props.onMoveUp(i),
            iconName: 'SortUp'
          }
        }, {
          iconButtonProps: {
            disabled: i > this.props.snapshots.length - 2,
            themePalette: this.props.themePalette,
            title: _language.strings.buttonMoveDown,
            onClick: e => this.props.onMoveDown(i),
            iconName: 'SortDown'
          }
        });
      }

      actions.push({
        iconButtonProps: {
          themePalette: this.props.themePalette,
          title: _language.strings.buttonDeleteSnapshot,
          onClick: () => this.setState({
            confirmation: {
              buttonText: _language.strings.buttonDeleteSnapshot,
              handler: () => this.props.onRemoveSnapshot(i)
            }
          }),
          iconName: 'Delete'
        }
      });
      return React.createElement("div", {
        key: i,
        className: _sanddanceReact.util.classList('snapshot', i === this.props.selectedSnapshotIndex && 'selected')
      }, React.createElement("div", {
        onClick: e => this.props.onSnapshotClick(snapshot, i)
      }, React.createElement("div", {
        className: 'title'
      }, snapshot.title), React.createElement("div", {
        className: 'thumbnail'
      }, React.createElement("img", {
        title: snapshot.description,
        src: snapshot.image,
        style: {
          backgroundColor: snapshot.bgColor
        }
      }))), React.createElement(Actions, {
        actions: actions,
        snapshot: snapshot
      }));
    }))));
  }

}

exports.Snapshots = Snapshots;

function Actions(props) {
  return React.createElement("div", {
    className: "actions"
  }, props.actions.map((action, i) => {
    if (action.iconButtonProps) {
      return React.createElement(_iconButton.IconButton, Object.assign({
        key: i
      }, action.iconButtonProps));
    }

    if (action.element) {
      return action.element;
    }
  }));
}
},{"react":"mpTF","../base":"yK94","../controls/dialog":"ajeQ","../controls/group":"gj41","../controls/iconButton":"tNGe","@msrvida/sanddance-react":"miZu","../language":"Zz8c"}],"appz":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.toggleSearch = toggleSearch;

var _sanddanceReact = require("@msrvida/sanddance-react");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function comparableGroup(group) {
  return Object.assign(Object.assign({}, group), {
    clause: null
  });
}

function compareGroup(a, b) {
  return _sanddanceReact.SandDance.searchExpression.compareGroup(comparableGroup(a), comparableGroup(b));
}

function toggleSearch(haystack, needle) {
  const groups = [];
  let found = false; //look for item in all

  haystack.forEach(group => {
    if (compareGroup(group, needle)) {
      //if it exists, don't add it
      found = true;
    } else {
      groups.push(group);
    }
  });
  return {
    groups,
    found
  };
}
},{"@msrvida/sanddance-react":"miZu"}],"El1r":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.CommandBarButtonStyles = void 0;

var _base = require("../base");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
//adapted from https://github.com/OfficeDev/office-ui-fabric-react/blob/master/packages/fluent-theme/src/fluent/styles/CommandBarButton.styles.ts
const CommandBarButtonStyles = props => {
  const {
    theme
  } = props;

  if (!theme) {
    throw new Error('Theme is undefined or null.');
  }

  const {
    palette,
    semanticColors
  } = theme;
  const BUTTON_ICON_CLASSNAME = '.ms-Button-icon';
  return {
    root: [Object.assign({}, _base.base.fabric.getFocusStyle(theme, {
      inset: 2
    })), {
      backgroundColor: palette.white
    }],
    rootHovered: {
      backgroundColor: palette.neutralLighter,
      selectors: {
        [BUTTON_ICON_CLASSNAME]: {
          color: palette.themeDarkAlt
        }
      }
    },
    rootPressed: {
      backgroundColor: palette.neutralLight,
      color: palette.neutralDark,
      selectors: {
        [BUTTON_ICON_CLASSNAME]: {
          color: palette.themeDark
        }
      }
    },
    rootChecked: {
      backgroundColor: palette.neutralLight,
      color: palette.neutralDark,
      selectors: {
        [BUTTON_ICON_CLASSNAME]: {
          color: palette.themeDark
        }
      }
    },
    rootCheckedHovered: {
      backgroundColor: palette.neutralQuaternaryAlt,
      color: palette.neutralDark
    },
    rootExpanded: {
      color: palette.neutralDark,
      backgroundColor: palette.neutralLight,
      selectors: {
        [BUTTON_ICON_CLASSNAME]: {
          color: palette.themeDark
        }
      }
    },
    rootExpandedHovered: {
      background: palette.neutralQuaternaryAlt
    },
    rootDisabled: {
      backgroundColor: palette.white,
      selectors: {
        [BUTTON_ICON_CLASSNAME]: {
          color: semanticColors.disabledBodySubtext
        }
      }
    },
    splitButtonMenuButton: {
      backgroundColor: palette.white,
      color: palette.neutralSecondary,
      selectors: {
        ':hover': {
          backgroundColor: palette.neutralLighter,
          selectors: {
            [BUTTON_ICON_CLASSNAME]: {
              color: palette.neutralPrimary
            }
          }
        },
        ':active': {
          backgroundColor: palette.neutralLight,
          selectors: {
            [BUTTON_ICON_CLASSNAME]: {
              color: palette.neutralPrimary
            }
          }
        }
      }
    },
    splitButtonMenuButtonDisabled: {
      backgroundColor: palette.white
    },
    icon: {
      color: palette.themePrimary
    }
  };
};

exports.CommandBarButtonStyles = CommandBarButtonStyles;
},{"../base":"yK94"}],"oSPh":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Logo = Logo;

var React = _interopRequireWildcard(require("react"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const s = `
 ......
.......
...
......
 ......
    ...
.......
......
`;
const d = s.split('\n').map((row, irow) => row.length ? row.split('').map((char, icol) => char.trim() ? `M${2 * icol + 1} ${2 * (irow - 1) + 1} v1 h1 v-1 Z` : '').join(' ') : '').join('\n');

function Logo() {
  return React.createElement("svg", {
    xmlns: "http://www.w3.org/2000/svg",
    viewBox: "0 0 16 16"
  }, React.createElement("path", {
    d: d
  }));
}
},{"react":"mpTF"}],"RkrT":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Topbar = Topbar;

var React = _interopRequireWildcard(require("react"));

var _base = require("../base");

var _CommandBarButton = require("./CommandBarButton.styles");

var _logo = require("./logo");

var _sanddanceReact = require("@msrvida/sanddance-react");

var _language = require("../language");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function Topbar(props) {
  const zeroResults = props.selectionState.selectedData && props.selectionState.selectedData.length === 0;
  const disabled = !props.loaded;
  const items = [{
    key: 'deselect',
    name: _language.strings.buttonDeselect,
    iconProps: {
      iconName: 'Cancel'
    },
    disabled: disabled || !props.selectionSearch,
    onClick: props.doDeselect
  }, {
    key: 'isolate',
    name: _language.strings.buttonIsolate,
    iconProps: {
      iconName: 'Filter'
    },
    disabled: disabled || !props.selectionSearch || zeroResults,
    onClick: () => props.doFilter(props.selectionSearch)
  }, {
    key: 'exclude',
    name: _language.strings.buttonExclude,
    iconProps: {
      iconName: 'ClearFilter'
    },
    disabled: disabled || !props.selectionSearch || zeroResults,
    onClick: () => props.doFilter(_sanddanceReact.SandDance.searchExpression.invert(props.selectionSearch))
  }, {
    key: 'reset',
    name: _language.strings.buttonReset,
    iconProps: {
      iconName: 'RemoveFilter'
    },
    disabled: disabled || !props.filter,
    onClick: props.doUnfilter
  }];

  if (props.buttons) {
    items.push.apply(items, props.buttons);
  }

  const farItems = [{
    key: 'previous-snapshot',
    iconProps: {
      iconName: 'Previous'
    },
    title: _language.strings.buttonPrevSnapshot,
    onClick: props.onSnapshotPreviousClick,
    disabled: props.snapshots.length < 2
  }, {
    key: 'snapshot',
    iconProps: {
      iconName: 'Camera'
    },
    title: _language.strings.buttonCreateSnapshot,
    onClick: props.onSnapshotClick,
    disabled: !props.loaded
  }, {
    key: 'next-snapshot',
    iconProps: {
      iconName: 'Next'
    },
    title: _language.strings.buttonNextSnapshot,
    onClick: props.onSnapshotNextClick,
    disabled: props.snapshots.length < 2
  }, {
    key: 'view',
    iconProps: {
      iconName: props.view === '2d' ? 'Product' : 'Page'
    },
    title: props.view === '2d' ? _language.strings.labelViewType3d : _language.strings.lavelViewType2d,
    onClick: props.onViewClick,
    disabled: !props.loaded
  }, {
    key: 'home',
    iconProps: {
      iconName: 'PicturePosition'
    },
    title: _language.strings.buttonCameraHome,
    onClick: props.onHomeClick,
    disabled: !props.loaded
  }];
  return React.createElement("div", {
    className: "sanddance-explorer-topbar"
  }, React.createElement("div", {
    className: "logo"
  }, React.createElement(_logo.Logo, null), React.createElement("a", {
    href: props.logoClickUrl || '/',
    target: props.logoClickTarget || '_blank'
  }, _language.strings.appName)), React.createElement("div", {
    className: "sanddance-explorer-commandbar"
  }, React.createElement(_base.base.fabric.Customizer, {
    scopedSettings: {
      CommandBarButton: {
        styles: buttonProps => {
          buttonProps.theme.palette = props.themePalette;
          return (0, _CommandBarButton.CommandBarButtonStyles)(buttonProps);
        }
      }
    }
  }, React.createElement(_base.base.fabric.CommandBar, {
    items: items,
    farItems: farItems,
    styles: {
      root: {
        backgroundColor: 'transparent',
        height: 'unset',
        paddingLeft: 0,
        paddingRight: 0
      }
    }
  }))));
}
},{"react":"mpTF","../base":"yK94","./CommandBarButton.styles":"El1r","./logo":"oSPh","@msrvida/sanddance-react":"miZu","../language":"Zz8c"}],"ZEae":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Explorer = void 0;

var React = _interopRequireWildcard(require("react"));

var _colorMap = require("./colorMap");

var _base = require("./base");

var _colorScheme = require("./colorScheme");

var _chart = require("./dialogs/chart");

var _color = require("./dialogs/color");

var _interfaces = require("./interfaces");

var _partialInsight = require("./partialInsight");

var _dataBrowser = require("./dialogs/dataBrowser");

var _dataScope = require("./controls/dataScope");

var _defaults = require("./defaults");

var _dialog = require("./controls/dialog");

var _columns = require("./columns");

var _mouseEvent = require("./mouseEvent");

var _iconButton = require("./controls/iconButton");

var _search = require("./dialogs/search");

var _dataLoader = require("./dataLoader");

var _clickableTextLayer = require("./clickableTextLayer");

var _chartRecommender = require("@msrvida/chart-recommender");

var _canvas = require("./canvas");

var _sanddanceReact = require("@msrvida/sanddance-react");

var _settings = require("./dialogs/settings");

var _sidebar = require("./controls/sidebar");

var _snapshotEditor = require("./dialogs/snapshotEditor");

var _snapshots = require("./dialogs/snapshots");

var _language = require("./language");

var _themes = require("./themes");

var _toggleSearch = require("./toggleSearch");

var _topbar = require("./controls/topbar");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const dataBrowserTitles = {};
dataBrowserTitles[_dataScope.DataScopeId.AllData] = _language.strings.selectDataSpanAll;
dataBrowserTitles[_dataScope.DataScopeId.FilteredData] = _language.strings.selectDataSpanFilter;
dataBrowserTitles[_dataScope.DataScopeId.SelectedData] = _language.strings.selectDataSpanSelection;
const dataBrowserZeroMessages = {};
dataBrowserZeroMessages[_dataScope.DataScopeId.AllData] = _language.strings.labelZeroAll;
dataBrowserZeroMessages[_dataScope.DataScopeId.FilteredData] = null; //empty array is not used

dataBrowserZeroMessages[_dataScope.DataScopeId.SelectedData] = _language.strings.labelZeroSearchResults;
const dataBrowserNullMessages = {};
dataBrowserNullMessages[_dataScope.DataScopeId.AllData] = _language.strings.labelDataNullAll;
dataBrowserNullMessages[_dataScope.DataScopeId.FilteredData] = _language.strings.labelDataNullFiltered;
dataBrowserNullMessages[_dataScope.DataScopeId.SelectedData] = _language.strings.labelDataNullSelection;

function createInputSearch(search) {
  const groups = _sanddanceReact.SandDance.util.ensureSearchExpressionGroupArray(search);

  const dialogSearch = groups.map((group, groupIndex) => {
    return Object.assign(Object.assign({
      key: groupIndex
    }, group), {
      expressions: group.expressions.map((ex, i) => {
        const ex2 = Object.assign({
          key: i
        }, ex);
        return ex2;
      })
    });
  });
  return dialogSearch;
}

class Explorer extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      calculating: null,
      errors: null,
      autoCompleteDistinctValues: {},
      colorBin: null,
      dataContent: null,
      dataFile: null,
      search: null,
      facets: null,
      filter: null,
      filteredData: null,
      specCapabilities: null,
      size: {
        height: null,
        width: null
      },
      scheme: null,
      transform: null,
      columns: null,
      chart: 'grid',
      signalValues: null,
      hideAxes: false,
      hideLegend: false,
      sideTabId: _interfaces.SideTabId.ChartType,
      dataScopeId: _dataScope.DataScopeId.AllData,
      selectedItemIndex: {},
      sidebarClosed: false,
      sidebarPinned: true,
      view: props.initialView || '2d',
      snapshots: [],
      selectedSnapshotIndex: -1,
      tooltipExclusions: [],
      positionedColumnMapProps: null,
      note: null
    };
    this.state.selectedItemIndex[_dataScope.DataScopeId.AllData] = 0;
    this.state.selectedItemIndex[_dataScope.DataScopeId.FilteredData] = 0;
    this.state.selectedItemIndex[_dataScope.DataScopeId.SelectedData] = 0;
    this.snapshotThumbWidth = _defaults.snapshotThumbWidth;
    this.discardColorContextUpdates = true;
    this.updateViewerOptions(Object.assign(Object.assign({}, _sanddanceReact.SandDance.VegaDeckGl.util.clone(_sanddanceReact.SandDance.Viewer.defaultViewerOptions)), props.viewerOptions));
  }

  finalize() {
    if (this.viewer) this.viewer.finalize();
  }

  updateViewerOptions(viewerOptions) {
    this.viewerOptions = Object.assign(Object.assign({}, _sanddanceReact.SandDance.VegaDeckGl.util.deepMerge(_defaults.defaultViewerOptions, this.viewerOptions, viewerOptions)), {
      tooltipOptions: {
        exclude: columnName => this.state.tooltipExclusions.indexOf(columnName) >= 0
      },
      onColorContextChange: () => this.manageColorToolbar(),
      onDataFilter: (dataFilter, filteredData) => {
        const selectedItemIndex = Object.assign({}, this.state.selectedItemIndex);
        selectedItemIndex[_dataScope.DataScopeId.FilteredData] = 0;
        this.changeInsight({
          filter: dataFilter,
          filteredData,
          selectedItemIndex
        });

        if (this.state.sideTabId === _interfaces.SideTabId.Data && this.state.dataScopeId === _dataScope.DataScopeId.FilteredData) {
          //make sure item is active
          requestAnimationFrame(() => filteredData && this.silentActivation(filteredData[0]));
        }

        viewerOptions && viewerOptions.onDataFilter && viewerOptions.onDataFilter(dataFilter, filteredData);
      },
      onSelectionChanged: (newSearch, index, selectedData) => {
        if (this.ignoreSelectionChange) return;
        const selectedItemIndex = Object.assign({}, this.state.selectedItemIndex);
        selectedItemIndex[_dataScope.DataScopeId.SelectedData] = index || 0;
        let {
          search,
          sideTabId
        } = this.state;

        if (newSearch) {
          search = createInputSearch(newSearch); //} else {
          //sideTabId = SideTabId.ChartType;
        }

        this.setState({
          search,
          selectedItemIndex,
          sideTabId
        });
        viewerOptions && viewerOptions.onSelectionChanged && viewerOptions.onSelectionChanged(newSearch, index, selectedData);
      },
      onAxisClick: (e, search) => {
        this.toggleableSearch(e, search);
        viewerOptions && viewerOptions.onLegendRowClick && viewerOptions.onAxisClick(e, search);
      },
      onLegendHeaderClick: e => {
        const pos = (0, _mouseEvent.getPosition)(e);
        const specRole = this.state.specCapabilities && this.state.specCapabilities.roles.filter(r => r.role === 'color')[0];
        const positionedColumnMapProps = Object.assign(Object.assign({}, this.getColumnMapBaseProps()), {
          collapseLabel: true,
          container: this.div,
          selectedColumnName: this.state.columns['color'],
          onDismiss: () => {
            this.setState({
              positionedColumnMapProps: null
            });
          },
          specRole,
          left: pos.left - this.div.clientLeft,
          top: pos.top - this.div.clientTop
        });
        this.setState({
          positionedColumnMapProps
        });
      },
      onLegendRowClick: (e, legendRow) => {
        this.toggleableSearch(e, legendRow.search);
        viewerOptions && viewerOptions.onLegendRowClick && viewerOptions.onLegendRowClick(e, legendRow);
      },
      onError: errors => {
        this.setState({
          errors
        });
        viewerOptions && viewerOptions.onError && viewerOptions.onError(errors);
      },
      onBeforeCreateLayers: _clickableTextLayer.onBeforeCreateLayers,
      getTextColor: o => {
        const t = o;

        if (t.specRole) {
          return this.viewerOptions.colors.clickableText;
        } else {
          return o.color;
        }
      },
      getTextHighlightColor: o => {
        const t = o;

        if (t.specRole) {
          return this.viewerOptions.colors.clickableTextHighlight;
        } else {
          return o.color;
        }
      },
      onTextClick: (e, text) => {
        if (e && text) {
          const pos = (0, _mouseEvent.getPosition)(e);
          const {
            specRole
          } = text;

          if (pos && specRole) {
            const positionedColumnMapProps = Object.assign(Object.assign({}, this.getColumnMapBaseProps()), {
              collapseLabel: true,
              container: this.div,
              selectedColumnName: this.state.columns[specRole.role],
              onDismiss: () => {
                this.setState({
                  positionedColumnMapProps: null
                });
              },
              specRole,
              left: pos.left - this.div.clientLeft,
              top: pos.top - this.div.clientTop
            });
            this.setState({
              positionedColumnMapProps
            });
          } else {
            this.setState({
              positionedColumnMapProps: null
            });
          }
        }
      }
    });

    if (this.viewer && this.viewer.presenter) {
      const newPresenterStyle = _sanddanceReact.SandDance.util.getPresenterStyle(this.viewerOptions);

      const mergePrenterStyle = Object.assign(Object.assign({}, this.viewer.presenter.style), newPresenterStyle);
      this.viewer.presenter.style = mergePrenterStyle;
      this.viewer.options = _sanddanceReact.SandDance.VegaDeckGl.util.deepMerge(this.viewer.options, this.props.viewerOptions, this.viewerOptions);
    }
  }

  signal(signalName, signalValue) {
    switch (signalName) {
      case _sanddanceReact.SandDance.constants.SignalNames.ColorBinCount:
      case _sanddanceReact.SandDance.constants.SignalNames.ColorReverse:
      case _sanddanceReact.SandDance.constants.SignalNames.MarkOpacity:
        this.discardColorContextUpdates = false;
        break;
    }

    this.viewer.vegaViewGl.signal(signalName, signalValue);
    this.viewer.vegaViewGl.run();
    this.discardColorContextUpdates = true;
    this.props.onSignalChanged && this.props.onSignalChanged();
  }

  manageColorToolbar() {
    const canRemap = this.viewer.colorContexts && this.viewer.colorContexts.length > 1;
    (0, _colorMap.applyColorButtons)(this.viewer.presenter, !!this.state.columns.color, {
      themePalette: _themes.themePalettes[this.props.theme || ''],
      canRemap,
      isRemap: canRemap && this.viewer.currentColorContext > 0,
      colorMapHandler: remap => {
        this.viewer.currentColorContext = ~~remap;
        this.viewer.renderSameLayout();
        this.manageColorToolbar();
      }
    });
  }

  getInsight() {
    return this.viewer.getInsight();
  }

  setInsight(partialInsight = this.viewer.getInsight(), rebaseFilter = false) {
    const selectedItemIndex = Object.assign({}, this.state.selectedItemIndex);
    selectedItemIndex[_dataScope.DataScopeId.AllData] = 0;
    selectedItemIndex[_dataScope.DataScopeId.FilteredData] = 0;
    selectedItemIndex[_dataScope.DataScopeId.SelectedData] = 0;
    let newState = Object.assign({
      chart: null,
      scheme: null,
      columns: null,
      filter: null,
      filteredData: null,
      selectedItemIndex
    }, partialInsight);
    newState.search = createInputSearch(newState.filter);

    const changeInsight = () => {
      this.getColorContext = null;
      this.changeInsight(newState);
    };

    const currentFilter = this.viewer.getInsight().filter;

    if (rebaseFilter && currentFilter && newState.filter) {
      if (_sanddanceReact.SandDance.searchExpression.startsWith(newState.filter, currentFilter)) {
        changeInsight();
      } else {
        this.viewer.reset().then(() => new Promise((resolve, reject) => {
          setTimeout(resolve, this.viewer.options.transitionDurations.scope);
        })).then(changeInsight);
      }
    } else {
      changeInsight();
    }
  }

  handleReviveSnapshot(snapshot, selectedSnapshotIndex) {
    let handled = false;

    if (this.props.onSnapshotClick) {
      this.setState({
        selectedSnapshotIndex
      });
      handled = this.props.onSnapshotClick(snapshot, selectedSnapshotIndex);
    }

    if (!handled) {
      this.reviveSnapshot(selectedSnapshotIndex);
    }
  }

  reviveSnapshot(snapshotOrIndex) {
    if (typeof snapshotOrIndex === 'number') {
      const selectedSnapshotIndex = snapshotOrIndex;
      const snapshot = this.state.snapshots[selectedSnapshotIndex];
      const newState = Object.assign(Object.assign({}, snapshot.insight), {
        note: snapshot.description,
        selectedSnapshotIndex
      });

      if (!this.state.sidebarClosed) {
        newState.sideTabId = _interfaces.SideTabId.Snapshots;
        this.scrollSnapshotIntoView(selectedSnapshotIndex);
      }

      this.setInsight(newState, true);
    } else {
      const snapshot = snapshotOrIndex;

      if (snapshot.insight) {
        this.setInsight(Object.assign(Object.assign({}, snapshot.insight), {
          note: snapshot.description,
          selectedSnapshotIndex: -1
        }), true); //don't navigate to sideTab
      } else {
        this.setState({
          note: snapshot.description,
          selectedSnapshotIndex: -1
        });
      }
    }
  }

  load(data, getPartialInsight, optionsOrPrefs) {
    this.changeInsight({
      columns: null,
      note: null
    });
    return new Promise((resolve, reject) => {
      const loadFinal = dataContent => {
        let partialInsight;
        this.prefs = optionsOrPrefs && optionsOrPrefs.chartPrefs || optionsOrPrefs || {};

        if (getPartialInsight) {
          partialInsight = getPartialInsight(dataContent.columns);
          (0, _partialInsight.initPrefs)(this.prefs, partialInsight);
        }

        if (!partialInsight) {
          //load recommendation
          let r = new _chartRecommender.RecommenderSummary(dataContent.columns, dataContent.data);
          partialInsight = r.recommend();
        }

        const selectedItemIndex = Object.assign({}, this.state.selectedItemIndex);
        const sideTabId = _interfaces.SideTabId.ChartType;
        selectedItemIndex[_dataScope.DataScopeId.AllData] = 0;
        selectedItemIndex[_dataScope.DataScopeId.FilteredData] = 0;
        selectedItemIndex[_dataScope.DataScopeId.SelectedData] = 0;
        let newState = Object.assign({
          dataFile,
          dataContent,
          snapshots: dataContent.snapshots || this.state.snapshots,
          autoCompleteDistinctValues: {},
          filter: null,
          filteredData: null,
          transform: null,
          tooltipExclusions: optionsOrPrefs && optionsOrPrefs.tooltipExclusions || [],
          selectedItemIndex,
          sideTabId
        }, partialInsight);
        this.getColorContext = null;
        (0, _columns.ensureColumnsExist)(newState.columns, dataContent.columns, newState.transform);
        const errors = (0, _columns.ensureColumnsPopulated)(partialInsight ? partialInsight.chart : null, newState.columns, dataContent.columns);
        newState.errors = errors; //change insight

        this.changeInsight(newState); //make sure item is active

        this.activateDataBrowserItem(sideTabId, this.state.dataScopeId);
        resolve();
      };

      let dataFile;

      if (Array.isArray(data)) {
        return (0, _dataLoader.loadDataArray)(data, 'json').then(result => {
          dataFile = {
            type: 'json'
          };
          loadFinal(result);
        }).catch(reject);
      } else {
        dataFile = data;
        return (0, _dataLoader.loadDataFile)(dataFile).then(loadFinal).catch(reject);
      }
    });
  }

  changeChartType(chart) {
    const partialInsight = (0, _partialInsight.copyPrefToNewState)(this.prefs, chart, '*', '*');
    const newState = Object.assign({
      chart
    }, partialInsight);
    const columns = this.state.columns || {};
    newState.columns = Object.assign({}, columns); //special case mappings when switching chart type

    if (this.state.chart === 'scatterplot' && (chart === 'barchart' || chart === 'barchartV')) {
      newState.columns = Object.assign(Object.assign({}, columns), {
        sort: columns.y
      });
    } else if (this.state.chart === 'scatterplot' && chart === 'barchartH') {
      newState.columns = Object.assign(Object.assign({}, columns), {
        sort: columns.x
      });
    } else if (chart === 'treemap') {
      newState.view = '2d';

      if (!columns.size) {
        //make sure size exists and is numeric
        let sizeColumnName = (0, _chartRecommender.preferredColumnForTreemapSize)(this.state.dataContent.columns, true);

        if (!sizeColumnName) {
          sizeColumnName = (0, _chartRecommender.preferredColumnForTreemapSize)(this.state.dataContent.columns, false);
        }

        if (!sizeColumnName) {//TODO error - no numeric columns
        } else {
          newState.columns = Object.assign(Object.assign({}, columns), {
            size: sizeColumnName
          });
        }
      }
    } else if (chart === 'stacks') {
      newState.view = '3d';
    }

    (0, _columns.ensureColumnsExist)(newState.columns, this.state.dataContent.columns, this.state.transform);
    const errors = (0, _columns.ensureColumnsPopulated)(chart, newState.columns, this.state.dataContent.columns);

    if (errors) {
      newState.errors = errors;
    }

    this.calculate(() => this.changeInsight(newState));
  }

  calculate(calculating) {
    this.setState({
      calculating
    });
  }

  changeView(view) {
    this.changeInsight({
      view
    });
  } //state members which change the insight


  changeInsight(newState) {
    if (!newState.signalValues) {
      newState.signalValues = null;
    }

    if (newState.chart === 'barchart') {
      newState.chart = 'barchartV';
    }

    this.setState(newState);
  }

  changespecCapabilities(specCapabilities) {
    this.setState({
      specCapabilities
    });
  }

  changeColumnMapping(role, column, options) {
    const columns = Object.assign({}, this.state.columns);

    const final = () => {
      columns[role] = column && column.name;
      this.changeInsight({
        columns
      });
    };

    if (column) {
      switch (role) {
        case 'facet':
          {
            (() => {
              const facetColumn = column;
              let facets;

              if (facetColumn.quantitative) {
                facets = {
                  columns: 3,
                  rows: 3
                };
              } else {
                switch (facetColumn.stats.distinctValueCount) {
                  case 2:
                    {
                      facets = {
                        columns: 2,
                        rows: 1
                      };
                      break;
                    }

                  default:
                    {
                      facets = {
                        columns: null,
                        rows: null
                      };
                      let square = 1;

                      while (square * square < facetColumn.stats.distinctValueCount) {
                        square++;
                      }

                      facets.columns = facets.rows = square;
                    }
                }
              }

              columns['facet'] = column.name;
              this.changeInsight({
                facets,
                columns
              });
            })();

            break;
          }

        case 'color':
          {
            (() => {
              let newState = {
                scheme: options && options.scheme,
                columns,
                colorBin: this.state.colorBin
              };

              if (!newState.scheme) {
                const partialInsight = (0, _partialInsight.copyPrefToNewState)(this.prefs, this.state.chart, 'color', column.name);
                newState = Object.assign(Object.assign({}, newState), partialInsight);
              }

              if (!newState.scheme) {
                newState.scheme = (0, _colorScheme.bestColorScheme)(column, null, this.state.scheme);
              }

              if (!column.stats.hasColorData) {
                newState.directColor = false;

                if (this.state.directColor !== newState.directColor) {
                  newState.calculating = () => this._resize();
                }
              }

              if (this.state.columns && this.state.columns.color && this.state.columns.color !== column.name) {
                const currColorColumn = this.state.dataContent.columns.filter(c => c.name === this.state.columns.color)[0];

                if (column.isColorData != currColorColumn.isColorData) {
                  newState.calculating = () => this._resize();
                }
              }

              this.ignoreSelectionChange = true;
              this.viewer.deselect().then(() => {
                this.ignoreSelectionChange = false; //allow deselection to render

                requestAnimationFrame(() => {
                  columns['color'] = column.name;
                  this.getColorContext = null;
                  this.changeInsight(newState);
                });
              });
            })();

            break;
          }

        case 'x':
          {
            (() => {
              const partialInsight = (0, _partialInsight.copyPrefToNewState)(this.prefs, this.state.chart, 'x', column.name);
              const newState = Object.assign({
                columns
              }, partialInsight);
              columns['x'] = column.name;
              this.changeInsight(newState);
            })();

            break;
          }

        default:
          {
            final();
            break;
          }
      }
    } else {
      final();
    }
  }

  setSideTabId(sideTabId, dataScopeId) {
    if (sideTabId === _interfaces.SideTabId.Data && dataScopeId == null) {
      //choose most relevant DataScopeId
      dataScopeId = this.getBestDataScopeId();
    }

    if (dataScopeId == null) {
      dataScopeId = this.state.dataScopeId;
    }

    this.setState({
      sideTabId,
      dataScopeId,
      sidebarClosed: false
    });
    this.activateDataBrowserItem(sideTabId, dataScopeId);
  }

  getBestDataScopeId() {
    let dataScopeId;
    const selectionState = this.viewer && this.viewer.getSelection();

    if (selectionState && selectionState.selectedData && selectionState.selectedData.length) {
      dataScopeId = _dataScope.DataScopeId.SelectedData;
    } else if (this.state.filteredData) {
      dataScopeId = _dataScope.DataScopeId.FilteredData;
    } else {
      dataScopeId = _dataScope.DataScopeId.AllData;
    }

    return dataScopeId;
  }

  activateDataBrowserItem(sideTabId, dataScopeId) {
    if (!this.viewer) return;
    let itemToActivate;

    if (sideTabId === _interfaces.SideTabId.Data) {
      switch (dataScopeId) {
        case _dataScope.DataScopeId.AllData:
          {
            itemToActivate = this.state.dataContent && this.state.dataContent.data[this.state.selectedItemIndex[_dataScope.DataScopeId.AllData]];
            break;
          }

        case _dataScope.DataScopeId.FilteredData:
          {
            itemToActivate = this.state.filteredData && this.state.filteredData[this.state.selectedItemIndex[_dataScope.DataScopeId.FilteredData]];
            break;
          }

        case _dataScope.DataScopeId.SelectedData:
          {
            const selection = this.viewer.getSelection() || {};
            itemToActivate = selection.selectedData && selection.selectedData[this.state.selectedItemIndex[_dataScope.DataScopeId.SelectedData]];
            break;
          }
      }
    }

    this.silentActivation(itemToActivate);
  }

  silentActivation(itemToActivate) {
    this.ignoreSelectionChange = true;

    const done = () => {
      this.ignoreSelectionChange = false;
    };

    if (itemToActivate) {
      return this.viewer.activate(itemToActivate).then(done);
    } else {
      return this.viewer.deActivate().then(done);
    }
  }

  sidebar(sidebarClosed, sidebarPinned) {
    this.setState({
      sidebarClosed,
      sidebarPinned
    });
  }

  resize() {
    this.setState({
      calculating: () => this._resize()
    });
  }

  _resize() {
    this.changeInsight({
      size: this.getLayoutDivSize(this.state.sidebarPinned, this.state.sidebarClosed)
    });
  }

  viewerMounted(glDiv) {
    this.setState({
      size: this.getLayoutDivSize(this.state.sidebarPinned, this.state.sidebarClosed),
      signalValues: this.state.signalValues //keep initialized signalValues

    });
  }

  getLayoutDivSize(pinned, closed) {
    const div = pinned && !closed ? this.layoutDivPinned : this.layoutDivUnpinned;
    return {
      height: div.offsetHeight,
      width: div.offsetWidth
    };
  }

  toggleableSearch(e, search) {
    if (e.ctrlKey) {
      this.setState({
        search: createInputSearch(search)
      });
      this.setSideTabId(_interfaces.SideTabId.Search);
    } else {
      var oldSelection = this.viewer.getSelection();

      if (oldSelection.search) {
        //look for matching groups and toggle them
        const result = (0, _toggleSearch.toggleSearch)(_sanddanceReact.SandDance.util.ensureSearchExpressionGroupArray(oldSelection.search), search);

        if (result.found) {
          //removing a group
          if (result.groups.length === 0) {
            this.doDeselect();
          } else {
            //select with new search removed
            this.doSelect(result.groups);
          }
        } else {
          //adding a new group
          if (e.altKey || e.shiftKey) {
            let group = true;

            if (e.altKey) {
              search.clause = '&&';
            } else if (e.shiftKey) {
              if (this.props.searchORDisabled) {
                group = false;
              } else {
                search.clause = '||';
              }
            }

            if (group) {
              result.groups.push(search);
              this.doSelect(result.groups);
            } else {
              this.doSelect(search);
            }
          } else {
            //replace
            this.doSelect(search);
          }
        }
      } else {
        this.doSelect(search);
      }
    }
  }

  doFilter(search) {
    this.viewer.filter(search);
  }

  doUnfilter() {
    this.viewer.reset();
  }

  doSelect(search) {
    this.viewer.select(search);
  }

  doDeselect() {
    return this.viewer.deselect();
  }

  writeSnapshot(snapshot, editIndex) {
    let {
      selectedSnapshotIndex
    } = this.state;
    let snapshots;

    if (editIndex >= 0) {
      snapshots = [...this.state.snapshots];
      snapshots[editIndex] = snapshot;
      this.setState({
        snapshots,
        selectedSnapshotIndex
      });
    } else {
      const note = snapshot.description;
      snapshots = this.state.snapshots.concat(snapshot);
      selectedSnapshotIndex = snapshots.length - 1;

      if (!this.state.sidebarClosed) {
        this.scrollSnapshotIntoView(selectedSnapshotIndex);
      }

      this.setState({
        sideTabId: _interfaces.SideTabId.Snapshots,
        snapshots,
        selectedSnapshotIndex,
        note
      });
    }
  }

  scrollSnapshotIntoView(selectedSnapshotIndex) {
    clearTimeout(this.scrollSnapshotTimer);
    this.scrollSnapshotTimer = setTimeout(() => {
      const selectedSnapshotElement = this.div.querySelector(`.snapshot:nth-child(${selectedSnapshotIndex + 1})`);

      if (selectedSnapshotElement) {
        selectedSnapshotElement.scrollIntoView({
          behavior: 'smooth',
          block: 'nearest'
        });
      }
    }, 500);
  }

  componentDidMount() {
    if (this.props.mounted) {
      this.props.mounted(this);
    }
  }

  render() {
    const {
      colorBin,
      columns,
      directColor,
      facets,
      filter,
      hideAxes,
      hideLegend,
      scheme,
      signalValues,
      size,
      transform,
      chart,
      view
    } = this.state;
    const insight = {
      colorBin,
      columns,
      directColor,
      facets,
      filter,
      hideAxes,
      hideLegend,
      scheme,
      signalValues,
      size,
      transform,
      chart,
      view
    };
    const loaded = !!(this.state.columns && this.state.dataContent);
    const selectionState = this.viewer && this.viewer.getSelection() || {};
    const selectionSearch = selectionState && selectionState.search;
    const columnMapProps = this.getColumnMapBaseProps();
    const datas = {};
    datas[_dataScope.DataScopeId.AllData] = this.state.dataContent && this.state.dataContent.data;
    datas[_dataScope.DataScopeId.FilteredData] = this.state.filteredData;
    datas[_dataScope.DataScopeId.SelectedData] = selectionState && selectionState.selectedData;

    if (this.state.calculating) {
      requestAnimationFrame(() => {
        //allow render to complete
        if (this.state.calculating) {
          this.state.calculating();
          this.setState({
            calculating: null
          });
        }
      });
    }

    const theme = this.props.theme || '';
    const themePalette = _themes.themePalettes[theme];
    return React.createElement("div", {
      ref: div => {
        if (div) this.div = div;
      },
      className: _sanddanceReact.util.classList('sanddance-explorer', this.props.theme)
    }, React.createElement(_topbar.Topbar, {
      logoClickUrl: this.props.logoClickUrl,
      logoClickTarget: this.props.logoClickTarget,
      themePalette: themePalette,
      loaded: loaded,
      doDeselect: this.doDeselect.bind(this),
      doFilter: this.doFilter.bind(this),
      doUnfilter: this.doUnfilter.bind(this),
      filter: this.state.filter,
      selectionSearch: selectionSearch,
      selectionState: selectionState,
      buttons: this.props.topBarButtonProps,
      view: this.state.view,
      snapshots: this.state.snapshots,
      onSnapshotPreviousClick: () => {
        let selectedSnapshotIndex;

        if (this.state.selectedSnapshotIndex === -1) {
          selectedSnapshotIndex = this.state.snapshots.length - 1;
        } else {
          selectedSnapshotIndex = this.state.selectedSnapshotIndex;
          selectedSnapshotIndex--;

          if (selectedSnapshotIndex < 0) {
            selectedSnapshotIndex = this.state.snapshots.length - 1;
          }
        }

        this.handleReviveSnapshot(this.state.snapshots[selectedSnapshotIndex], selectedSnapshotIndex);
      },
      onSnapshotClick: () => this.snapshotEditor.editSnapshot(),
      onSnapshotNextClick: () => {
        let selectedSnapshotIndex;

        if (this.state.selectedSnapshotIndex === -1) {
          selectedSnapshotIndex = 0;
        } else {
          selectedSnapshotIndex = this.state.selectedSnapshotIndex;
          selectedSnapshotIndex++;

          if (selectedSnapshotIndex > this.state.snapshots.length - 1) {
            selectedSnapshotIndex = 0;
          }
        }

        this.handleReviveSnapshot(this.state.snapshots[selectedSnapshotIndex], selectedSnapshotIndex);
      },
      onViewClick: () => {
        const view = this.state.view === '2d' ? '3d' : '2d';
        this.changeInsight({
          view
        });
      },
      onHomeClick: () => this.viewer.presenter.homeCamera()
    }), React.createElement("div", {
      className: _sanddanceReact.util.classList('sanddance-main', this.state.sidebarPinned && 'pinned', this.state.sidebarClosed && 'closed', (insight.hideLegend || insight.directColor || !colorMapping(insight, this.state.dataContent && this.state.dataContent.columns)) && 'hide-legend')
    }, React.createElement("div", {
      ref: div => {
        if (div && !this.layoutDivUnpinned) this.layoutDivUnpinned = div;
      },
      className: "sanddance-layout-unpinned"
    }), React.createElement("div", {
      ref: div => {
        if (div && !this.layoutDivPinned) this.layoutDivPinned = div;
      },
      className: "sanddance-layout-pinned"
    }), !loaded && React.createElement("div", {
      className: "loading"
    }, React.createElement(_base.base.fabric.Spinner, {
      size: _base.base.fabric.SpinnerSize.large,
      label: _language.strings.loading
    })), React.createElement(_sidebar.Sidebar, {
      themePalette: themePalette,
      calculating: !!this.state.calculating,
      closed: this.state.sidebarClosed,
      hideSidebarControls: this.props.hideSidebarControls,
      pinned: this.state.sidebarPinned,
      disabled: !loaded,
      dataScopeProps: {
        themePalette,
        compact: this.state.sidebarClosed,
        onCompactClick: () => {
          this.changeInsight({
            sidebarClosed: false,
            size: this.getLayoutDivSize(this.state.sidebarPinned, false)
          });
        },
        dataSet: this.props.datasetElement,
        dataCount: loaded && {
          all: this.state.dataContent && this.state.dataContent.data.length,
          filtered: this.state.filteredData && this.state.filteredData.length,
          selected: selectionState && selectionState.selectedData && selectionState.selectedData.length
        },
        active: this.state.sideTabId === _interfaces.SideTabId.Data,
        onDataScopeClick: dataScopeId => this.setSideTabId(_interfaces.SideTabId.Data, dataScopeId),
        selectedDataScope: this.state.dataScopeId,
        disabled: !loaded
      },
      onSideTabClick: sideTabId => {
        //collapse or toggle
        if (sideTabId === _interfaces.SideTabId.Collapse || this.state.sideTabId === sideTabId) {
          let {
            dataScopeId,
            sidebarClosed
          } = this.state;

          if (sidebarClosed && sideTabId === _interfaces.SideTabId.Data) {
            dataScopeId = this.getBestDataScopeId();
          }

          sidebarClosed = !this.state.sidebarClosed;
          this.changeInsight({
            dataScopeId,
            sidebarClosed,
            size: this.getLayoutDivSize(this.state.sidebarPinned, sidebarClosed)
          });
        } else if (sideTabId === _interfaces.SideTabId.Pin) {
          this.changeInsight({
            sidebarPinned: !this.state.sidebarPinned,
            size: this.getLayoutDivSize(!this.state.sidebarPinned, this.state.sidebarClosed)
          });
        } else {
          this.setSideTabId(sideTabId);
        }
      },
      selectedSideTab: this.state.sideTabId
    }, loaded && (() => {
      switch (this.state.sideTabId) {
        case _interfaces.SideTabId.ChartType:
          {
            return React.createElement(_chart.Chart, Object.assign({
              collapseLabels: this.props.compactUI,
              tooltipExclusions: this.state.tooltipExclusions,
              toggleTooltipExclusion: columnName => {
                const tooltipExclusions = [...this.state.tooltipExclusions];
                const i = tooltipExclusions.indexOf(columnName);

                if (i < 0) {
                  tooltipExclusions.push(columnName);
                } else {
                  tooltipExclusions.splice(i, 1);
                }

                this.setState({
                  tooltipExclusions
                });
                this.props.onTooltipExclusionsChanged && this.props.onTooltipExclusionsChanged(tooltipExclusions);
              },
              disabled: !loaded || this.state.sidebarClosed
            }, columnMapProps, {
              chart: this.state.chart,
              view: this.state.view,
              onChangeChartType: chart => this.changeChartType(chart),
              insightColumns: this.state.columns,
              onChangeSignal: (role, column, name, value) => (0, _partialInsight.saveSignalValuePref)(this.prefs, this.state.chart, role, column, name, value)
            }));
          }

        case _interfaces.SideTabId.Color:
          {
            return React.createElement(_color.Color, Object.assign({
              compactUI: this.props.compactUI,
              specCapabilities: this.state.specCapabilities,
              disabled: !loaded || this.state.sidebarClosed
            }, columnMapProps, {
              dataContent: this.state.dataContent,
              scheme: this.state.scheme,
              colorBin: this.state.colorBin,
              colorBinSignal: this.viewer && this.viewer.vegaSpec && this.viewer.vegaSpec.signals.filter(s => s.name === _sanddanceReact.SandDance.constants.SignalNames.ColorBinCount)[0],
              colorReverseSignal: this.viewer && this.viewer.vegaSpec && this.viewer.vegaSpec.signals.filter(s => s.name === _sanddanceReact.SandDance.constants.SignalNames.ColorReverse)[0],
              colorColumn: this.state.columns.color,
              onColorBinChange: colorBin => {
                this.ignoreSelectionChange = true;
                this.viewer.deselect().then(() => {
                  this.ignoreSelectionChange = false; //allow deselection to render

                  requestAnimationFrame(() => {
                    this.getColorContext = null;
                    this.changeInsight({
                      colorBin
                    });
                    (0, _partialInsight.savePref)(this.prefs, this.state.chart, 'color', this.state.columns.color, {
                      colorBin
                    });
                  });
                });
              },
              onColorSchemeChange: scheme => {
                this.changeColumnMapping('color', this.state.dataContent.columns.filter(c => c.name === this.state.columns.color)[0], {
                  scheme
                });
                (0, _partialInsight.savePref)(this.prefs, this.state.chart, 'color', this.state.columns.color, {
                  scheme
                });
              },
              onColorBinCountChange: value => {
                const signalValues = {};
                signalValues[_sanddanceReact.SandDance.constants.SignalNames.ColorBinCount] = value;
                (0, _partialInsight.savePref)(this.prefs, this.state.chart, 'color', this.state.columns.color, {
                  signalValues
                });
              },
              onColorReverseChange: value => {
                this.getColorContext = null;
                const signalValues = {};
                signalValues[_sanddanceReact.SandDance.constants.SignalNames.ColorReverse] = value;
              },
              directColor: this.state.directColor,
              onDirectColorChange: directColor => {
                this.changeInsight({
                  directColor,
                  calculating: () => this._resize()
                });
              }
            }));
          }

        case _interfaces.SideTabId.Data:
          {
            const data = datas[this.state.dataScopeId];
            let itemVisible = true;

            switch (this.state.dataScopeId) {
              case _dataScope.DataScopeId.AllData:
                {
                  const item = this.state.selectedItemIndex[this.state.dataScopeId];
                  itemVisible = this.state.dataContent && !this.state.filteredData || this.state.filteredData.indexOf(data[item]) >= 0;
                }
            }

            return React.createElement(_dataBrowser.DataBrowser, {
              theme: this.props.theme,
              themePalette: themePalette,
              disabled: !loaded || this.state.sidebarClosed,
              columns: this.state.dataContent && this.state.dataContent.columns,
              data: data,
              displayName: this.state.dataFile && this.state.dataFile.displayName || _language.strings.defaultFileName,
              title: dataBrowserTitles[this.state.dataScopeId],
              nullMessage: dataBrowserNullMessages[this.state.dataScopeId],
              zeroMessage: dataBrowserZeroMessages[this.state.dataScopeId],
              index: this.state.selectedItemIndex[this.state.dataScopeId],
              itemVisible: itemVisible,
              dataExportHandler: this.props.dataExportHandler,
              selectedDataScope: this.state.dataScopeId,
              onDataScopeClick: dataScopeId => this.setSideTabId(_interfaces.SideTabId.Data, dataScopeId),
              onActivate: (row, index) => {
                const selectedItemIndex = Object.assign({}, this.state.selectedItemIndex);
                selectedItemIndex[this.state.dataScopeId] = index;
                this.setState({
                  selectedItemIndex
                });
                this.silentActivation(row);
              },
              onSearch: (e, search) => {
                if (e.ctrlKey) {
                  this.setState({
                    sideTabId: _interfaces.SideTabId.Search,
                    search
                  });
                } else {
                  this.doSelect(search);
                }
              },
              bingSearchDisabled: this.props.bingSearchDisabled
            });
          }

        case _interfaces.SideTabId.Search:
          {
            return React.createElement(_search.Search, {
              collapseLabels: this.props.compactUI,
              themePalette: themePalette,
              disabled: !loaded || this.state.sidebarClosed,
              disableGroupOR: this.props.searchORDisabled,
              disableExpressionOR: this.props.searchORDisabled,
              initializer: {
                columns: columnMapProps.allColumns,
                search: this.state.search
              },
              autoCompleteDistinctValues: this.state.autoCompleteDistinctValues,
              onSelect: expr => this.doSelect(expr),
              data: this.state.dataContent.data
            });
          }

        case _interfaces.SideTabId.Snapshots:
          {
            return React.createElement(_snapshots.Snapshots, Object.assign({}, this.props.snapshotProps, {
              editor: this.snapshotEditor,
              themePalette: themePalette,
              explorer: this,
              snapshots: this.state.snapshots,
              selectedSnapshotIndex: this.state.selectedSnapshotIndex,
              onClearSnapshots: () => this.setState({
                snapshots: [],
                selectedSnapshotIndex: -1
              }),
              onWriteSnapshot: (s, i) => this.writeSnapshot(s, i),
              onRemoveSnapshot: i => {
                const snapshots = [...this.state.snapshots];
                snapshots.splice(i, 1);
                let {
                  selectedSnapshotIndex
                } = this.state;

                if (i === selectedSnapshotIndex) {
                  selectedSnapshotIndex = -1;
                } else if (selectedSnapshotIndex > i) {
                  selectedSnapshotIndex--;
                }

                this.setState({
                  snapshots,
                  selectedSnapshotIndex
                });
              },
              onSnapshotClick: (snapshot, selectedSnapshotIndex) => {
                this.setState({
                  selectedSnapshotIndex
                });
                this.calculate(() => {
                  this.handleReviveSnapshot(snapshot, selectedSnapshotIndex);
                });
              },
              onMoveUp: i => {
                if (i > 0) {
                  const snapshots = [...this.state.snapshots];
                  const temp = snapshots[i - 1];
                  snapshots[i - 1] = snapshots[i];
                  snapshots[i] = temp;
                  let {
                    selectedSnapshotIndex
                  } = this.state;

                  if (i === selectedSnapshotIndex) {
                    selectedSnapshotIndex = i - 1;
                  } else if (i - 1 === selectedSnapshotIndex) {
                    selectedSnapshotIndex = i;
                  }

                  this.setState({
                    snapshots,
                    selectedSnapshotIndex
                  });
                }
              },
              onMoveDown: i => {
                if (i < this.state.snapshots.length - 1) {
                  const snapshots = [...this.state.snapshots];
                  const temp = snapshots[i + 1];
                  snapshots[i + 1] = snapshots[i];
                  snapshots[i] = temp;
                  let {
                    selectedSnapshotIndex
                  } = this.state;

                  if (i === selectedSnapshotIndex) {
                    selectedSnapshotIndex = i + 1;
                  } else if (i + 1 === selectedSnapshotIndex) {
                    selectedSnapshotIndex = i;
                  }

                  this.setState({
                    snapshots,
                    selectedSnapshotIndex
                  });
                }
              }
            }));
          }

        case _interfaces.SideTabId.Settings:
          {
            return React.createElement(_settings.Settings, {
              explorer: this,
              dataFile: this.state.dataFile,
              scheme: this.state.scheme,
              hideLegend: this.state.hideLegend,
              onToggleLegend: hideLegend => this.setState({
                hideLegend,
                calculating: () => this._resize()
              }),
              hideAxes: this.state.hideAxes,
              onToggleAxes: hideAxes => this.setState({
                calculating: () => this.setState({
                  hideAxes
                })
              }),
              additionalSettings: this.props.additionalSettings
            }, this.props.systemInfoChildren);
          }
      }
    })()), loaded && React.createElement("div", {
      className: "sanddance-view"
    }, React.createElement(_sanddanceReact.SandDanceReact, {
      renderOptions: {
        initialColorContext: this.getColorContext && this.getColorContext(this.viewer.insight, insight),
        discardColorContextUpdates: () => this.discardColorContextUpdates
      },
      viewerOptions: this.viewerOptions,
      ref: reactViewer => {
        if (reactViewer) {
          this.viewer = reactViewer.viewer;
        }
      },
      onView: renderResult => {
        this.changespecCapabilities(renderResult.specResult.errors ? renderResult.specResult.specCapabilities : this.viewer.specCapabilities);

        this.getColorContext = (oldInsight, newInsight) => {
          if (!oldInsight && !newInsight) {
            return null;
          }

          if (!oldInsight || !newInsight) {
            return null;
          }

          if (oldInsight.scheme !== newInsight.scheme) {
            return null;
          }

          if (oldInsight.columns.color !== newInsight.columns.color) {
            return null;
          }

          if (oldInsight.directColor != newInsight.directColor) {
            return null;
          }

          return this.viewer.colorContexts && this.viewer.colorContexts[this.viewer.currentColorContext];
        }; //don't allow tabbing to the canvas


        (0, _canvas.removeTabIndex)(this.viewer);
        this.props.onView && this.props.onView();
      },
      onError: e => {
        this.props.onError && this.props.onError(e);
      },
      data: this.state.dataContent.data,
      insight: insight,
      onMount: el => this.viewerMounted(el)
    }), this.state.note && React.createElement("div", {
      className: 'sanddance-note'
    }, React.createElement(_iconButton.IconButton, {
      className: 'cancel',
      themePalette: themePalette,
      title: _language.strings.buttonClose,
      iconName: 'Cancel',
      onClick: () => this.setState({
        note: null
      })
    }), this.state.note)), React.createElement(_dialog.Dialog, {
      title: _language.strings.labelError,
      hidden: !this.state.errors,
      onDismiss: () => {
        this.setState({
          errors: null
        });
      }
    }, this.state.errors && this.state.errors.map((error, i) => React.createElement("div", {
      key: i
    }, error))), React.createElement(_snapshotEditor.SnapshotEditor, Object.assign({
      ref: se => this.snapshotEditor = se
    }, this.props.snapshotProps, {
      explorer: this,
      onWriteSnapshot: (s, i) => this.writeSnapshot(s, i),
      themePalette: themePalette
    }))), this.state.positionedColumnMapProps && React.createElement(_clickableTextLayer.PositionedColumnMap, Object.assign({}, this.state.positionedColumnMapProps)));
  }

  getColumnMapBaseProps() {
    const allColumns = this.state.dataContent && this.state.dataContent.columns.filter(c => !_sanddanceReact.SandDance.util.isInternalFieldName(c.name, true));
    const quantitativeColumns = allColumns && allColumns.filter(c => c.quantitative);
    const categoricalColumns = allColumns && allColumns.filter(c => !c.quantitative);
    const props = {
      changeColumnMapping: (role, columnOrRole) => {
        let column;

        if (typeof columnOrRole === 'string') {
          //look up current insight
          const columnName = this.state.columns[columnOrRole];
          column = allColumns.filter(c => c.name === columnName)[0];
        } else {
          column = columnOrRole;
        }

        this.changeColumnMapping(role, column);
      },
      allColumns,
      quantitativeColumns,
      categoricalColumns,
      specCapabilities: this.state.specCapabilities,
      explorer: this
    };
    return props;
  }

}

exports.Explorer = Explorer;

function colorMapping(insight, columns) {
  if (columns && insight.columns && insight.columns.color) {
    return columns.filter(c => c.name === insight.columns.color)[0];
  }
}
},{"react":"mpTF","./colorMap":"ZSSH","./base":"yK94","./colorScheme":"AKGR","./dialogs/chart":"frKj","./dialogs/color":"Mhm6","./interfaces":"Eyva","./partialInsight":"A1e3","./dialogs/dataBrowser":"NTik","./controls/dataScope":"PlDJ","./defaults":"JNef","./controls/dialog":"ajeQ","./columns":"CiZM","./mouseEvent":"j8xV","./controls/iconButton":"tNGe","./dialogs/search":"RsgD","./dataLoader":"sKvG","./clickableTextLayer":"RpYO","@msrvida/chart-recommender":"CmqI","./canvas":"PlI7","@msrvida/sanddance-react":"miZu","./dialogs/settings":"d6VM","./controls/sidebar":"BOsx","./dialogs/snapshotEditor":"GbMR","./dialogs/snapshots":"semr","./language":"Zz8c","./themes":"wxrq","./toggleSearch":"appz","./controls/topbar":"RkrT"}],"TX8u":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
var _exportNames = {
  getEmbedHTML: true,
  SideTabId: true,
  use: true,
  capabilities: true,
  getColorSettingsFromThemePalette: true,
  themePalettes: true,
  SandDance: true,
  util: true,
  version: true
};
Object.defineProperty(exports, "getEmbedHTML", {
  enumerable: true,
  get: function () {
    return _dataExporter.getEmbedHTML;
  }
});
Object.defineProperty(exports, "SideTabId", {
  enumerable: true,
  get: function () {
    return _interfaces.SideTabId;
  }
});
Object.defineProperty(exports, "use", {
  enumerable: true,
  get: function () {
    return _base.use;
  }
});
Object.defineProperty(exports, "capabilities", {
  enumerable: true,
  get: function () {
    return _canvas.capabilities;
  }
});
Object.defineProperty(exports, "getColorSettingsFromThemePalette", {
  enumerable: true,
  get: function () {
    return _themes.getColorSettingsFromThemePalette;
  }
});
Object.defineProperty(exports, "themePalettes", {
  enumerable: true,
  get: function () {
    return _themes.themePalettes;
  }
});
Object.defineProperty(exports, "SandDance", {
  enumerable: true,
  get: function () {
    return _sanddanceReact.SandDance;
  }
});
Object.defineProperty(exports, "util", {
  enumerable: true,
  get: function () {
    return _sanddanceReact.util;
  }
});
Object.defineProperty(exports, "version", {
  enumerable: true,
  get: function () {
    return _version.version;
  }
});

var _dataExporter = require("./controls/dataExporter");

var _interfaces = require("./interfaces");

var _base = require("./base");

var _canvas = require("./canvas");

var _themes = require("./themes");

var _explorer = require("./explorer");

Object.keys(_explorer).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _explorer[key];
    }
  });
});

var _sanddanceReact = require("@msrvida/sanddance-react");

var _version = require("./version");
},{"./controls/dataExporter":"mUYZ","./interfaces":"Eyva","./base":"yK94","./canvas":"PlI7","./themes":"wxrq","./explorer":"ZEae","@msrvida/sanddance-react":"miZu","./version":"GBPQ"}],"eUAn":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.accessorName = accessorName;
exports.accessorFields = accessorFields;

function _default(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;
}
},{}],"MSzm":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(message) {
  throw Error(message);
}
},{}],"sk85":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _error = _interopRequireDefault(require("./error"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(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);
      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) (0, _error.default)('Access path missing open bracket: ' + p);
      if (b > 0) push();
      b = 0;
      i = j + 1;
    }
  }

  if (b) (0, _error.default)('Access path missing closing bracket: ' + p);
  if (q) (0, _error.default)('Access path missing closing quote: ' + p);

  if (j > i) {
    j++;
    push();
  }

  return path;
}
},{"./error":"MSzm"}],"ocRV":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _default = Array.isArray;
exports.default = _default;
},{}],"HHXR":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(_) {
  return _ === Object(_);
}
},{}],"P8Vo":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(_) {
  return typeof _ === 'string';
}
},{}],"bLbI":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = $;

var _isArray = _interopRequireDefault(require("./isArray"));

var _isObject = _interopRequireDefault(require("./isObject"));

var _isString = _interopRequireDefault(require("./isString"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function $(x) {
  return (0, _isArray.default)(x) ? '[' + x.map($) + ']' : (0, _isObject.default)(x) || (0, _isString.default)(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;
}
},{"./isArray":"ocRV","./isObject":"HHXR","./isString":"P8Vo"}],"i32D":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _accessor = _interopRequireDefault(require("./accessor"));

var _splitAccessPath = _interopRequireDefault(require("./splitAccessPath"));

var _stringValue = _interopRequireDefault(require("./stringValue"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(field, name) {
  var path = (0, _splitAccessPath.default)(field),
      code = 'return _[' + path.map(_stringValue.default).join('][') + '];';
  return (0, _accessor.default)(Function('_', code), [field = path.length === 1 ? path[0] : field], name || field);
}
},{"./accessor":"eUAn","./splitAccessPath":"sk85","./stringValue":"bLbI"}],"i6JF":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.falsy = exports.truthy = exports.one = exports.zero = exports.identity = exports.id = void 0;

var _accessor = _interopRequireDefault(require("./accessor"));

var _field = _interopRequireDefault(require("./field"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var empty = [];
var id = (0, _field.default)('id');
exports.id = id;
var identity = (0, _accessor.default)(function (_) {
  return _;
}, empty, 'identity');
exports.identity = identity;
var zero = (0, _accessor.default)(function () {
  return 0;
}, empty, 'zero');
exports.zero = zero;
var one = (0, _accessor.default)(function () {
  return 1;
}, empty, 'one');
exports.one = one;
var truthy = (0, _accessor.default)(function () {
  return true;
}, empty, 'true');
exports.truthy = truthy;
var falsy = (0, _accessor.default)(function () {
  return false;
}, empty, 'false');
exports.falsy = falsy;
},{"./accessor":"eUAn","./field":"i32D"}],"CCFi":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.Debug = exports.Info = exports.Warn = exports.Error = exports.None = void 0;

function log(method, level, input) {
  var args = [level].concat([].slice.call(input));
  console[method].apply(console, args); // eslint-disable-line no-console
}

var None = 0;
exports.None = None;
var Error = 1;
exports.Error = Error;
var Warn = 2;
exports.Warn = Warn;
var Info = 3;
exports.Info = Info;
var Debug = 4;
exports.Debug = Debug;

function _default(_, method) {
  var level = _ || None;
  return {
    level: function (_) {
      if (arguments.length) {
        level = +_;
        return this;
      } else {
        return level;
      }
    },
    error: function () {
      if (level >= Error) log(method || 'error', 'ERROR', arguments);
      return this;
    },
    warn: function () {
      if (level >= Warn) log(method || 'warn', 'WARN', arguments);
      return this;
    },
    info: function () {
      if (level >= Info) log(method || 'log', 'INFO', arguments);
      return this;
    },
    debug: function () {
      if (level >= Debug) log(method || 'log', 'DEBUG', arguments);
      return this;
    }
  };
}
},{}],"SLBi":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.mergeConfig = mergeConfig;
exports.writeConfig = writeConfig;

var _isArray = _interopRequireDefault(require("./isArray"));

var _isObject = _interopRequireDefault(require("./isObject"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function mergeConfig(...configs) {
  return configs.reduce((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) {
  var k, o;

  if ((0, _isObject.default)(value) && !(0, _isArray.default)(value)) {
    o = (0, _isObject.default)(output[key]) ? output[key] : output[key] = {};

    for (k in value) {
      if (recurse && (recurse === true || recurse[k])) {
        writeConfig(o, k, value[k]);
      } else {
        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;
}
},{"./isArray":"ocRV","./isObject":"HHXR"}],"reAw":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(array) {
  return array[array.length - 1];
}
},{}],"Qkx3":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(_) {
  return _ == null || _ === '' ? null : +_;
}
},{}],"Vsez":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.panLinear = panLinear;
exports.panLog = panLog;
exports.panPow = panPow;
exports.panSymlog = panSymlog;
exports.zoomLinear = zoomLinear;
exports.zoomLog = zoomLog;
exports.zoomPow = zoomPow;
exports.zoomSymlog = zoomSymlog;

var _accessors = require("./accessors");

var _peek = _interopRequireDefault(require("./peek"));

var _toNumber = _interopRequireDefault(require("./toNumber"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function exp(sign) {
  return function (x) {
    return sign * Math.exp(x);
  };
}

function log(sign) {
  return function (x) {
    return Math.log(sign * x);
  };
}

function 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 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((0, _peek.default)(domain)),
      dd = (d1 - d0) * delta;
  return [ground(d0 - dd), ground(d1 - dd)];
}

function panLinear(domain, delta) {
  return pan(domain, delta, _toNumber.default, _accessors.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) {
  var d0 = lift(domain[0]),
      d1 = lift((0, _peek.default)(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.default, _accessors.identity);
}

function zoomLog(domain, anchor, scale) {
  var 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));
}
},{"./accessors":"i6JF","./peek":"reAw","./toNumber":"Qkx3"}],"zaTZ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.quarter = quarter;
exports.utcquarter = utcquarter;

function quarter(date) {
  return 1 + ~~(new Date(date).getMonth() / 3);
}

function utcquarter(date) {
  return 1 + ~~(new Date(date).getUTCMonth() / 3);
}
},{}],"vQw3":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _isArray = _interopRequireDefault(require("./isArray"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(_) {
  return _ != null ? (0, _isArray.default)(_) ? _ : [_] : [];
}
},{"./isArray":"ocRV"}],"yB6Z":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

/**
 * 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 _default(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];
}
},{}],"JRL8":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(_) {
  return typeof _ === 'function';
}
},{}],"FLnm":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _accessor = _interopRequireWildcard(require("./accessor"));

var _array = _interopRequireDefault(require("./array"));

var _isFunction = _interopRequireDefault(require("./isFunction"));

var _splitAccessPath = _interopRequireDefault(require("./splitAccessPath"));

var _stringValue = _interopRequireDefault(require("./stringValue"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _default(fields, orders) {
  var idx = [],
      cmp = (fields = (0, _array.default)(fields)).map(function (f, i) {
    if (f == null) {
      return null;
    } else {
      idx.push(i);
      return (0, _isFunction.default)(f) ? f : (0, _splitAccessPath.default)(f).map(_stringValue.default).join('][');
    }
  }),
      n = idx.length - 1,
      ord = (0, _array.default)(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 ((0, _isFunction.default)(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 ((0, _isFunction.default)(field)) {
      ((0, _accessor.accessorFields)(field) || []).forEach(function (_) {
        map[_] = 1;
      });
    } else if (field != null) {
      map[field + ''] = 1;
    }

    return map;
  }, {});
  return (0, _accessor.default)(f, Object.keys(fields));
}
},{"./accessor":"eUAn","./array":"vQw3","./isFunction":"JRL8","./splitAccessPath":"sk85","./stringValue":"bLbI"}],"v180":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _isFunction = _interopRequireDefault(require("./isFunction"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(_) {
  return (0, _isFunction.default)(_) ? _ : function () {
    return _;
  };
}
},{"./isFunction":"JRL8"}],"Jdp6":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(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);
  };
}
},{}],"cI24":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(_) {
  for (var x, k, i = 1, len = arguments.length; i < len; ++i) {
    x = arguments[i];

    for (k in x) {
      _[k] = x[k];
    }
  }

  return _;
}
},{}],"Lmbs":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

/**
 * Return an array with minimum and maximum values, in the
 * form [min, max]. Ignores null, undefined, and NaN values.
 */
function _default(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]; 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]); 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];
}
},{}],"LRTq":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(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;
      }
    }

    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;
      }
    }

    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];
}
},{}],"shrV":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
const hop = Object.prototype.hasOwnProperty;

function _default(object, property) {
  return hop.call(object, property);
}
},{}],"G1oZ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _hasOwnProperty = _interopRequireDefault(require("./hasOwnProperty"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var NULL = {};

function _default(input) {
  var obj = {},
      map,
      test;

  function has(key) {
    return (0, _hasOwnProperty.default)(obj, key) && obj[key] !== NULL;
  }

  map = {
    size: 0,
    empty: 0,
    object: obj,
    has: has,
    get: function (key) {
      return has(key) ? obj[key] : undefined;
    },
    set: function (key, value) {
      if (!has(key)) {
        ++map.size;
        if (obj[key] === NULL) --map.empty;
      }

      obj[key] = value;
      return this;
    },
    delete: function (key) {
      if (has(key)) {
        --map.size;
        ++map.empty;
        obj[key] = NULL;
      }

      return this;
    },
    clear: function () {
      map.size = map.empty = 0;
      map.object = obj = {};
    },
    test: function (_) {
      if (arguments.length) {
        test = _;
        return map;
      } else {
        return test;
      }
    },
    clean: function () {
      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;
}
},{"./hasOwnProperty":"shrV"}],"Ga0Y":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _peek = _interopRequireDefault(require("./peek"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(range, value, threshold, left, right, center) {
  if (!threshold && threshold !== 0) return center;
  var a = range[0],
      b = (0, _peek.default)(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;
}
},{"./peek":"reAw"}],"x2xL":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(child, parent) {
  var proto = child.prototype = Object.create(parent.prototype);
  proto.constructor = child;
  return proto;
}
},{}],"IIGL":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

/**
 * 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 _default(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);
}
},{}],"iXuS":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(_) {
  return typeof _ === 'boolean';
}
},{}],"fS6u":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(_) {
  return Object.prototype.toString.call(_) === '[object Date]';
}
},{}],"hvB3":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(_) {
  return typeof _ === 'number';
}
},{}],"LQHk":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(_) {
  return Object.prototype.toString.call(_) === '[object RegExp]';
}
},{}],"sV9b":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _accessor = _interopRequireDefault(require("./accessor"));

var _array = _interopRequireDefault(require("./array"));

var _splitAccessPath = _interopRequireDefault(require("./splitAccessPath"));

var _stringValue = _interopRequireDefault(require("./stringValue"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(fields, flat) {
  if (fields) {
    fields = flat ? (0, _array.default)(fields).map(function (f) {
      return f.replace(/\\(.)/g, '$1');
    }) : (0, _array.default)(fields);
  }

  var fn = !(fields && fields.length) ? function () {
    return '';
  } : Function('_', 'return \'\'+' + fields.map(function (f) {
    return '_[' + (flat ? (0, _stringValue.default)(f) : (0, _splitAccessPath.default)(f).map(_stringValue.default).join('][')) + ']';
  }).join('+\'|\'+') + ';');
  return (0, _accessor.default)(fn, fields, 'key');
}
},{"./accessor":"eUAn","./array":"vQw3","./splitAccessPath":"sk85","./stringValue":"bLbI"}],"vC6A":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _peek = _interopRequireDefault(require("./peek"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(array, frac) {
  const lo = array[0],
        hi = (0, _peek.default)(array),
        f = +frac;
  return !f ? lo : f === 1 ? hi : lo + f * (hi - lo);
}
},{"./peek":"reAw"}],"XBV1":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(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;
}
},{}],"PGwr":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(str, reps) {
  var s = '';

  while (--reps >= 0) s += str;

  return s;
}
},{}],"rW7L":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _repeat = _interopRequireDefault(require("./repeat"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(str, length, padchar, align) {
  var c = padchar || ' ',
      s = str + '',
      n = length - s.length;
  return n <= 0 ? s : align === 'left' ? (0, _repeat.default)(c, n) + s : align === 'center' ? (0, _repeat.default)(c, ~~(n / 2)) + s + (0, _repeat.default)(c, Math.ceil(n / 2)) : s + (0, _repeat.default)(c, n);
}
},{"./repeat":"PGwr"}],"yXXE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _peek = _interopRequireDefault(require("./peek"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * Return the numerical span of an array: the difference between
 * the last and first values.
 */
function _default(array) {
  return array && (0, _peek.default)(array) - array[0] || 0;
}
},{"./peek":"reAw"}],"ZxAv":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(_) {
  return _ == null || _ === '' ? null : !_ || _ === 'false' || _ === '0' ? false : !!_;
}
},{}],"VHYr":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _isDate = _interopRequireDefault(require("./isDate"));

var _isNumber = _interopRequireDefault(require("./isNumber"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function defaultParser(_) {
  return (0, _isNumber.default)(_) ? _ : (0, _isDate.default)(_) ? _ : Date.parse(_);
}

function _default(_, parser) {
  parser = parser || defaultParser;
  return _ == null || _ === '' ? null : parser(_);
}
},{"./isDate":"fS6u","./isNumber":"hvB3"}],"jg26":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(_) {
  return _ == null || _ === '' ? null : _ + '';
}
},{}],"pUPE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(_) {
  for (var s = {}, i = 0, n = _.length; i < n; ++i) s[_[i]] = true;

  return s;
}
},{}],"XXzk":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(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;
}
},{}],"emIe":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(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);
    }
  }
}
},{}],"dejJ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "accessor", {
  enumerable: true,
  get: function () {
    return _accessor.default;
  }
});
Object.defineProperty(exports, "accessorName", {
  enumerable: true,
  get: function () {
    return _accessor.accessorName;
  }
});
Object.defineProperty(exports, "accessorFields", {
  enumerable: true,
  get: function () {
    return _accessor.accessorFields;
  }
});
Object.defineProperty(exports, "id", {
  enumerable: true,
  get: function () {
    return _accessors.id;
  }
});
Object.defineProperty(exports, "identity", {
  enumerable: true,
  get: function () {
    return _accessors.identity;
  }
});
Object.defineProperty(exports, "zero", {
  enumerable: true,
  get: function () {
    return _accessors.zero;
  }
});
Object.defineProperty(exports, "one", {
  enumerable: true,
  get: function () {
    return _accessors.one;
  }
});
Object.defineProperty(exports, "truthy", {
  enumerable: true,
  get: function () {
    return _accessors.truthy;
  }
});
Object.defineProperty(exports, "falsy", {
  enumerable: true,
  get: function () {
    return _accessors.falsy;
  }
});
Object.defineProperty(exports, "logger", {
  enumerable: true,
  get: function () {
    return _logger.default;
  }
});
Object.defineProperty(exports, "None", {
  enumerable: true,
  get: function () {
    return _logger.None;
  }
});
Object.defineProperty(exports, "Error", {
  enumerable: true,
  get: function () {
    return _logger.Error;
  }
});
Object.defineProperty(exports, "Warn", {
  enumerable: true,
  get: function () {
    return _logger.Warn;
  }
});
Object.defineProperty(exports, "Info", {
  enumerable: true,
  get: function () {
    return _logger.Info;
  }
});
Object.defineProperty(exports, "Debug", {
  enumerable: true,
  get: function () {
    return _logger.Debug;
  }
});
Object.defineProperty(exports, "mergeConfig", {
  enumerable: true,
  get: function () {
    return _mergeConfig.mergeConfig;
  }
});
Object.defineProperty(exports, "writeConfig", {
  enumerable: true,
  get: function () {
    return _mergeConfig.writeConfig;
  }
});
Object.defineProperty(exports, "panLinear", {
  enumerable: true,
  get: function () {
    return _transform.panLinear;
  }
});
Object.defineProperty(exports, "panLog", {
  enumerable: true,
  get: function () {
    return _transform.panLog;
  }
});
Object.defineProperty(exports, "panPow", {
  enumerable: true,
  get: function () {
    return _transform.panPow;
  }
});
Object.defineProperty(exports, "panSymlog", {
  enumerable: true,
  get: function () {
    return _transform.panSymlog;
  }
});
Object.defineProperty(exports, "zoomLinear", {
  enumerable: true,
  get: function () {
    return _transform.zoomLinear;
  }
});
Object.defineProperty(exports, "zoomLog", {
  enumerable: true,
  get: function () {
    return _transform.zoomLog;
  }
});
Object.defineProperty(exports, "zoomPow", {
  enumerable: true,
  get: function () {
    return _transform.zoomPow;
  }
});
Object.defineProperty(exports, "zoomSymlog", {
  enumerable: true,
  get: function () {
    return _transform.zoomSymlog;
  }
});
Object.defineProperty(exports, "quarter", {
  enumerable: true,
  get: function () {
    return _quarter.quarter;
  }
});
Object.defineProperty(exports, "utcquarter", {
  enumerable: true,
  get: function () {
    return _quarter.utcquarter;
  }
});
Object.defineProperty(exports, "array", {
  enumerable: true,
  get: function () {
    return _array.default;
  }
});
Object.defineProperty(exports, "clampRange", {
  enumerable: true,
  get: function () {
    return _clampRange.default;
  }
});
Object.defineProperty(exports, "compare", {
  enumerable: true,
  get: function () {
    return _compare.default;
  }
});
Object.defineProperty(exports, "constant", {
  enumerable: true,
  get: function () {
    return _constant.default;
  }
});
Object.defineProperty(exports, "debounce", {
  enumerable: true,
  get: function () {
    return _debounce.default;
  }
});
Object.defineProperty(exports, "error", {
  enumerable: true,
  get: function () {
    return _error.default;
  }
});
Object.defineProperty(exports, "extend", {
  enumerable: true,
  get: function () {
    return _extend.default;
  }
});
Object.defineProperty(exports, "extent", {
  enumerable: true,
  get: function () {
    return _extent.default;
  }
});
Object.defineProperty(exports, "extentIndex", {
  enumerable: true,
  get: function () {
    return _extentIndex.default;
  }
});
Object.defineProperty(exports, "fastmap", {
  enumerable: true,
  get: function () {
    return _fastmap.default;
  }
});
Object.defineProperty(exports, "field", {
  enumerable: true,
  get: function () {
    return _field.default;
  }
});
Object.defineProperty(exports, "flush", {
  enumerable: true,
  get: function () {
    return _flush.default;
  }
});
Object.defineProperty(exports, "hasOwnProperty", {
  enumerable: true,
  get: function () {
    return _hasOwnProperty.default;
  }
});
Object.defineProperty(exports, "inherits", {
  enumerable: true,
  get: function () {
    return _inherits.default;
  }
});
Object.defineProperty(exports, "inrange", {
  enumerable: true,
  get: function () {
    return _inrange.default;
  }
});
Object.defineProperty(exports, "isArray", {
  enumerable: true,
  get: function () {
    return _isArray.default;
  }
});
Object.defineProperty(exports, "isBoolean", {
  enumerable: true,
  get: function () {
    return _isBoolean.default;
  }
});
Object.defineProperty(exports, "isDate", {
  enumerable: true,
  get: function () {
    return _isDate.default;
  }
});
Object.defineProperty(exports, "isFunction", {
  enumerable: true,
  get: function () {
    return _isFunction.default;
  }
});
Object.defineProperty(exports, "isNumber", {
  enumerable: true,
  get: function () {
    return _isNumber.default;
  }
});
Object.defineProperty(exports, "isObject", {
  enumerable: true,
  get: function () {
    return _isObject.default;
  }
});
Object.defineProperty(exports, "isRegExp", {
  enumerable: true,
  get: function () {
    return _isRegExp.default;
  }
});
Object.defineProperty(exports, "isString", {
  enumerable: true,
  get: function () {
    return _isString.default;
  }
});
Object.defineProperty(exports, "key", {
  enumerable: true,
  get: function () {
    return _key.default;
  }
});
Object.defineProperty(exports, "lerp", {
  enumerable: true,
  get: function () {
    return _lerp.default;
  }
});
Object.defineProperty(exports, "merge", {
  enumerable: true,
  get: function () {
    return _merge.default;
  }
});
Object.defineProperty(exports, "pad", {
  enumerable: true,
  get: function () {
    return _pad.default;
  }
});
Object.defineProperty(exports, "peek", {
  enumerable: true,
  get: function () {
    return _peek.default;
  }
});
Object.defineProperty(exports, "repeat", {
  enumerable: true,
  get: function () {
    return _repeat.default;
  }
});
Object.defineProperty(exports, "span", {
  enumerable: true,
  get: function () {
    return _span.default;
  }
});
Object.defineProperty(exports, "splitAccessPath", {
  enumerable: true,
  get: function () {
    return _splitAccessPath.default;
  }
});
Object.defineProperty(exports, "stringValue", {
  enumerable: true,
  get: function () {
    return _stringValue.default;
  }
});
Object.defineProperty(exports, "toBoolean", {
  enumerable: true,
  get: function () {
    return _toBoolean.default;
  }
});
Object.defineProperty(exports, "toDate", {
  enumerable: true,
  get: function () {
    return _toDate.default;
  }
});
Object.defineProperty(exports, "toNumber", {
  enumerable: true,
  get: function () {
    return _toNumber.default;
  }
});
Object.defineProperty(exports, "toString", {
  enumerable: true,
  get: function () {
    return _toString.default;
  }
});
Object.defineProperty(exports, "toSet", {
  enumerable: true,
  get: function () {
    return _toSet.default;
  }
});
Object.defineProperty(exports, "truncate", {
  enumerable: true,
  get: function () {
    return _truncate.default;
  }
});
Object.defineProperty(exports, "visitArray", {
  enumerable: true,
  get: function () {
    return _visitArray.default;
  }
});

var _accessor = _interopRequireWildcard(require("./src/accessor"));

var _accessors = require("./src/accessors");

var _logger = _interopRequireWildcard(require("./src/logger"));

var _mergeConfig = require("./src/mergeConfig");

var _transform = require("./src/transform");

var _quarter = require("./src/quarter");

var _array = _interopRequireDefault(require("./src/array"));

var _clampRange = _interopRequireDefault(require("./src/clampRange"));

var _compare = _interopRequireDefault(require("./src/compare"));

var _constant = _interopRequireDefault(require("./src/constant"));

var _debounce = _interopRequireDefault(require("./src/debounce"));

var _error = _interopRequireDefault(require("./src/error"));

var _extend = _interopRequireDefault(require("./src/extend"));

var _extent = _interopRequireDefault(require("./src/extent"));

var _extentIndex = _interopRequireDefault(require("./src/extentIndex"));

var _fastmap = _interopRequireDefault(require("./src/fastmap"));

var _field = _interopRequireDefault(require("./src/field"));

var _flush = _interopRequireDefault(require("./src/flush"));

var _hasOwnProperty = _interopRequireDefault(require("./src/hasOwnProperty"));

var _inherits = _interopRequireDefault(require("./src/inherits"));

var _inrange = _interopRequireDefault(require("./src/inrange"));

var _isArray = _interopRequireDefault(require("./src/isArray"));

var _isBoolean = _interopRequireDefault(require("./src/isBoolean"));

var _isDate = _interopRequireDefault(require("./src/isDate"));

var _isFunction = _interopRequireDefault(require("./src/isFunction"));

var _isNumber = _interopRequireDefault(require("./src/isNumber"));

var _isObject = _interopRequireDefault(require("./src/isObject"));

var _isRegExp = _interopRequireDefault(require("./src/isRegExp"));

var _isString = _interopRequireDefault(require("./src/isString"));

var _key = _interopRequireDefault(require("./src/key"));

var _lerp = _interopRequireDefault(require("./src/lerp"));

var _merge = _interopRequireDefault(require("./src/merge"));

var _pad = _interopRequireDefault(require("./src/pad"));

var _peek = _interopRequireDefault(require("./src/peek"));

var _repeat = _interopRequireDefault(require("./src/repeat"));

var _span = _interopRequireDefault(require("./src/span"));

var _splitAccessPath = _interopRequireDefault(require("./src/splitAccessPath"));

var _stringValue = _interopRequireDefault(require("./src/stringValue"));

var _toBoolean = _interopRequireDefault(require("./src/toBoolean"));

var _toDate = _interopRequireDefault(require("./src/toDate"));

var _toNumber = _interopRequireDefault(require("./src/toNumber"));

var _toString = _interopRequireDefault(require("./src/toString"));

var _toSet = _interopRequireDefault(require("./src/toSet"));

var _truncate = _interopRequireDefault(require("./src/truncate"));

var _visitArray = _interopRequireDefault(require("./src/visitArray"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
},{"./src/accessor":"eUAn","./src/accessors":"i6JF","./src/logger":"CCFi","./src/mergeConfig":"SLBi","./src/transform":"Vsez","./src/quarter":"zaTZ","./src/array":"vQw3","./src/clampRange":"yB6Z","./src/compare":"FLnm","./src/constant":"v180","./src/debounce":"Jdp6","./src/error":"MSzm","./src/extend":"cI24","./src/extent":"Lmbs","./src/extentIndex":"LRTq","./src/fastmap":"G1oZ","./src/field":"i32D","./src/flush":"Ga0Y","./src/hasOwnProperty":"shrV","./src/inherits":"x2xL","./src/inrange":"IIGL","./src/isArray":"ocRV","./src/isBoolean":"iXuS","./src/isDate":"fS6u","./src/isFunction":"JRL8","./src/isNumber":"hvB3","./src/isObject":"HHXR","./src/isRegExp":"LQHk","./src/isString":"P8Vo","./src/key":"sV9b","./src/lerp":"vC6A","./src/merge":"XBV1","./src/pad":"rW7L","./src/peek":"reAw","./src/repeat":"PGwr","./src/span":"yXXE","./src/splitAccessPath":"sk85","./src/stringValue":"bLbI","./src/toBoolean":"ZxAv","./src/toDate":"VHYr","./src/toNumber":"Qkx3","./src/toString":"jg26","./src/toSet":"pUPE","./src/truncate":"XXzk","./src/visitArray":"emIe"}],"VQpj":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = UniqueList;

var _vegaUtil = require("vega-util");

function UniqueList(idFunc) {
  var $ = idFunc || _vegaUtil.identity,
      list = [],
      ids = {};

  list.add = function (_) {
    var id = $(_);

    if (!ids[id]) {
      ids[id] = 1;
      list.push(_);
    }

    return list;
  };

  list.remove = function (_) {
    var id = $(_),
        idx;

    if (ids[id]) {
      ids[id] = 0;

      if ((idx = list.indexOf(_)) >= 0) {
        list.splice(idx, 1);
      }
    }

    return list;
  };

  return list;
}
},{"vega-util":"dejJ"}],"rfb2":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

/**
 * 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 _default(df, callback) {
  try {
    await callback(df);
  } catch (err) {
    df.error(err);
  }
}
},{}],"dQkW":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.reset = reset;
exports.isTuple = isTuple;
exports.tupleid = tupleid;
exports.ingest = ingest;
exports.derive = derive;
exports.rederive = rederive;
exports.replace = replace;
exports.stableCompare = stableCompare;
var TUPLE_ID_KEY = Symbol('vega_id'),
    TUPLE_ID = 1;
/**
 * Resets the internal tuple id counter to one.
 */

function reset() {
  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(datum) {
  var 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 derive(t) {
  return rederive(t, ingest({}));
}
/**
 * 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 (var 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);
}
},{}],"VswZ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.isChangeSet = isChangeSet;
exports.default = changeset;

var _Tuple = require("./Tuple");

var _vegaUtil = require("vega-util");

function isChangeSet(v) {
  return v && v.constructor === changeset;
}

function changeset() {
  var add = [],
      // insert tuples
  rem = [],
      // remove tuples
  mod = [],
      // modify tuples
  remp = [],
      // remove by predicate
  modp = [],
      // modify by predicate
  reflow = false;
  return {
    constructor: changeset,
    insert: function (t) {
      var d = (0, _vegaUtil.array)(t),
          i = 0,
          n = d.length;

      for (; i < n; ++i) add.push(d[i]);

      return this;
    },
    remove: function (t) {
      var a = (0, _vegaUtil.isFunction)(t) ? remp : rem,
          d = (0, _vegaUtil.array)(t),
          i = 0,
          n = d.length;

      for (; i < n; ++i) a.push(d[i]);

      return this;
    },
    modify: function (t, field, value) {
      var m = {
        field: field,
        value: (0, _vegaUtil.constant)(value)
      };

      if ((0, _vegaUtil.isFunction)(t)) {
        m.filter = t;
        modp.push(m);
      } else {
        m.tuple = t;
        mod.push(m);
      }

      return this;
    },
    encode: function (t, set) {
      if ((0, _vegaUtil.isFunction)(t)) modp.push({
        filter: t,
        field: set
      });else mod.push({
        tuple: t,
        field: set
      });
      return this;
    },
    reflow: function () {
      reflow = true;
      return this;
    },
    pulse: function (pulse, tuples) {
      var cur = {},
          out = {},
          i,
          n,
          m,
          f,
          t,
          id; // build lookup table of current tuples

      for (i = 0, n = tuples.length; i < n; ++i) {
        cur[(0, _Tuple.tupleid)(tuples[i])] = 1;
      } // process individual tuples to remove


      for (i = 0, n = rem.length; i < n; ++i) {
        t = rem[i];
        cur[(0, _Tuple.tupleid)(t)] = -1;
      } // process predicate-based removals


      for (i = 0, n = remp.length; i < n; ++i) {
        f = remp[i];
        tuples.forEach(function (t) {
          if (f(t)) cur[(0, _Tuple.tupleid)(t)] = -1;
        });
      } // process all add tuples


      for (i = 0, n = add.length; i < n; ++i) {
        t = add[i];
        id = (0, _Tuple.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((0, _Tuple.ingest)(add[i]));
        }
      } // populate pulse rem list


      for (i = 0, n = tuples.length; i < n; ++i) {
        t = tuples[i];
        if (cur[(0, _Tuple.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[(0, _Tuple.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[(0, _Tuple.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(function (t) {
          if (f(t) && cur[(0, _Tuple.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(function (t) {
          return cur[(0, _Tuple.tupleid)(t)] > 0;
        }) : tuples.slice();
      } else {
        for (id in out) pulse.mod.push(out[id]);
      }

      return pulse;
    }
  };
}
},{"./Tuple":"dQkW","vega-util":"dejJ"}],"Ie0V":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Parameters;

var _vegaUtil = require("vega-util");

var 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: {}
  });
}

var prototype = 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.
 */

prototype.set = function (name, index, value, force) {
  var 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] = (0, _vegaUtil.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.
 */


prototype.modified = function (name, index) {
  var mod = this[CACHE],
      k;

  if (!arguments.length) {
    for (k in mod) {
      if (mod[k]) return true;
    }

    return false;
  } else if ((0, _vegaUtil.isArray)(name)) {
    for (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.
 */


prototype.clear = function () {
  this[CACHE] = {};
  return this;
};
},{"vega-util":"dejJ"}],"ODzd":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Operator;

var _Parameters = _interopRequireDefault(require("./Parameters"));

var _UniqueList = _interopRequireDefault(require("./util/UniqueList"));

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var OP_ID = 0;
var PULSE = 'pulse';
var NO_PARAMS = new _Parameters.default(); // Boolean Flags

var SKIP = 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);
}

var prototype = 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}
 */

prototype.targets = function () {
  return this._targets || (this._targets = (0, _UniqueList.default)(_vegaUtil.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.
 */


prototype.set = function (value) {
  if (this.value !== value) {
    this.value = value;
    return 1;
  } else {
    return 0;
  }
};

function flag(bit) {
  return function (state) {
    var f = this.flags;
    if (arguments.length === 0) return !!(f & bit);
    this.flags = state ? f | bit : f & ~bit;
    return this;
  };
}
/**
 * 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.
 */


prototype.skip = flag(SKIP);
/**
 * 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.
 */

prototype.modified = 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.
 */

prototype.parameters = function (params, react, initonly) {
  react = react !== false;
  var self = this,
      argval = self._argval = self._argval || new _Parameters.default(),
      argops = self._argops = self._argops || [],
      deps = [],
      name,
      value,
      n,
      i;

  function add(name, index, value) {
    if (value instanceof Operator) {
      if (value !== self) {
        if (react) value.targets().add(self);
        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) {
      (0, _vegaUtil.array)(value).forEach(function (op) {
        if (!(op instanceof Operator)) {
          (0, _vegaUtil.error)('Pulse parameters must be operator instances.');
        } else if (op !== self) {
          op.targets().add(self);
          deps.push(op);
        }
      });
      self.source = value;
    } else if ((0, _vegaUtil.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.
 */


prototype.marshall = function (stamp) {
  var argval = this._argval || NO_PARAMS,
      argops = this._argops,
      item,
      i,
      n,
      op,
      mod;

  if (argops) {
    for (i = 0, n = argops.length; 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;
};
/**
 * 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.
 */


prototype.evaluate = function (pulse) {
  var update = this._update;

  if (update) {
    var 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)
 */


prototype.run = function (pulse) {
  if (pulse.stamp < this.stamp) return pulse.StopPropagation;
  var rv;

  if (this.skip()) {
    this.skip(false);
    rv = 0;
  } else {
    rv = this.evaluate(pulse);
  }

  return this.pulse = rv || pulse;
};
},{"./Parameters":"Ie0V","./util/UniqueList":"VQpj","vega-util":"dejJ"}],"GEkR":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _Operator = _interopRequireDefault(require("../Operator"));

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * 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 _default(init, update, params, react) {
  var shift = 1,
      op;

  if (init instanceof _Operator.default) {
    op = init;
  } else if (init && init.prototype instanceof _Operator.default) {
    op = new init();
  } else if ((0, _vegaUtil.isFunction)(init)) {
    op = new _Operator.default(null, init);
  } else {
    shift = 0;
    op = new _Operator.default(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;
}
},{"../Operator":"ODzd","vega-util":"dejJ"}],"XYnh":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

/**
 * 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 _default(target, sources) {
  var targetRank = target.rank,
      i,
      n;

  for (i = 0, n = sources.length; i < n; ++i) {
    if (targetRank < sources[i].rank) {
      this.rerank(target);
      return;
    }
  }
}
},{}],"NW4e":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = EventStream;
exports.stream = stream;

var _UniqueList = _interopRequireDefault(require("./util/UniqueList"));

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var 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 stream(filter, apply, receive) {
  return new EventStream(filter, apply, receive);
}

var prototype = EventStream.prototype;
prototype._filter = _vegaUtil.truthy;
prototype._apply = _vegaUtil.identity;

prototype.targets = function () {
  return this._targets || (this._targets = (0, _UniqueList.default)(_vegaUtil.id));
};

prototype.consume = function (_) {
  if (!arguments.length) return !!this._consume;
  this._consume = !!_;
  return this;
};

prototype.receive = function (evt) {
  if (this._filter(evt)) {
    var val = this.value = this._apply(evt),
        trg = this._targets,
        n = trg ? trg.length : 0,
        i = 0;

    for (; i < n; ++i) trg[i].receive(val);

    if (this._consume) {
      evt.preventDefault();
      evt.stopPropagation();
    }
  }
};

prototype.filter = function (filter) {
  var s = stream(filter);
  this.targets().add(s);
  return s;
};

prototype.apply = function (apply) {
  var s = stream(null, apply);
  this.targets().add(s);
  return s;
};

prototype.merge = function () {
  var s = stream();
  this.targets().add(s);

  for (var i = 0, n = arguments.length; i < n; ++i) {
    arguments[i].targets().add(s);
  }

  return s;
};

prototype.throttle = function (pause) {
  var t = -1;
  return this.filter(function () {
    var now = Date.now();

    if (now - t > pause) {
      t = now;
      return 1;
    } else {
      return 0;
    }
  });
};

prototype.debounce = function (delay) {
  var s = stream();
  this.targets().add(stream(null, null, (0, _vegaUtil.debounce)(delay, function (e) {
    var df = e.dataflow;
    s.receive(e);
    if (df && df.run) df.run();
  })));
  return s;
};

prototype.between = function (a, b) {
  var active = false;
  a.targets().add(stream(null, null, function () {
    active = true;
  }));
  b.targets().add(stream(null, null, function () {
    active = false;
  }));
  return this.filter(function () {
    return active;
  });
};
},{"./util/UniqueList":"VQpj","vega-util":"dejJ"}],"bnHl":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _EventStream = require("../EventStream");

var _vegaUtil = require("vega-util");

/**
 * 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 _default(source, type, filter, apply) {
  var df = this,
      s = (0, _EventStream.stream)(filter, apply),
      send = function (e) {
    e.dataflow = df;

    try {
      s.receive(e);
    } catch (error) {
      df.error(error);
    } finally {
      df.run();
    }
  },
      sources;

  if (typeof source === 'string' && typeof document !== 'undefined') {
    sources = document.querySelectorAll(source);
  } else {
    sources = (0, _vegaUtil.array)(source);
  }

  for (var i = 0, n = sources.length; i < n; ++i) {
    sources[i].addEventListener(type, send);
  }

  return s;
}
},{"../EventStream":"NW4e","vega-util":"dejJ"}],"aRmL":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _vegaUtil = require("vega-util");

// Matches absolute URLs with optional protocol
//   https://...    file://...    //...
const protocol_re = /^([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):|[^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 _default(fetch, fs) {
  return function (options) {
    return {
      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 sanity 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 = (0, _vegaUtil.extend)({}, 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) {
    (0, _vegaUtil.error)('Sanitize failure, invalid URI: ' + (0, _vegaUtil.stringValue)(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[base.length - 1] !== '/') {
      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 + '';
  } // 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 ? function (filename) {
    return new Promise(function (accept, reject) {
      fs.readFile(filename, function (error, data) {
        if (error) reject(error);else accept(data);
      });
    });
  } : fileReject;
}
/**
 * Default file system loader that simply rejects.
 */


async function fileReject() {
  (0, _vegaUtil.error)('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 = (0, _vegaUtil.extend)({}, this.options.http, options),
          type = options && options.response,
          response = await fetch(url, opt);
    return !response.ok ? (0, _vegaUtil.error)(response.status + '' + response.statusText) : (0, _vegaUtil.isFunction)(response[type]) ? response[type]() : response.text();
  } : httpReject;
}
/**
 * Default http request handler that simply rejects.
 */


async function httpReject() {
  (0, _vegaUtil.error)('No HTTP fetch method available.');
}
},{"vega-util":"dejJ"}],"iCuC":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.inferType = inferType;
exports.inferTypes = inferTypes;
exports.typeParsers = void 0;

var _vegaUtil = require("vega-util");

var typeParsers = {
  boolean: _vegaUtil.toBoolean,
  integer: _vegaUtil.toNumber,
  number: _vegaUtil.toNumber,
  date: _vegaUtil.toDate,
  string: _vegaUtil.toString,
  unknown: _vegaUtil.identity
};
exports.typeParsers = typeParsers;
var typeTests = [isBoolean, isInteger, isNumber, isDate];
var typeList = ['boolean', 'integer', 'number', 'date'];

function inferType(values, field) {
  if (!values || !values.length) return 'unknown';
  var value,
      i,
      j,
      t = 0,
      n = values.length,
      m = typeTests.length,
      a = typeTests.map(function (_, i) {
    return i + 1;
  });

  for (i = 0, n = values.length; 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';
      }
    }
  }

  t = a.reduce(function (u, v) {
    return u === 0 ? v : u;
  }, 0) - 1;
  return typeList[t];
}

function inferTypes(data, fields) {
  return fields.reduce(function (types, field) {
    types[field] = inferType(data, field);
    return types;
  }, {});
} // -- Type Checks ----


function isValid(_) {
  return _ != null && _ === _;
}

function isBoolean(_) {
  return _ === 'true' || _ === 'false' || _ === true || _ === false;
}

function isDate(_) {
  return !Number.isNaN(Date.parse(_));
}

function isNumber(_) {
  return !Number.isNaN(+_) && !(_ instanceof Date);
}

function isInteger(_) {
  return isNumber(_) && Number.isInteger(+_);
}
},{"vega-util":"dejJ"}],"tL5P":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
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" : "");
}

function _default(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
  };
}
},{}],"fKkG":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.csvFormatValue = exports.csvFormatRow = exports.csvFormatRows = exports.csvFormatBody = exports.csvFormat = exports.csvParseRows = exports.csvParse = void 0;

var _dsv = _interopRequireDefault(require("./dsv.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var csv = (0, _dsv.default)(",");
var csvParse = csv.parse;
exports.csvParse = csvParse;
var csvParseRows = csv.parseRows;
exports.csvParseRows = csvParseRows;
var csvFormat = csv.format;
exports.csvFormat = csvFormat;
var csvFormatBody = csv.formatBody;
exports.csvFormatBody = csvFormatBody;
var csvFormatRows = csv.formatRows;
exports.csvFormatRows = csvFormatRows;
var csvFormatRow = csv.formatRow;
exports.csvFormatRow = csvFormatRow;
var csvFormatValue = csv.formatValue;
exports.csvFormatValue = csvFormatValue;
},{"./dsv.js":"tL5P"}],"tbIf":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.tsvFormatValue = exports.tsvFormatRow = exports.tsvFormatRows = exports.tsvFormatBody = exports.tsvFormat = exports.tsvParseRows = exports.tsvParse = void 0;

var _dsv = _interopRequireDefault(require("./dsv.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var tsv = (0, _dsv.default)("\t");
var tsvParse = tsv.parse;
exports.tsvParse = tsvParse;
var tsvParseRows = tsv.parseRows;
exports.tsvParseRows = tsvParseRows;
var tsvFormat = tsv.format;
exports.tsvFormat = tsvFormat;
var tsvFormatBody = tsv.formatBody;
exports.tsvFormatBody = tsvFormatBody;
var tsvFormatRows = tsv.formatRows;
exports.tsvFormatRows = tsvFormatRows;
var tsvFormatRow = tsv.formatRow;
exports.tsvFormatRow = tsvFormatRow;
var tsvFormatValue = tsv.formatValue;
exports.tsvFormatValue = tsvFormatValue;
},{"./dsv.js":"tL5P"}],"ztEN":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = autoType;

function autoType(object) {
  for (var key in object) {
    var value = object[key].trim(),
        number,
        m;
    if (!value) value = null;else if (value === "true") value = true;else if (value === "false") value = false;else if (value === "NaN") value = NaN;else if (!isNaN(number = +value)) value = number;else if (m = value.match(/^([-+]\d{2})?\d{4}(-\d{2}(-\d{2})?)?(T\d{2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|[-+]\d{2}:\d{2})?)?$/)) {
      if (fixtz && !!m[4] && !m[7]) value = value.replace(/-/g, "/").replace(/T/, " ");
      value = new Date(value);
    } else continue;
    object[key] = value;
  }

  return object;
} // https://github.com/d3/d3-dsv/issues/45


var fixtz = new Date("2019-01-01T00:00").getHours() || new Date("2019-07-01T00:00").getHours();
},{}],"OUxC":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "dsvFormat", {
  enumerable: true,
  get: function () {
    return _dsv.default;
  }
});
Object.defineProperty(exports, "csvParse", {
  enumerable: true,
  get: function () {
    return _csv.csvParse;
  }
});
Object.defineProperty(exports, "csvParseRows", {
  enumerable: true,
  get: function () {
    return _csv.csvParseRows;
  }
});
Object.defineProperty(exports, "csvFormat", {
  enumerable: true,
  get: function () {
    return _csv.csvFormat;
  }
});
Object.defineProperty(exports, "csvFormatBody", {
  enumerable: true,
  get: function () {
    return _csv.csvFormatBody;
  }
});
Object.defineProperty(exports, "csvFormatRows", {
  enumerable: true,
  get: function () {
    return _csv.csvFormatRows;
  }
});
Object.defineProperty(exports, "csvFormatRow", {
  enumerable: true,
  get: function () {
    return _csv.csvFormatRow;
  }
});
Object.defineProperty(exports, "csvFormatValue", {
  enumerable: true,
  get: function () {
    return _csv.csvFormatValue;
  }
});
Object.defineProperty(exports, "tsvParse", {
  enumerable: true,
  get: function () {
    return _tsv.tsvParse;
  }
});
Object.defineProperty(exports, "tsvParseRows", {
  enumerable: true,
  get: function () {
    return _tsv.tsvParseRows;
  }
});
Object.defineProperty(exports, "tsvFormat", {
  enumerable: true,
  get: function () {
    return _tsv.tsvFormat;
  }
});
Object.defineProperty(exports, "tsvFormatBody", {
  enumerable: true,
  get: function () {
    return _tsv.tsvFormatBody;
  }
});
Object.defineProperty(exports, "tsvFormatRows", {
  enumerable: true,
  get: function () {
    return _tsv.tsvFormatRows;
  }
});
Object.defineProperty(exports, "tsvFormatRow", {
  enumerable: true,
  get: function () {
    return _tsv.tsvFormatRow;
  }
});
Object.defineProperty(exports, "tsvFormatValue", {
  enumerable: true,
  get: function () {
    return _tsv.tsvFormatValue;
  }
});
Object.defineProperty(exports, "autoType", {
  enumerable: true,
  get: function () {
    return _autoType.default;
  }
});

var _dsv = _interopRequireDefault(require("./dsv.js"));

var _csv = require("./csv.js");

var _tsv = require("./tsv.js");

var _autoType = _interopRequireDefault(require("./autoType.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./dsv.js":"tL5P","./csv.js":"fKkG","./tsv.js":"tbIf","./autoType.js":"ztEN"}],"G1mB":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.delimitedFormat = delimitedFormat;
exports.default = dsv;

var _d3Dsv = require("d3-dsv");

var _vegaUtil = require("vega-util");

function delimitedFormat(delimiter) {
  const parse = function (data, format) {
    const delim = {
      delimiter: delimiter
    };
    return dsv(data, format ? (0, _vegaUtil.extend)(format, delim) : delim);
  };

  parse.responseType = 'text';
  return parse;
}

function dsv(data, format) {
  if (format.header) {
    data = format.header.map(_vegaUtil.stringValue).join(format.delimiter) + '\n' + data;
  }

  return (0, _d3Dsv.dsvFormat)(format.delimiter).parse(data + '');
}

dsv.responseType = 'text';
},{"d3-dsv":"OUxC","vega-util":"dejJ"}],"ZxbG":[function(require,module,exports) {
'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('')
}

},{}],"xduo":[function(require,module,exports) {
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
}

},{}],"MPXn":[function(require,module,exports) {
var toString = {}.toString;

module.exports = Array.isArray || function (arr) {
  return toString.call(arr) == '[object Array]';
};

},{}],"ISQD":[function(require,module,exports) {

var global = arguments[3];
/*!
 * The buffer module from node.js, for the browser.
 *
 * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
 * @license  MIT
 */
/* eslint-disable no-proto */

'use strict'

var base64 = require('base64-js')
var ieee754 = require('ieee754')
var isArray = require('isarray')

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
}

},{"base64-js":"ZxbG","ieee754":"xduo","isarray":"MPXn","buffer":"ISQD"}],"OGkx":[function(require,module,exports) {
var Buffer = require("buffer").Buffer;
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = json;

var _vegaUtil = require("vega-util");

function isBuffer(_) {
  return typeof Buffer === 'function' && (0, _vegaUtil.isFunction)(Buffer.isBuffer) ? Buffer.isBuffer(_) : false;
}

function json(data, format) {
  const prop = format && format.property ? (0, _vegaUtil.field)(format.property) : _vegaUtil.identity;
  return (0, _vegaUtil.isObject)(data) && !isBuffer(data) ? parseJSON(prop(data)) : prop(JSON.parse(data));
}

json.responseType = 'json';

function parseJSON(data, format) {
  return format && format.copy ? JSON.parse(JSON.stringify(data)) : data;
}
},{"vega-util":"dejJ","buffer":"ISQD"}],"nbTg":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _identity = _interopRequireDefault(require("./identity.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(transform) {
  if (transform == null) return _identity.default;
  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;
  };
}
},{"./identity.js":"LuEH"}],"SPxy":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _transform = _interopRequireDefault(require("./transform.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(topology) {
  var t = (0, _transform.default)(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];
}
},{"./transform.js":"nbTg"}],"FMgf":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(array, n) {
  var t,
      j = array.length,
      i = j - n;

  while (i < --j) t = array[i], array[i++] = array[j], array[j] = t;
}
},{}],"nVb3":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.object = object;

var _reverse = _interopRequireDefault(require("./reverse.js"));

var _transform = _interopRequireDefault(require("./transform.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(topology, o) {
  if (typeof o === "string") o = topology.objects[o];
  return o.type === "GeometryCollection" ? {
    type: "FeatureCollection",
    features: o.geometries.map(function (o) {
      return feature(topology, o);
    })
  } : feature(topology, o);
}

function feature(topology, o) {
  var id = o.id,
      bbox = o.bbox,
      properties = o.properties == null ? {} : o.properties,
      geometry = 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 object(topology, o) {
  var transformPoint = (0, _transform.default)(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) (0, _reverse.default)(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);
}
},{"./reverse.js":"FMgf","./transform.js":"nbTg"}],"NI4v":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(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;
}
},{}],"j61X":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.meshArcs = meshArcs;

var _feature = require("./feature.js");

var _stitch = _interopRequireDefault(require("./stitch.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(topology) {
  return (0, _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: (0, _stitch.default)(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;
}
},{"./feature.js":"nVb3","./stitch.js":"NI4v"}],"CzXn":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.mergeArcs = mergeArcs;

var _feature = require("./feature.js");

var _stitch = _interopRequireDefault(require("./stitch.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

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!
}

function _default(topology) {
  return (0, _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((0, _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 = (0, _stitch.default)(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;
    })
  };
}
},{"./feature.js":"nVb3","./stitch.js":"NI4v"}],"umQ3":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(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;
}
},{}],"D2Pe":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _bisect = _interopRequireDefault(require("./bisect.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(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 = (0, _bisect.default)(n, ik)] !== ik) n.splice(i, 0, ik);
        if ((n = neighbors[ik])[i = (0, _bisect.default)(n, ij)] !== ij) n.splice(i, 0, ij);
      }
    }
  }

  return neighbors;
}
},{"./bisect.js":"umQ3"}],"xfSQ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _identity = _interopRequireDefault(require("./identity.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(transform) {
  if (transform == null) return _identity.default;
  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;
  };
}
},{"./identity.js":"LuEH"}],"c0Mt":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _bbox = _interopRequireDefault(require("./bbox.js"));

var _untransform = _interopRequireDefault(require("./untransform.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(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 || (0, _bbox.default)(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 = (0, _untransform.default)(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)
  };
}
},{"./bbox.js":"SPxy","./untransform.js":"xfSQ"}],"nipz":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "bbox", {
  enumerable: true,
  get: function () {
    return _bbox.default;
  }
});
Object.defineProperty(exports, "feature", {
  enumerable: true,
  get: function () {
    return _feature.default;
  }
});
Object.defineProperty(exports, "mesh", {
  enumerable: true,
  get: function () {
    return _mesh.default;
  }
});
Object.defineProperty(exports, "meshArcs", {
  enumerable: true,
  get: function () {
    return _mesh.meshArcs;
  }
});
Object.defineProperty(exports, "merge", {
  enumerable: true,
  get: function () {
    return _merge.default;
  }
});
Object.defineProperty(exports, "mergeArcs", {
  enumerable: true,
  get: function () {
    return _merge.mergeArcs;
  }
});
Object.defineProperty(exports, "neighbors", {
  enumerable: true,
  get: function () {
    return _neighbors.default;
  }
});
Object.defineProperty(exports, "quantize", {
  enumerable: true,
  get: function () {
    return _quantize.default;
  }
});
Object.defineProperty(exports, "transform", {
  enumerable: true,
  get: function () {
    return _transform.default;
  }
});
Object.defineProperty(exports, "untransform", {
  enumerable: true,
  get: function () {
    return _untransform.default;
  }
});

var _bbox = _interopRequireDefault(require("./bbox.js"));

var _feature = _interopRequireDefault(require("./feature.js"));

var _mesh = _interopRequireWildcard(require("./mesh.js"));

var _merge = _interopRequireWildcard(require("./merge.js"));

var _neighbors = _interopRequireDefault(require("./neighbors.js"));

var _quantize = _interopRequireDefault(require("./quantize.js"));

var _transform = _interopRequireDefault(require("./transform.js"));

var _untransform = _interopRequireDefault(require("./untransform.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./bbox.js":"SPxy","./feature.js":"nVb3","./mesh.js":"j61X","./merge.js":"CzXn","./neighbors.js":"D2Pe","./quantize.js":"c0Mt","./transform.js":"nbTg","./untransform.js":"xfSQ"}],"JVlB":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = topojson;

var _json = _interopRequireDefault(require("./json"));

var _topojsonClient = require("topojson-client");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

const filters = {
  interior: (a, b) => a !== b,
  exterior: (a, b) => a === b
};

function topojson(data, format) {
  let method, object, property, filter;
  data = (0, _json.default)(data, format);

  if (format && format.feature) {
    method = _topojsonClient.feature;
    property = format.feature;
  } else if (format && format.mesh) {
    method = _topojsonClient.mesh;
    property = format.mesh;
    filter = filters[format.filter];
  } else {
    (0, _vegaUtil.error)('Missing TopoJSON feature or mesh parameter.');
  }

  object = (object = data.objects[property]) ? method(data, object, filter) : (0, _vegaUtil.error)('Invalid TopoJSON object: ' + property);
  return object && object.features || [object];
}

topojson.responseType = 'json';
},{"./json":"OGkx","topojson-client":"nipz","vega-util":"dejJ"}],"xgvC":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.formats = formats;
exports.responseType = responseType;
exports.format = void 0;

var _dsv = _interopRequireWildcard(require("./dsv"));

var _json = _interopRequireDefault(require("./json"));

var _topojson = _interopRequireDefault(require("./topojson"));

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

const format = {
  dsv: _dsv.default,
  csv: (0, _dsv.delimitedFormat)(','),
  tsv: (0, _dsv.delimitedFormat)('\t'),
  json: _json.default,
  topojson: _topojson.default
};
exports.format = format;

function formats(name, reader) {
  if (arguments.length > 1) {
    format[name] = reader;
    return this;
  } else {
    return (0, _vegaUtil.hasOwnProperty)(format, name) ? format[name] : null;
  }
}

function responseType(type) {
  const f = formats(type);
  return f && f.responseType || 'text';
}
},{"./dsv":"G1mB","./json":"OGkx","./topojson":"JVlB","vega-util":"dejJ"}],"ia2J":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = 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;
}
},{}],"YQ38":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.milliseconds = exports.default = void 0;

var _interval = _interopRequireDefault(require("./interval.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var millisecond = (0, _interval.default)(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 (0, _interval.default)(function (date) {
    date.setTime(Math.floor(date / k) * k);
  }, function (date, step) {
    date.setTime(+date + step * k);
  }, function (start, end) {
    return (end - start) / k;
  });
};

var _default = millisecond;
exports.default = _default;
var milliseconds = millisecond.range;
exports.milliseconds = milliseconds;
},{"./interval.js":"ia2J"}],"woBw":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.durationWeek = exports.durationDay = exports.durationHour = exports.durationMinute = exports.durationSecond = void 0;
var durationSecond = 1e3;
exports.durationSecond = durationSecond;
var durationMinute = 6e4;
exports.durationMinute = durationMinute;
var durationHour = 36e5;
exports.durationHour = durationHour;
var durationDay = 864e5;
exports.durationDay = durationDay;
var durationWeek = 6048e5;
exports.durationWeek = durationWeek;
},{}],"nNS8":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.seconds = exports.default = void 0;

var _interval = _interopRequireDefault(require("./interval.js"));

var _duration = require("./duration.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var second = (0, _interval.default)(function (date) {
  date.setTime(date - date.getMilliseconds());
}, function (date, step) {
  date.setTime(+date + step * _duration.durationSecond);
}, function (start, end) {
  return (end - start) / _duration.durationSecond;
}, function (date) {
  return date.getUTCSeconds();
});
var _default = second;
exports.default = _default;
var seconds = second.range;
exports.seconds = seconds;
},{"./interval.js":"ia2J","./duration.js":"woBw"}],"NxbZ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.minutes = exports.default = void 0;

var _interval = _interopRequireDefault(require("./interval.js"));

var _duration = require("./duration.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var minute = (0, _interval.default)(function (date) {
  date.setTime(date - date.getMilliseconds() - date.getSeconds() * _duration.durationSecond);
}, function (date, step) {
  date.setTime(+date + step * _duration.durationMinute);
}, function (start, end) {
  return (end - start) / _duration.durationMinute;
}, function (date) {
  return date.getMinutes();
});
var _default = minute;
exports.default = _default;
var minutes = minute.range;
exports.minutes = minutes;
},{"./interval.js":"ia2J","./duration.js":"woBw"}],"ShhP":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.hours = exports.default = void 0;

var _interval = _interopRequireDefault(require("./interval.js"));

var _duration = require("./duration.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var hour = (0, _interval.default)(function (date) {
  date.setTime(date - date.getMilliseconds() - date.getSeconds() * _duration.durationSecond - date.getMinutes() * _duration.durationMinute);
}, function (date, step) {
  date.setTime(+date + step * _duration.durationHour);
}, function (start, end) {
  return (end - start) / _duration.durationHour;
}, function (date) {
  return date.getHours();
});
var _default = hour;
exports.default = _default;
var hours = hour.range;
exports.hours = hours;
},{"./interval.js":"ia2J","./duration.js":"woBw"}],"mZUN":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.days = exports.default = void 0;

var _interval = _interopRequireDefault(require("./interval.js"));

var _duration = require("./duration.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var day = (0, _interval.default)(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()) * _duration.durationMinute) / _duration.durationDay;
}, function (date) {
  return date.getDate() - 1;
});
var _default = day;
exports.default = _default;
var days = day.range;
exports.days = days;
},{"./interval.js":"ia2J","./duration.js":"woBw"}],"HYDq":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.saturdays = exports.fridays = exports.thursdays = exports.wednesdays = exports.tuesdays = exports.mondays = exports.sundays = exports.saturday = exports.friday = exports.thursday = exports.wednesday = exports.tuesday = exports.monday = exports.sunday = void 0;

var _interval = _interopRequireDefault(require("./interval.js"));

var _duration = require("./duration.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function weekday(i) {
  return (0, _interval.default)(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.durationMinute) / _duration.durationWeek;
  });
}

var sunday = weekday(0);
exports.sunday = sunday;
var monday = weekday(1);
exports.monday = monday;
var tuesday = weekday(2);
exports.tuesday = tuesday;
var wednesday = weekday(3);
exports.wednesday = wednesday;
var thursday = weekday(4);
exports.thursday = thursday;
var friday = weekday(5);
exports.friday = friday;
var saturday = weekday(6);
exports.saturday = saturday;
var sundays = sunday.range;
exports.sundays = sundays;
var mondays = monday.range;
exports.mondays = mondays;
var tuesdays = tuesday.range;
exports.tuesdays = tuesdays;
var wednesdays = wednesday.range;
exports.wednesdays = wednesdays;
var thursdays = thursday.range;
exports.thursdays = thursdays;
var fridays = friday.range;
exports.fridays = fridays;
var saturdays = saturday.range;
exports.saturdays = saturdays;
},{"./interval.js":"ia2J","./duration.js":"woBw"}],"BD8V":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.months = exports.default = void 0;

var _interval = _interopRequireDefault(require("./interval.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var month = (0, _interval.default)(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();
});
var _default = month;
exports.default = _default;
var months = month.range;
exports.months = months;
},{"./interval.js":"ia2J"}],"Aez4":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.years = exports.default = void 0;

var _interval = _interopRequireDefault(require("./interval.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var year = (0, _interval.default)(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 : (0, _interval.default)(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);
  });
};

var _default = year;
exports.default = _default;
var years = year.range;
exports.years = years;
},{"./interval.js":"ia2J"}],"O3Kl":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.utcMinutes = exports.default = void 0;

var _interval = _interopRequireDefault(require("./interval.js"));

var _duration = require("./duration.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var utcMinute = (0, _interval.default)(function (date) {
  date.setUTCSeconds(0, 0);
}, function (date, step) {
  date.setTime(+date + step * _duration.durationMinute);
}, function (start, end) {
  return (end - start) / _duration.durationMinute;
}, function (date) {
  return date.getUTCMinutes();
});
var _default = utcMinute;
exports.default = _default;
var utcMinutes = utcMinute.range;
exports.utcMinutes = utcMinutes;
},{"./interval.js":"ia2J","./duration.js":"woBw"}],"f0g5":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.utcHours = exports.default = void 0;

var _interval = _interopRequireDefault(require("./interval.js"));

var _duration = require("./duration.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var utcHour = (0, _interval.default)(function (date) {
  date.setUTCMinutes(0, 0, 0);
}, function (date, step) {
  date.setTime(+date + step * _duration.durationHour);
}, function (start, end) {
  return (end - start) / _duration.durationHour;
}, function (date) {
  return date.getUTCHours();
});
var _default = utcHour;
exports.default = _default;
var utcHours = utcHour.range;
exports.utcHours = utcHours;
},{"./interval.js":"ia2J","./duration.js":"woBw"}],"nsxn":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.utcDays = exports.default = void 0;

var _interval = _interopRequireDefault(require("./interval.js"));

var _duration = require("./duration.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var utcDay = (0, _interval.default)(function (date) {
  date.setUTCHours(0, 0, 0, 0);
}, function (date, step) {
  date.setUTCDate(date.getUTCDate() + step);
}, function (start, end) {
  return (end - start) / _duration.durationDay;
}, function (date) {
  return date.getUTCDate() - 1;
});
var _default = utcDay;
exports.default = _default;
var utcDays = utcDay.range;
exports.utcDays = utcDays;
},{"./interval.js":"ia2J","./duration.js":"woBw"}],"bIsM":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.utcSaturdays = exports.utcFridays = exports.utcThursdays = exports.utcWednesdays = exports.utcTuesdays = exports.utcMondays = exports.utcSundays = exports.utcSaturday = exports.utcFriday = exports.utcThursday = exports.utcWednesday = exports.utcTuesday = exports.utcMonday = exports.utcSunday = void 0;

var _interval = _interopRequireDefault(require("./interval.js"));

var _duration = require("./duration.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function utcWeekday(i) {
  return (0, _interval.default)(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.durationWeek;
  });
}

var utcSunday = utcWeekday(0);
exports.utcSunday = utcSunday;
var utcMonday = utcWeekday(1);
exports.utcMonday = utcMonday;
var utcTuesday = utcWeekday(2);
exports.utcTuesday = utcTuesday;
var utcWednesday = utcWeekday(3);
exports.utcWednesday = utcWednesday;
var utcThursday = utcWeekday(4);
exports.utcThursday = utcThursday;
var utcFriday = utcWeekday(5);
exports.utcFriday = utcFriday;
var utcSaturday = utcWeekday(6);
exports.utcSaturday = utcSaturday;
var utcSundays = utcSunday.range;
exports.utcSundays = utcSundays;
var utcMondays = utcMonday.range;
exports.utcMondays = utcMondays;
var utcTuesdays = utcTuesday.range;
exports.utcTuesdays = utcTuesdays;
var utcWednesdays = utcWednesday.range;
exports.utcWednesdays = utcWednesdays;
var utcThursdays = utcThursday.range;
exports.utcThursdays = utcThursdays;
var utcFridays = utcFriday.range;
exports.utcFridays = utcFridays;
var utcSaturdays = utcSaturday.range;
exports.utcSaturdays = utcSaturdays;
},{"./interval.js":"ia2J","./duration.js":"woBw"}],"KVil":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.utcMonths = exports.default = void 0;

var _interval = _interopRequireDefault(require("./interval.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var utcMonth = (0, _interval.default)(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();
});
var _default = utcMonth;
exports.default = _default;
var utcMonths = utcMonth.range;
exports.utcMonths = utcMonths;
},{"./interval.js":"ia2J"}],"zjPu":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.utcYears = exports.default = void 0;

var _interval = _interopRequireDefault(require("./interval.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var utcYear = (0, _interval.default)(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 : (0, _interval.default)(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);
  });
};

var _default = utcYear;
exports.default = _default;
var utcYears = utcYear.range;
exports.utcYears = utcYears;
},{"./interval.js":"ia2J"}],"QBVT":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "timeInterval", {
  enumerable: true,
  get: function () {
    return _interval.default;
  }
});
Object.defineProperty(exports, "timeMillisecond", {
  enumerable: true,
  get: function () {
    return _millisecond.default;
  }
});
Object.defineProperty(exports, "timeMilliseconds", {
  enumerable: true,
  get: function () {
    return _millisecond.milliseconds;
  }
});
Object.defineProperty(exports, "utcMillisecond", {
  enumerable: true,
  get: function () {
    return _millisecond.default;
  }
});
Object.defineProperty(exports, "utcMilliseconds", {
  enumerable: true,
  get: function () {
    return _millisecond.milliseconds;
  }
});
Object.defineProperty(exports, "timeSecond", {
  enumerable: true,
  get: function () {
    return _second.default;
  }
});
Object.defineProperty(exports, "timeSeconds", {
  enumerable: true,
  get: function () {
    return _second.seconds;
  }
});
Object.defineProperty(exports, "utcSecond", {
  enumerable: true,
  get: function () {
    return _second.default;
  }
});
Object.defineProperty(exports, "utcSeconds", {
  enumerable: true,
  get: function () {
    return _second.seconds;
  }
});
Object.defineProperty(exports, "timeMinute", {
  enumerable: true,
  get: function () {
    return _minute.default;
  }
});
Object.defineProperty(exports, "timeMinutes", {
  enumerable: true,
  get: function () {
    return _minute.minutes;
  }
});
Object.defineProperty(exports, "timeHour", {
  enumerable: true,
  get: function () {
    return _hour.default;
  }
});
Object.defineProperty(exports, "timeHours", {
  enumerable: true,
  get: function () {
    return _hour.hours;
  }
});
Object.defineProperty(exports, "timeDay", {
  enumerable: true,
  get: function () {
    return _day.default;
  }
});
Object.defineProperty(exports, "timeDays", {
  enumerable: true,
  get: function () {
    return _day.days;
  }
});
Object.defineProperty(exports, "timeWeek", {
  enumerable: true,
  get: function () {
    return _week.sunday;
  }
});
Object.defineProperty(exports, "timeWeeks", {
  enumerable: true,
  get: function () {
    return _week.sundays;
  }
});
Object.defineProperty(exports, "timeSunday", {
  enumerable: true,
  get: function () {
    return _week.sunday;
  }
});
Object.defineProperty(exports, "timeSundays", {
  enumerable: true,
  get: function () {
    return _week.sundays;
  }
});
Object.defineProperty(exports, "timeMonday", {
  enumerable: true,
  get: function () {
    return _week.monday;
  }
});
Object.defineProperty(exports, "timeMondays", {
  enumerable: true,
  get: function () {
    return _week.mondays;
  }
});
Object.defineProperty(exports, "timeTuesday", {
  enumerable: true,
  get: function () {
    return _week.tuesday;
  }
});
Object.defineProperty(exports, "timeTuesdays", {
  enumerable: true,
  get: function () {
    return _week.tuesdays;
  }
});
Object.defineProperty(exports, "timeWednesday", {
  enumerable: true,
  get: function () {
    return _week.wednesday;
  }
});
Object.defineProperty(exports, "timeWednesdays", {
  enumerable: true,
  get: function () {
    return _week.wednesdays;
  }
});
Object.defineProperty(exports, "timeThursday", {
  enumerable: true,
  get: function () {
    return _week.thursday;
  }
});
Object.defineProperty(exports, "timeThursdays", {
  enumerable: true,
  get: function () {
    return _week.thursdays;
  }
});
Object.defineProperty(exports, "timeFriday", {
  enumerable: true,
  get: function () {
    return _week.friday;
  }
});
Object.defineProperty(exports, "timeFridays", {
  enumerable: true,
  get: function () {
    return _week.fridays;
  }
});
Object.defineProperty(exports, "timeSaturday", {
  enumerable: true,
  get: function () {
    return _week.saturday;
  }
});
Object.defineProperty(exports, "timeSaturdays", {
  enumerable: true,
  get: function () {
    return _week.saturdays;
  }
});
Object.defineProperty(exports, "timeMonth", {
  enumerable: true,
  get: function () {
    return _month.default;
  }
});
Object.defineProperty(exports, "timeMonths", {
  enumerable: true,
  get: function () {
    return _month.months;
  }
});
Object.defineProperty(exports, "timeYear", {
  enumerable: true,
  get: function () {
    return _year.default;
  }
});
Object.defineProperty(exports, "timeYears", {
  enumerable: true,
  get: function () {
    return _year.years;
  }
});
Object.defineProperty(exports, "utcMinute", {
  enumerable: true,
  get: function () {
    return _utcMinute.default;
  }
});
Object.defineProperty(exports, "utcMinutes", {
  enumerable: true,
  get: function () {
    return _utcMinute.utcMinutes;
  }
});
Object.defineProperty(exports, "utcHour", {
  enumerable: true,
  get: function () {
    return _utcHour.default;
  }
});
Object.defineProperty(exports, "utcHours", {
  enumerable: true,
  get: function () {
    return _utcHour.utcHours;
  }
});
Object.defineProperty(exports, "utcDay", {
  enumerable: true,
  get: function () {
    return _utcDay.default;
  }
});
Object.defineProperty(exports, "utcDays", {
  enumerable: true,
  get: function () {
    return _utcDay.utcDays;
  }
});
Object.defineProperty(exports, "utcWeek", {
  enumerable: true,
  get: function () {
    return _utcWeek.utcSunday;
  }
});
Object.defineProperty(exports, "utcWeeks", {
  enumerable: true,
  get: function () {
    return _utcWeek.utcSundays;
  }
});
Object.defineProperty(exports, "utcSunday", {
  enumerable: true,
  get: function () {
    return _utcWeek.utcSunday;
  }
});
Object.defineProperty(exports, "utcSundays", {
  enumerable: true,
  get: function () {
    return _utcWeek.utcSundays;
  }
});
Object.defineProperty(exports, "utcMonday", {
  enumerable: true,
  get: function () {
    return _utcWeek.utcMonday;
  }
});
Object.defineProperty(exports, "utcMondays", {
  enumerable: true,
  get: function () {
    return _utcWeek.utcMondays;
  }
});
Object.defineProperty(exports, "utcTuesday", {
  enumerable: true,
  get: function () {
    return _utcWeek.utcTuesday;
  }
});
Object.defineProperty(exports, "utcTuesdays", {
  enumerable: true,
  get: function () {
    return _utcWeek.utcTuesdays;
  }
});
Object.defineProperty(exports, "utcWednesday", {
  enumerable: true,
  get: function () {
    return _utcWeek.utcWednesday;
  }
});
Object.defineProperty(exports, "utcWednesdays", {
  enumerable: true,
  get: function () {
    return _utcWeek.utcWednesdays;
  }
});
Object.defineProperty(exports, "utcThursday", {
  enumerable: true,
  get: function () {
    return _utcWeek.utcThursday;
  }
});
Object.defineProperty(exports, "utcThursdays", {
  enumerable: true,
  get: function () {
    return _utcWeek.utcThursdays;
  }
});
Object.defineProperty(exports, "utcFriday", {
  enumerable: true,
  get: function () {
    return _utcWeek.utcFriday;
  }
});
Object.defineProperty(exports, "utcFridays", {
  enumerable: true,
  get: function () {
    return _utcWeek.utcFridays;
  }
});
Object.defineProperty(exports, "utcSaturday", {
  enumerable: true,
  get: function () {
    return _utcWeek.utcSaturday;
  }
});
Object.defineProperty(exports, "utcSaturdays", {
  enumerable: true,
  get: function () {
    return _utcWeek.utcSaturdays;
  }
});
Object.defineProperty(exports, "utcMonth", {
  enumerable: true,
  get: function () {
    return _utcMonth.default;
  }
});
Object.defineProperty(exports, "utcMonths", {
  enumerable: true,
  get: function () {
    return _utcMonth.utcMonths;
  }
});
Object.defineProperty(exports, "utcYear", {
  enumerable: true,
  get: function () {
    return _utcYear.default;
  }
});
Object.defineProperty(exports, "utcYears", {
  enumerable: true,
  get: function () {
    return _utcYear.utcYears;
  }
});

var _interval = _interopRequireDefault(require("./interval.js"));

var _millisecond = _interopRequireWildcard(require("./millisecond.js"));

var _second = _interopRequireWildcard(require("./second.js"));

var _minute = _interopRequireWildcard(require("./minute.js"));

var _hour = _interopRequireWildcard(require("./hour.js"));

var _day = _interopRequireWildcard(require("./day.js"));

var _week = require("./week.js");

var _month = _interopRequireWildcard(require("./month.js"));

var _year = _interopRequireWildcard(require("./year.js"));

var _utcMinute = _interopRequireWildcard(require("./utcMinute.js"));

var _utcHour = _interopRequireWildcard(require("./utcHour.js"));

var _utcDay = _interopRequireWildcard(require("./utcDay.js"));

var _utcWeek = require("./utcWeek.js");

var _utcMonth = _interopRequireWildcard(require("./utcMonth.js"));

var _utcYear = _interopRequireWildcard(require("./utcYear.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./interval.js":"ia2J","./millisecond.js":"YQ38","./second.js":"nNS8","./minute.js":"NxbZ","./hour.js":"ShhP","./day.js":"mZUN","./week.js":"HYDq","./month.js":"BD8V","./year.js":"Aez4","./utcMinute.js":"O3Kl","./utcHour.js":"f0g5","./utcDay.js":"nsxn","./utcWeek.js":"bIsM","./utcMonth.js":"KVil","./utcYear.js":"zjPu"}],"iLB2":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = formatLocale;

var _d3Time = require("d3-time");

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,
    "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,
    "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,
    "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 ? _d3Time.utcMonday.ceil(week) : (0, _d3Time.utcMonday)(week);
          week = _d3Time.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 = localDate(newDate(d.y, 0, 1)), day = week.getDay();
          week = day > 4 || day === 0 ? _d3Time.timeMonday.ceil(week) : (0, _d3Time.timeMonday)(week);
          week = _d3Time.timeDay.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[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 (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) {
  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 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 + _d3Time.timeDay.count((0, _d3Time.timeYear)(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(_d3Time.timeSunday.count((0, _d3Time.timeYear)(d) - 1, d), p, 2);
}

function formatWeekNumberISO(d, p) {
  var day = d.getDay();
  d = day >= 4 || day === 0 ? (0, _d3Time.timeThursday)(d) : _d3Time.timeThursday.ceil(d);
  return pad(_d3Time.timeThursday.count((0, _d3Time.timeYear)(d), d) + ((0, _d3Time.timeYear)(d).getDay() === 4), p, 2);
}

function formatWeekdayNumberSunday(d) {
  return d.getDay();
}

function formatWeekNumberMonday(d, p) {
  return pad(_d3Time.timeMonday.count((0, _d3Time.timeYear)(d) - 1, d), p, 2);
}

function formatYear(d, p) {
  return pad(d.getFullYear() % 100, p, 2);
}

function formatFullYear(d, p) {
  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 + _d3Time.utcDay.count((0, _d3Time.utcYear)(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(_d3Time.utcSunday.count((0, _d3Time.utcYear)(d) - 1, d), p, 2);
}

function formatUTCWeekNumberISO(d, p) {
  var day = d.getUTCDay();
  d = day >= 4 || day === 0 ? (0, _d3Time.utcThursday)(d) : _d3Time.utcThursday.ceil(d);
  return pad(_d3Time.utcThursday.count((0, _d3Time.utcYear)(d), d) + ((0, _d3Time.utcYear)(d).getUTCDay() === 4), p, 2);
}

function formatUTCWeekdayNumberSunday(d) {
  return d.getUTCDay();
}

function formatUTCWeekNumberMonday(d, p) {
  return pad(_d3Time.utcMonday.count((0, _d3Time.utcYear)(d) - 1, d), p, 2);
}

function formatUTCYear(d, p) {
  return pad(d.getUTCFullYear() % 100, p, 2);
}

function formatUTCFullYear(d, p) {
  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);
}
},{"d3-time":"QBVT"}],"ydIr":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = defaultLocale;
exports.utcParse = exports.utcFormat = exports.timeParse = exports.timeFormat = void 0;

var _locale = _interopRequireDefault(require("./locale.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var locale;
var timeFormat;
exports.timeFormat = timeFormat;
var timeParse;
exports.timeParse = timeParse;
var utcFormat;
exports.utcFormat = utcFormat;
var utcParse;
exports.utcParse = 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 = (0, _locale.default)(definition);
  exports.timeFormat = timeFormat = locale.format;
  exports.timeParse = timeParse = locale.parse;
  exports.utcFormat = utcFormat = locale.utcFormat;
  exports.utcParse = utcParse = locale.utcParse;
  return locale;
}
},{"./locale.js":"iLB2"}],"IIzo":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.isoSpecifier = void 0;

var _defaultLocale = require("./defaultLocale.js");

var isoSpecifier = "%Y-%m-%dT%H:%M:%S.%LZ";
exports.isoSpecifier = isoSpecifier;

function formatIsoNative(date) {
  return date.toISOString();
}

var formatIso = Date.prototype.toISOString ? formatIsoNative : (0, _defaultLocale.utcFormat)(isoSpecifier);
var _default = formatIso;
exports.default = _default;
},{"./defaultLocale.js":"ydIr"}],"u4fb":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _isoFormat = require("./isoFormat.js");

var _defaultLocale = require("./defaultLocale.js");

function parseIsoNative(string) {
  var date = new Date(string);
  return isNaN(date) ? null : date;
}

var parseIso = +new Date("2000-01-01T00:00:00.000Z") ? parseIsoNative : (0, _defaultLocale.utcParse)(_isoFormat.isoSpecifier);
var _default = parseIso;
exports.default = _default;
},{"./isoFormat.js":"IIzo","./defaultLocale.js":"ydIr"}],"fort":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "timeFormatDefaultLocale", {
  enumerable: true,
  get: function () {
    return _defaultLocale.default;
  }
});
Object.defineProperty(exports, "timeFormat", {
  enumerable: true,
  get: function () {
    return _defaultLocale.timeFormat;
  }
});
Object.defineProperty(exports, "timeParse", {
  enumerable: true,
  get: function () {
    return _defaultLocale.timeParse;
  }
});
Object.defineProperty(exports, "utcFormat", {
  enumerable: true,
  get: function () {
    return _defaultLocale.utcFormat;
  }
});
Object.defineProperty(exports, "utcParse", {
  enumerable: true,
  get: function () {
    return _defaultLocale.utcParse;
  }
});
Object.defineProperty(exports, "timeFormatLocale", {
  enumerable: true,
  get: function () {
    return _locale.default;
  }
});
Object.defineProperty(exports, "isoFormat", {
  enumerable: true,
  get: function () {
    return _isoFormat.default;
  }
});
Object.defineProperty(exports, "isoParse", {
  enumerable: true,
  get: function () {
    return _isoParse.default;
  }
});

var _defaultLocale = _interopRequireWildcard(require("./defaultLocale.js"));

var _locale = _interopRequireDefault(require("./locale.js"));

var _isoFormat = _interopRequireDefault(require("./isoFormat.js"));

var _isoParse = _interopRequireDefault(require("./isoParse.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
},{"./defaultLocale.js":"ydIr","./locale.js":"iLB2","./isoFormat.js":"IIzo","./isoParse.js":"u4fb"}],"DTbp":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _type = require("./type");

var _index = require("./formats/index");

var _vegaUtil = require("vega-util");

var _d3TimeFormat = require("d3-time-format");

function _default(data, schema, dateParse) {
  schema = schema || {};
  const reader = (0, _index.formats)(schema.type || 'json');
  if (!reader) (0, _vegaUtil.error)('Unknown data format type: ' + schema.type);
  data = reader(data, schema);
  if (schema.parse) parse(data, schema.parse, dateParse);
  if ((0, _vegaUtil.hasOwnProperty)(data, 'columns')) delete data.columns;
  return data;
}

function parse(data, types, dateParse) {
  if (!data.length) return; // early exit for empty data

  dateParse = dateParse || _d3TimeFormat.timeParse;
  var fields = data.columns || Object.keys(data[0]),
      parsers,
      datum,
      field,
      i,
      j,
      n,
      m;
  if (types === 'auto') types = (0, _type.inferTypes)(data, fields);
  fields = Object.keys(types);
  parsers = fields.map(function (field) {
    var type = types[field],
        parts,
        pattern;

    if (type && (type.indexOf('date:') === 0 || type.indexOf('utc:') === 0)) {
      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);
      }

      return parts[0] === 'utc' ? (0, _d3TimeFormat.utcParse)(pattern) : dateParse(pattern);
    }

    if (!_type.typeParsers[type]) {
      throw Error('Illegal format pattern: ' + field + ':' + type);
    }

    return _type.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]);
    }
  }
}
},{"./type":"iCuC","./formats/index":"xgvC","vega-util":"dejJ","d3-time-format":"fort"}],"wGnx":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "read", {
  enumerable: true,
  get: function () {
    return _read.default;
  }
});
Object.defineProperty(exports, "inferType", {
  enumerable: true,
  get: function () {
    return _type.inferType;
  }
});
Object.defineProperty(exports, "inferTypes", {
  enumerable: true,
  get: function () {
    return _type.inferTypes;
  }
});
Object.defineProperty(exports, "typeParsers", {
  enumerable: true,
  get: function () {
    return _type.typeParsers;
  }
});
Object.defineProperty(exports, "format", {
  enumerable: true,
  get: function () {
    return _index.format;
  }
});
Object.defineProperty(exports, "formats", {
  enumerable: true,
  get: function () {
    return _index.formats;
  }
});
Object.defineProperty(exports, "responseType", {
  enumerable: true,
  get: function () {
    return _index.responseType;
  }
});
exports.loader = void 0;

var _loader = _interopRequireDefault(require("./src/loader"));

var _read = _interopRequireDefault(require("./src/read"));

var _type = require("./src/type");

var _index = require("./src/formats/index");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var loader = (0, _loader.default)(typeof fetch !== 'undefined' && fetch, // use built-in fetch API
null // no file system access
);
exports.loader = loader;
},{"./src/loader":"aRmL","./src/read":"DTbp","./src/type":"iCuC","./src/formats/index":"xgvC"}],"qe0h":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ingest = ingest;
exports.request = request;
exports.preload = preload;
exports.parse = void 0;

var _vegaLoader = require("vega-loader");

var _vegaUtil = require("vega-util");

const parse = _vegaLoader.read;
/**
 * 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}
 */

exports.parse = parse;

function ingest(target, data, format) {
  return this.pulse(target, this.changeset().insert(parse(data, format)));
}
/**
 * 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: (0, _vegaLoader.responseType)(format && format.type)
    });

    try {
      data = 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(_vegaUtil.truthy).insert(res.data || []));
  pending.done();
  return res;
}

function loadPending(df) {
  var pending = new Promise(function (a) {
    accept = a;
  }),
      accept;
  pending.requests = 0;

  pending.done = function () {
    if (--pending.requests === 0) {
      df._pending = null;
      accept(df);
    }
  };

  return df._pending = pending;
}
},{"vega-loader":"wGnx","vega-util":"dejJ"}],"tZCX":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _Operator = _interopRequireDefault(require("../Operator"));

var _ChangeSet = require("../ChangeSet");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var 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 _default(source, target, update, params, options) {
  var fn = source instanceof _Operator.default ? onOperator : onStream;
  fn(this, source, target, update, params, options);
  return this;
}

function onStream(df, stream, target, update, params, options) {
  var opt = (0, _vegaUtil.extend)({}, options, SKIP),
      func,
      op;
  if (!(0, _vegaUtil.isFunction)(target)) target = (0, _vegaUtil.constant)(target);

  if (update === undefined) {
    func = e => df.touch(target(e));
  } else if ((0, _vegaUtil.isFunction)(update)) {
    op = new _Operator.default(null, update, params, false);

    func = e => {
      op.evaluate(e);
      const t = target(e),
            v = op.value;
      (0, _ChangeSet.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.default(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 = (0, _vegaUtil.isFunction)(update) ? update : (0, _vegaUtil.constant)(update);
  return target ? function (_, pulse) {
    const value = update(_, pulse);

    if (!target.skip()) {
      target.skip(value !== this.value).value = value;
    }

    return value;
  } : update;
}
},{"../Operator":"ODzd","../ChangeSet":"VswZ","vega-util":"dejJ"}],"rz5u":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.rank = rank;
exports.rerank = rerank;

var _vegaUtil = require("vega-util");

/**
 * 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) {
  var queue = [op],
      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) (0, _vegaUtil.error)('Cycle detected in dataflow graph.');
      }
    }
  }
}
},{"vega-util":"dejJ"}],"VFuI":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Pulse;
exports.StopPropagation = void 0;

var _Tuple = require("./Tuple");

var _vegaUtil = require("vega-util");

/**
 * Sentinel value indicating pulse propagation should stop.
 */
var StopPropagation = {}; // Pulse visit type flags

exports.StopPropagation = StopPropagation;
var 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;
}

var prototype = Pulse.prototype;
/**
 * Sentinel value indicating pulse propagation should stop.
 */

prototype.StopPropagation = StopPropagation;
/**
 * Boolean flag indicating ADD (added) tuples.
 */

prototype.ADD = ADD;
/**
 * Boolean flag indicating REM (removed) tuples.
 */

prototype.REM = REM;
/**
 * Boolean flag indicating MOD (modified) tuples.
 */

prototype.MOD = MOD;
/**
 * Boolean flag indicating ADD (added) and REM (removed) tuples.
 */

prototype.ADD_REM = ADD_REM;
/**
 * Boolean flag indicating ADD (added) and MOD (modified) tuples.
 */

prototype.ADD_MOD = ADD_MOD;
/**
 * Boolean flag indicating ADD, REM and MOD tuples.
 */

prototype.ALL = ALL;
/**
 * Boolean flag indicating all tuples in a data source
 * except for the ADD, REM and MOD tuples.
 */

prototype.REFLOW = REFLOW;
/**
 * Boolean flag indicating a 'pass-through' to a
 * backing data source, ignoring ADD, REM and MOD tuples.
 */

prototype.SOURCE = SOURCE;
/**
 * Boolean flag indicating that source data should be
 * suppressed when creating a forked pulse.
 */

prototype.NO_SOURCE = NO_SOURCE;
/**
 * Boolean flag indicating that field modifications should be
 * suppressed when creating a forked pulse.
 */

prototype.NO_FIELDS = 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
 */

prototype.fork = function (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
 */


prototype.clone = function () {
  var 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.
 */


prototype.addAll = function () {
  var p = this;

  if (!this.source || this.source.length === this.add.length) {
    return p;
  } else {
    p = new Pulse(this.dataflow).init(this);
    p.add = p.source;
    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.
 */


prototype.init = function (src, flags) {
  var 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;
  }

  return p;
};
/**
 * Schedules a function to run after pulse propagation completes.
 * @param {function} func - The function to run.
 */


prototype.runAfter = function (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.
 */


prototype.changed = function (flags) {
  var 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.
 */


prototype.reflow = function (fork) {
  if (fork) return this.fork(ALL).reflow();
  var len = this.add.length,
      src = this.source && this.source.length;

  if (src && src !== len) {
    this.mod = this.source;
    if (len) this.filter(MOD, filter(this, ADD));
  }

  return this;
};
/**
 * 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.
 */


prototype.modifies = function (_) {
  var hash = this.fields || (this.fields = {});

  if ((0, _vegaUtil.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.
 */


prototype.modified = function (_, nomod) {
  var fields = this.fields;
  return !((nomod || this.mod.length) && fields) ? false : !arguments.length ? !!fields : (0, _vegaUtil.isArray)(_) ? _.some(function (f) {
    return 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.
 */


prototype.filter = function (flags, filter) {
  var 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;
};

function addFilter(a, b) {
  return a ? function (t, i) {
    return a(t, i) && b(t, i);
  } : b;
}
/**
 * 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.
 */


prototype.materialize = function (flags) {
  flags = flags || ALL;
  var 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;
};

function materialize(data, filter) {
  var out = [];
  (0, _vegaUtil.visitArray)(data, filter, function (_) {
    out.push(_);
  });
  return out;
}

function filter(pulse, flags) {
  var map = {};
  pulse.visit(flags, function (t) {
    map[(0, _Tuple.tupleid)(t)] = 1;
  });
  return function (t) {
    return map[(0, _Tuple.tupleid)(t)] ? null : t;
  };
}
/**
 * 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.
 */


prototype.visit = function (flags, visitor) {
  var p = this,
      v = visitor,
      src,
      sum;

  if (flags & SOURCE) {
    (0, _vegaUtil.visitArray)(p.source, p.srcF, v);
    return p;
  }

  if (flags & ADD) (0, _vegaUtil.visitArray)(p.add, p.addF, v);
  if (flags & REM) (0, _vegaUtil.visitArray)(p.rem, p.remF, v);
  if (flags & MOD) (0, _vegaUtil.visitArray)(p.mod, p.modF, v);

  if (flags & REFLOW && (src = p.source)) {
    sum = p.add.length + p.mod.length;

    if (sum === src.length) {// do nothing
    } else if (sum) {
      (0, _vegaUtil.visitArray)(src, filter(p, ADD_MOD), v);
    } else {
      // if no add/rem/mod tuples, visit source
      (0, _vegaUtil.visitArray)(src, p.srcF, v);
    }
  }

  return p;
};
},{"./Tuple":"dQkW","vega-util":"dejJ"}],"vurg":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = MultiPulse;

var _Pulse = _interopRequireDefault(require("./Pulse"));

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * 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) {
  var p = this,
      c = 0,
      pulse,
      hash,
      i,
      n,
      f;
  this.dataflow = dataflow;
  this.stamp = stamp;
  this.fields = null;
  this.encode = encode || null;
  this.pulses = pulses;

  for (i = 0, n = pulses.length; i < n; ++i) {
    pulse = pulses[i];
    if (pulse.stamp !== stamp) continue;

    if (pulse.fields) {
      hash = p.fields || (p.fields = {});

      for (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;
}

var prototype = (0, _vegaUtil.inherits)(MultiPulse, _Pulse.default);
/**
 * Creates a new pulse based on the values of this pulse.
 * The dataflow, time stamp and field modification values are copied over.
 * @return {Pulse}
 */

prototype.fork = function (flags) {
  var p = new _Pulse.default(this.dataflow).init(this, flags & this.NO_FIELDS);

  if (flags !== undefined) {
    if (flags & p.ADD) {
      this.visit(p.ADD, function (t) {
        return p.add.push(t);
      });
    }

    if (flags & p.REM) {
      this.visit(p.REM, function (t) {
        return p.rem.push(t);
      });
    }

    if (flags & p.MOD) {
      this.visit(p.MOD, function (t) {
        return p.mod.push(t);
      });
    }
  }

  return p;
};

prototype.changed = function (flags) {
  return this.changes & flags;
};

prototype.modified = function (_) {
  var p = this,
      fields = p.fields;
  return !(fields && p.changes & p.MOD) ? 0 : (0, _vegaUtil.isArray)(_) ? _.some(function (f) {
    return fields[f];
  }) : fields[_];
};

prototype.filter = function () {
  (0, _vegaUtil.error)('MultiPulse does not support filtering.');
};

prototype.materialize = function () {
  (0, _vegaUtil.error)('MultiPulse does not support materialization.');
};

prototype.visit = function (flags, visitor) {
  var p = this,
      pulses = p.pulses,
      n = pulses.length,
      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;
};
},{"./Pulse":"VFuI","vega-util":"dejJ"}],"qHRP":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.evaluate = evaluate;
exports.runAsync = runAsync;
exports.run = run;
exports.runAfter = runAfter;
exports.enqueue = enqueue;
exports.getPulse = getPulse;

var _Pulse = _interopRequireWildcard(require("../Pulse"));

var _MultiPulse = _interopRequireDefault(require("../MultiPulse"));

var _asyncCallback = _interopRequireDefault(require("../util/asyncCallback"));

var _UniqueList = _interopRequireDefault(require("../util/UniqueList"));

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/* 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,
        level = df.logLevel(); // 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 (0, _asyncCallback.default)(df, prerun); // exit early if there are no updates

  if (!df._touched.length) {
    df.info('Dataflow invoked, but nothing to do.');
    return df;
  } // increment timestamp clock


  let stamp = ++df._clock,
      count = 0,
      op,
      next,
      dt,
      error; // set the current pulse

  df._pulse = new _Pulse.default(df, stamp, encode);

  if (level >= _vegaUtil.Info) {
    dt = Date.now();
    df.debug('-- START PROPAGATION (' + stamp + ') -----');
  } // initialize priority queue, reset touched operators


  df._touched.forEach(op => df._enqueue(op, true));

  df._touched = (0, _UniqueList.default)(_vegaUtil.id);

  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)); // await if operator returned a promise

      if (next.then) {
        next = await next;
      }

      if (level >= _vegaUtil.Debug) {
        df.debug(op.id, next === _Pulse.StopPropagation ? 'STOP' : next, op);
      } // propagate evaluation, enqueue dependent operators


      if (next !== _Pulse.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;

  if (level >= _vegaUtil.Info) {
    dt = Date.now() - dt;
    df.info('> Pulse ' + stamp + ': ' + count + ' operators; ' + dt + 'ms');
  }

  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 (0, _asyncCallback.default)(df, pr[i].callback);
    }
  } // invoke postrun function, if provided


  if (postrun) await (0, _asyncCallback.default)(df, postrun);
  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 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) {
  var 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) {
  var s = op.source,
      stamp = this._clock;
  return s && (0, _vegaUtil.isArray)(s) ? new _MultiPulse.default(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 !== _Pulse.StopPropagation) {
    p.source = s.source;
  }

  return p;
}
},{"../Pulse":"VFuI","../MultiPulse":"vurg","../util/asyncCallback":"rfb2","../util/UniqueList":"VQpj","vega-util":"dejJ"}],"Mbe4":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.touch = touch;
exports.update = update;
exports.pulse = pulse;

var _Pulse = _interopRequireDefault(require("../Pulse"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var 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) {
  var 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 update(op, value, options) {
  var 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 pulse(op, changeset, options) {
  this.touch(op, options || NO_OPT);
  var p = new _Pulse.default(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;
}
},{"../Pulse":"VFuI"}],"uiQq":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Heap;

function Heap(cmp) {
  var nodes = [];
  return {
    clear: () => nodes = [],
    size: () => nodes.length,
    peek: () => nodes[0],
    push: x => {
      nodes.push(x);
      return siftdown(nodes, 0, nodes.length - 1, cmp);
    },
    pop: () => {
      var last = nodes.pop(),
          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) {
  var item, parent, pidx;
  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) {
  var start = idx,
      end = array.length,
      item = array[idx],
      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);
}
},{}],"eHp4":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Dataflow;

var _add = _interopRequireDefault(require("./add"));

var _connect = _interopRequireDefault(require("./connect"));

var _events = _interopRequireDefault(require("./events"));

var _load = require("./load");

var _on = _interopRequireDefault(require("./on"));

var _rank = require("./rank");

var _run = require("./run");

var _update = require("./update");

var _ChangeSet = _interopRequireDefault(require("../ChangeSet"));

var _Heap = _interopRequireDefault(require("../util/Heap"));

var _UniqueList = _interopRequireDefault(require("../util/UniqueList"));

var _vegaLoader = require("vega-loader");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * A dataflow graph for reactive processing of data streams.
 * @constructor
 */
function Dataflow() {
  this.logger((0, _vegaUtil.logger)());
  this.logLevel(_vegaUtil.Error);
  this._clock = 0;
  this._rank = 0;

  try {
    this._loader = (0, _vegaLoader.loader)();
  } catch (e) {// do nothing if loader module is unavailable
  }

  this._touched = (0, _UniqueList.default)(_vegaUtil.id);
  this._input = {};
  this._pulse = null;
  this._heap = (0, _Heap.default)((a, b) => a.qrank - b.qrank);
  this._postrun = [];
}

var prototype = 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.
 */

prototype.stamp = function () {
  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.
 */


prototype.loader = function (_) {
  if (arguments.length) {
    this._loader = _;
    return this;
  } else {
    return this._loader;
  }
};
/**
 * Empty entry threshold for garbage cleaning. Map data structures will
 * perform cleaning once the number of empty entries exceeds this value.
 */


prototype.cleanThreshold = 1e4; // OPERATOR REGISTRATION

prototype.add = _add.default;
prototype.connect = _connect.default;
prototype.rank = _rank.rank;
prototype.rerank = _rank.rerank; // OPERATOR UPDATES

prototype.pulse = _update.pulse;
prototype.touch = _update.touch;
prototype.update = _update.update;
prototype.changeset = _ChangeSet.default; // DATA LOADING

prototype.ingest = _load.ingest;
prototype.parse = _load.parse;
prototype.preload = _load.preload;
prototype.request = _load.request; // EVENT HANDLING

prototype.events = _events.default;
prototype.on = _on.default; // PULSE PROPAGATION

prototype.evaluate = _run.evaluate;
prototype.run = _run.run;
prototype.runAsync = _run.runAsync;
prototype.runAfter = _run.runAfter;
prototype._enqueue = _run.enqueue;
prototype._getPulse = _run.getPulse; // LOGGING AND ERROR HANDLING

function logMethod(method) {
  return function () {
    return this._log[method].apply(this, arguments);
  };
}
/**
 * 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.
 */


prototype.logger = function (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.
 */


prototype.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.
 */

prototype.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.
 */

prototype.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.
 */

prototype.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.
 */

prototype.logLevel = logMethod('level');
},{"./add":"GEkR","./connect":"XYnh","./events":"bnHl","./load":"qe0h","./on":"tZCX","./rank":"rz5u","./run":"qHRP","./update":"Mbe4","../ChangeSet":"VswZ","../util/Heap":"uiQq","../util/UniqueList":"VQpj","vega-loader":"wGnx","vega-util":"dejJ"}],"ieX1":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Transform;

var _Operator = _interopRequireDefault(require("./Operator"));

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * 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.default.call(this, init, null, params);
}

var prototype = (0, _vegaUtil.inherits)(Transform, _Operator.default);
/**
 * 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)
 */

prototype.run = function (pulse) {
  if (pulse.stamp < this.stamp) return pulse.StopPropagation;
  var 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.
 */


prototype.evaluate = function (pulse) {
  var 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.
 */


prototype.transform = function () {};
},{"./Operator":"ODzd","vega-util":"dejJ"}],"dG7J":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.definition = definition;
exports.transform = transform;
exports.transforms = void 0;

var _vegaUtil = require("vega-util");

var transforms = {};
exports.transforms = transforms;

function definition(type) {
  var t = transform(type);
  return t && t.Definition || null;
}

function transform(type) {
  type = type && type.toLowerCase();
  return (0, _vegaUtil.hasOwnProperty)(transforms, type) ? transforms[type] : null;
}
},{"vega-util":"dejJ"}],"UC8n":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "UniqueList", {
  enumerable: true,
  get: function () {
    return _UniqueList.default;
  }
});
Object.defineProperty(exports, "asyncCallback", {
  enumerable: true,
  get: function () {
    return _asyncCallback.default;
  }
});
Object.defineProperty(exports, "changeset", {
  enumerable: true,
  get: function () {
    return _ChangeSet.default;
  }
});
Object.defineProperty(exports, "isChangeSet", {
  enumerable: true,
  get: function () {
    return _ChangeSet.isChangeSet;
  }
});
Object.defineProperty(exports, "Dataflow", {
  enumerable: true,
  get: function () {
    return _Dataflow.default;
  }
});
Object.defineProperty(exports, "EventStream", {
  enumerable: true,
  get: function () {
    return _EventStream.default;
  }
});
Object.defineProperty(exports, "Parameters", {
  enumerable: true,
  get: function () {
    return _Parameters.default;
  }
});
Object.defineProperty(exports, "Pulse", {
  enumerable: true,
  get: function () {
    return _Pulse.default;
  }
});
Object.defineProperty(exports, "MultiPulse", {
  enumerable: true,
  get: function () {
    return _MultiPulse.default;
  }
});
Object.defineProperty(exports, "Operator", {
  enumerable: true,
  get: function () {
    return _Operator.default;
  }
});
Object.defineProperty(exports, "Transform", {
  enumerable: true,
  get: function () {
    return _Transform.default;
  }
});
Object.defineProperty(exports, "derive", {
  enumerable: true,
  get: function () {
    return _Tuple.derive;
  }
});
Object.defineProperty(exports, "ingest", {
  enumerable: true,
  get: function () {
    return _Tuple.ingest;
  }
});
Object.defineProperty(exports, "isTuple", {
  enumerable: true,
  get: function () {
    return _Tuple.isTuple;
  }
});
Object.defineProperty(exports, "rederive", {
  enumerable: true,
  get: function () {
    return _Tuple.rederive;
  }
});
Object.defineProperty(exports, "replace", {
  enumerable: true,
  get: function () {
    return _Tuple.replace;
  }
});
Object.defineProperty(exports, "stableCompare", {
  enumerable: true,
  get: function () {
    return _Tuple.stableCompare;
  }
});
Object.defineProperty(exports, "tupleid", {
  enumerable: true,
  get: function () {
    return _Tuple.tupleid;
  }
});
Object.defineProperty(exports, "definition", {
  enumerable: true,
  get: function () {
    return _register.definition;
  }
});
Object.defineProperty(exports, "transform", {
  enumerable: true,
  get: function () {
    return _register.transform;
  }
});
Object.defineProperty(exports, "transforms", {
  enumerable: true,
  get: function () {
    return _register.transforms;
  }
});

var _UniqueList = _interopRequireDefault(require("./src/util/UniqueList"));

var _asyncCallback = _interopRequireDefault(require("./src/util/asyncCallback"));

var _ChangeSet = _interopRequireWildcard(require("./src/ChangeSet"));

var _Dataflow = _interopRequireDefault(require("./src/dataflow/Dataflow"));

var _EventStream = _interopRequireDefault(require("./src/EventStream"));

var _Parameters = _interopRequireDefault(require("./src/Parameters"));

var _Pulse = _interopRequireDefault(require("./src/Pulse"));

var _MultiPulse = _interopRequireDefault(require("./src/MultiPulse"));

var _Operator = _interopRequireDefault(require("./src/Operator"));

var _Transform = _interopRequireDefault(require("./src/Transform"));

var _Tuple = require("./src/Tuple");

var _register = require("./src/register");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./src/util/UniqueList":"VQpj","./src/util/asyncCallback":"rfb2","./src/ChangeSet":"VswZ","./src/dataflow/Dataflow":"eHp4","./src/EventStream":"NW4e","./src/Parameters":"Ie0V","./src/Pulse":"VFuI","./src/MultiPulse":"vurg","./src/Operator":"ODzd","./src/Transform":"ieX1","./src/Tuple":"dQkW","./src/register":"dG7J"}],"k6fm":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.multikey = multikey;
exports.groupkey = groupkey;

function multikey(f) {
  return function (x) {
    var n = f.length,
        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);
}
},{}],"Dcrk":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.measureName = measureName;
exports.createMeasure = createMeasure;
exports.compileMeasures = compileMeasures;
exports.ValidAggregateOps = exports.AggregateOps = void 0;

var _vegaUtil = require("vega-util");

function measureName(op, field, as) {
  return as || op + (!field ? '' : '_' + field);
}

var AggregateOps = {
  'values': measure({
    name: 'values',
    init: 'cell.store = true;',
    set: 'cell.data.values()',
    idx: -1
  }),
  'count': measure({
    name: 'count',
    set: 'cell.num'
  }),
  '__count__': measure({
    name: 'count',
    set: 'this.missing + this.valid'
  }),
  'missing': measure({
    name: 'missing',
    set: 'this.missing'
  }),
  'valid': measure({
    name: 'valid',
    set: 'this.valid'
  }),
  'sum': measure({
    name: 'sum',
    init: 'this.sum = 0;',
    add: 'this.sum += +v;',
    rem: 'this.sum -= v;',
    set: 'this.sum'
  }),
  'mean': measure({
    name: 'mean',
    init: 'this.mean = 0;',
    add: 'var d = v - this.mean; this.mean += d / this.valid;',
    rem: 'var d = v - this.mean; this.mean -= this.valid ? d / this.valid : this.mean;',
    set: 'this.valid ? this.mean : undefined'
  }),
  'average': measure({
    name: 'average',
    set: 'this.valid ? this.mean : undefined',
    req: ['mean'],
    idx: 1
  }),
  'variance': measure({
    name: 'variance',
    init: 'this.dev = 0;',
    add: 'this.dev += d * (v - this.mean);',
    rem: 'this.dev -= d * (v - this.mean);',
    set: 'this.valid > 1 ? this.dev / (this.valid-1) : undefined',
    req: ['mean'],
    idx: 1
  }),
  'variancep': measure({
    name: 'variancep',
    set: 'this.valid > 1 ? this.dev / this.valid : undefined',
    req: ['variance'],
    idx: 2
  }),
  'stdev': measure({
    name: 'stdev',
    set: 'this.valid > 1 ? Math.sqrt(this.dev / (this.valid-1)) : undefined',
    req: ['variance'],
    idx: 2
  }),
  'stdevp': measure({
    name: 'stdevp',
    set: 'this.valid > 1 ? Math.sqrt(this.dev / this.valid) : undefined',
    req: ['variance'],
    idx: 2
  }),
  'stderr': measure({
    name: 'stderr',
    set: 'this.valid > 1 ? Math.sqrt(this.dev / (this.valid * (this.valid-1))) : undefined',
    req: ['variance'],
    idx: 2
  }),
  'distinct': measure({
    name: 'distinct',
    set: 'cell.data.distinct(this.get)',
    req: ['values'],
    idx: 3
  }),
  'ci0': measure({
    name: 'ci0',
    set: 'cell.data.ci0(this.get)',
    req: ['values'],
    idx: 3
  }),
  'ci1': measure({
    name: 'ci1',
    set: 'cell.data.ci1(this.get)',
    req: ['values'],
    idx: 3
  }),
  'median': measure({
    name: 'median',
    set: 'cell.data.q2(this.get)',
    req: ['values'],
    idx: 3
  }),
  'q1': measure({
    name: 'q1',
    set: 'cell.data.q1(this.get)',
    req: ['values'],
    idx: 3
  }),
  'q3': measure({
    name: 'q3',
    set: 'cell.data.q3(this.get)',
    req: ['values'],
    idx: 3
  }),
  'argmin': measure({
    name: 'argmin',
    init: 'this.argmin = undefined;',
    add: 'if (v < this.min) this.argmin = t;',
    rem: 'if (v <= this.min) this.argmin = undefined;',
    set: 'this.argmin || cell.data.argmin(this.get)',
    req: ['min'],
    str: ['values'],
    idx: 3
  }),
  'argmax': measure({
    name: 'argmax',
    init: 'this.argmax = undefined;',
    add: 'if (v > this.max) this.argmax = t;',
    rem: 'if (v >= this.max) this.argmax = undefined;',
    set: 'this.argmax || cell.data.argmax(this.get)',
    req: ['max'],
    str: ['values'],
    idx: 3
  }),
  'min': measure({
    name: 'min',
    init: 'this.min = undefined;',
    add: 'if (v < this.min || this.min === undefined) this.min = v;',
    rem: 'if (v <= this.min) this.min = NaN;',
    set: 'this.min = (Number.isNaN(this.min) ? cell.data.min(this.get) : this.min)',
    str: ['values'],
    idx: 4
  }),
  'max': measure({
    name: 'max',
    init: 'this.max = undefined;',
    add: 'if (v > this.max || this.max === undefined) this.max = v;',
    rem: 'if (v >= this.max) this.max = NaN;',
    set: 'this.max = (Number.isNaN(this.max) ? cell.data.max(this.get) : this.max)',
    str: ['values'],
    idx: 4
  })
};
exports.AggregateOps = AggregateOps;
var ValidAggregateOps = Object.keys(AggregateOps);
exports.ValidAggregateOps = ValidAggregateOps;

function createMeasure(op, name) {
  return AggregateOps[op](name);
}

function measure(base) {
  return function (out) {
    var m = (0, _vegaUtil.extend)({
      init: '',
      add: '',
      rem: '',
      idx: 0
    }, base);
    m.out = out || base.name;
    return m;
  };
}

function compareIndex(a, b) {
  return a.idx - b.idx;
}

function resolve(agg, stream) {
  function collect(m, a) {
    function helper(r) {
      if (!m[r]) collect(m, m[r] = AggregateOps[r]());
    }

    if (a.req) a.req.forEach(helper);
    if (stream && a.str) a.str.forEach(helper);
    return m;
  }

  var map = agg.reduce(collect, agg.reduce(function (m, a) {
    m[a.name] = a;
    return m;
  }, {}));
  var values = [],
      key;

  for (key in map) values.push(map[key]);

  return values.sort(compareIndex);
}

function compileMeasures(agg, field) {
  var get = field || _vegaUtil.identity,
      all = resolve(agg, true),
      // assume streaming removes may occur
  init = 'var cell = this.cell; this.valid = 0; this.missing = 0;',
      ctr = 'this.cell = cell; this.init();',
      add = 'if(v==null){++this.missing; return;} if(v!==v) return; ++this.valid;',
      rem = 'if(v==null){--this.missing; return;} if(v!==v) return; --this.valid;',
      set = 'var cell = this.cell;';
  all.forEach(function (a) {
    init += a.init;
    add += a.add;
    rem += a.rem;
  });
  agg.slice().sort(compareIndex).forEach(function (a) {
    set += 't[' + (0, _vegaUtil.stringValue)(a.out) + ']=' + a.set + ';';
  });
  set += 'return t;';
  ctr = Function('cell', ctr);
  ctr.prototype.init = Function(init);
  ctr.prototype.add = Function('v', 't', add);
  ctr.prototype.rem = Function('v', 't', rem);
  ctr.prototype.set = Function('t', set);
  ctr.prototype.get = get;
  ctr.fields = agg.map(function (_) {
    return _.out;
  });
  return ctr;
}
},{"vega-util":"dejJ"}],"GiOq":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function* _default(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;
      }
    }
  }
}
},{}],"CHz1":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(a, b) {
  return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
}
},{}],"TH2p":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _ascending = _interopRequireDefault(require("./ascending.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(compare) {
  if (compare.length === 1) compare = ascendingComparator(compare);
  return {
    left: function (a, x, lo, hi) {
      if (lo == null) lo = 0;
      if (hi == null) hi = a.length;

      while (lo < hi) {
        var mid = lo + hi >>> 1;
        if (compare(a[mid], x) < 0) lo = mid + 1;else hi = mid;
      }

      return lo;
    },
    right: function (a, x, lo, hi) {
      if (lo == null) lo = 0;
      if (hi == null) hi = a.length;

      while (lo < hi) {
        var mid = lo + hi >>> 1;
        if (compare(a[mid], x) > 0) hi = mid;else lo = mid + 1;
      }

      return lo;
    }
  };
}

function ascendingComparator(f) {
  return function (d, x) {
    return (0, _ascending.default)(f(d), x);
  };
}
},{"./ascending.js":"CHz1"}],"Yob9":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.bisectLeft = exports.bisectRight = void 0;

var _ascending = _interopRequireDefault(require("./ascending.js"));

var _bisector = _interopRequireDefault(require("./bisector.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var ascendingBisect = (0, _bisector.default)(_ascending.default);
var bisectRight = ascendingBisect.right;
exports.bisectRight = bisectRight;
var bisectLeft = ascendingBisect.left;
exports.bisectLeft = bisectLeft;
var _default = bisectRight;
exports.default = _default;
},{"./ascending.js":"CHz1","./bisector.js":"TH2p"}],"qen7":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = count;

function count(values, valueof) {
  let count = 0;

  if (valueof === undefined) {
    for (let value of values) {
      if (value != null && (value = +value) >= value) {
        ++count;
      }
    }
  } else {
    let index = -1;

    for (let value of values) {
      if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
        ++count;
      }
    }
  }

  return count;
}
},{}],"xaEI":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = cross;

function length(array) {
  return array.length | 0;
}

function empty(length) {
  return !(length > 0);
}

function arrayify(values) {
  return typeof values !== "object" || "length" in values ? values : Array.from(values);
}

function reducer(reduce) {
  return values => reduce(...values);
}

function cross(...values) {
  const reduce = typeof values[values.length - 1] === "function" && reducer(values.pop());
  values = values.map(arrayify);
  const lengths = values.map(length);
  const j = values.length - 1;
  const index = new Array(j + 1).fill(0);
  const product = [];
  if (j < 0 || lengths.some(empty)) return product;

  while (true) {
    product.push(index.map((j, i) => values[i][j]));
    let i = j;

    while (++index[i] === lengths[i]) {
      if (i === 0) return reduce ? product.map(reduce) : product;
      index[i--] = 0;
    }
  }
}
},{}],"LPRC":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = cumsum;

function cumsum(values, valueof) {
  var sum = 0,
      index = 0;
  return Float64Array.from(values, valueof === undefined ? v => sum += +v || 0 : v => sum += +valueof(v, index++, values) || 0);
}
},{}],"s7oJ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(a, b) {
  return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
}
},{}],"dVf8":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = variance;

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);
}
},{}],"gdWJ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = deviation;

var _variance = _interopRequireDefault(require("./variance.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function deviation(values, valueof) {
  const v = (0, _variance.default)(values, valueof);
  return v ? Math.sqrt(v) : v;
}
},{"./variance.js":"dVf8"}],"CLkD":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(values, valueof) {
  let min;
  let max;

  if (valueof === undefined) {
    for (const value of values) {
      if (value != null) {
        if (min === undefined) {
          if (value >= value) min = max = value;
        } else {
          if (min > value) min = value;
          if (max < value) max = value;
        }
      }
    }
  } else {
    let index = -1;

    for (let value of values) {
      if ((value = valueof(value, ++index, values)) != null) {
        if (min === undefined) {
          if (value >= value) min = max = value;
        } else {
          if (min > value) min = value;
          if (max < value) max = value;
        }
      }
    }
  }

  return [min, max];
}
},{}],"lUE8":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = group;
exports.groups = groups;
exports.rollup = rollup;
exports.rollups = rollups;

var _identity = _interopRequireDefault(require("./identity.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function group(values, ...keys) {
  return nest(values, _identity.default, _identity.default, keys);
}

function groups(values, ...keys) {
  return nest(values, Array.from, _identity.default, keys);
}

function rollup(values, reduce, ...keys) {
  return nest(values, _identity.default, reduce, keys);
}

function rollups(values, reduce, ...keys) {
  return nest(values, Array.from, reduce, keys);
}

function nest(values, map, reduce, keys) {
  return function regroup(values, i) {
    if (i >= keys.length) return reduce(values);
    const groups = new Map();
    const keyof = keys[i++];
    let index = -1;

    for (const value of values) {
      const key = keyof(value, ++index, values);
      const group = groups.get(key);
      if (group) group.push(value);else groups.set(key, [value]);
    }

    for (const [key, values] of groups) {
      groups.set(key, regroup(values, i));
    }

    return map(groups);
  }(values, 0);
}
},{"./identity.js":"LuEH"}],"gb1M":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.map = exports.slice = void 0;
var array = Array.prototype;
var slice = array.slice;
exports.slice = slice;
var map = array.map;
exports.map = map;
},{}],"OKWp":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(x) {
  return function () {
    return x;
  };
}
},{}],"p0JS":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(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;
}
},{}],"ZDeh":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.tickIncrement = tickIncrement;
exports.tickStep = tickStep;
var e10 = Math.sqrt(50),
    e5 = Math.sqrt(10),
    e2 = Math.sqrt(2);

function _default(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) {
    start = Math.ceil(start / step);
    stop = Math.floor(stop / step);
    ticks = new Array(n = Math.ceil(stop - start + 1));

    while (++i < n) ticks[i] = (start + i) * step;
  } else {
    start = Math.floor(start * step);
    stop = Math.ceil(stop * step);
    ticks = new Array(n = Math.ceil(start - stop + 1));

    while (++i < n) ticks[i] = (start - 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;
}
},{}],"H59p":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _count = _interopRequireDefault(require("../count.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(values) {
  return Math.ceil(Math.log((0, _count.default)(values)) / Math.LN2) + 1;
}
},{"../count.js":"qen7"}],"XtZq":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _array = require("./array.js");

var _bisect = _interopRequireDefault(require("./bisect.js"));

var _constant = _interopRequireDefault(require("./constant.js"));

var _extent = _interopRequireDefault(require("./extent.js"));

var _identity = _interopRequireDefault(require("./identity.js"));

var _range = _interopRequireDefault(require("./range.js"));

var _ticks = require("./ticks.js");

var _sturges = _interopRequireDefault(require("./threshold/sturges.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default() {
  var value = _identity.default,
      domain = _extent.default,
      threshold = _sturges.default;

  function histogram(data) {
    if (!Array.isArray(data)) data = Array.from(data);
    var i,
        n = data.length,
        x,
        values = new Array(n);

    for (i = 0; i < n; ++i) {
      values[i] = value(data[i], i, data);
    }

    var xz = domain(values),
        x0 = xz[0],
        x1 = xz[1],
        tz = threshold(values, x0, x1); // Convert number of thresholds into uniform thresholds.

    if (!Array.isArray(tz)) {
      tz = (0, _ticks.tickStep)(x0, x1, tz);
      tz = (0, _range.default)(Math.ceil(x0 / tz) * tz, x1, tz); // exclusive
    } // Remove any thresholds outside the domain.


    var m = tz.length;

    while (tz[0] <= x0) tz.shift(), --m;

    while (tz[m - 1] > x1) tz.pop(), --m;

    var bins = new Array(m + 1),
        bin; // Initialize bins.

    for (i = 0; i <= m; ++i) {
      bin = bins[i] = [];
      bin.x0 = i > 0 ? tz[i - 1] : x0;
      bin.x1 = i < m ? tz[i] : x1;
    } // Assign data to bins by value, ignoring any outside the domain.


    for (i = 0; i < n; ++i) {
      x = values[i];

      if (x0 <= x && x <= x1) {
        bins[(0, _bisect.default)(tz, x, 0, m)].push(data[i]);
      }
    }

    return bins;
  }

  histogram.value = function (_) {
    return arguments.length ? (value = typeof _ === "function" ? _ : (0, _constant.default)(_), histogram) : value;
  };

  histogram.domain = function (_) {
    return arguments.length ? (domain = typeof _ === "function" ? _ : (0, _constant.default)([_[0], _[1]]), histogram) : domain;
  };

  histogram.thresholds = function (_) {
    return arguments.length ? (threshold = typeof _ === "function" ? _ : Array.isArray(_) ? (0, _constant.default)(_array.slice.call(_)) : (0, _constant.default)(_), histogram) : threshold;
  };

  return histogram;
}
},{"./array.js":"gb1M","./bisect.js":"Yob9","./constant.js":"OKWp","./extent.js":"CLkD","./identity.js":"LuEH","./range.js":"p0JS","./ticks.js":"ZDeh","./threshold/sturges.js":"H59p"}],"x9wj":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = max;

function 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;
}
},{}],"GKKy":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = min;

function 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;
}
},{}],"CLiU":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = quickselect;

var _ascending = _interopRequireDefault(require("./ascending.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// 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.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;
}
},{"./ascending.js":"CHz1"}],"Mz1A":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.numbers = numbers;

function _default(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;
      }
    }
  }
}
},{}],"GHmv":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = quantile;
exports.quantileSorted = quantileSorted;

var _max = _interopRequireDefault(require("./max.js"));

var _min = _interopRequireDefault(require("./min.js"));

var _quickselect = _interopRequireDefault(require("./quickselect.js"));

var _number = _interopRequireWildcard(require("./number.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function quantile(values, p, valueof) {
  values = Float64Array.from((0, _number.numbers)(values, valueof));
  if (!(n = values.length)) return;
  if ((p = +p) <= 0 || n < 2) return (0, _min.default)(values);
  if (p >= 1) return (0, _max.default)(values);
  var n,
      i = (n - 1) * p,
      i0 = Math.floor(i),
      value0 = (0, _max.default)((0, _quickselect.default)(values, i0).subarray(0, i0 + 1)),
      value1 = (0, _min.default)(values.subarray(i0 + 1));
  return value0 + (value1 - value0) * (i - i0);
}

function quantileSorted(values, p, valueof = _number.default) {
  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);
}
},{"./max.js":"x9wj","./min.js":"GKKy","./quickselect.js":"CLiU","./number.js":"Mz1A"}],"cBAY":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _count = _interopRequireDefault(require("../count.js"));

var _quantile = _interopRequireDefault(require("../quantile.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(values, min, max) {
  return Math.ceil((max - min) / (2 * ((0, _quantile.default)(values, 0.75) - (0, _quantile.default)(values, 0.25)) * Math.pow((0, _count.default)(values), -1 / 3)));
}
},{"../count.js":"qen7","../quantile.js":"GHmv"}],"lvim":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _count = _interopRequireDefault(require("../count.js"));

var _deviation = _interopRequireDefault(require("../deviation.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(values, min, max) {
  return Math.ceil((max - min) / (3.5 * (0, _deviation.default)(values) * Math.pow((0, _count.default)(values), -1 / 3)));
}
},{"../count.js":"qen7","../deviation.js":"gdWJ"}],"qG2o":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = maxIndex;

function maxIndex(values, valueof) {
  let max;
  let maxIndex = -1;
  let index = -1;

  if (valueof === undefined) {
    for (const value of values) {
      ++index;

      if (value != null && (max < value || max === undefined && value >= value)) {
        max = value, maxIndex = index;
      }
    }
  } else {
    for (let value of values) {
      if ((value = valueof(value, ++index, values)) != null && (max < value || max === undefined && value >= value)) {
        max = value, maxIndex = index;
      }
    }
  }

  return maxIndex;
}
},{}],"cGYI":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = mean;

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;
}
},{}],"FfrF":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _quantile = _interopRequireDefault(require("./quantile.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(values, valueof) {
  return (0, _quantile.default)(values, 0.5, valueof);
}
},{"./quantile.js":"GHmv"}],"EzuM":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = merge;

function* flatten(arrays) {
  for (const array of arrays) {
    yield* array;
  }
}

function merge(arrays) {
  return Array.from(flatten(arrays));
}
},{}],"Ym5e":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = minIndex;

function minIndex(values, valueof) {
  let min;
  let minIndex = -1;
  let index = -1;

  if (valueof === undefined) {
    for (const value of values) {
      ++index;

      if (value != null && (min > value || min === undefined && value >= value)) {
        min = value, minIndex = index;
      }
    }
  } else {
    for (let value of values) {
      if ((value = valueof(value, ++index, values)) != null && (min > value || min === undefined && value >= value)) {
        min = value, minIndex = index;
      }
    }
  }

  return minIndex;
}
},{}],"PuGY":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = pairs;
exports.pair = pair;

function pairs(values, pairof = pair) {
  const pairs = [];
  let previous;
  let first = false;

  for (const value of values) {
    if (first) pairs.push(pairof(previous, value));
    previous = value;
    first = true;
  }

  return pairs;
}

function pair(a, b) {
  return [a, b];
}
},{}],"XFTn":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(source, keys) {
  return Array.from(keys, key => source[key]);
}
},{}],"IxQK":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = least;

var _ascending = _interopRequireDefault(require("./ascending.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function least(values, compare = _ascending.default) {
  let min;
  let defined = false;

  if (compare.length === 1) {
    let minValue;

    for (const element of values) {
      const value = compare(element);

      if (defined ? (0, _ascending.default)(value, minValue) < 0 : (0, _ascending.default)(value, value) === 0) {
        min = element;
        minValue = value;
        defined = true;
      }
    }
  } else {
    for (const value of values) {
      if (defined ? compare(value, min) < 0 : compare(value, value) === 0) {
        min = value;
        defined = true;
      }
    }
  }

  return min;
}
},{"./ascending.js":"CHz1"}],"upcM":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = leastIndex;

var _ascending = _interopRequireDefault(require("./ascending.js"));

var _minIndex = _interopRequireDefault(require("./minIndex.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function leastIndex(values, compare = _ascending.default) {
  if (compare.length === 1) return (0, _minIndex.default)(values, compare);
  let minValue;
  let min = -1;
  let index = -1;

  for (const value of values) {
    ++index;

    if (min < 0 ? compare(value, value) === 0 : compare(value, minValue) < 0) {
      minValue = value;
      min = index;
    }
  }

  return min;
}
},{"./ascending.js":"CHz1","./minIndex.js":"Ym5e"}],"mwkB":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = greatest;

var _ascending = _interopRequireDefault(require("./ascending.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function greatest(values, compare = _ascending.default) {
  let max;
  let defined = false;

  if (compare.length === 1) {
    let maxValue;

    for (const element of values) {
      const value = compare(element);

      if (defined ? (0, _ascending.default)(value, maxValue) > 0 : (0, _ascending.default)(value, value) === 0) {
        max = element;
        maxValue = value;
        defined = true;
      }
    }
  } else {
    for (const value of values) {
      if (defined ? compare(value, max) > 0 : compare(value, value) === 0) {
        max = value;
        defined = true;
      }
    }
  }

  return max;
}
},{"./ascending.js":"CHz1"}],"hCzr":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = greatestIndex;

var _ascending = _interopRequireDefault(require("./ascending.js"));

var _maxIndex = _interopRequireDefault(require("./maxIndex.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function greatestIndex(values, compare = _ascending.default) {
  if (compare.length === 1) return (0, _maxIndex.default)(values, compare);
  let maxValue;
  let max = -1;
  let index = -1;

  for (const value of values) {
    ++index;

    if (max < 0 ? compare(value, value) === 0 : compare(value, maxValue) > 0) {
      maxValue = value;
      max = index;
    }
  }

  return max;
}
},{"./ascending.js":"CHz1","./maxIndex.js":"qG2o"}],"H5no":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = scan;

var _leastIndex = _interopRequireDefault(require("./leastIndex.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function scan(values, compare) {
  const index = (0, _leastIndex.default)(values, compare);
  return index < 0 ? undefined : index;
}
},{"./leastIndex.js":"upcM"}],"q8CL":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = shuffle;

function shuffle(array, i0 = 0, i1 = array.length) {
  var m = i1 - (i0 = +i0),
      t,
      i;

  while (m) {
    i = Math.random() * m-- | 0;
    t = array[m + i0];
    array[m + i0] = array[i + i0];
    array[i + i0] = t;
  }

  return array;
}
},{}],"tfh5":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = sum;

function 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;
}
},{}],"ovym":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _min = _interopRequireDefault(require("./min.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(matrix) {
  if (!(n = matrix.length)) return [];

  for (var i = -1, m = (0, _min.default)(matrix, length), transpose = new Array(m); ++i < m;) {
    for (var j = -1, n, row = transpose[i] = new Array(n); ++j < n;) {
      row[j] = matrix[j][i];
    }
  }

  return transpose;
}

function length(d) {
  return d.length;
}
},{"./min.js":"GKKy"}],"DYHk":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _transpose = _interopRequireDefault(require("./transpose.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default() {
  return (0, _transpose.default)(arguments);
}
},{"./transpose.js":"ovym"}],"Rpnd":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "bisect", {
  enumerable: true,
  get: function () {
    return _bisect.default;
  }
});
Object.defineProperty(exports, "bisectRight", {
  enumerable: true,
  get: function () {
    return _bisect.bisectRight;
  }
});
Object.defineProperty(exports, "bisectLeft", {
  enumerable: true,
  get: function () {
    return _bisect.bisectLeft;
  }
});
Object.defineProperty(exports, "ascending", {
  enumerable: true,
  get: function () {
    return _ascending.default;
  }
});
Object.defineProperty(exports, "bisector", {
  enumerable: true,
  get: function () {
    return _bisector.default;
  }
});
Object.defineProperty(exports, "count", {
  enumerable: true,
  get: function () {
    return _count.default;
  }
});
Object.defineProperty(exports, "cross", {
  enumerable: true,
  get: function () {
    return _cross.default;
  }
});
Object.defineProperty(exports, "cumsum", {
  enumerable: true,
  get: function () {
    return _cumsum.default;
  }
});
Object.defineProperty(exports, "descending", {
  enumerable: true,
  get: function () {
    return _descending.default;
  }
});
Object.defineProperty(exports, "deviation", {
  enumerable: true,
  get: function () {
    return _deviation.default;
  }
});
Object.defineProperty(exports, "extent", {
  enumerable: true,
  get: function () {
    return _extent.default;
  }
});
Object.defineProperty(exports, "group", {
  enumerable: true,
  get: function () {
    return _group.default;
  }
});
Object.defineProperty(exports, "groups", {
  enumerable: true,
  get: function () {
    return _group.groups;
  }
});
Object.defineProperty(exports, "rollup", {
  enumerable: true,
  get: function () {
    return _group.rollup;
  }
});
Object.defineProperty(exports, "rollups", {
  enumerable: true,
  get: function () {
    return _group.rollups;
  }
});
Object.defineProperty(exports, "bin", {
  enumerable: true,
  get: function () {
    return _bin.default;
  }
});
Object.defineProperty(exports, "histogram", {
  enumerable: true,
  get: function () {
    return _bin.default;
  }
});
Object.defineProperty(exports, "thresholdFreedmanDiaconis", {
  enumerable: true,
  get: function () {
    return _freedmanDiaconis.default;
  }
});
Object.defineProperty(exports, "thresholdScott", {
  enumerable: true,
  get: function () {
    return _scott.default;
  }
});
Object.defineProperty(exports, "thresholdSturges", {
  enumerable: true,
  get: function () {
    return _sturges.default;
  }
});
Object.defineProperty(exports, "max", {
  enumerable: true,
  get: function () {
    return _max.default;
  }
});
Object.defineProperty(exports, "maxIndex", {
  enumerable: true,
  get: function () {
    return _maxIndex.default;
  }
});
Object.defineProperty(exports, "mean", {
  enumerable: true,
  get: function () {
    return _mean.default;
  }
});
Object.defineProperty(exports, "median", {
  enumerable: true,
  get: function () {
    return _median.default;
  }
});
Object.defineProperty(exports, "merge", {
  enumerable: true,
  get: function () {
    return _merge.default;
  }
});
Object.defineProperty(exports, "min", {
  enumerable: true,
  get: function () {
    return _min.default;
  }
});
Object.defineProperty(exports, "minIndex", {
  enumerable: true,
  get: function () {
    return _minIndex.default;
  }
});
Object.defineProperty(exports, "pairs", {
  enumerable: true,
  get: function () {
    return _pairs.default;
  }
});
Object.defineProperty(exports, "permute", {
  enumerable: true,
  get: function () {
    return _permute.default;
  }
});
Object.defineProperty(exports, "quantile", {
  enumerable: true,
  get: function () {
    return _quantile.default;
  }
});
Object.defineProperty(exports, "quantileSorted", {
  enumerable: true,
  get: function () {
    return _quantile.quantileSorted;
  }
});
Object.defineProperty(exports, "quickselect", {
  enumerable: true,
  get: function () {
    return _quickselect.default;
  }
});
Object.defineProperty(exports, "range", {
  enumerable: true,
  get: function () {
    return _range.default;
  }
});
Object.defineProperty(exports, "least", {
  enumerable: true,
  get: function () {
    return _least.default;
  }
});
Object.defineProperty(exports, "leastIndex", {
  enumerable: true,
  get: function () {
    return _leastIndex.default;
  }
});
Object.defineProperty(exports, "greatest", {
  enumerable: true,
  get: function () {
    return _greatest.default;
  }
});
Object.defineProperty(exports, "greatestIndex", {
  enumerable: true,
  get: function () {
    return _greatestIndex.default;
  }
});
Object.defineProperty(exports, "scan", {
  enumerable: true,
  get: function () {
    return _scan.default;
  }
});
Object.defineProperty(exports, "shuffle", {
  enumerable: true,
  get: function () {
    return _shuffle.default;
  }
});
Object.defineProperty(exports, "sum", {
  enumerable: true,
  get: function () {
    return _sum.default;
  }
});
Object.defineProperty(exports, "ticks", {
  enumerable: true,
  get: function () {
    return _ticks.default;
  }
});
Object.defineProperty(exports, "tickIncrement", {
  enumerable: true,
  get: function () {
    return _ticks.tickIncrement;
  }
});
Object.defineProperty(exports, "tickStep", {
  enumerable: true,
  get: function () {
    return _ticks.tickStep;
  }
});
Object.defineProperty(exports, "transpose", {
  enumerable: true,
  get: function () {
    return _transpose.default;
  }
});
Object.defineProperty(exports, "variance", {
  enumerable: true,
  get: function () {
    return _variance.default;
  }
});
Object.defineProperty(exports, "zip", {
  enumerable: true,
  get: function () {
    return _zip.default;
  }
});

var _bisect = _interopRequireWildcard(require("./bisect.js"));

var _ascending = _interopRequireDefault(require("./ascending.js"));

var _bisector = _interopRequireDefault(require("./bisector.js"));

var _count = _interopRequireDefault(require("./count.js"));

var _cross = _interopRequireDefault(require("./cross.js"));

var _cumsum = _interopRequireDefault(require("./cumsum.js"));

var _descending = _interopRequireDefault(require("./descending.js"));

var _deviation = _interopRequireDefault(require("./deviation.js"));

var _extent = _interopRequireDefault(require("./extent.js"));

var _group = _interopRequireWildcard(require("./group.js"));

var _bin = _interopRequireDefault(require("./bin.js"));

var _freedmanDiaconis = _interopRequireDefault(require("./threshold/freedmanDiaconis.js"));

var _scott = _interopRequireDefault(require("./threshold/scott.js"));

var _sturges = _interopRequireDefault(require("./threshold/sturges.js"));

var _max = _interopRequireDefault(require("./max.js"));

var _maxIndex = _interopRequireDefault(require("./maxIndex.js"));

var _mean = _interopRequireDefault(require("./mean.js"));

var _median = _interopRequireDefault(require("./median.js"));

var _merge = _interopRequireDefault(require("./merge.js"));

var _min = _interopRequireDefault(require("./min.js"));

var _minIndex = _interopRequireDefault(require("./minIndex.js"));

var _pairs = _interopRequireDefault(require("./pairs.js"));

var _permute = _interopRequireDefault(require("./permute.js"));

var _quantile = _interopRequireWildcard(require("./quantile.js"));

var _quickselect = _interopRequireDefault(require("./quickselect.js"));

var _range = _interopRequireDefault(require("./range.js"));

var _least = _interopRequireDefault(require("./least.js"));

var _leastIndex = _interopRequireDefault(require("./leastIndex.js"));

var _greatest = _interopRequireDefault(require("./greatest.js"));

var _greatestIndex = _interopRequireDefault(require("./greatestIndex.js"));

var _scan = _interopRequireDefault(require("./scan.js"));

var _shuffle = _interopRequireDefault(require("./shuffle.js"));

var _sum = _interopRequireDefault(require("./sum.js"));

var _ticks = _interopRequireWildcard(require("./ticks.js"));

var _transpose = _interopRequireDefault(require("./transpose.js"));

var _variance = _interopRequireDefault(require("./variance.js"));

var _zip = _interopRequireDefault(require("./zip.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
},{"./bisect.js":"Yob9","./ascending.js":"CHz1","./bisector.js":"TH2p","./count.js":"qen7","./cross.js":"xaEI","./cumsum.js":"LPRC","./descending.js":"s7oJ","./deviation.js":"gdWJ","./extent.js":"CLkD","./group.js":"lUE8","./bin.js":"XtZq","./threshold/freedmanDiaconis.js":"cBAY","./threshold/scott.js":"lvim","./threshold/sturges.js":"H59p","./max.js":"x9wj","./maxIndex.js":"qG2o","./mean.js":"cGYI","./median.js":"FfrF","./merge.js":"EzuM","./min.js":"GKKy","./minIndex.js":"Ym5e","./pairs.js":"PuGY","./permute.js":"XFTn","./quantile.js":"GHmv","./quickselect.js":"CLiU","./range.js":"p0JS","./least.js":"IxQK","./leastIndex.js":"upcM","./greatest.js":"mwkB","./greatestIndex.js":"hCzr","./scan.js":"H5no","./shuffle.js":"q8CL","./sum.js":"tfh5","./ticks.js":"ZDeh","./transpose.js":"ovym","./variance.js":"dVf8","./zip.js":"DYHk"}],"FwoB":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _numbers = _interopRequireDefault(require("./numbers"));

var _d3Array = require("d3-array");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(array, p, f) {
  var values = Float64Array.from((0, _numbers.default)(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(_d3Array.ascending);
  return p.map(_ => (0, _d3Array.quantileSorted)(values, _));
}
},{"./numbers":"GiOq","d3-array":"Rpnd"}],"r9x6":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _quantiles = _interopRequireDefault(require("./quantiles"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(array, f) {
  return (0, _quantiles.default)(array, [0.25, 0.50, 0.75], f);
}
},{"./quantiles":"FwoB"}],"cdFE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _quartiles = _interopRequireDefault(require("./quartiles"));

var _d3Array = require("d3-array");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Scott, D. W. (1992) Multivariate Density Estimation:
// Theory, Practice, and Visualization. Wiley.
function _default(array, f) {
  var n = array.length,
      v = (0, _d3Array.deviation)(array, f),
      q = (0, _quartiles.default)(array, f),
      h = (q[2] - q[0]) / 1.34;
  v = Math.min(v, h) || v || Math.abs(q[0]) || 1;
  return 1.06 * v * Math.pow(n, -0.2);
}
},{"./quartiles":"r9x6","d3-array":"Rpnd"}],"KzVa":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(_) {
  // determine range
  var maxb = _.maxbins || 20,
      base = _.base || 10,
      logb = Math.log(base),
      div = _.divide || [5, 2],
      min = _.extent[0],
      max = _.extent[1],
      span = _.span || max - min || Math.abs(min) || 1,
      step,
      level,
      minstep,
      precision,
      v,
      i,
      n,
      eps;

  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);
  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
  };
}
},{}],"IXnM":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.setRandom = setRandom;
exports.random = void 0;
var random = Math.random;
exports.random = random;

function setRandom(r) {
  exports.random = random = r;
}
},{}],"sg01":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _numbers = _interopRequireDefault(require("./numbers"));

var _random = require("./random");

var _d3Array = require("d3-array");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(array, samples, alpha, f) {
  if (!array.length) return [undefined, undefined];
  var values = Float64Array.from((0, _numbers.default)(array, f)),
      n = values.length,
      m = samples,
      a,
      i,
      j,
      mu;

  for (j = 0, mu = Array(m); j < m; ++j) {
    for (a = 0, i = 0; i < n; ++i) {
      a += values[~~((0, _random.random)() * n)];
    }

    mu[j] = a / n;
  }

  mu.sort(_d3Array.ascending);
  return [(0, _d3Array.quantile)(mu, alpha / 2), (0, _d3Array.quantile)(mu, 1 - alpha / 2)];
}
},{"./numbers":"GiOq","./random":"IXnM","d3-array":"Rpnd"}],"djO7":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

// 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 _default(array, step, smooth, f) {
  f = f || (_ => _);

  let i = 0,
      j = 1,
      n = array.length,
      v = new Float64Array(n),
      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) {
  let n = v.length,
      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;
}
},{}],"lrW5":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(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;
  };
}
},{}],"OA6r":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _random = require("./random");

function _default(min, max) {
  if (max == null) {
    max = min;
    min = 0;
  }

  var dist = {},
      a,
      b,
      d;

  dist.min = function (_) {
    if (arguments.length) {
      a = _ || 0;
      d = b - a;
      return dist;
    } else {
      return a;
    }
  };

  dist.max = function (_) {
    if (arguments.length) {
      b = _ || 0;
      d = b - a;
      return dist;
    } else {
      return b;
    }
  };

  dist.sample = function () {
    return a + Math.floor(d * (0, _random.random)());
  };

  dist.pdf = function (x) {
    return x === Math.floor(x) && x >= a && x < b ? 1 / d : 0;
  };

  dist.cdf = function (x) {
    var v = Math.floor(x);
    return v < a ? 0 : v >= b ? 1 : (v - a + 1) / d;
  };

  dist.icdf = function (p) {
    return p >= 0 && p <= 1 ? a - 1 + Math.floor(p * d) : NaN;
  };

  return dist.min(min).max(max);
}
},{"./random":"IXnM"}],"oHC1":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.SQRT2 = exports.SQRT2PI = void 0;
const SQRT2PI = Math.sqrt(2 * Math.PI);
exports.SQRT2PI = SQRT2PI;
const SQRT2 = Math.SQRT2;
exports.SQRT2 = SQRT2;
},{}],"Dz5A":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.sampleNormal = sampleNormal;
exports.densityNormal = densityNormal;
exports.cumulativeNormal = cumulativeNormal;
exports.quantileNormal = quantileNormal;
exports.default = _default;

var _constants = require("./constants");

var _random = require("./random");

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 = (0, _random.random)() * 2 - 1;
      y = (0, _random.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 * _constants.SQRT2PI);
} // Approximation from West (2009)
// Better Approximations to Cumulative Normal Functions


function cumulativeNormal(value, mean, stdev) {
  mean = mean || 0;
  stdev = stdev == null ? 1 : stdev;
  let cd,
      z = (value - mean) / stdev,
      Z = Math.abs(z);

  if (Z > 37) {
    cd = 0;
  } else {
    let sum,
        exp = Math.exp(-Z * Z / 2);

    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) * _constants.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 _default(mean, stdev) {
  var mu,
      sigma,
      dist = {
    mean: function (_) {
      if (arguments.length) {
        mu = _ || 0;
        return dist;
      } else {
        return mu;
      }
    },
    stdev: function (_) {
      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);
}
},{"./constants":"oHC1","./random":"IXnM"}],"QgXE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _bandwidth = _interopRequireDefault(require("./bandwidth"));

var _normal = _interopRequireDefault(require("./normal"));

var _random = require("./random");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// TODO: support for additional kernels?
function _default(support, bandwidth) {
  var kernel = (0, _normal.default)(),
      dist = {},
      n = 0;

  dist.data = function (_) {
    if (arguments.length) {
      support = _;
      n = _ ? _.length : 0;
      return dist.bandwidth(bandwidth);
    } else {
      return support;
    }
  };

  dist.bandwidth = function (_) {
    if (!arguments.length) return bandwidth;
    bandwidth = _;
    if (!bandwidth && support) bandwidth = (0, _bandwidth.default)(support);
    return dist;
  };

  dist.sample = function () {
    return support[~~((0, _random.random)() * n)] + bandwidth * kernel.sample();
  };

  dist.pdf = function (x) {
    for (var y = 0, i = 0; i < n; ++i) {
      y += kernel.pdf((x - support[i]) / bandwidth);
    }

    return y / bandwidth / n;
  };

  dist.cdf = function (x) {
    for (var y = 0, i = 0; i < n; ++i) {
      y += kernel.cdf((x - support[i]) / bandwidth);
    }

    return y / n;
  };

  dist.icdf = function () {
    throw Error('KDE icdf not supported.');
  };

  return dist.data(support);
}
},{"./bandwidth":"cdFE","./normal":"Dz5A","./random":"IXnM"}],"T3QV":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.sampleLogNormal = sampleLogNormal;
exports.densityLogNormal = densityLogNormal;
exports.cumulativeLogNormal = cumulativeLogNormal;
exports.quantileLogNormal = quantileLogNormal;
exports.default = _default;

var _normal = require("./normal");

var _constants = require("./constants");

function sampleLogNormal(mean, stdev) {
  mean = mean || 0;
  stdev = stdev == null ? 1 : stdev;
  return Math.exp(mean + (0, _normal.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 * _constants.SQRT2PI * value);
}

function cumulativeLogNormal(value, mean, stdev) {
  return (0, _normal.cumulativeNormal)(Math.log(value), mean, stdev);
}

function quantileLogNormal(p, mean, stdev) {
  return Math.exp((0, _normal.quantileNormal)(p, mean, stdev));
}

function _default(mean, stdev) {
  var mu,
      sigma,
      dist = {
    mean: function (_) {
      if (arguments.length) {
        mu = _ || 0;
        return dist;
      } else {
        return mu;
      }
    },
    stdev: function (_) {
      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);
}
},{"./normal":"Dz5A","./constants":"oHC1"}],"Fw2A":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _random = require("./random");

function _default(dists, weights) {
  var dist = {},
      m = 0,
      w;

  function normalize(x) {
    var w = [],
        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;
  }

  dist.weights = function (_) {
    if (arguments.length) {
      w = normalize(weights = _ || []);
      return dist;
    }

    return weights;
  };

  dist.distributions = function (_) {
    if (arguments.length) {
      if (_) {
        m = _.length;
        dists = _;
      } else {
        m = 0;
        dists = [];
      }

      return dist.weights(weights);
    }

    return dists;
  };

  dist.sample = function () {
    var r = (0, _random.random)(),
        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();
  };

  dist.pdf = function (x) {
    for (var p = 0, i = 0; i < m; ++i) {
      p += w[i] * dists[i].pdf(x);
    }

    return p;
  };

  dist.cdf = function (x) {
    for (var p = 0, i = 0; i < m; ++i) {
      p += w[i] * dists[i].cdf(x);
    }

    return p;
  };

  dist.icdf = function () {
    throw Error('Mixture icdf not supported.');
  };

  return dist.distributions(dists).weights(weights);
}
},{"./random":"IXnM"}],"sqAQ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.sampleUniform = sampleUniform;
exports.densityUniform = densityUniform;
exports.cumulativeUniform = cumulativeUniform;
exports.quantileUniform = quantileUniform;
exports.default = _default;

var _random = require("./random");

function sampleUniform(min, max) {
  if (max == null) {
    max = min == null ? 1 : min;
    min = 0;
  }

  return min + (max - min) * (0, _random.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 _default(min, max) {
  var a,
      b,
      dist = {
    min: function (_) {
      if (arguments.length) {
        a = _ || 0;
        return dist;
      } else {
        return a;
      }
    },
    max: function (_) {
      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);
}
},{"./random":"IXnM"}],"jKMU":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

// Ordinary Least Squares
function _default(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];
}
},{}],"pvk3":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.points = points;
exports.visitPoints = visitPoints;

function 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 X = new Float64Array(data.length),
        Y = new Float64Array(data.length);
  let i = 0;

  for (let d of data) {
    X[i] = x(d);
    Y[i] = y(d);
    ++i;
  }

  return [X, Y];
}

function visitPoints(data, x, y, callback) {
  let index = -1,
      i = -1,
      u,
      v;

  for (let d of data) {
    u = x(d, ++index, data);
    v = y(d, index, data);

    if (u != null && (u = +u) >= u && v != null && (v = +v) >= v) {
      callback(u, v, ++i);
    }
  }
}
},{}],"THs1":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _points = require("./points");

// Adapted from d3-regression by Harry Stevens
// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE
function _default(data, x, y, uY, predict) {
  let SSE = 0,
      SST = 0;
  (0, _points.visitPoints)(data, x, y, (dx, dy) => {
    const sse = dy - predict(dx),
          sst = dy - uY;
    SSE += sse * sse;
    SST += sst * sst;
  });
  return 1 - SSE / SST;
}
},{"./points":"pvk3"}],"HTLe":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _ols = _interopRequireDefault(require("./ols"));

var _points = require("./points");

var _rSquared = _interopRequireDefault(require("./r-squared"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Adapted from d3-regression by Harry Stevens
// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE
function _default(data, x, y) {
  let X = 0,
      Y = 0,
      XY = 0,
      X2 = 0,
      n = 0;
  (0, _points.visitPoints)(data, x, y, (dx, dy) => {
    X += dx;
    Y += dy;
    XY += dx * dy;
    X2 += dx * dx;
    ++n;
  });

  const coef = (0, _ols.default)(X / n, Y / n, XY / n, X2 / n),
        predict = x => coef[0] + coef[1] * x;

  return {
    coef: coef,
    predict: predict,
    rSquared: (0, _rSquared.default)(data, x, y, Y / n, predict)
  };
}
},{"./ols":"jKMU","./points":"pvk3","./r-squared":"THs1"}],"ClCW":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _ols = _interopRequireDefault(require("./ols"));

var _points = require("./points");

var _rSquared = _interopRequireDefault(require("./r-squared"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Adapted from d3-regression by Harry Stevens
// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE
function _default(data, x, y) {
  let X = 0,
      Y = 0,
      XY = 0,
      X2 = 0,
      n = 0;
  (0, _points.visitPoints)(data, x, y, (dx, dy) => {
    dx = Math.log(dx);
    X += dx;
    Y += dy;
    XY += dx * dy;
    X2 += dx * dx;
    ++n;
  });

  const coef = (0, _ols.default)(X / n, Y / n, XY / n, X2 / n),
        predict = x => coef[0] + coef[1] * Math.log(x);

  return {
    coef: coef,
    predict: predict,
    rSquared: (0, _rSquared.default)(data, x, y, Y / n, predict)
  };
}
},{"./ols":"jKMU","./points":"pvk3","./r-squared":"THs1"}],"TFqr":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _ols = _interopRequireDefault(require("./ols"));

var _points = require("./points");

var _rSquared = _interopRequireDefault(require("./r-squared"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(data, x, y) {
  let Y = 0,
      YL = 0,
      XY = 0,
      XYL = 0,
      X2Y = 0,
      n = 0;
  (0, _points.visitPoints)(data, x, y, (dx, dy) => {
    const ly = Math.log(dy),
          xy = dx * dy;
    Y += dy;
    XY += xy;
    X2Y += dx * xy;
    YL += dy * ly;
    XYL += xy * ly;
    ++n;
  });

  const coef = (0, _ols.default)(XY / Y, YL / Y, XYL / Y, X2Y / Y),
        predict = x => coef[0] * Math.exp(coef[1] * x);

  coef[0] = Math.exp(coef[0]);
  return {
    coef: coef,
    predict: predict,
    rSquared: (0, _rSquared.default)(data, x, y, Y / n, predict)
  };
}
},{"./ols":"jKMU","./points":"pvk3","./r-squared":"THs1"}],"SXAp":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _ols = _interopRequireDefault(require("./ols"));

var _points = require("./points");

var _rSquared = _interopRequireDefault(require("./r-squared"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Adapted from d3-regression by Harry Stevens
// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE
function _default(data, x, y) {
  let X = 0,
      Y = 0,
      XY = 0,
      X2 = 0,
      YS = 0,
      n = 0;
  (0, _points.visitPoints)(data, x, y, (dx, dy) => {
    const lx = Math.log(dx),
          ly = Math.log(dy);
    X += lx;
    Y += ly;
    XY += lx * ly;
    X2 += lx * lx;
    YS += dy;
    ++n;
  });

  const coef = (0, _ols.default)(X / n, Y / n, XY / n, X2 / n),
        predict = x => coef[0] * Math.pow(x, coef[1]);

  coef[0] = Math.exp(coef[0]);
  return {
    coef: coef,
    predict: predict,
    rSquared: (0, _rSquared.default)(data, x, y, YS / n, predict)
  };
}
},{"./ols":"jKMU","./points":"pvk3","./r-squared":"THs1"}],"esN8":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _points = require("./points");

var _rSquared = _interopRequireDefault(require("./r-squared"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(data, x, y) {
  let X = 0,
      Y = 0,
      X2 = 0,
      X3 = 0,
      X4 = 0,
      XY = 0,
      X2Y = 0,
      n = 0;
  (0, _points.visitPoints)(data, x, y, (dx, dy) => {
    const x2 = dx * dx;
    X += dx;
    Y += dy;
    X2 += x2;
    X3 += x2 * dx;
    X4 += x2 * x2;
    XY += dx * dy;
    X2Y += x2 * dy;
    ++n;
  });
  Y = Y / n;
  XY = XY - X * Y;
  X2Y = X2Y - X2 * Y;

  const XX = X2 - X * X / n,
        XX2 = X3 - X2 * X / n,
        X2X2 = X4 - X2 * X2 / n,
        d = XX * X2X2 - XX2 * XX2,
        a = (X2Y * XX - XY * XX2) / d,
        b = (XY * X2X2 - X2Y * XX2) / d,
        c = Y - b * (X / n) - a * (X2 / n),
        predict = x => a * x * x + b * x + c;

  return {
    coef: [c, b, a],
    predict: predict,
    rSquared: (0, _rSquared.default)(data, x, y, Y, predict)
  };
}
},{"./points":"pvk3","./r-squared":"THs1"}],"oLBL":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _linear = _interopRequireDefault(require("./linear"));

var _points = require("./points");

var _quad = _interopRequireDefault(require("./quad"));

var _rSquared = _interopRequireDefault(require("./r-squared"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Adapted from d3-regression by Harry Stevens
// 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 _default(data, x, y, order) {
  // use more efficient methods for lower orders
  if (order === 1) return (0, _linear.default)(data, x, y);
  if (order === 2) return (0, _quad.default)(data, x, y);
  const [xv, yv] = (0, _points.points)(data, x, y),
        n = xv.length,
        lhs = [],
        rhs = [],
        k = order + 1;
  let Y = 0,
      i,
      j,
      l,
      v,
      c;

  for (i = 0; i < n; ++i) {
    Y += yv[i];
  }

  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 => {
    let y = 0,
        i = 0,
        n = coef.length;

    for (; i < n; ++i) y += coef[i] * Math.pow(x, i);

    return y;
  };

  return {
    coef: coef,
    predict: predict,
    rSquared: (0, _rSquared.default)(data, x, y, Y / n, predict)
  };
} // 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;
}
},{"./linear":"HTLe","./points":"pvk3","./quad":"esN8","./r-squared":"THs1"}],"dkgJ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _ols = _interopRequireDefault(require("./ols"));

var _points = require("./points");

var _d3Array = require("d3-array");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

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 _default(data, x, y, bandwidth) {
  const [xv, yv] = (0, _points.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,
          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] = (0, _ols.default)(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 = (0, _d3Array.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 output(xv, yhat);
} // 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) {
  let val = xv[i],
      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 output(xv, yhat) {
  const n = xv.length,
        out = [];

  for (let i = 0, cnt = 0, prev = [], v; i < n; ++i) {
    v = xv[i];

    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 = [v, yhat[i]];
      out.push(prev);
    }
  }

  return out;
}
},{"./ols":"jKMU","./points":"pvk3","d3-array":"Rpnd"}],"ipOg":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
// subdivide up to accuracy of 0.1 degrees
const MIN_RADIANS = 0.1 * Math.PI / 180; // Adaptively sample an interpolated function over a domain extent

function _default(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],
      p1 = next[next.length - 1];

  while (p1) {
    // midpoint for potential curve subdivision
    const pm = point((p0[0] + p1[0]) / 2);

    if (pm[0] - p0[0] >= stop && angleDelta(p0, pm, p1) > MIN_RADIANS) {
      // maximum resolution has not yet been met, and
      // subdivision midpoint 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 angleDelta(p, q, r) {
  const a0 = Math.atan2(r[1] - p[1], r[0] - p[0]),
        a1 = Math.atan2(q[1] - p[1], q[0] - p[0]);
  return Math.abs(a0 - a1);
}
},{}],"yUSi":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "bandwidthNRD", {
  enumerable: true,
  get: function () {
    return _bandwidth.default;
  }
});
Object.defineProperty(exports, "bin", {
  enumerable: true,
  get: function () {
    return _bin.default;
  }
});
Object.defineProperty(exports, "bootstrapCI", {
  enumerable: true,
  get: function () {
    return _bootstrapCI.default;
  }
});
Object.defineProperty(exports, "dotbin", {
  enumerable: true,
  get: function () {
    return _dotbin.default;
  }
});
Object.defineProperty(exports, "quantiles", {
  enumerable: true,
  get: function () {
    return _quantiles.default;
  }
});
Object.defineProperty(exports, "quartiles", {
  enumerable: true,
  get: function () {
    return _quartiles.default;
  }
});
Object.defineProperty(exports, "random", {
  enumerable: true,
  get: function () {
    return _random.random;
  }
});
Object.defineProperty(exports, "setRandom", {
  enumerable: true,
  get: function () {
    return _random.setRandom;
  }
});
Object.defineProperty(exports, "randomLCG", {
  enumerable: true,
  get: function () {
    return _lcg.default;
  }
});
Object.defineProperty(exports, "randomInteger", {
  enumerable: true,
  get: function () {
    return _integer.default;
  }
});
Object.defineProperty(exports, "randomKDE", {
  enumerable: true,
  get: function () {
    return _kde.default;
  }
});
Object.defineProperty(exports, "randomLogNormal", {
  enumerable: true,
  get: function () {
    return _lognormal.default;
  }
});
Object.defineProperty(exports, "sampleLogNormal", {
  enumerable: true,
  get: function () {
    return _lognormal.sampleLogNormal;
  }
});
Object.defineProperty(exports, "densityLogNormal", {
  enumerable: true,
  get: function () {
    return _lognormal.densityLogNormal;
  }
});
Object.defineProperty(exports, "cumulativeLogNormal", {
  enumerable: true,
  get: function () {
    return _lognormal.cumulativeLogNormal;
  }
});
Object.defineProperty(exports, "quantileLogNormal", {
  enumerable: true,
  get: function () {
    return _lognormal.quantileLogNormal;
  }
});
Object.defineProperty(exports, "randomMixture", {
  enumerable: true,
  get: function () {
    return _mixture.default;
  }
});
Object.defineProperty(exports, "randomNormal", {
  enumerable: true,
  get: function () {
    return _normal.default;
  }
});
Object.defineProperty(exports, "sampleNormal", {
  enumerable: true,
  get: function () {
    return _normal.sampleNormal;
  }
});
Object.defineProperty(exports, "densityNormal", {
  enumerable: true,
  get: function () {
    return _normal.densityNormal;
  }
});
Object.defineProperty(exports, "cumulativeNormal", {
  enumerable: true,
  get: function () {
    return _normal.cumulativeNormal;
  }
});
Object.defineProperty(exports, "quantileNormal", {
  enumerable: true,
  get: function () {
    return _normal.quantileNormal;
  }
});
Object.defineProperty(exports, "randomUniform", {
  enumerable: true,
  get: function () {
    return _uniform.default;
  }
});
Object.defineProperty(exports, "sampleUniform", {
  enumerable: true,
  get: function () {
    return _uniform.sampleUniform;
  }
});
Object.defineProperty(exports, "densityUniform", {
  enumerable: true,
  get: function () {
    return _uniform.densityUniform;
  }
});
Object.defineProperty(exports, "cumulativeUniform", {
  enumerable: true,
  get: function () {
    return _uniform.cumulativeUniform;
  }
});
Object.defineProperty(exports, "quantileUniform", {
  enumerable: true,
  get: function () {
    return _uniform.quantileUniform;
  }
});
Object.defineProperty(exports, "regressionLinear", {
  enumerable: true,
  get: function () {
    return _linear.default;
  }
});
Object.defineProperty(exports, "regressionLog", {
  enumerable: true,
  get: function () {
    return _log.default;
  }
});
Object.defineProperty(exports, "regressionExp", {
  enumerable: true,
  get: function () {
    return _exp.default;
  }
});
Object.defineProperty(exports, "regressionPow", {
  enumerable: true,
  get: function () {
    return _pow.default;
  }
});
Object.defineProperty(exports, "regressionQuad", {
  enumerable: true,
  get: function () {
    return _quad.default;
  }
});
Object.defineProperty(exports, "regressionPoly", {
  enumerable: true,
  get: function () {
    return _poly.default;
  }
});
Object.defineProperty(exports, "regressionLoess", {
  enumerable: true,
  get: function () {
    return _loess.default;
  }
});
Object.defineProperty(exports, "sampleCurve", {
  enumerable: true,
  get: function () {
    return _sampleCurve.default;
  }
});

var _bandwidth = _interopRequireDefault(require("./src/bandwidth"));

var _bin = _interopRequireDefault(require("./src/bin"));

var _bootstrapCI = _interopRequireDefault(require("./src/bootstrapCI"));

var _dotbin = _interopRequireDefault(require("./src/dotbin"));

var _quantiles = _interopRequireDefault(require("./src/quantiles"));

var _quartiles = _interopRequireDefault(require("./src/quartiles"));

var _random = require("./src/random");

var _lcg = _interopRequireDefault(require("./src/lcg"));

var _integer = _interopRequireDefault(require("./src/integer"));

var _kde = _interopRequireDefault(require("./src/kde"));

var _lognormal = _interopRequireWildcard(require("./src/lognormal"));

var _mixture = _interopRequireDefault(require("./src/mixture"));

var _normal = _interopRequireWildcard(require("./src/normal"));

var _uniform = _interopRequireWildcard(require("./src/uniform"));

var _linear = _interopRequireDefault(require("./src/regression/linear"));

var _log = _interopRequireDefault(require("./src/regression/log"));

var _exp = _interopRequireDefault(require("./src/regression/exp"));

var _pow = _interopRequireDefault(require("./src/regression/pow"));

var _quad = _interopRequireDefault(require("./src/regression/quad"));

var _poly = _interopRequireDefault(require("./src/regression/poly"));

var _loess = _interopRequireDefault(require("./src/regression/loess"));

var _sampleCurve = _interopRequireDefault(require("./src/sampleCurve"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./src/bandwidth":"cdFE","./src/bin":"KzVa","./src/bootstrapCI":"sg01","./src/dotbin":"djO7","./src/quantiles":"FwoB","./src/quartiles":"r9x6","./src/random":"IXnM","./src/lcg":"lrW5","./src/integer":"OA6r","./src/kde":"QgXE","./src/lognormal":"T3QV","./src/mixture":"Fw2A","./src/normal":"Dz5A","./src/uniform":"sqAQ","./src/regression/linear":"HTLe","./src/regression/log":"ClCW","./src/regression/exp":"TFqr","./src/regression/pow":"SXAp","./src/regression/quad":"esN8","./src/regression/poly":"oLBL","./src/regression/loess":"dkgJ","./src/sampleCurve":"ipOg"}],"KXQo":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = TupleStore;

var _vegaDataflow = require("vega-dataflow");

var _vegaStatistics = require("vega-statistics");

var _vegaUtil = require("vega-util");

function TupleStore(key) {
  this._key = key ? (0, _vegaUtil.field)(key) : _vegaDataflow.tupleid;
  this.reset();
}

var prototype = TupleStore.prototype;

prototype.reset = function () {
  this._add = [];
  this._rem = [];
  this._ext = null;
  this._get = null;
  this._q = null;
};

prototype.add = function (v) {
  this._add.push(v);
};

prototype.rem = function (v) {
  this._rem.push(v);
};

prototype.values = function () {
  this._get = null;
  if (this._rem.length === 0) return this._add;
  var a = this._add,
      r = this._rem,
      k = this._key,
      n = a.length,
      m = r.length,
      x = Array(n - m),
      map = {},
      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.distinct = function (get) {
  var v = this.values(),
      n = v.length,
      map = {},
      count = 0,
      s;

  while (--n >= 0) {
    s = get(v[n]) + '';

    if (!(0, _vegaUtil.hasOwnProperty)(map, s)) {
      map[s] = 1;
      ++count;
    }
  }

  return count;
};

prototype.extent = function (get) {
  if (this._get !== get || !this._ext) {
    var v = this.values(),
        i = (0, _vegaUtil.extentIndex)(v, get);
    this._ext = [v[i[0]], v[i[1]]];
    this._get = get;
  }

  return this._ext;
};

prototype.argmin = function (get) {
  return this.extent(get)[0] || {};
};

prototype.argmax = function (get) {
  return this.extent(get)[1] || {};
};

prototype.min = function (get) {
  var m = this.extent(get)[0];
  return m != null ? get(m) : undefined;
};

prototype.max = function (get) {
  var m = this.extent(get)[1];
  return m != null ? get(m) : undefined;
};

prototype.quartile = function (get) {
  if (this._get !== get || !this._q) {
    this._q = (0, _vegaStatistics.quartiles)(this.values(), get);
    this._get = get;
  }

  return this._q;
};

prototype.q1 = function (get) {
  return this.quartile(get)[0];
};

prototype.q2 = function (get) {
  return this.quartile(get)[1];
};

prototype.q3 = function (get) {
  return this.quartile(get)[2];
};

prototype.ci = function (get) {
  if (this._get !== get || !this._ci) {
    this._ci = (0, _vegaStatistics.bootstrapCI)(this.values(), 1000, 0.05, get);
    this._get = get;
  }

  return this._ci;
};

prototype.ci0 = function (get) {
  return this.ci(get)[0];
};

prototype.ci1 = function (get) {
  return this.ci(get)[1];
};
},{"vega-dataflow":"UC8n","vega-statistics":"yUSi","vega-util":"dejJ"}],"b67s":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Aggregate;

var _AggregateKeys = require("./util/AggregateKeys");

var _AggregateOps = require("./util/AggregateOps");

var _TupleStore = _interopRequireDefault(require("./util/TupleStore"));

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * 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) {
  _vegaDataflow.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": _AggregateOps.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"
  }]
};
var prototype = (0, _vegaUtil.inherits)(Aggregate, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var 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();
  }

  return aggr.changes(out);
};

prototype.cross = function () {
  var aggr = this,
      curr = aggr.value,
      dims = aggr._dnames,
      vals = dims.map(function () {
    return {};
  }),
      n = dims.length; // collect all group-by domain values

  function collect(cells) {
    var 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) {
    var name = dims[index],
        v = vals[index++],
        k,
        key;

    for (k in v) {
      tuple[name] = v[k];
      key = base ? base + '|' + k : k;
      if (index < n) generate(key, tuple, index);else if (!curr[key]) aggr.cell(key, tuple);
    }
  }

  generate('', {}, 0);
};

prototype.init = function (_) {
  // initialize input and output fields
  var inputs = this._inputs = [],
      outputs = this._outputs = [],
      inputMap = {};

  function inputVisit(get) {
    var fields = (0, _vegaUtil.array)((0, _vegaUtil.accessorFields)(get)),
        i = 0,
        n = fields.length,
        f;

    for (; i < n; ++i) {
      if (!inputMap[f = fields[i]]) {
        inputMap[f] = 1;
        inputs.push(f);
      }
    }
  } // initialize group-by dimensions


  this._dims = (0, _vegaUtil.array)(_.groupby);
  this._dnames = this._dims.map(function (d) {
    var dname = (0, _vegaUtil.accessorName)(d);
    inputVisit(d);
    outputs.push(dname);
    return dname;
  });
  this.cellkey = _.key ? _.key : (0, _AggregateKeys.groupkey)(this._dims); // initialize aggregate measures

  this._countOnly = true;
  this._counts = [];
  this._measures = [];
  var fields = _.fields || [null],
      ops = _.ops || ['count'],
      as = _.as || [],
      n = fields.length,
      map = {},
      field,
      op,
      m,
      mname,
      outname,
      i;

  if (n !== ops.length) {
    (0, _vegaUtil.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') {
      (0, _vegaUtil.error)('Null aggregate field specified.');
    }

    mname = (0, _vegaUtil.accessorName)(field);
    outname = (0, _AggregateOps.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((0, _AggregateOps.createMeasure)(op, outname));
  }

  this._measures = this._measures.map(function (m) {
    return (0, _AggregateOps.compileMeasures)(m, m.field);
  });
  return {}; // aggregation cells (this.value)
}; // -- Cell Management -----


prototype.cellkey = (0, _AggregateKeys.groupkey)();

prototype.cell = function (key, t) {
  var 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;
};

prototype.newcell = function (key, t) {
  var cell = {
    key: key,
    num: 0,
    agg: null,
    tuple: this.newtuple(t, this._prev && this._prev[key]),
    stamp: this.stamp,
    store: false
  };

  if (!this._countOnly) {
    var measures = this._measures,
        n = measures.length,
        i;
    cell.agg = Array(n);

    for (i = 0; i < n; ++i) {
      cell.agg[i] = new measures[i](cell);
    }
  }

  if (cell.store) {
    cell.data = new _TupleStore.default();
  }

  return cell;
};

prototype.newtuple = function (t, p) {
  var names = this._dnames,
      dims = this._dims,
      x = {},
      i,
      n;

  for (i = 0, n = dims.length; i < n; ++i) {
    x[names[i]] = dims[i](t);
  }

  return p ? (0, _vegaDataflow.replace)(p.tuple, x) : (0, _vegaDataflow.ingest)(x);
}; // -- Process Tuples -----


prototype.add = function (t) {
  var key = this.cellkey(t),
      cell = this.cell(key, t),
      agg,
      i,
      n;
  cell.num += 1;
  if (this._countOnly) return;
  if (cell.store) cell.data.add(t);
  agg = cell.agg;

  for (i = 0, n = agg.length; i < n; ++i) {
    agg[i].add(agg[i].get(t), t);
  }
};

prototype.rem = function (t) {
  var key = this.cellkey(t),
      cell = this.cell(key, t),
      agg,
      i,
      n;
  cell.num -= 1;
  if (this._countOnly) return;
  if (cell.store) cell.data.rem(t);
  agg = cell.agg;

  for (i = 0, n = agg.length; i < n; ++i) {
    agg[i].rem(agg[i].get(t), t);
  }
};

prototype.celltuple = function (cell) {
  var tuple = cell.tuple,
      counts = this._counts,
      agg,
      i,
      n; // consolidate stored values

  if (cell.store) {
    cell.data.values();
  } // update tuple properties


  for (i = 0, n = counts.length; i < n; ++i) {
    tuple[counts[i]] = cell.num;
  }

  if (!this._countOnly) {
    agg = cell.agg;

    for (i = 0, n = agg.length; i < n; ++i) {
      agg[i].set(tuple);
    }
  }

  return tuple;
};

prototype.changes = function (out) {
  var adds = this._adds,
      mods = this._mods,
      prev = this._prev,
      drop = this._drop,
      add = out.add,
      rem = out.rem,
      mod = out.mod,
      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;
};
},{"./util/AggregateKeys":"k6fm","./util/AggregateOps":"Dcrk","./util/TupleStore":"KXQo","vega-dataflow":"UC8n","vega-util":"dejJ"}],"Itxd":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Bin;

var _vegaDataflow = require("vega-dataflow");

var _vegaStatistics = require("vega-statistics");

var _vegaUtil = require("vega-util");

// epsilon bias to offset floating point error (#1737)
const EPSILON = 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) {
  _vegaDataflow.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"]
  }]
};
var prototype = (0, _vegaUtil.inherits)(Bin, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var band = _.interval !== false,
      bins = this._bins(_),
      start = bins.start,
      step = bins.step,
      as = _.as || ['bin0', 'bin1'],
      b0 = as[0],
      b1 = as[1],
      flag;

  if (_.modified()) {
    pulse = pulse.reflow(true);
    flag = pulse.SOURCE;
  } else {
    flag = pulse.modified((0, _vegaUtil.accessorFields)(_.field)) ? pulse.ADD_MOD : pulse.ADD;
  }

  pulse.visit(flag, band ? function (t) {
    var 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

    t[b1] = v == null ? null : start + step * (1 + (v - start) / step);
  } : function (t) {
    t[b0] = bins(t);
  });
  return pulse.modifies(band ? as : b0);
};

prototype._bins = function (_) {
  if (this.value && !_.modified()) {
    return this.value;
  }

  var field = _.field,
      bins = (0, _vegaStatistics.bin)(_),
      start = bins.start,
      stop = bins.stop,
      step = bins.step,
      a,
      d;

  if ((a = _.anchor) != null) {
    d = a - (start + step * Math.floor((a - start) / step));
    start += d;
    stop += d;
  }

  var f = function (t) {
    var v = field(t);

    if (v == null) {
      return null;
    } else {
      v = Math.max(start, Math.min(+v, stop - step));
      return start + step * Math.floor(EPSILON + (v - start) / step);
    }
  };

  f.start = start;
  f.stop = stop;
  f.step = step;
  return this.value = (0, _vegaUtil.accessor)(f, (0, _vegaUtil.accessorFields)(field), _.name || 'bin_' + (0, _vegaUtil.accessorName)(field));
};
},{"vega-dataflow":"UC8n","vega-statistics":"yUSi","vega-util":"dejJ"}],"My0V":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _vegaUtil = require("vega-util");

function _default(idFunc, source, input) {
  var $ = idFunc,
      data = source || [],
      add = input || [],
      rem = {},
      cnt = 0;
  return {
    add: function (t) {
      add.push(t);
    },
    remove: function (t) {
      rem[$(t)] = ++cnt;
    },
    size: function () {
      return data.length;
    },
    data: function (compare, resort) {
      if (cnt) {
        data = data.filter(function (t) {
          return !rem[$(t)];
        });
        rem = {};
        cnt = 0;
      }

      if (resort && compare) {
        data.sort(compare);
      }

      if (add.length) {
        data = compare ? (0, _vegaUtil.merge)(compare, data, add.sort(compare)) : data.concat(add);
        add = [];
      }

      return data;
    }
  };
}
},{"vega-util":"dejJ"}],"fln0":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Collect;

var _SortedList = _interopRequireDefault(require("./util/SortedList"));

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * 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) {
  _vegaDataflow.Transform.call(this, [], params);
}

Collect.Definition = {
  "type": "Collect",
  "metadata": {
    "source": true
  },
  "params": [{
    "name": "sort",
    "type": "compare"
  }]
};
var prototype = (0, _vegaUtil.inherits)(Collect, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var out = pulse.fork(pulse.ALL),
      list = (0, _SortedList.default)(_vegaDataflow.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((0, _vegaDataflow.stableCompare)(sort), mod); // propagate tree root if defined

  if (pulse.source && pulse.source.root) {
    this.value.root = pulse.source.root;
  }

  return out;
};
},{"./util/SortedList":"My0V","vega-dataflow":"UC8n","vega-util":"dejJ"}],"tzR4":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Compare;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.Operator.call(this, null, update, params);
}

(0, _vegaUtil.inherits)(Compare, _vegaDataflow.Operator);

function update(_) {
  return this.value && !_.modified() ? this.value : (0, _vegaUtil.compare)(_.fields, _.orders);
}
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"vMFQ":[function(require,module,exports) {
var process = require("process");
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = CountPattern;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.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);
}

var prototype = (0, _vegaUtil.inherits)(CountPattern, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  function process(update) {
    return function (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);
      }
    };
  }

  var init = this._parameterCheck(_, pulse),
      counts = this._counts,
      match = this._match,
      stop = this._stop,
      get = _.field,
      as = _.as || ['text', 'count'],
      add = process(function (t) {
    counts[t] = 1 + (counts[t] || 0);
  }),
      rem = process(function (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
};

prototype._parameterCheck = function (_, pulse) {
  var 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;
};

prototype._finish = function (pulse, as) {
  var counts = this._counts,
      tuples = this._tuples || (this._tuples = {}),
      text = as[0],
      count = as[1],
      out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
      w,
      t,
      c;

  for (w in counts) {
    t = tuples[w];
    c = counts[w] || 0;

    if (!t && c) {
      tuples[w] = t = (0, _vegaDataflow.ingest)({});
      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);
};
},{"vega-dataflow":"UC8n","vega-util":"dejJ","process":"r7L2"}],"JAZ9":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Cross;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.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"]
  }]
};
var prototype = (0, _vegaUtil.inherits)(Cross, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var out = pulse.fork(pulse.NO_SOURCE),
      data = this.value,
      as = _.as || ['a', 'b'],
      a = as[0],
      b = as[1],
      reset = !data || pulse.changed(pulse.ADD_REM) || _.modified('as') || _.modified('filter');

  if (reset) {
    if (data) out.rem = data;
    data = pulse.materialize(pulse.SOURCE).source;
    out.add = this.value = cross(data, a, b, _.filter || _vegaUtil.truthy);
  } else {
    out.mod = data;
  }

  out.source = this.value;
  return out.modifies(as);
};

function 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((0, _vegaDataflow.ingest)(t));
        t = {};
        t[a] = left;
      }
    }
  }

  return data;
}
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"attj":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = parse;

var _vegaStatistics = require("vega-statistics");

var _vegaUtil = require("vega-util");

var Distributions = {
  kde: _vegaStatistics.randomKDE,
  mixture: _vegaStatistics.randomMixture,
  normal: _vegaStatistics.randomNormal,
  lognormal: _vegaStatistics.randomLogNormal,
  uniform: _vegaStatistics.randomUniform
};
var 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 parse(def, data) {
  var func = def[FUNCTION];

  if (!(0, _vegaUtil.hasOwnProperty)(Distributions, func)) {
    (0, _vegaUtil.error)('Unknown distribution function: ' + func);
  }

  var d = Distributions[func]();

  for (var 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(function (_) {
          return parse(_, data);
        }));
      } // otherwise, simply set the parameter
      else if (typeof d[name] === FUNCTION) {
          d[name](def[name]);
        }
  }

  return d;
}
},{"vega-statistics":"yUSi","vega-util":"dejJ"}],"BCKR":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Density;

var _Distributions = _interopRequireDefault(require("./util/Distributions"));

var _vegaDataflow = require("vega-dataflow");

var _vegaStatistics = require("vega-statistics");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * 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) {
  _vegaDataflow.Transform.call(this, null, params);
}

var 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
  }]
}];
var 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(mixture)
  }, {
    "name": "as",
    "type": "string",
    "array": true,
    "default": ["value", "density"]
  }]
};
var prototype = (0, _vegaUtil.inherits)(Density, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);

  if (!this.value || pulse.changed() || _.modified()) {
    var dist = (0, _Distributions.default)(_.distribution, source(pulse)),
        minsteps = _.steps || _.minsteps || 25,
        maxsteps = _.steps || _.maxsteps || 200,
        method = _.method || 'pdf';

    if (method !== 'pdf' && method !== 'cdf') {
      (0, _vegaUtil.error)('Invalid density method: ' + method);
    }

    if (!_.extent && !dist.data) {
      (0, _vegaUtil.error)('Missing density extent parameter.');
    }

    method = dist[method];
    var as = _.as || ['value', 'density'],
        domain = _.extent || (0, _vegaUtil.extent)(dist.data()),
        values = (0, _vegaStatistics.sampleCurve)(method, domain, minsteps, maxsteps).map(v => {
      var tuple = {};
      tuple[as[0]] = v[0];
      tuple[as[1]] = v[1];
      return (0, _vegaDataflow.ingest)(tuple);
    });
    if (this.value) out.rem = this.value;
    this.value = out.add = out.source = values;
  }

  return out;
};

function source(pulse) {
  return function () {
    return pulse.materialize(pulse.SOURCE).source;
  };
}
},{"./util/Distributions":"attj","vega-dataflow":"UC8n","vega-statistics":"yUSi","vega-util":"dejJ"}],"cFFM":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.fieldNames = fieldNames;
exports.partition = partition;

var _vegaUtil = require("vega-util");

// use either provided alias or accessor field name
function fieldNames(fields, as) {
  if (!fields) return null;
  return fields.map(function (f, i) {
    return as[i] || (0, _vegaUtil.accessorName)(f);
  });
}

function partition(data, groupby, field) {
  var groups = [],
      get = function (f) {
    return f(t);
  },
      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;
}
},{"vega-util":"dejJ"}],"jDtN":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = DotBin;

var _util = require("./util/util");

var _vegaDataflow = require("vega-dataflow");

var _vegaStatistics = require("vega-statistics");

var _vegaUtil = require("vega-util");

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) {
  _vegaDataflow.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 prototype = (0, _vegaUtil.inherits)(DotBin, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  if (this.value && !(_.modified() || pulse.changed())) {
    return pulse; // early exit
  }

  const source = pulse.materialize(pulse.SOURCE).source,
        groups = (0, _util.partition)(pulse.source, _.groupby, _vegaUtil.identity),
        smooth = _.smooth || false,
        field = _.field,
        step = _.step || autostep(source, field),
        sort = (0, _vegaDataflow.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 (0, _vegaStatistics.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);
};

function autostep(data, field) {
  return (0, _vegaUtil.span)((0, _vegaUtil.extent)(data, field)) / 30;
}
},{"./util/util":"cFFM","vega-dataflow":"UC8n","vega-statistics":"yUSi","vega-util":"dejJ"}],"wYCT":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Expression;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.Operator.call(this, null, update, params);

  this.modified(true);
}

(0, _vegaUtil.inherits)(Expression, _vegaDataflow.Operator);

function update(_) {
  var expr = _.expr;
  return this.value && !_.modified('expr') ? this.value : (0, _vegaUtil.accessor)(datum => expr(datum, _), (0, _vegaUtil.accessorFields)(expr), (0, _vegaUtil.accessorName)(expr));
}
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"znYt":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Extent;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.Transform.call(this, [undefined, undefined], params);
}

Extent.Definition = {
  "type": "Extent",
  "metadata": {},
  "params": [{
    "name": "field",
    "type": "field",
    "required": true
  }]
};
var prototype = (0, _vegaUtil.inherits)(Extent, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var extent = this.value,
      field = _.field,
      min = extent[0],
      max = extent[1],
      mod;
  mod = pulse.changed() || pulse.modified(field.fields) || _.modified('field');

  if (mod || min == null) {
    min = +Infinity;
    max = -Infinity;
  }

  pulse.visit(mod ? pulse.SOURCE : pulse.ADD, function (t) {
    var v = field(t);

    if (v != null) {
      // coerce to number
      v = +v; // NaNs will fail all comparisons!

      if (v < min) min = v;
      if (v > max) max = v;
    }
  });

  if (!Number.isFinite(min) || !Number.isFinite(max)) {
    let name = (0, _vegaUtil.accessorName)(field);
    if (name) name = ` for field "${name}"`;
    pulse.dataflow.warn(`Infinite extent${name}: [${min}, ${max}]`);
    min = max = undefined;
  }

  this.value = [min, max];
};
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"yQRw":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Subflow;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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).
 * @param {Transform} target - A transform that receives the subflow of tuples.
 */
function Subflow(pulse, parent) {
  _vegaDataflow.Operator.call(this, pulse);

  this.parent = parent;
}

var prototype = (0, _vegaUtil.inherits)(Subflow, _vegaDataflow.Operator);

prototype.connect = function (target) {
  this.targets().add(target);
  return target.source = this;
};
/**
 * Add an 'add' tuple to the subflow pulse.
 * @param {Tuple} t - The tuple being added.
 */


prototype.add = function (t) {
  this.value.add.push(t);
};
/**
 * Add a 'rem' tuple to the subflow pulse.
 * @param {Tuple} t - The tuple being removed.
 */


prototype.rem = function (t) {
  this.value.rem.push(t);
};
/**
 * Add a 'mod' tuple to the subflow pulse.
 * @param {Tuple} t - The tuple being modified.
 */


prototype.mod = function (t) {
  this.value.mod.push(t);
};
/**
 * Re-initialize this operator's pulse value.
 * @param {Pulse} pulse - The pulse to copy from.
 * @see Pulse.init
 */


prototype.init = function (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}
 */


prototype.evaluate = function () {
  // assert: this.value.stamp === pulse.stamp
  return this.value;
};
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"dOe5":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Facet;

var _Subflow = _interopRequireDefault(require("./Subflow"));

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * 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) {
  _vegaDataflow.Transform.call(this, {}, params);

  this._keys = (0, _vegaUtil.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

  var a = this._targets = [];
  a.active = 0;

  a.forEach = function (f) {
    for (var i = 0, n = a.active; i < n; ++i) f(a[i], i, a);
  };
}

var prototype = (0, _vegaUtil.inherits)(Facet, _vegaDataflow.Transform);

prototype.activate = function (flow) {
  this._targets[this._targets.active++] = flow;
};

prototype.subflow = function (key, flow, pulse, parent) {
  var flows = this.value,
      sf = (0, _vegaUtil.hasOwnProperty)(flows, key) && flows[key],
      df,
      p;

  if (!sf) {
    p = parent || (p = this._group[key]) && p.tuple;
    df = pulse.dataflow;
    sf = df.add(new _Subflow.default(pulse.fork(pulse.NO_SOURCE), this)).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;
};

prototype.transform = function (_, pulse) {
  var df = pulse.dataflow,
      self = this,
      key = _.key,
      flow = _.subflow,
      cache = this._keys,
      rekey = _.modified('key');

  function subflow(key) {
    return self.subflow(key, flow, pulse);
  }

  this._group = _.group || {};
  this._targets.active = 0; // reset list of active subflows

  pulse.visit(pulse.REM, function (t) {
    var id = (0, _vegaDataflow.tupleid)(t),
        k = cache.get(id);

    if (k !== undefined) {
      cache.delete(id);
      subflow(k).rem(t);
    }
  });
  pulse.visit(pulse.ADD, function (t) {
    var k = key(t);
    cache.set((0, _vegaDataflow.tupleid)(t), k);
    subflow(k).add(t);
  });

  if (rekey || pulse.modified(key.fields)) {
    pulse.visit(pulse.MOD, function (t) {
      var id = (0, _vegaDataflow.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, function (t) {
      subflow(cache.get((0, _vegaDataflow.tupleid)(t))).mod(t);
    });
  }

  if (rekey) {
    pulse.visit(pulse.REFLOW, function (t) {
      var id = (0, _vegaDataflow.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 (cache.empty > df.cleanThreshold) df.runAfter(cache.clean);
  return pulse;
};
},{"./Subflow":"yQRw","vega-dataflow":"UC8n","vega-util":"dejJ"}],"KQfn":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Field;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.Operator.call(this, null, update, params);
}

(0, _vegaUtil.inherits)(Field, _vegaDataflow.Operator);

function update(_) {
  return this.value && !_.modified() ? this.value : (0, _vegaUtil.isArray)(_.name) ? (0, _vegaUtil.array)(_.name).map(function (f) {
    return (0, _vegaUtil.field)(f);
  }) : (0, _vegaUtil.field)(_.name, _.as);
}
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"pT1s":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Filter;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.Transform.call(this, (0, _vegaUtil.fastmap)(), params);
}

Filter.Definition = {
  "type": "Filter",
  "metadata": {
    "changes": true
  },
  "params": [{
    "name": "expr",
    "type": "expr",
    "required": true
  }]
};
var prototype = (0, _vegaUtil.inherits)(Filter, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var 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,
      isMod = true;
  pulse.visit(pulse.REM, function (t) {
    var id = (0, _vegaDataflow.tupleid)(t);
    if (!cache.has(id)) rem.push(t);else cache.delete(id);
  });
  pulse.visit(pulse.ADD, function (t) {
    if (test(t, _)) add.push(t);else cache.set((0, _vegaDataflow.tupleid)(t), 1);
  });

  function revisit(t) {
    var id = (0, _vegaDataflow.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;
};
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"ub5p":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Flatten;

var _util = require("./util/util");

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.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
  }]
};
var prototype = (0, _vegaUtil.inherits)(Flatten, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var out = pulse.fork(pulse.NO_SOURCE),
      fields = _.fields,
      as = (0, _util.fieldNames)(fields, _.as || []),
      index = _.index || null,
      m = as.length; // remove any previous results

  out.rem = this.value; // generate flattened tuples

  pulse.visit(pulse.SOURCE, function (t) {
    var arrays = fields.map(f => f(t)),
        maxlen = arrays.reduce((l, a) => Math.max(l, a.length), 0),
        i = 0,
        j,
        d,
        v;

    for (; i < maxlen; ++i) {
      d = (0, _vegaDataflow.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);
};
},{"./util/util":"cFFM","vega-dataflow":"UC8n","vega-util":"dejJ"}],"t4K2":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Fold;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.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"]
  }]
};
var prototype = (0, _vegaUtil.inherits)(Fold, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var out = pulse.fork(pulse.NO_SOURCE),
      fields = _.fields,
      fnames = fields.map(_vegaUtil.accessorName),
      as = _.as || ['key', 'value'],
      k = as[0],
      v = as[1],
      n = fields.length;
  out.rem = this.value;
  pulse.visit(pulse.SOURCE, function (t) {
    for (var i = 0, d; i < n; ++i) {
      d = (0, _vegaDataflow.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);
};
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"BFyf":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Formula;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.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"
  }]
};
var prototype = (0, _vegaUtil.inherits)(Formula, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var 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, _));
};
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"uxdB":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Generate;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.Transform.call(this, [], params);
}

var prototype = (0, _vegaUtil.inherits)(Generate, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var data = this.value,
      out = pulse.fork(pulse.ALL),
      num = _.size - data.length,
      gen = _.generator,
      add,
      rem,
      t;

  if (num > 0) {
    // need more tuples, generate and add
    for (add = []; --num >= 0;) {
      add.push(t = (0, _vegaDataflow.ingest)(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;
};
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"zRfo":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Impute;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

var _d3Array = require("d3-array");

var Methods = {
  value: 'value',
  median: _d3Array.median,
  mean: _d3Array.mean,
  min: _d3Array.min,
  max: _d3Array.max
};
var 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) {
  _vegaDataflow.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
  }]
};
var prototype = (0, _vegaUtil.inherits)(Impute, _vegaDataflow.Transform);

function getValue(_) {
  var m = _.method || Methods.value,
      v;

  if (Methods[m] == null) {
    (0, _vegaUtil.error)('Unrecognized imputation method: ' + m);
  } else if (m === Methods.value) {
    v = _.value !== undefined ? _.value : 0;
    return function () {
      return v;
    };
  } else {
    return Methods[m];
  }
}

function getField(_) {
  var f = _.field;
  return function (t) {
    return t ? f(t) : NaN;
  };
}

prototype.transform = function (_, pulse) {
  var out = pulse.fork(pulse.ALL),
      impute = getValue(_),
      field = getField(_),
      fName = (0, _vegaUtil.accessorName)(_.field),
      kName = (0, _vegaUtil.accessorName)(_.key),
      gNames = (_.groupby || []).map(_vegaUtil.accessorName),
      groups = 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((0, _vegaDataflow.ingest)(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 partition(data, groupby, key, keyvals) {
  var get = function (f) {
    return f(t);
  },
      groups = [],
      domain = keyvals ? keyvals.slice() : [],
      kMap = {},
      gMap = {},
      gVals,
      gKey,
      group,
      i,
      j,
      k,
      n,
      t;

  domain.forEach(function (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;
}
},{"vega-dataflow":"UC8n","vega-util":"dejJ","d3-array":"Rpnd"}],"WQTj":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = JoinAggregate;

var _Aggregate = _interopRequireDefault(require("./Aggregate"));

var _AggregateOps = require("./util/AggregateOps");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * Extend input tuples with aggregate values.
 * Calcuates aggregate values and joins them with the input stream.
 * @constructor
 */
function JoinAggregate(params) {
  _Aggregate.default.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": _AggregateOps.ValidAggregateOps
  }, {
    "name": "as",
    "type": "string",
    "null": true,
    "array": true
  }, {
    "name": "key",
    "type": "field"
  }]
};
var prototype = (0, _vegaUtil.inherits)(JoinAggregate, _Aggregate.default);

prototype.transform = function (_, pulse) {
  var aggr = this,
      mod = _.modified(),
      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, function (t) {
      aggr.add(t);
    });
  } else {
    cells = aggr.value = aggr.value || this.init(_);
    pulse.visit(pulse.REM, function (t) {
      aggr.rem(t);
    });
    pulse.visit(pulse.ADD, function (t) {
      aggr.add(t);
    });
  } // update aggregation cells


  aggr.changes(); // write aggregate values to input tuples

  pulse.visit(pulse.SOURCE, function (t) {
    (0, _vegaUtil.extend)(t, cells[aggr.cellkey(t)].tuple);
  });
  return pulse.reflow(mod).modifies(this._outputs);
};

prototype.changes = function () {
  var adds = this._adds,
      mods = this._mods,
      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
};
},{"./Aggregate":"b67s","./util/AggregateOps":"Dcrk","vega-util":"dejJ"}],"nVFc":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = KDE;

var _util = require("./util/util");

var _vegaStatistics = require("vega-statistics");

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.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"]
  }]
};
var prototype = (0, _vegaUtil.inherits)(KDE, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);

  if (!this.value || pulse.changed() || _.modified()) {
    const source = pulse.materialize(pulse.SOURCE).source,
          groups = (0, _util.partition)(source, _.groupby, _.field),
          names = (_.groupby || []).map(_vegaUtil.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') {
      (0, _vegaUtil.error)('Invalid density method: ' + method);
    }

    if (_.resolve === 'shared') {
      if (!domain) domain = (0, _vegaUtil.extent)(source, _.field);
      minsteps = maxsteps = _.steps || maxsteps;
    }

    groups.forEach(g => {
      const density = (0, _vegaStatistics.randomKDE)(g, bandwidth)[method],
            scale = _.counts ? g.length : 1,
            local = domain || (0, _vegaUtil.extent)(g);
      (0, _vegaStatistics.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((0, _vegaDataflow.ingest)(t));
      });
    });
    if (this.value) out.rem = this.value;
    this.value = out.add = out.source = values;
  }

  return out;
};
},{"./util/util":"cFFM","vega-statistics":"yUSi","vega-dataflow":"UC8n","vega-util":"dejJ"}],"dIwl":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Key;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.Operator.call(this, null, update, params);
}

(0, _vegaUtil.inherits)(Key, _vegaDataflow.Operator);

function update(_) {
  return this.value && !_.modified() ? this.value : (0, _vegaUtil.key)(_.fields, _.flat);
}
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"Z91X":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Load;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.Transform.call(this, [], params);
}

var prototype = (0, _vegaUtil.inherits)(Load, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  const df = pulse.dataflow;

  if (_.values) {
    // parse and ingest values
    return output(this, pulse, df.parse(_.values, _.format));
  } else {
    // return promise for async loading
    return df.request(_.url, _.format).then(res => output(this, pulse, (0, _vegaUtil.array)(res.data)));
  }
};

function output(op, pulse, data) {
  data.forEach(_vegaDataflow.ingest);
  const out = pulse.fork(pulse.NO_FIELDS & pulse.NO_SOURCE);
  out.rem = op.value;
  op.value = out.add = out.source = data;
  return out;
}
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"Gaui":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Lookup;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.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
  }]
};
var prototype = (0, _vegaUtil.inherits)(Lookup, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var out = pulse,
      as = _.as,
      keys = _.fields,
      index = _.index,
      values = _.values,
      defaultValue = _.default == null ? null : _.default,
      reset = _.modified(),
      flag = reset ? pulse.SOURCE : pulse.ADD,
      n = keys.length,
      set,
      m,
      mods;

  if (values) {
    m = values.length;

    if (n > 1 && !as) {
      (0, _vegaUtil.error)('Multi-field lookup requires explicit "as" parameter.');
    }

    if (as && as.length !== n * m) {
      (0, _vegaUtil.error)('The "as" parameter has too few output field names.');
    }

    as = as || values.map(_vegaUtil.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) {
      (0, _vegaUtil.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(function (k) {
      return pulse.modified(k.fields);
    });
    flag |= mods ? pulse.MOD : 0;
  }

  pulse.visit(flag, set);
  return out.modifies(as);
};
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"ZpMQ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = MultiExtent;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.Operator.call(this, null, update, params);
}

(0, _vegaUtil.inherits)(MultiExtent, _vegaDataflow.Operator);

function update(_) {
  if (this.value && !_.modified()) {
    return this.value;
  }

  var min = +Infinity,
      max = -Infinity,
      ext = _.extents,
      i,
      n,
      e;

  for (i = 0, n = ext.length; i < n; ++i) {
    e = ext[i];
    if (e[0] < min) min = e[0];
    if (e[1] > max) max = e[1];
  }

  return [min, max];
}
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"d1Ms":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = MultiValues;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.Operator.call(this, null, update, params);
}

(0, _vegaUtil.inherits)(MultiValues, _vegaDataflow.Operator);

function update(_) {
  return this.value && !_.modified() ? this.value : _.values.reduce(function (data, _) {
    return data.concat(_);
  }, []);
}
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"KHVM":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Params;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.Transform.call(this, null, params);
}

(0, _vegaUtil.inherits)(Params, _vegaDataflow.Transform);

Params.prototype.transform = function (_, pulse) {
  this.modified(_.modified());
  this.value = _;
  return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); // do not pass tuples
};
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"quik":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Pivot;

var _Aggregate = _interopRequireDefault(require("./Aggregate"));

var _AggregateOps = require("./util/AggregateOps");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * 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.default.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": _AggregateOps.ValidAggregateOps,
    "default": "sum"
  }, {
    "name": "limit",
    "type": "number",
    "default": 0
  }, {
    "name": "key",
    "type": "field"
  }]
};
var prototype = (0, _vegaUtil.inherits)(Pivot, _Aggregate.default);
prototype._transform = prototype.transform;

prototype.transform = function (_, 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) {
  var key = _.field,
      value = _.value,
      op = (_.op === 'count' ? '__count__' : _.op) || 'sum',
      fields = (0, _vegaUtil.accessorFields)(key).concat((0, _vegaUtil.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(function () {
      return op;
    }),
    fields: keys.map(function (k) {
      return get(k, key, value, fields);
    }),
    as: keys.map(function (k) {
      return k + '';
    }),
    modified: _.modified.bind(_)
  };
} // Generate aggregate field accessor.
// Output NaN for non-existent values; aggregator will ignore!


function get(k, key, value, fields) {
  return (0, _vegaUtil.accessor)(function (d) {
    return key(d) === k ? value(d) : NaN;
  }, fields, k + '');
} // Collect (and optionally limit) all unique pivot values.


function pivotKeys(key, limit, pulse) {
  var map = {},
      list = [];
  pulse.visit(pulse.SOURCE, function (t) {
    var k = key(t);

    if (!map[k]) {
      map[k] = 1;
      list.push(k);
    }
  }); // TODO? Move this comparator to vega-util?

  list.sort(function (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;
  });
  return limit ? list.slice(0, limit) : list;
}
},{"./Aggregate":"b67s","./util/AggregateOps":"Dcrk","vega-util":"dejJ"}],"uGi8":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = PreFacet;

var _Facet = _interopRequireDefault(require("./Facet"));

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * 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.default.call(this, params);
}

var prototype = (0, _vegaUtil.inherits)(PreFacet, _Facet.default);

prototype.transform = function (_, pulse) {
  var self = this,
      flow = _.subflow,
      field = _.field;

  if (_.modified('field') || field && pulse.modified((0, _vegaUtil.accessorFields)(field))) {
    (0, _vegaUtil.error)('PreFacet does not support field modification.');
  }

  this._targets.active = 0; // reset list of active subflows

  pulse.visit(pulse.MOD, function (t) {
    var sf = self.subflow((0, _vegaDataflow.tupleid)(t), flow, pulse, t);
    field ? field(t).forEach(function (_) {
      sf.mod(_);
    }) : sf.mod(t);
  });
  pulse.visit(pulse.ADD, function (t) {
    var sf = self.subflow((0, _vegaDataflow.tupleid)(t), flow, pulse, t);
    field ? field(t).forEach(function (_) {
      sf.add((0, _vegaDataflow.ingest)(_));
    }) : sf.add(t);
  });
  pulse.visit(pulse.REM, function (t) {
    var sf = self.subflow((0, _vegaDataflow.tupleid)(t), flow, pulse, t);
    field ? field(t).forEach(function (_) {
      sf.rem(_);
    }) : sf.rem(t);
  });
  return pulse;
};
},{"./Facet":"dOe5","vega-dataflow":"UC8n","vega-util":"dejJ"}],"kpgt":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Project;

var _util = require("./util/util");

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.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
  }]
};
var prototype = (0, _vegaUtil.inherits)(Project, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var fields = _.fields,
      as = (0, _util.fieldNames)(_.fields, _.as || []),
      derive = fields ? function (s, t) {
    return project(s, t, fields, as);
  } : _vegaDataflow.rederive,
      out,
      lut;

  if (this.value) {
    lut = this.value;
  } else {
    pulse = pulse.addAll();
    lut = this.value = {};
  }

  out = pulse.fork(pulse.NO_SOURCE);
  pulse.visit(pulse.REM, function (t) {
    var id = (0, _vegaDataflow.tupleid)(t);
    out.rem.push(lut[id]);
    lut[id] = null;
  });
  pulse.visit(pulse.ADD, function (t) {
    var dt = derive(t, (0, _vegaDataflow.ingest)({}));
    lut[(0, _vegaDataflow.tupleid)(t)] = dt;
    out.add.push(dt);
  });
  pulse.visit(pulse.MOD, function (t) {
    out.mod.push(derive(t, lut[(0, _vegaDataflow.tupleid)(t)]));
  });
  return out;
};

function project(s, t, fields, as) {
  for (var i = 0, n = fields.length; i < n; ++i) {
    t[as[i]] = fields[i](s);
  }

  return t;
}
},{"./util/util":"cFFM","vega-dataflow":"UC8n","vega-util":"dejJ"}],"XOSM":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Proxy;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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 Proxy(params) {
  _vegaDataflow.Transform.call(this, null, params);
}

var prototype = (0, _vegaUtil.inherits)(Proxy, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  this.value = _.value;
  return _.modified('value') ? pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS) : pulse.StopPropagation;
};
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"oOy6":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Quantile;

var _util = require("./util/util");

var _vegaDataflow = require("vega-dataflow");

var _vegaStatistics = require("vega-statistics");

var _vegaUtil = require("vega-util");

var _d3Array = require("d3-array");

/**
 * 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) {
  _vegaDataflow.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"]
  }]
};
var prototype = (0, _vegaUtil.inherits)(Quantile, _vegaDataflow.Transform);
var EPSILON = 1e-14;

prototype.transform = function (_, pulse) {
  var 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 = (0, _util.partition)(source, _.groupby, _.field),
        names = (_.groupby || []).map(_vegaUtil.accessorName),
        values = [],
        step = _.step || 0.01,
        p = _.probs || (0, _d3Array.range)(step / 2, 1 - EPSILON, step),
        n = p.length;
  groups.forEach(g => {
    const q = (0, _vegaStatistics.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((0, _vegaDataflow.ingest)(t));
    }
  });
  if (this.value) out.rem = this.value;
  this.value = out.add = out.source = values;
  return out;
};
},{"./util/util":"cFFM","vega-dataflow":"UC8n","vega-statistics":"yUSi","vega-util":"dejJ","d3-array":"Rpnd"}],"cjWe":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Relay;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.Transform.call(this, null, params);
}

var prototype = (0, _vegaUtil.inherits)(Relay, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var 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 => {
      var id = (0, _vegaDataflow.tupleid)(t);
      out.rem.push(lut[id]);
      lut[id] = null;
    });
    pulse.visit(pulse.ADD, t => {
      var dt = (0, _vegaDataflow.derive)(t);
      lut[(0, _vegaDataflow.tupleid)(t)] = dt;
      out.add.push(dt);
    });
    pulse.visit(pulse.MOD, t => {
      var dt = lut[(0, _vegaDataflow.tupleid)(t)],
          k;

      for (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;
};
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"EdCz":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Sample;

var _vegaDataflow = require("vega-dataflow");

var _vegaStatistics = require("vega-statistics");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.Transform.call(this, [], params);

  this.count = 0;
}

Sample.Definition = {
  "type": "Sample",
  "metadata": {},
  "params": [{
    "name": "size",
    "type": "number",
    "default": 1000
  }]
};
var prototype = (0, _vegaUtil.inherits)(Sample, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var out = pulse.fork(pulse.NO_SOURCE),
      mod = _.modified('size'),
      num = _.size,
      res = this.value,
      cnt = this.count,
      cap = 0,
      map = res.reduce(function (m, t) {
    m[(0, _vegaDataflow.tupleid)(t)] = 1;
    return m;
  }, {}); // sample reservoir update function


  function update(t) {
    var p, idx;

    if (res.length < num) {
      res.push(t);
    } else {
      idx = ~~((cnt + 1) * (0, _vegaStatistics.random)());

      if (idx < res.length && idx >= cap) {
        p = res[idx];
        if (map[(0, _vegaDataflow.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, function (t) {
      var id = (0, _vegaDataflow.tupleid)(t);

      if (map[id]) {
        map[id] = -1;
        out.rem.push(t);
      }

      --cnt;
    }); // filter removed tuples out of the sample reservoir

    res = res.filter(function (t) {
      return map[(0, _vegaDataflow.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, function (t) {
      // update, but skip previously sampled tuples
      if (!map[(0, _vegaDataflow.tupleid)(t)]) update(t);
    });
    cap = -1;
  }

  if (mod && res.length > num) {
    for (var i = 0, n = res.length - num; i < n; ++i) {
      map[(0, _vegaDataflow.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, function (t) {
      if (map[(0, _vegaDataflow.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(function (t) {
      return !map[(0, _vegaDataflow.tupleid)(t)];
    });
  }

  this.count = cnt;
  this.value = out.source = res;
  return out;
};
},{"vega-dataflow":"UC8n","vega-statistics":"yUSi","vega-util":"dejJ"}],"Us42":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Sequence;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

var _d3Array = require("d3-array");

/**
 * 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) {
  _vegaDataflow.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"
  }]
};
var prototype = (0, _vegaUtil.inherits)(Sequence, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  if (this.value && !_.modified()) return;
  var out = pulse.materialize().fork(pulse.MOD),
      as = _.as || 'data';
  out.rem = this.value ? pulse.rem.concat(this.value) : pulse.rem;
  this.value = (0, _d3Array.range)(_.start, _.stop, _.step || 1).map(function (v) {
    var t = {};
    t[as] = v;
    return (0, _vegaDataflow.ingest)(t);
  });
  out.add = pulse.add.concat(this.value);
  return out;
};
},{"vega-dataflow":"UC8n","vega-util":"dejJ","d3-array":"Rpnd"}],"S3Nr":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Sieve;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.Transform.call(this, null, params);

  this.modified(true); // always treat as modified
}

var prototype = (0, _vegaUtil.inherits)(Sieve, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  this.value = pulse.source;
  return pulse.changed() ? pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS) : pulse.StopPropagation;
};
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"vhL4":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.timeUnits = timeUnits;
exports.MILLISECONDS = exports.SECONDS = exports.MINUTES = exports.HOURS = exports.DAY = exports.DATE = exports.WEEK = exports.MONTH = exports.QUARTER = exports.YEAR = void 0;

var _vegaUtil = require("vega-util");

const YEAR = 'year';
exports.YEAR = YEAR;
const QUARTER = 'quarter';
exports.QUARTER = QUARTER;
const MONTH = 'month';
exports.MONTH = MONTH;
const WEEK = 'week';
exports.WEEK = WEEK;
const DATE = 'date';
exports.DATE = DATE;
const DAY = 'day';
exports.DAY = DAY;
const HOURS = 'hours';
exports.HOURS = HOURS;
const MINUTES = 'minutes';
exports.MINUTES = MINUTES;
const SECONDS = 'seconds';
exports.SECONDS = SECONDS;
const MILLISECONDS = 'milliseconds';
exports.MILLISECONDS = MILLISECONDS;
const UNITS = [YEAR, QUARTER, MONTH, WEEK, DATE, DAY, HOURS, MINUTES, SECONDS, MILLISECONDS].reduce((o, u, i) => (o[u] = 1 + i, o), {});

function timeUnits(units) {
  const u = (0, _vegaUtil.array)(units).slice(),
        m = {}; // check validity

  if (!u.length) (0, _vegaUtil.error)('Missing time unit.');
  u.forEach(unit => {
    if ((0, _vegaUtil.hasOwnProperty)(UNITS, unit)) {
      m[unit] = 1;
    } else {
      (0, _vegaUtil.error)(`Invalid time unit: ${unit}.`);
    }
  });

  if ((m[WEEK] || m[DAY]) && (m[QUARTER] || m[MONTH] || m[DATE])) {
    (0, _vegaUtil.error)(`Incompatible time units: ${units}`);
  } // ensure proper sort order


  u.sort((a, b) => UNITS[a] - UNITS[b]);
  return u;
}
},{"vega-util":"dejJ"}],"VSmt":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.timeFloor = timeFloor;
exports.utcFloor = utcFloor;

var _units = require("./units");

var _vegaUtil = require("vega-util");

var _d3Time = require("d3-time");

const t0 = new Date();

function floor(units, step, fn, newDate) {
  const s = step || 1,
        b = (0, _vegaUtil.peek)(units),
        _ = (unit, p, key) => skip(fn[key || unit], unit === b && s, p);

  const t = new Date(),
        u = (0, _vegaUtil.toSet)(units),
        y = u[_units.YEAR] ? _(_units.YEAR) : (0, _vegaUtil.constant)(2012),
        m = u[_units.MONTH] ? _(_units.MONTH) : u[_units.QUARTER] ? _(_units.QUARTER) : _vegaUtil.zero,
        d = u[_units.WEEK] && u[_units.DAY] ? _(_units.DAY, 1, _units.WEEK + _units.DAY) : u[_units.WEEK] ? _(_units.WEEK, 1) : u[_units.DAY] ? _(_units.DAY, 1) : u[_units.DATE] ? _(_units.DATE, 1) : _vegaUtil.one,
        H = u[_units.HOURS] ? _(_units.HOURS) : _vegaUtil.zero,
        M = u[_units.MINUTES] ? _(_units.MINUTES) : _vegaUtil.zero,
        S = u[_units.SECONDS] ? _(_units.SECONDS) : _vegaUtil.zero,
        L = u[_units.MILLISECONDS] ? _(_units.MILLISECONDS) : _vegaUtil.zero;
  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 skip(f, step, phase) {
  return step <= 1 ? f : phase ? (d, y) => phase + step * Math.floor((f(d, y) - phase) / step) : (d, y) => step * Math.floor(f(d, y) / step);
} // 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 = {
  [_units.YEAR]: d => d.getFullYear(),
  [_units.QUARTER]: d => 3 * ~~(d.getMonth() / 3),
  [_units.MONTH]: d => d.getMonth(),
  [_units.DATE]: d => d.getDate(),
  [_units.HOURS]: d => d.getHours(),
  [_units.MINUTES]: d => d.getMinutes(),
  [_units.SECONDS]: d => d.getSeconds(),
  [_units.MILLISECONDS]: d => d.getMilliseconds(),
  [_units.DAY]: (d, y) => weekday(1, d.getDay(), localFirst(y)),
  [_units.WEEK]: (d, y) => weekday(localWeekNum(d), 0, localFirst(y)),
  [_units.WEEK + _units.DAY]: (d, y) => weekday(localWeekNum(d), d.getDay(), localFirst(y))
};

function localYear(y) {
  t0.setFullYear(y);
  t0.setMonth(0);
  t0.setDate(1);
  t0.setHours(0, 0, 0, 0);
  return t0;
}

function localWeekNum(d) {
  return _d3Time.timeWeek.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 timeFloor(units, step) {
  return floor(units, step || 1, localGet, localDate);
} // -- UTC TIME --


const utcGet = {
  [_units.YEAR]: d => d.getUTCFullYear(),
  [_units.QUARTER]: d => 3 * ~~(d.getUTCMonth() / 3),
  [_units.MONTH]: d => d.getUTCMonth(),
  [_units.DATE]: d => d.getUTCDate(),
  [_units.HOURS]: d => d.getUTCHours(),
  [_units.MINUTES]: d => d.getUTCMinutes(),
  [_units.SECONDS]: d => d.getUTCSeconds(),
  [_units.MILLISECONDS]: d => d.getUTCMilliseconds(),
  [_units.DAY]: (d, y) => weekday(1, d.getUTCDay(), utcFirst(y)),
  [_units.WEEK]: (d, y) => weekday(utcWeekNum(d), 0, utcFirst(y)),
  [_units.WEEK + _units.DAY]: (d, y) => weekday(utcWeekNum(d), d.getUTCDay(), utcFirst(y))
};

function utcWeekNum(d) {
  const y = Date.UTC(d.getUTCFullYear(), 0, 1);
  return _d3Time.utcWeek.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) {
    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));
}

function utcFloor(units, step) {
  return floor(units, step || 1, utcGet, utcDate);
}
},{"./units":"vhL4","vega-util":"dejJ","d3-time":"QBVT"}],"V3xQ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.timeInterval = timeInterval;
exports.utcInterval = utcInterval;
exports.timeOffset = timeOffset;
exports.utcOffset = utcOffset;
exports.timeSequence = timeSequence;
exports.utcSequence = utcSequence;

var _units = require("./units");

var _d3Time = require("d3-time");

const timeIntervals = {
  [_units.YEAR]: _d3Time.timeYear,
  [_units.QUARTER]: _d3Time.timeMonth.every(3),
  [_units.MONTH]: _d3Time.timeMonth,
  [_units.WEEK]: _d3Time.timeWeek,
  [_units.DATE]: _d3Time.timeDay,
  [_units.DAY]: _d3Time.timeDay,
  [_units.HOURS]: _d3Time.timeHour,
  [_units.MINUTES]: _d3Time.timeMinute,
  [_units.SECONDS]: _d3Time.timeSecond,
  [_units.MILLISECONDS]: _d3Time.timeMillisecond
};
const utcIntervals = {
  [_units.YEAR]: _d3Time.utcYear,
  [_units.QUARTER]: _d3Time.utcMonth.every(3),
  [_units.MONTH]: _d3Time.utcMonth,
  [_units.WEEK]: _d3Time.utcWeek,
  [_units.DATE]: _d3Time.utcDay,
  [_units.DAY]: _d3Time.utcDay,
  [_units.HOURS]: _d3Time.utcHour,
  [_units.MINUTES]: _d3Time.utcMinute,
  [_units.SECONDS]: _d3Time.utcSecond,
  [_units.MILLISECONDS]: _d3Time.utcMillisecond
};

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);
}
},{"./units":"vhL4","d3-time":"QBVT"}],"BFQi":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.timeUnitSpecifier = timeUnitSpecifier;
exports.timeFormat = timeFormat;
exports.utcFormat = utcFormat;

var _units = require("./units");

var _interval = require("./interval");

var _d3TimeFormat = require("d3-time-format");

var _vegaUtil = require("vega-util");

const defaultSpecifiers = {
  [_units.YEAR]: '%Y ',
  [_units.QUARTER]: 'Q%q ',
  [_units.MONTH]: '%b ',
  [_units.DATE]: '%d ',
  [_units.WEEK]: 'W%U ',
  [_units.DAY]: '%a ',
  [_units.HOURS]: '%H:00',
  [_units.MINUTES]: '00:%M',
  [_units.SECONDS]: ':%S',
  [_units.MILLISECONDS]: '.%L',
  [`${_units.YEAR}-${_units.MONTH}`]: '%Y-%m ',
  [`${_units.YEAR}-${_units.MONTH}-${_units.DATE}`]: '%Y-%m-%d ',
  [`${_units.HOURS}-${_units.MINUTES}`]: '%H:%M'
};

function timeUnitSpecifier(units, specifiers) {
  const s = (0, _vegaUtil.extend)({}, defaultSpecifiers, specifiers),
        u = (0, _units.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();
}

function timeFormat(specifier) {
  return formatter(_d3TimeFormat.timeFormat, _interval.timeInterval, specifier);
}

function utcFormat(specifier) {
  return formatter(_d3TimeFormat.utcFormat, _interval.utcInterval, specifier);
}

function formatter(format, interval, specifier) {
  return (0, _vegaUtil.isString)(specifier) ? format(specifier) : multiFormat(format, interval, specifier);
}

function multiFormat(format, interval, spec) {
  spec = spec || {};

  if (!(0, _vegaUtil.isObject)(spec)) {
    (0, _vegaUtil.error)(`Invalid time multi-format specifier: ${spec}`);
  }

  const second = interval(_units.SECONDS),
        minute = interval(_units.MINUTES),
        hour = interval(_units.HOURS),
        day = interval(_units.DATE),
        week = interval(_units.WEEK),
        month = interval(_units.MONTH),
        quarter = interval(_units.QUARTER),
        year = interval(_units.YEAR),
        L = format(spec[_units.MILLISECONDS] || '.%L'),
        S = format(spec[_units.SECONDS] || ':%S'),
        M = format(spec[_units.MINUTES] || '%I:%M'),
        H = format(spec[_units.HOURS] || '%I %p'),
        d = format(spec[_units.DATE] || spec[_units.DAY] || '%a %d'),
        w = format(spec[_units.WEEK] || '%b %d'),
        m = format(spec[_units.MONTH] || '%B'),
        q = format(spec[_units.QUARTER] || '%B'),
        y = format(spec[_units.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);
  };
}
},{"./units":"vhL4","./interval":"V3xQ","d3-time-format":"fort","vega-util":"dejJ"}],"glpm":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _units = require("./units");

var _vegaUtil = require("vega-util");

var _d3Array = require("d3-array");

const durationSecond = 1000,
      durationMinute = durationSecond * 60,
      durationHour = durationMinute * 60,
      durationDay = durationHour * 24,
      durationWeek = durationDay * 7,
      durationMonth = durationDay * 30,
      durationYear = durationDay * 365;
const Milli = [_units.YEAR, _units.MONTH, _units.DATE, _units.HOURS, _units.MINUTES, _units.SECONDS, _units.MILLISECONDS],
      Seconds = Milli.slice(0, -1),
      Minutes = Seconds.slice(0, -1),
      Hours = Minutes.slice(0, -1),
      Day = Hours.slice(0, -1),
      Week = [_units.YEAR, _units.WEEK],
      Month = [_units.YEAR, _units.MONTH],
      Year = [_units.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 _default(opt) {
  const ext = opt.extent,
        max = opt.maxbins || 40,
        target = Math.abs((0, _vegaUtil.span)(ext)) / max;
  let i = (0, _d3Array.bisector)(i => i[2]).right(intervals, target),
      units,
      step;

  if (i === intervals.length) {
    units = Year, step = (0, _d3Array.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((0, _d3Array.tickStep)(ext[0], ext[1], max), 1);
  }

  return {
    units,
    step
  };
}
},{"./units":"vhL4","vega-util":"dejJ","d3-array":"Rpnd"}],"j8qo":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "timeUnits", {
  enumerable: true,
  get: function () {
    return _units.timeUnits;
  }
});
Object.defineProperty(exports, "timeFloor", {
  enumerable: true,
  get: function () {
    return _floor.timeFloor;
  }
});
Object.defineProperty(exports, "utcFloor", {
  enumerable: true,
  get: function () {
    return _floor.utcFloor;
  }
});
Object.defineProperty(exports, "timeUnitSpecifier", {
  enumerable: true,
  get: function () {
    return _format.timeUnitSpecifier;
  }
});
Object.defineProperty(exports, "timeFormat", {
  enumerable: true,
  get: function () {
    return _format.timeFormat;
  }
});
Object.defineProperty(exports, "utcFormat", {
  enumerable: true,
  get: function () {
    return _format.utcFormat;
  }
});
Object.defineProperty(exports, "timeInterval", {
  enumerable: true,
  get: function () {
    return _interval.timeInterval;
  }
});
Object.defineProperty(exports, "timeOffset", {
  enumerable: true,
  get: function () {
    return _interval.timeOffset;
  }
});
Object.defineProperty(exports, "timeSequence", {
  enumerable: true,
  get: function () {
    return _interval.timeSequence;
  }
});
Object.defineProperty(exports, "utcInterval", {
  enumerable: true,
  get: function () {
    return _interval.utcInterval;
  }
});
Object.defineProperty(exports, "utcOffset", {
  enumerable: true,
  get: function () {
    return _interval.utcOffset;
  }
});
Object.defineProperty(exports, "utcSequence", {
  enumerable: true,
  get: function () {
    return _interval.utcSequence;
  }
});
Object.defineProperty(exports, "timeBin", {
  enumerable: true,
  get: function () {
    return _bin.default;
  }
});

var _units = require("./src/units");

var _floor = require("./src/floor");

var _format = require("./src/format");

var _interval = require("./src/interval");

var _bin = _interopRequireDefault(require("./src/bin"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./src/units":"vhL4","./src/floor":"VSmt","./src/format":"BFQi","./src/interval":"V3xQ","./src/bin":"glpm"}],"pDMY":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = TimeUnit;

var _vegaDataflow = require("vega-dataflow");

var _vegaTime = require("vega-time");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.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": "string",
    "array": true
  }, {
    "name": "step",
    "type": "number",
    "default": 1
  }, {
    "name": "timezone",
    "type": "enum",
    "default": "local",
    "values": ["local", "utc"]
  }, {
    "name": "as",
    "type": "string",
    "array": true,
    "length": 2,
    "default": OUTPUT
  }]
};
var prototype = (0, _vegaUtil.inherits)(TimeUnit, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var field = _.field,
      band = _.interval !== false,
      utc = _.timezone === 'utc',
      floor = this._floor(_, pulse),
      offset = (utc ? _vegaTime.utcInterval : _vegaTime.timeInterval)(floor.unit).offset,
      as = _.as || OUTPUT,
      u0 = as[0],
      u1 = as[1],
      min = floor.start || Infinity,
      max = floor.stop || -Infinity,
      step = floor.step,
      flag = pulse.ADD;

  if (_.modified() || pulse.modified((0, _vegaUtil.accessorFields)(_.field))) {
    pulse = pulse.reflow(true);
    flag = pulse.SOURCE;
    min = Infinity;
    max = -Infinity;
  }

  pulse.visit(flag, function (t) {
    var v = field(t),
        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);
};

prototype._floor = function (_, pulse) {
  const utc = _.timezone === 'utc'; // get parameters

  let {
    units,
    step
  } = _.units ? {
    units: _.units,
    step: _.step || 1
  } : (0, _vegaTime.timeBin)({
    extent: (0, _vegaUtil.extent)(pulse.materialize(pulse.SOURCE).source, _.field),
    maxbins: _.maxbins
  }); // check / standardize time units

  units = (0, _vegaTime.timeUnits)(units);
  const prev = this.value || {},
        floor = (utc ? _vegaTime.utcFloor : _vegaTime.timeFloor)(units, step);
  floor.unit = (0, _vegaUtil.peek)(units);
  floor.units = units;
  floor.step = step;
  floor.start = prev.start;
  floor.stop = prev.stop;
  return this.value = floor;
};
},{"vega-dataflow":"UC8n","vega-time":"j8qo","vega-util":"dejJ"}],"XZzh":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = TupleIndex;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.Transform.call(this, (0, _vegaUtil.fastmap)(), params);
}

var prototype = (0, _vegaUtil.inherits)(TupleIndex, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var df = pulse.dataflow,
      field = _.field,
      index = this.value,
      mod = true;

  function set(t) {
    index.set(field(t), t);
  }

  if (_.modified('field') || pulse.modified(field.fields)) {
    index.clear();
    pulse.visit(pulse.SOURCE, set);
  } else if (pulse.changed()) {
    pulse.visit(pulse.REM, function (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();
};
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"BQSl":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Values;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.Transform.call(this, null, params);
}

var prototype = (0, _vegaUtil.inherits)(Values, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var run = !this.value || _.modified('field') || _.modified('sort') || pulse.changed() || _.sort && pulse.modified(_.sort.fields);

  if (run) {
    this.value = (_.sort ? pulse.source.slice().sort((0, _vegaDataflow.stableCompare)(_.sort)) : pulse.source).map(_.field);
  }
};
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"BqHh":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.WindowOp = WindowOp;
exports.ValidWindowOps = exports.WindowOps = void 0;

var _vegaUtil = require("vega-util");

function WindowOp(op, field, param, as) {
  let fn = WindowOps[op](field, param);
  return {
    init: fn.init || _vegaUtil.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 => {
        let 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 => {
        let i = w.index,
            d = w.data;
        return i && w.compare(d[i - 1], d[i]) ? ++drank : drank;
      }
    };
  },
  percent_rank: function () {
    let 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 => {
        let i = w.index,
            d = w.data,
            c = w.compare;

        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)) (0, _vegaUtil.error)('ntile num must be greater than zero.');
    let 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 => {
        let i = w.index - offset;
        return i >= 0 ? field(w.data[i]) : null;
      }
    };
  },
  lead: function (field, offset) {
    offset = +offset || 1;
    return {
      next: w => {
        let 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)) (0, _vegaUtil.error)('nth_value nth must be greater than zero.');
    return {
      next: w => {
        let i = w.i0 + (nth - 1);
        return i < w.i1 ? field(w.data[i]) : null;
      }
    };
  },
  prev_value: function (field) {
    let prev = null;
    return {
      next: w => {
        let v = field(w.data[w.index]);
        return v != null ? prev = v : prev;
      }
    };
  },
  next_value: function (field) {
    let v = null,
        i = -1;
    return {
      next: w => {
        let d = w.data;
        return w.index <= i ? v : (i = find(field, d, w.index)) < 0 ? (i = d.length, v = null) : v = field(d[i]);
      }
    };
  }
};
exports.WindowOps = WindowOps;

function find(field, data, index) {
  for (let n = data.length; index < n; ++index) {
    let v = field(data[index]);
    if (v != null) return index;
  }

  return -1;
}

var ValidWindowOps = Object.keys(WindowOps);
exports.ValidWindowOps = ValidWindowOps;
},{"vega-util":"dejJ"}],"lI1k":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = WindowState;

var _AggregateOps = require("./AggregateOps");

var _TupleStore = _interopRequireDefault(require("./TupleStore"));

var _WindowOps = require("./WindowOps");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function WindowState(_) {
  let self = this,
      ops = (0, _vegaUtil.array)(_.ops),
      fields = (0, _vegaUtil.array)(_.fields),
      params = (0, _vegaUtil.array)(_.params),
      as = (0, _vegaUtil.array)(_.as),
      outputs = self.outputs = [],
      windows = self.windows = [],
      inputs = {},
      map = {},
      countOnly = true,
      counts = [],
      measures = [];

  function visitInputs(f) {
    (0, _vegaUtil.array)((0, _vegaUtil.accessorFields)(f)).forEach(_ => inputs[_] = 1);
  }

  visitInputs(_.sort);
  ops.forEach(function (op, i) {
    let field = fields[i],
        mname = (0, _vegaUtil.accessorName)(field),
        name = (0, _AggregateOps.measureName)(op, mname, as[i]);
    visitInputs(field);
    outputs.push(name); // Window operation

    if ((0, _vegaUtil.hasOwnProperty)(_WindowOps.WindowOps, op)) {
      windows.push((0, _WindowOps.WindowOp)(op, fields[i], params[i], name));
    } // Aggregate operation
    else {
        if (field == null && op !== 'count') {
          (0, _vegaUtil.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((0, _AggregateOps.createMeasure)(op, name));
      }
  });

  if (counts.length || measures.length) {
    self.cell = cell(measures, counts, countOnly);
  }

  self.inputs = Object.keys(inputs);
}

const prototype = WindowState.prototype;

prototype.init = function () {
  this.windows.forEach(_ => _.init());
  if (this.cell) this.cell.init();
};

prototype.update = function (w, t) {
  let self = this,
      cell = self.cell,
      wind = self.windows,
      data = w.data,
      m = wind && wind.length,
      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 => (0, _AggregateOps.compileMeasures)(m, m.field));
  let 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.default();
  }

  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;
}
},{"./AggregateOps":"Dcrk","./TupleStore":"KXQo","./WindowOps":"BqHh","vega-util":"dejJ"}],"SoeP":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Window;

var _AggregateKeys = require("./util/AggregateKeys");

var _AggregateOps = require("./util/AggregateOps");

var _SortedList = _interopRequireDefault(require("./util/SortedList"));

var _WindowOps = require("./util/WindowOps");

var _WindowState = _interopRequireDefault(require("./util/WindowState"));

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

var _d3Array = require("d3-array");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * 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) {
  _vegaDataflow.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": _WindowOps.ValidWindowOps.concat(_AggregateOps.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
  }]
};
var prototype = (0, _vegaUtil.inherits)(Window, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var self = this,
      state = self.state,
      mod = _.modified(),
      cmp = (0, _vegaDataflow.stableCompare)(_.sort),
      i,
      n;

  this.stamp = pulse.stamp; // initialize window state

  if (!state || mod) {
    state = self.state = new _WindowState.default(_);
  } // retrieve group for a tuple


  var key = (0, _AggregateKeys.groupkey)(_.groupby);

  function group(t) {
    return self.group(key(t));
  } // partition input tuples


  if (mod || pulse.modified(state.inputs)) {
    self.value = {};
    pulse.visit(pulse.SOURCE, function (t) {
      group(t).add(t);
    });
  } else {
    pulse.visit(pulse.REM, function (t) {
      group(t).remove(t);
    });
    pulse.visit(pulse.ADD, function (t) {
      group(t).add(t);
    });
  } // perform window calculations for each modified partition


  for (i = 0, n = self._mlen; i < n; ++i) {
    processPartition(self._mods[i], state, cmp, _);
  }

  self._mlen = 0;
  self._mods = []; // TODO don't reflow everything?

  return pulse.reflow(mod).modifies(state.outputs);
};

prototype.group = function (key) {
  var self = this,
      group = self.value[key];

  if (!group) {
    group = self.value[key] = (0, _SortedList.default)(_vegaDataflow.tupleid);
    group.stamp = -1;
  }

  if (group.stamp < self.stamp) {
    group.stamp = self.stamp;
    self._mods[self._mlen++] = group;
  }

  return group;
};

function processPartition(list, state, cmp, _) {
  var sort = _.sort,
      range = sort && !_.ignorePeers,
      frame = _.frame || [null, 0],
      data = list.data(cmp),
      // use cmp for stable sort
  n = data.length,
      i = 0,
      b = range ? (0, _d3Array.bisector)(sort) : null,
      w = {
    i0: 0,
    i1: 0,
    p0: 0,
    p1: 0,
    index: 0,
    data: data,
    compare: sort || (0, _vegaUtil.constant)(-1)
  };

  for (state.init(); 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) {
  var 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]);
}
},{"./util/AggregateKeys":"k6fm","./util/AggregateOps":"Dcrk","./util/SortedList":"My0V","./util/WindowOps":"BqHh","./util/WindowState":"lI1k","vega-dataflow":"UC8n","vega-util":"dejJ","d3-array":"Rpnd"}],"fCtd":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "aggregate", {
  enumerable: true,
  get: function () {
    return _Aggregate.default;
  }
});
Object.defineProperty(exports, "bin", {
  enumerable: true,
  get: function () {
    return _Bin.default;
  }
});
Object.defineProperty(exports, "collect", {
  enumerable: true,
  get: function () {
    return _Collect.default;
  }
});
Object.defineProperty(exports, "compare", {
  enumerable: true,
  get: function () {
    return _Compare.default;
  }
});
Object.defineProperty(exports, "countpattern", {
  enumerable: true,
  get: function () {
    return _CountPattern.default;
  }
});
Object.defineProperty(exports, "cross", {
  enumerable: true,
  get: function () {
    return _Cross.default;
  }
});
Object.defineProperty(exports, "density", {
  enumerable: true,
  get: function () {
    return _Density.default;
  }
});
Object.defineProperty(exports, "dotbin", {
  enumerable: true,
  get: function () {
    return _DotBin.default;
  }
});
Object.defineProperty(exports, "expression", {
  enumerable: true,
  get: function () {
    return _Expression.default;
  }
});
Object.defineProperty(exports, "extent", {
  enumerable: true,
  get: function () {
    return _Extent.default;
  }
});
Object.defineProperty(exports, "facet", {
  enumerable: true,
  get: function () {
    return _Facet.default;
  }
});
Object.defineProperty(exports, "field", {
  enumerable: true,
  get: function () {
    return _Field.default;
  }
});
Object.defineProperty(exports, "filter", {
  enumerable: true,
  get: function () {
    return _Filter.default;
  }
});
Object.defineProperty(exports, "flatten", {
  enumerable: true,
  get: function () {
    return _Flatten.default;
  }
});
Object.defineProperty(exports, "fold", {
  enumerable: true,
  get: function () {
    return _Fold.default;
  }
});
Object.defineProperty(exports, "formula", {
  enumerable: true,
  get: function () {
    return _Formula.default;
  }
});
Object.defineProperty(exports, "generate", {
  enumerable: true,
  get: function () {
    return _Generate.default;
  }
});
Object.defineProperty(exports, "impute", {
  enumerable: true,
  get: function () {
    return _Impute.default;
  }
});
Object.defineProperty(exports, "joinaggregate", {
  enumerable: true,
  get: function () {
    return _JoinAggregate.default;
  }
});
Object.defineProperty(exports, "kde", {
  enumerable: true,
  get: function () {
    return _KDE.default;
  }
});
Object.defineProperty(exports, "key", {
  enumerable: true,
  get: function () {
    return _Key.default;
  }
});
Object.defineProperty(exports, "load", {
  enumerable: true,
  get: function () {
    return _Load.default;
  }
});
Object.defineProperty(exports, "lookup", {
  enumerable: true,
  get: function () {
    return _Lookup.default;
  }
});
Object.defineProperty(exports, "multiextent", {
  enumerable: true,
  get: function () {
    return _MultiExtent.default;
  }
});
Object.defineProperty(exports, "multivalues", {
  enumerable: true,
  get: function () {
    return _MultiValues.default;
  }
});
Object.defineProperty(exports, "params", {
  enumerable: true,
  get: function () {
    return _Params.default;
  }
});
Object.defineProperty(exports, "pivot", {
  enumerable: true,
  get: function () {
    return _Pivot.default;
  }
});
Object.defineProperty(exports, "prefacet", {
  enumerable: true,
  get: function () {
    return _PreFacet.default;
  }
});
Object.defineProperty(exports, "project", {
  enumerable: true,
  get: function () {
    return _Project.default;
  }
});
Object.defineProperty(exports, "proxy", {
  enumerable: true,
  get: function () {
    return _Proxy.default;
  }
});
Object.defineProperty(exports, "quantile", {
  enumerable: true,
  get: function () {
    return _Quantile.default;
  }
});
Object.defineProperty(exports, "relay", {
  enumerable: true,
  get: function () {
    return _Relay.default;
  }
});
Object.defineProperty(exports, "sample", {
  enumerable: true,
  get: function () {
    return _Sample.default;
  }
});
Object.defineProperty(exports, "sequence", {
  enumerable: true,
  get: function () {
    return _Sequence.default;
  }
});
Object.defineProperty(exports, "sieve", {
  enumerable: true,
  get: function () {
    return _Sieve.default;
  }
});
Object.defineProperty(exports, "subflow", {
  enumerable: true,
  get: function () {
    return _Subflow.default;
  }
});
Object.defineProperty(exports, "timeunit", {
  enumerable: true,
  get: function () {
    return _TimeUnit.default;
  }
});
Object.defineProperty(exports, "tupleindex", {
  enumerable: true,
  get: function () {
    return _TupleIndex.default;
  }
});
Object.defineProperty(exports, "values", {
  enumerable: true,
  get: function () {
    return _Values.default;
  }
});
Object.defineProperty(exports, "window", {
  enumerable: true,
  get: function () {
    return _Window.default;
  }
});

var _Aggregate = _interopRequireDefault(require("./src/Aggregate"));

var _Bin = _interopRequireDefault(require("./src/Bin"));

var _Collect = _interopRequireDefault(require("./src/Collect"));

var _Compare = _interopRequireDefault(require("./src/Compare"));

var _CountPattern = _interopRequireDefault(require("./src/CountPattern"));

var _Cross = _interopRequireDefault(require("./src/Cross"));

var _Density = _interopRequireDefault(require("./src/Density"));

var _DotBin = _interopRequireDefault(require("./src/DotBin"));

var _Expression = _interopRequireDefault(require("./src/Expression"));

var _Extent = _interopRequireDefault(require("./src/Extent"));

var _Facet = _interopRequireDefault(require("./src/Facet"));

var _Field = _interopRequireDefault(require("./src/Field"));

var _Filter = _interopRequireDefault(require("./src/Filter"));

var _Flatten = _interopRequireDefault(require("./src/Flatten"));

var _Fold = _interopRequireDefault(require("./src/Fold"));

var _Formula = _interopRequireDefault(require("./src/Formula"));

var _Generate = _interopRequireDefault(require("./src/Generate"));

var _Impute = _interopRequireDefault(require("./src/Impute"));

var _JoinAggregate = _interopRequireDefault(require("./src/JoinAggregate"));

var _KDE = _interopRequireDefault(require("./src/KDE"));

var _Key = _interopRequireDefault(require("./src/Key"));

var _Load = _interopRequireDefault(require("./src/Load"));

var _Lookup = _interopRequireDefault(require("./src/Lookup"));

var _MultiExtent = _interopRequireDefault(require("./src/MultiExtent"));

var _MultiValues = _interopRequireDefault(require("./src/MultiValues"));

var _Params = _interopRequireDefault(require("./src/Params"));

var _Pivot = _interopRequireDefault(require("./src/Pivot"));

var _PreFacet = _interopRequireDefault(require("./src/PreFacet"));

var _Project = _interopRequireDefault(require("./src/Project"));

var _Proxy = _interopRequireDefault(require("./src/Proxy"));

var _Quantile = _interopRequireDefault(require("./src/Quantile"));

var _Relay = _interopRequireDefault(require("./src/Relay"));

var _Sample = _interopRequireDefault(require("./src/Sample"));

var _Sequence = _interopRequireDefault(require("./src/Sequence"));

var _Sieve = _interopRequireDefault(require("./src/Sieve"));

var _Subflow = _interopRequireDefault(require("./src/Subflow"));

var _TimeUnit = _interopRequireDefault(require("./src/TimeUnit"));

var _TupleIndex = _interopRequireDefault(require("./src/TupleIndex"));

var _Values = _interopRequireDefault(require("./src/Values"));

var _Window = _interopRequireDefault(require("./src/Window"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./src/Aggregate":"b67s","./src/Bin":"Itxd","./src/Collect":"fln0","./src/Compare":"tzR4","./src/CountPattern":"vMFQ","./src/Cross":"JAZ9","./src/Density":"BCKR","./src/DotBin":"jDtN","./src/Expression":"wYCT","./src/Extent":"znYt","./src/Facet":"dOe5","./src/Field":"KQfn","./src/Filter":"pT1s","./src/Flatten":"ub5p","./src/Fold":"t4K2","./src/Formula":"BFyf","./src/Generate":"uxdB","./src/Impute":"zRfo","./src/JoinAggregate":"WQTj","./src/KDE":"nVFc","./src/Key":"dIwl","./src/Load":"Z91X","./src/Lookup":"Gaui","./src/MultiExtent":"ZpMQ","./src/MultiValues":"d1Ms","./src/Params":"KHVM","./src/Pivot":"quik","./src/PreFacet":"uGi8","./src/Project":"kpgt","./src/Proxy":"XOSM","./src/Quantile":"oOy6","./src/Relay":"cjWe","./src/Sample":"EdCz","./src/Sequence":"Us42","./src/Sieve":"S3Nr","./src/Subflow":"yQRw","./src/TimeUnit":"pDMY","./src/TupleIndex":"XZzh","./src/Values":"BQSl","./src/Window":"SoeP"}],"NhYQ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Row = exports.Column = exports.Flush = exports.Each = exports.All = exports.None = exports.Pad = exports.FitY = exports.FitX = exports.Fit = exports.Symbols = exports.Padding = exports.ColTitle = exports.ColFooter = exports.ColHeader = exports.RowTitle = exports.RowFooter = exports.RowHeader = exports.LegendRole = exports.ScopeRole = exports.FrameRole = exports.TitleRole = exports.AxisRole = exports.Group = exports.Y = exports.X = exports.End = exports.Middle = exports.Start = exports.BottomRight = exports.BottomLeft = exports.TopRight = exports.TopLeft = exports.Bottom = exports.Right = exports.Left = exports.Top = void 0;
const Top = 'top';
exports.Top = Top;
const Left = 'left';
exports.Left = Left;
const Right = 'right';
exports.Right = Right;
const Bottom = 'bottom';
exports.Bottom = Bottom;
const TopLeft = 'top-left';
exports.TopLeft = TopLeft;
const TopRight = 'top-right';
exports.TopRight = TopRight;
const BottomLeft = 'bottom-left';
exports.BottomLeft = BottomLeft;
const BottomRight = 'bottom-right';
exports.BottomRight = BottomRight;
const Start = 'start';
exports.Start = Start;
const Middle = 'middle';
exports.Middle = Middle;
const End = 'end';
exports.End = End;
const X = 'x';
exports.X = X;
const Y = 'y';
exports.Y = Y;
const Group = 'group';
exports.Group = Group;
const AxisRole = 'axis';
exports.AxisRole = AxisRole;
const TitleRole = 'title';
exports.TitleRole = TitleRole;
const FrameRole = 'frame';
exports.FrameRole = FrameRole;
const ScopeRole = 'scope';
exports.ScopeRole = ScopeRole;
const LegendRole = 'legend';
exports.LegendRole = LegendRole;
const RowHeader = 'row-header';
exports.RowHeader = RowHeader;
const RowFooter = 'row-footer';
exports.RowFooter = RowFooter;
const RowTitle = 'row-title';
exports.RowTitle = RowTitle;
const ColHeader = 'column-header';
exports.ColHeader = ColHeader;
const ColFooter = 'column-footer';
exports.ColFooter = ColFooter;
const ColTitle = 'column-title';
exports.ColTitle = ColTitle;
const Padding = 'padding';
exports.Padding = Padding;
const Symbols = 'symbol';
exports.Symbols = Symbols;
const Fit = 'fit';
exports.Fit = Fit;
const FitX = 'fit-x';
exports.FitX = FitX;
const FitY = 'fit-y';
exports.FitY = FitY;
const Pad = 'pad';
exports.Pad = Pad;
const None = 'none';
exports.None = None;
const All = 'all';
exports.All = All;
const Each = 'each';
exports.Each = Each;
const Flush = 'flush';
exports.Flush = Flush;
const Column = 'column';
exports.Column = Column;
const Row = 'row';
exports.Row = Row;
},{}],"pVXN":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Bounds;

function Bounds(b) {
  this.clear();
  if (b) this.union(b);
}

var prototype = Bounds.prototype;

prototype.clone = function () {
  return new Bounds(this);
};

prototype.clear = function () {
  this.x1 = +Number.MAX_VALUE;
  this.y1 = +Number.MAX_VALUE;
  this.x2 = -Number.MAX_VALUE;
  this.y2 = -Number.MAX_VALUE;
  return this;
};

prototype.empty = function () {
  return this.x1 === +Number.MAX_VALUE && this.y1 === +Number.MAX_VALUE && this.x2 === -Number.MAX_VALUE && this.y2 === -Number.MAX_VALUE;
};

prototype.equals = function (b) {
  return this.x1 === b.x1 && this.y1 === b.y1 && this.x2 === b.x2 && this.y2 === b.y2;
};

prototype.set = function (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;
};

prototype.add = function (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;
};

prototype.expand = function (d) {
  this.x1 -= d;
  this.y1 -= d;
  this.x2 += d;
  this.y2 += d;
  return this;
};

prototype.round = function () {
  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;
};

prototype.translate = function (dx, dy) {
  this.x1 += dx;
  this.x2 += dx;
  this.y1 += dy;
  this.y2 += dy;
  return this;
};

prototype.rotate = function (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]);
};

prototype.rotatedPoints = function (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];
};

prototype.union = function (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;
};

prototype.intersect = function (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;
};

prototype.encloses = function (b) {
  return b && this.x1 <= b.x1 && this.x2 >= b.x2 && this.y1 <= b.y1 && this.y2 >= b.y2;
};

prototype.alignsWith = function (b) {
  return b && (this.x1 == b.x1 || this.x2 == b.x2 || this.y1 == b.y1 || this.y2 == b.y2);
};

prototype.intersects = function (b) {
  return b && !(this.x2 < b.x1 || this.x1 > b.x2 || this.y2 < b.y1 || this.y1 > b.y2);
};

prototype.contains = function (x, y) {
  return !(x < this.x1 || x > this.x2 || y < this.y1 || y > this.y2);
};

prototype.width = function () {
  return this.x2 - this.x1;
};

prototype.height = function () {
  return this.y2 - this.y1;
};
},{}],"wQA6":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.isGradient = isGradient;
exports.gradientRef = gradientRef;
exports.default = _default;
exports.patternPrefix = void 0;
var gradient_id = 0;
const patternPrefix = 'p_';
exports.patternPrefix = patternPrefix;

function isGradient(value) {
  return value && value.gradient;
}

function gradientRef(g, defs, base) {
  let id = g.id,
      type = g.gradient,
      prefix = type === 'radial' ? patternPrefix : ''; // check id, assign default values as needed

  if (!id) {
    id = g.id = 'gradient_' + gradient_id++;

    if (type === 'radial') {
      g.x1 = get(g.x1, 0.5);
      g.y1 = get(g.y1, 0.5);
      g.r1 = get(g.r1, 0);
      g.x2 = get(g.x2, 0.5);
      g.y2 = get(g.y2, 0.5);
      g.r2 = get(g.r2, 0.5);
      prefix = patternPrefix;
    } else {
      g.x1 = get(g.x1, 0);
      g.y1 = get(g.y1, 0);
      g.x2 = get(g.x2, 1);
      g.y2 = get(g.y2, 0);
    }
  } // register definition


  defs[id] = g; // return url reference

  return 'url(' + (base || '') + '#' + prefix + id + ')';
}

function get(val, def) {
  return val != null ? val : def;
}

function _default(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;
    }
  };
}
},{}],"JYN2":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Item;

var _Bounds = _interopRequireDefault(require("./Bounds"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function Item(mark) {
  this.mark = mark;
  this.bounds = this.bounds || new _Bounds.default();
}
},{"./Bounds":"pVXN"}],"pDd9":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = GroupItem;

var _Item = _interopRequireDefault(require("./Item"));

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function GroupItem(mark) {
  _Item.default.call(this, mark);

  this.items = this.items || [];
}

(0, _vegaUtil.inherits)(GroupItem, _Item.default);
},{"./Item":"JYN2","vega-util":"dejJ"}],"pgHZ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.domCanvas = domCanvas;
exports.domImage = domImage;

function domCanvas(w, h) {
  if (typeof document !== 'undefined' && document.createElement) {
    var c = document.createElement('canvas');

    if (c && c.getContext) {
      c.width = w;
      c.height = h;
      return c;
    }
  }

  return null;
}

function domImage() {
  return typeof Image !== 'undefined' ? Image : null;
}
},{}],"ZLEK":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "domCanvas", {
  enumerable: true,
  get: function () {
    return _domCanvas.domCanvas;
  }
});
Object.defineProperty(exports, "canvas", {
  enumerable: true,
  get: function () {
    return _domCanvas.domCanvas;
  }
});
Object.defineProperty(exports, "image", {
  enumerable: true,
  get: function () {
    return _domCanvas.domImage;
  }
});

var _domCanvas = require("./src/domCanvas");
},{"./src/domCanvas":"pgHZ"}],"eoqI":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = ResourceLoader;

var _vegaCanvas = require("vega-canvas");

var _vegaLoader = require("vega-loader");

function ResourceLoader(customLoader) {
  this._pending = 0;
  this._loader = customLoader || (0, _vegaLoader.loader)();
}

var prototype = ResourceLoader.prototype;

prototype.pending = function () {
  return this._pending;
};

function increment(loader) {
  loader._pending += 1;
}

function decrement(loader) {
  loader._pending -= 1;
}

prototype.sanitizeURL = function (uri) {
  var loader = this;
  increment(loader);
  return loader._loader.sanitize(uri, {
    context: 'href'
  }).then(function (opt) {
    decrement(loader);
    return opt;
  }).catch(function () {
    decrement(loader);
    return null;
  });
};

prototype.loadImage = function (uri) {
  var loader = this,
      Image = (0, _vegaCanvas.image)();
  increment(loader);
  return loader._loader.sanitize(uri, {
    context: 'image'
  }).then(function (opt) {
    var url = opt.href;
    if (!url || !Image) throw {
      url: url
    };
    var img = new Image();

    img.onload = function () {
      decrement(loader);
    };

    img.onerror = function () {
      decrement(loader);
    };

    img.src = url;
    return img;
  }).catch(function (e) {
    decrement(loader);
    return {
      complete: false,
      width: 0,
      height: 0,
      src: e && e.url || ''
    };
  });
};

prototype.ready = function () {
  var loader = this;
  return new Promise(function (accept) {
    function poll(value) {
      if (!loader.pending()) accept(value);else setTimeout(function () {
        poll(true);
      }, 10);
    }

    poll(false);
  });
};
},{"vega-canvas":"ZLEK","vega-loader":"wGnx"}],"hCwf":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var pi = Math.PI,
    tau = 2 * pi,
    epsilon = 1e-6,
    tauEpsilon = tau - epsilon;

function Path() {
  this._x0 = this._y0 = // start of current subpath
  this._x1 = this._y1 = null; // end of current subpath

  this._ = "";
}

function path() {
  return new Path();
}

Path.prototype = 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 > 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) > 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((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) > 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) > epsilon || Math.abs(this._y1 - y0) > 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 % tau + 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 > epsilon) {
        this._ += "A" + r + "," + r + ",0," + +(da >= 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._;
  }
};
var _default = path;
exports.default = _default;
},{}],"zaWp":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "path", {
  enumerable: true,
  get: function () {
    return _path.default;
  }
});

var _path = _interopRequireDefault(require("./path.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./path.js":"hCwf"}],"k9An":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(x) {
  return function constant() {
    return x;
  };
}
},{}],"afGh":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.acos = acos;
exports.asin = asin;
exports.tau = exports.halfPi = exports.pi = exports.epsilon = exports.sqrt = exports.sin = exports.min = exports.max = exports.cos = exports.atan2 = exports.abs = void 0;
var abs = Math.abs;
exports.abs = abs;
var atan2 = Math.atan2;
exports.atan2 = atan2;
var cos = Math.cos;
exports.cos = cos;
var max = Math.max;
exports.max = max;
var min = Math.min;
exports.min = min;
var sin = Math.sin;
exports.sin = sin;
var sqrt = Math.sqrt;
exports.sqrt = sqrt;
var epsilon = 1e-12;
exports.epsilon = epsilon;
var pi = Math.PI;
exports.pi = pi;
var halfPi = pi / 2;
exports.halfPi = halfPi;
var tau = 2 * pi;
exports.tau = tau;

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);
}
},{}],"KUIA":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _d3Path = require("d3-path");

var _constant = _interopRequireDefault(require("./constant.js"));

var _math = require("./math.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

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 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) / (0, _math.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) * (0, _math.sqrt)((0, _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)
  };
}

function _default() {
  var innerRadius = arcInnerRadius,
      outerRadius = arcOuterRadius,
      cornerRadius = (0, _constant.default)(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) - _math.halfPi,
        a1 = endAngle.apply(this, arguments) - _math.halfPi,
        da = (0, _math.abs)(a1 - a0),
        cw = a1 > a0;

    if (!context) context = buffer = (0, _d3Path.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 > _math.tau - _math.epsilon) {
        context.moveTo(r1 * (0, _math.cos)(a0), r1 * (0, _math.sin)(a0));
        context.arc(0, 0, r1, a0, a1, !cw);

        if (r0 > _math.epsilon) {
          context.moveTo(r0 * (0, _math.cos)(a1), r0 * (0, _math.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) : (0, _math.sqrt)(r0 * r0 + r1 * r1)),
              rc = (0, _math.min)((0, _math.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 = (0, _math.asin)(rp / r0 * (0, _math.sin)(ap)),
                p1 = (0, _math.asin)(rp / r1 * (0, _math.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 * (0, _math.cos)(a01),
              y01 = r1 * (0, _math.sin)(a01),
              x10 = r0 * (0, _math.cos)(a10),
              y10 = r0 * (0, _math.sin)(a10); // Apply rounded corners?

          if (rc > _math.epsilon) {
            var x11 = r1 * (0, _math.cos)(a11),
                y11 = r1 * (0, _math.sin)(a11),
                x00 = r0 * (0, _math.cos)(a00),
                y00 = r0 * (0, _math.sin)(a00),
                oc; // Restrict the corner radius according to the sector angle.

            if (da < _math.pi && (oc = 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 / (0, _math.sin)((0, _math.acos)((ax * bx + ay * by) / ((0, _math.sqrt)(ax * ax + ay * ay) * (0, _math.sqrt)(bx * bx + by * by))) / 2),
                  lc = (0, _math.sqrt)(oc[0] * oc[0] + oc[1] * oc[1]);
              rc0 = (0, _math.min)(rc, (r0 - lc) / (kc - 1));
              rc1 = (0, _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, (0, _math.atan2)(t0.y01, t0.x01), (0, _math.atan2)(t1.y01, t1.x01), !cw); // Otherwise, draw the two corners and the ring.
              else {
                  context.arc(t0.cx, t0.cy, rc1, (0, _math.atan2)(t0.y01, t0.x01), (0, _math.atan2)(t0.y11, t0.x11), !cw);
                  context.arc(0, 0, r1, (0, _math.atan2)(t0.cy + t0.y11, t0.cx + t0.x11), (0, _math.atan2)(t1.cy + t1.y11, t1.cx + t1.x11), !cw);
                  context.arc(t1.cx, t1.cy, rc1, (0, _math.atan2)(t1.y11, t1.x11), (0, _math.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, (0, _math.atan2)(t0.y01, t0.x01), (0, _math.atan2)(t1.y01, t1.x01), !cw); // Otherwise, draw the two corners and the ring.
              else {
                  context.arc(t0.cx, t0.cy, rc0, (0, _math.atan2)(t0.y01, t0.x01), (0, _math.atan2)(t0.y11, t0.x11), !cw);
                  context.arc(0, 0, r0, (0, _math.atan2)(t0.cy + t0.y11, t0.cx + t0.x11), (0, _math.atan2)(t1.cy + t1.y11, t1.cx + t1.x11), cw);
                  context.arc(t1.cx, t1.cy, rc0, (0, _math.atan2)(t1.y11, t1.x11), (0, _math.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 - _math.pi / 2;
    return [(0, _math.cos)(a) * r, (0, _math.sin)(a) * r];
  };

  arc.innerRadius = function (_) {
    return arguments.length ? (innerRadius = typeof _ === "function" ? _ : (0, _constant.default)(+_), arc) : innerRadius;
  };

  arc.outerRadius = function (_) {
    return arguments.length ? (outerRadius = typeof _ === "function" ? _ : (0, _constant.default)(+_), arc) : outerRadius;
  };

  arc.cornerRadius = function (_) {
    return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : (0, _constant.default)(+_), arc) : cornerRadius;
  };

  arc.padRadius = function (_) {
    return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : (0, _constant.default)(+_), arc) : padRadius;
  };

  arc.startAngle = function (_) {
    return arguments.length ? (startAngle = typeof _ === "function" ? _ : (0, _constant.default)(+_), arc) : startAngle;
  };

  arc.endAngle = function (_) {
    return arguments.length ? (endAngle = typeof _ === "function" ? _ : (0, _constant.default)(+_), arc) : endAngle;
  };

  arc.padAngle = function (_) {
    return arguments.length ? (padAngle = typeof _ === "function" ? _ : (0, _constant.default)(+_), arc) : padAngle;
  };

  arc.context = function (_) {
    return arguments.length ? (context = _ == null ? null : _, arc) : context;
  };

  return arc;
}
},{"d3-path":"zaWp","./constant.js":"k9An","./math.js":"afGh"}],"QOZc":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

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;
    }
  }
};

function _default(context) {
  return new Linear(context);
}
},{}],"ds32":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.x = x;
exports.y = y;

function x(p) {
  return p[0];
}

function y(p) {
  return p[1];
}
},{}],"ddXz":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _d3Path = require("d3-path");

var _constant = _interopRequireDefault(require("./constant.js"));

var _linear = _interopRequireDefault(require("./curve/linear.js"));

var _point = require("./point.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default() {
  var x = _point.x,
      y = _point.y,
      defined = (0, _constant.default)(true),
      context = null,
      curve = _linear.default,
      output = null;

  function line(data) {
    var i,
        n = data.length,
        d,
        defined0 = false,
        buffer;
    if (context == null) output = curve(buffer = (0, _d3Path.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" ? _ : (0, _constant.default)(+_), line) : x;
  };

  line.y = function (_) {
    return arguments.length ? (y = typeof _ === "function" ? _ : (0, _constant.default)(+_), line) : y;
  };

  line.defined = function (_) {
    return arguments.length ? (defined = typeof _ === "function" ? _ : (0, _constant.default)(!!_), 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;
}
},{"d3-path":"zaWp","./constant.js":"k9An","./curve/linear.js":"QOZc","./point.js":"ds32"}],"hF4o":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _d3Path = require("d3-path");

var _constant = _interopRequireDefault(require("./constant.js"));

var _linear = _interopRequireDefault(require("./curve/linear.js"));

var _line = _interopRequireDefault(require("./line.js"));

var _point = require("./point.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default() {
  var x0 = _point.x,
      x1 = null,
      y0 = (0, _constant.default)(0),
      y1 = _point.y,
      defined = (0, _constant.default)(true),
      context = null,
      curve = _linear.default,
      output = null;

  function area(data) {
    var i,
        j,
        k,
        n = data.length,
        d,
        defined0 = false,
        buffer,
        x0z = new Array(n),
        y0z = new Array(n);
    if (context == null) output = curve(buffer = (0, _d3Path.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 (0, _line.default)().defined(defined).curve(curve).context(context);
  }

  area.x = function (_) {
    return arguments.length ? (x0 = typeof _ === "function" ? _ : (0, _constant.default)(+_), x1 = null, area) : x0;
  };

  area.x0 = function (_) {
    return arguments.length ? (x0 = typeof _ === "function" ? _ : (0, _constant.default)(+_), area) : x0;
  };

  area.x1 = function (_) {
    return arguments.length ? (x1 = _ == null ? null : typeof _ === "function" ? _ : (0, _constant.default)(+_), area) : x1;
  };

  area.y = function (_) {
    return arguments.length ? (y0 = typeof _ === "function" ? _ : (0, _constant.default)(+_), y1 = null, area) : y0;
  };

  area.y0 = function (_) {
    return arguments.length ? (y0 = typeof _ === "function" ? _ : (0, _constant.default)(+_), area) : y0;
  };

  area.y1 = function (_) {
    return arguments.length ? (y1 = _ == null ? null : typeof _ === "function" ? _ : (0, _constant.default)(+_), 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" ? _ : (0, _constant.default)(!!_), 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;
}
},{"d3-path":"zaWp","./constant.js":"k9An","./curve/linear.js":"QOZc","./line.js":"ddXz","./point.js":"ds32"}],"ZEQI":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(d) {
  return d;
}
},{}],"wa3i":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constant = _interopRequireDefault(require("./constant.js"));

var _descending = _interopRequireDefault(require("./descending.js"));

var _identity = _interopRequireDefault(require("./identity.js"));

var _math = require("./math.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default() {
  var value = _identity.default,
      sortValues = _descending.default,
      sort = null,
      startAngle = (0, _constant.default)(0),
      endAngle = (0, _constant.default)(_math.tau),
      padAngle = (0, _constant.default)(0);

  function pie(data) {
    var i,
        n = data.length,
        j,
        k,
        sum = 0,
        index = new Array(n),
        arcs = new Array(n),
        a0 = +startAngle.apply(this, arguments),
        da = Math.min(_math.tau, Math.max(-_math.tau, endAngle.apply(this, arguments) - a0)),
        a1,
        p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)),
        pa = p * (da < 0 ? -1 : 1),
        v;

    for (i = 0; i < n; ++i) {
      if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) {
        sum += v;
      }
    } // Optionally sort the arcs by previously-computed values or by data.


    if (sortValues != null) index.sort(function (i, j) {
      return sortValues(arcs[i], arcs[j]);
    });else if (sort != null) index.sort(function (i, j) {
      return sort(data[i], data[j]);
    }); // Compute the arcs! They are stored in the original data's order.

    for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) {
      j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {
        data: data[j],
        index: i,
        value: v,
        startAngle: a0,
        endAngle: a1,
        padAngle: p
      };
    }

    return arcs;
  }

  pie.value = function (_) {
    return arguments.length ? (value = typeof _ === "function" ? _ : (0, _constant.default)(+_), pie) : value;
  };

  pie.sortValues = function (_) {
    return arguments.length ? (sortValues = _, sort = null, pie) : sortValues;
  };

  pie.sort = function (_) {
    return arguments.length ? (sort = _, sortValues = null, pie) : sort;
  };

  pie.startAngle = function (_) {
    return arguments.length ? (startAngle = typeof _ === "function" ? _ : (0, _constant.default)(+_), pie) : startAngle;
  };

  pie.endAngle = function (_) {
    return arguments.length ? (endAngle = typeof _ === "function" ? _ : (0, _constant.default)(+_), pie) : endAngle;
  };

  pie.padAngle = function (_) {
    return arguments.length ? (padAngle = typeof _ === "function" ? _ : (0, _constant.default)(+_), pie) : padAngle;
  };

  return pie;
}
},{"./constant.js":"k9An","./descending.js":"s7oJ","./identity.js":"ZEQI","./math.js":"afGh"}],"cgqr":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = curveRadial;
exports.curveRadialLinear = void 0;

var _linear = _interopRequireDefault(require("./linear.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var curveRadialLinear = curveRadial(_linear.default);
exports.curveRadialLinear = curveRadialLinear;

function Radial(curve) {
  this._curve = curve;
}

Radial.prototype = {
  areaStart: function () {
    this._curve.areaStart();
  },
  areaEnd: function () {
    this._curve.areaEnd();
  },
  lineStart: function () {
    this._curve.lineStart();
  },
  lineEnd: function () {
    this._curve.lineEnd();
  },
  point: function (a, r) {
    this._curve.point(r * Math.sin(a), r * -Math.cos(a));
  }
};

function curveRadial(curve) {
  function radial(context) {
    return new Radial(curve(context));
  }

  radial._curve = curve;
  return radial;
}
},{"./linear.js":"QOZc"}],"xHmW":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.lineRadial = lineRadial;
exports.default = _default;

var _radial = _interopRequireWildcard(require("./curve/radial.js"));

var _line = _interopRequireDefault(require("./line.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function lineRadial(l) {
  var c = l.curve;
  l.angle = l.x, delete l.x;
  l.radius = l.y, delete l.y;

  l.curve = function (_) {
    return arguments.length ? c((0, _radial.default)(_)) : c()._curve;
  };

  return l;
}

function _default() {
  return lineRadial((0, _line.default)().curve(_radial.curveRadialLinear));
}
},{"./curve/radial.js":"cgqr","./line.js":"ddXz"}],"xDfm":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _radial = _interopRequireWildcard(require("./curve/radial.js"));

var _area = _interopRequireDefault(require("./area.js"));

var _lineRadial = require("./lineRadial.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _default() {
  var a = (0, _area.default)().curve(_radial.curveRadialLinear),
      c = a.curve,
      x0 = a.lineX0,
      x1 = a.lineX1,
      y0 = a.lineY0,
      y1 = a.lineY1;
  a.angle = a.x, delete a.x;
  a.startAngle = a.x0, delete a.x0;
  a.endAngle = a.x1, delete a.x1;
  a.radius = a.y, delete a.y;
  a.innerRadius = a.y0, delete a.y0;
  a.outerRadius = a.y1, delete a.y1;
  a.lineStartAngle = function () {
    return (0, _lineRadial.lineRadial)(x0());
  }, delete a.lineX0;
  a.lineEndAngle = function () {
    return (0, _lineRadial.lineRadial)(x1());
  }, delete a.lineX1;
  a.lineInnerRadius = function () {
    return (0, _lineRadial.lineRadial)(y0());
  }, delete a.lineY0;
  a.lineOuterRadius = function () {
    return (0, _lineRadial.lineRadial)(y1());
  }, delete a.lineY1;

  a.curve = function (_) {
    return arguments.length ? c((0, _radial.default)(_)) : c()._curve;
  };

  return a;
}
},{"./curve/radial.js":"cgqr","./area.js":"hF4o","./lineRadial.js":"xHmW"}],"lP1e":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(x, y) {
  return [(y = +y) * Math.cos(x -= Math.PI / 2), y * Math.sin(x)];
}
},{}],"aOxl":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.slice = void 0;
var slice = Array.prototype.slice;
exports.slice = slice;
},{}],"Ha4g":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.linkHorizontal = linkHorizontal;
exports.linkVertical = linkVertical;
exports.linkRadial = linkRadial;

var _d3Path = require("d3-path");

var _array = require("../array.js");

var _constant = _interopRequireDefault(require("../constant.js"));

var _point = require("../point.js");

var _pointRadial = _interopRequireDefault(require("../pointRadial.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function linkSource(d) {
  return d.source;
}

function linkTarget(d) {
  return d.target;
}

function link(curve) {
  var source = linkSource,
      target = linkTarget,
      x = _point.x,
      y = _point.y,
      context = null;

  function link() {
    var buffer,
        argv = _array.slice.call(arguments),
        s = source.apply(this, argv),
        t = target.apply(this, argv);

    if (!context) context = buffer = (0, _d3Path.path)();
    curve(context, +x.apply(this, (argv[0] = s, argv)), +y.apply(this, argv), +x.apply(this, (argv[0] = t, argv)), +y.apply(this, argv));
    if (buffer) return context = null, buffer + "" || null;
  }

  link.source = function (_) {
    return arguments.length ? (source = _, link) : source;
  };

  link.target = function (_) {
    return arguments.length ? (target = _, link) : target;
  };

  link.x = function (_) {
    return arguments.length ? (x = typeof _ === "function" ? _ : (0, _constant.default)(+_), link) : x;
  };

  link.y = function (_) {
    return arguments.length ? (y = typeof _ === "function" ? _ : (0, _constant.default)(+_), link) : y;
  };

  link.context = function (_) {
    return arguments.length ? (context = _ == null ? null : _, link) : context;
  };

  return link;
}

function curveHorizontal(context, x0, y0, x1, y1) {
  context.moveTo(x0, y0);
  context.bezierCurveTo(x0 = (x0 + x1) / 2, y0, x0, y1, x1, y1);
}

function curveVertical(context, x0, y0, x1, y1) {
  context.moveTo(x0, y0);
  context.bezierCurveTo(x0, y0 = (y0 + y1) / 2, x1, y0, x1, y1);
}

function curveRadial(context, x0, y0, x1, y1) {
  var p0 = (0, _pointRadial.default)(x0, y0),
      p1 = (0, _pointRadial.default)(x0, y0 = (y0 + y1) / 2),
      p2 = (0, _pointRadial.default)(x1, y0),
      p3 = (0, _pointRadial.default)(x1, y1);
  context.moveTo(p0[0], p0[1]);
  context.bezierCurveTo(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1]);
}

function linkHorizontal() {
  return link(curveHorizontal);
}

function linkVertical() {
  return link(curveVertical);
}

function linkRadial() {
  var l = link(curveRadial);
  l.angle = l.x, delete l.x;
  l.radius = l.y, delete l.y;
  return l;
}
},{"d3-path":"zaWp","../array.js":"aOxl","../constant.js":"k9An","../point.js":"ds32","../pointRadial.js":"lP1e"}],"M8zP":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _math = require("../math.js");

var _default = {
  draw: function (context, size) {
    var r = Math.sqrt(size / _math.pi);
    context.moveTo(r, 0);
    context.arc(0, 0, r, 0, _math.tau);
  }
};
exports.default = _default;
},{"../math.js":"afGh"}],"yk2Q":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _default = {
  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();
  }
};
exports.default = _default;
},{}],"dxeN":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var tan30 = Math.sqrt(1 / 3),
    tan30_2 = tan30 * 2;
var _default = {
  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();
  }
};
exports.default = _default;
},{}],"R9dz":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _math = require("../math.js");

var ka = 0.89081309152928522810,
    kr = Math.sin(_math.pi / 10) / Math.sin(7 * _math.pi / 10),
    kx = Math.sin(_math.tau / 10) * kr,
    ky = -Math.cos(_math.tau / 10) * kr;
var _default = {
  draw: function (context, size) {
    var r = Math.sqrt(size * ka),
        x = kx * r,
        y = ky * r;
    context.moveTo(0, -r);
    context.lineTo(x, y);

    for (var i = 1; i < 5; ++i) {
      var a = _math.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();
  }
};
exports.default = _default;
},{"../math.js":"afGh"}],"zJh7":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _default = {
  draw: function (context, size) {
    var w = Math.sqrt(size),
        x = -w / 2;
    context.rect(x, x, w, w);
  }
};
exports.default = _default;
},{}],"FFoX":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var sqrt3 = Math.sqrt(3);
var _default = {
  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();
  }
};
exports.default = _default;
},{}],"pUX9":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var c = -0.5,
    s = Math.sqrt(3) / 2,
    k = 1 / Math.sqrt(12),
    a = (k / 2 + 1) * 3;
var _default = {
  draw: function (context, size) {
    var r = Math.sqrt(size / a),
        x0 = r / 2,
        y0 = r * k,
        x1 = x0,
        y1 = r * k + r,
        x2 = -x1,
        y2 = y1;
    context.moveTo(x0, y0);
    context.lineTo(x1, y1);
    context.lineTo(x2, y2);
    context.lineTo(c * x0 - s * y0, s * x0 + c * y0);
    context.lineTo(c * x1 - s * y1, s * x1 + c * y1);
    context.lineTo(c * x2 - s * y2, s * x2 + c * y2);
    context.lineTo(c * x0 + s * y0, c * y0 - s * x0);
    context.lineTo(c * x1 + s * y1, c * y1 - s * x1);
    context.lineTo(c * x2 + s * y2, c * y2 - s * x2);
    context.closePath();
  }
};
exports.default = _default;
},{}],"JDbG":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.symbols = void 0;

var _d3Path = require("d3-path");

var _circle = _interopRequireDefault(require("./symbol/circle.js"));

var _cross = _interopRequireDefault(require("./symbol/cross.js"));

var _diamond = _interopRequireDefault(require("./symbol/diamond.js"));

var _star = _interopRequireDefault(require("./symbol/star.js"));

var _square = _interopRequireDefault(require("./symbol/square.js"));

var _triangle = _interopRequireDefault(require("./symbol/triangle.js"));

var _wye = _interopRequireDefault(require("./symbol/wye.js"));

var _constant = _interopRequireDefault(require("./constant.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var symbols = [_circle.default, _cross.default, _diamond.default, _square.default, _star.default, _triangle.default, _wye.default];
exports.symbols = symbols;

function _default() {
  var type = (0, _constant.default)(_circle.default),
      size = (0, _constant.default)(64),
      context = null;

  function symbol() {
    var buffer;
    if (!context) context = buffer = (0, _d3Path.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" ? _ : (0, _constant.default)(_), symbol) : type;
  };

  symbol.size = function (_) {
    return arguments.length ? (size = typeof _ === "function" ? _ : (0, _constant.default)(+_), symbol) : size;
  };

  symbol.context = function (_) {
    return arguments.length ? (context = _ == null ? null : _, symbol) : context;
  };

  return symbol;
}
},{"d3-path":"zaWp","./symbol/circle.js":"M8zP","./symbol/cross.js":"yk2Q","./symbol/diamond.js":"dxeN","./symbol/star.js":"R9dz","./symbol/square.js":"zJh7","./symbol/triangle.js":"FFoX","./symbol/wye.js":"pUX9","./constant.js":"k9An"}],"xgFl":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default() {}
},{}],"QeRe":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.point = point;
exports.Basis = Basis;
exports.default = _default;

function 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:
        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:
        point(this, x, y);
        break;
    }

    this._x0 = this._x1, this._x1 = x;
    this._y0 = this._y1, this._y1 = y;
  }
};

function _default(context) {
  return new Basis(context);
}
},{}],"xXOq":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _noop = _interopRequireDefault(require("../noop.js"));

var _basis = require("./basis.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function BasisClosed(context) {
  this._context = context;
}

BasisClosed.prototype = {
  areaStart: _noop.default,
  areaEnd: _noop.default,
  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:
        (0, _basis.point)(this, x, y);
        break;
    }

    this._x0 = this._x1, this._x1 = x;
    this._y0 = this._y1, this._y1 = y;
  }
};

function _default(context) {
  return new BasisClosed(context);
}
},{"../noop.js":"xgFl","./basis.js":"QeRe"}],"si4a":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _basis = require("./basis.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:
        (0, _basis.point)(this, x, y);
        break;
    }

    this._x0 = this._x1, this._x1 = x;
    this._y0 = this._y1, this._y1 = y;
  }
};

function _default(context) {
  return new BasisOpen(context);
}
},{"./basis.js":"QeRe"}],"sNVh":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _basis = require("./basis.js");

function Bundle(context, beta) {
  this._basis = new _basis.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);
  }
};

var _default = function custom(beta) {
  function bundle(context) {
    return beta === 1 ? new _basis.Basis(context) : new Bundle(context, beta);
  }

  bundle.beta = function (beta) {
    return custom(+beta);
  };

  return bundle;
}(0.85);

exports.default = _default;
},{"./basis.js":"QeRe"}],"Xn7T":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.point = point;
exports.Cardinal = Cardinal;
exports.default = void 0;

function 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:
        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:
        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;
  }
};

var _default = function custom(tension) {
  function cardinal(context) {
    return new Cardinal(context, tension);
  }

  cardinal.tension = function (tension) {
    return custom(+tension);
  };

  return cardinal;
}(0);

exports.default = _default;
},{}],"Vmco":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.CardinalClosed = CardinalClosed;
exports.default = void 0;

var _noop = _interopRequireDefault(require("../noop.js"));

var _cardinal = require("./cardinal.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function CardinalClosed(context, tension) {
  this._context = context;
  this._k = (1 - tension) / 6;
}

CardinalClosed.prototype = {
  areaStart: _noop.default,
  areaEnd: _noop.default,
  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:
        (0, _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;
  }
};

var _default = function custom(tension) {
  function cardinal(context) {
    return new CardinalClosed(context, tension);
  }

  cardinal.tension = function (tension) {
    return custom(+tension);
  };

  return cardinal;
}(0);

exports.default = _default;
},{"../noop.js":"xgFl","./cardinal.js":"Xn7T"}],"qhAo":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.CardinalOpen = CardinalOpen;
exports.default = void 0;

var _cardinal = require("./cardinal.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:
        (0, _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;
  }
};

var _default = function custom(tension) {
  function cardinal(context) {
    return new CardinalOpen(context, tension);
  }

  cardinal.tension = function (tension) {
    return custom(+tension);
  };

  return cardinal;
}(0);

exports.default = _default;
},{"./cardinal.js":"Xn7T"}],"Wuon":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.point = point;
exports.default = void 0;

var _math = require("../math.js");

var _cardinal = require("./cardinal.js");

function 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:
        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;
  }
};

var _default = function custom(alpha) {
  function catmullRom(context) {
    return alpha ? new CatmullRom(context, alpha) : new _cardinal.Cardinal(context, 0);
  }

  catmullRom.alpha = function (alpha) {
    return custom(+alpha);
  };

  return catmullRom;
}(0.5);

exports.default = _default;
},{"../math.js":"afGh","./cardinal.js":"Xn7T"}],"VAcR":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _cardinalClosed = require("./cardinalClosed.js");

var _noop = _interopRequireDefault(require("../noop.js"));

var _catmullRom = require("./catmullRom.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function CatmullRomClosed(context, alpha) {
  this._context = context;
  this._alpha = alpha;
}

CatmullRomClosed.prototype = {
  areaStart: _noop.default,
  areaEnd: _noop.default,
  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:
        (0, _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;
  }
};

var _default = function custom(alpha) {
  function catmullRom(context) {
    return alpha ? new CatmullRomClosed(context, alpha) : new _cardinalClosed.CardinalClosed(context, 0);
  }

  catmullRom.alpha = function (alpha) {
    return custom(+alpha);
  };

  return catmullRom;
}(0.5);

exports.default = _default;
},{"./cardinalClosed.js":"Vmco","../noop.js":"xgFl","./catmullRom.js":"Wuon"}],"ohVI":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _cardinalOpen = require("./cardinalOpen.js");

var _catmullRom = require("./catmullRom.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:
        (0, _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;
  }
};

var _default = function custom(alpha) {
  function catmullRom(context) {
    return alpha ? new CatmullRomOpen(context, alpha) : new _cardinalOpen.CardinalOpen(context, 0);
  }

  catmullRom.alpha = function (alpha) {
    return custom(+alpha);
  };

  return catmullRom;
}(0.5);

exports.default = _default;
},{"./cardinalOpen.js":"qhAo","./catmullRom.js":"Wuon"}],"FTCL":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _noop = _interopRequireDefault(require("../noop.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function LinearClosed(context) {
  this._context = context;
}

LinearClosed.prototype = {
  areaStart: _noop.default,
  areaEnd: _noop.default,
  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);
  }
};

function _default(context) {
  return new LinearClosed(context);
}
},{"../noop.js":"xgFl"}],"ipSN":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.monotoneX = monotoneX;
exports.monotoneY = monotoneY;

function 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 (sign(s0) + 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 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:
        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;
        point(this, slope2(this, t1 = slope3(this, x, y)), t1);
        break;

      default:
        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);
}
},{}],"u0Uc":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

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];
}

function _default(context) {
  return new Natural(context);
}
},{}],"tDZT":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.stepBefore = stepBefore;
exports.stepAfter = stepAfter;

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;
  }
};

function _default(context) {
  return new Step(context, 0.5);
}

function stepBefore(context) {
  return new Step(context, 0);
}

function stepAfter(context) {
  return new Step(context, 1);
}
},{}],"tuer":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(series, order) {
  if (!((n = series.length) > 1)) return;

  for (var i = 1, j, s0, s1 = series[order[0]], n, m = s1.length; i < n; ++i) {
    s0 = s1, s1 = series[order[i]];

    for (j = 0; j < m; ++j) {
      s1[j][1] += s1[j][0] = isNaN(s0[j][1]) ? s0[j][0] : s0[j][1];
    }
  }
}
},{}],"h5Jt":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(series) {
  var n = series.length,
      o = new Array(n);

  while (--n >= 0) o[n] = n;

  return o;
}
},{}],"RN2I":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _array = require("./array.js");

var _constant = _interopRequireDefault(require("./constant.js"));

var _none = _interopRequireDefault(require("./offset/none.js"));

var _none2 = _interopRequireDefault(require("./order/none.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function stackValue(d, key) {
  return d[key];
}

function _default() {
  var keys = (0, _constant.default)([]),
      order = _none2.default,
      offset = _none.default,
      value = stackValue;

  function stack(data) {
    var kz = keys.apply(this, arguments),
        i,
        m = data.length,
        n = kz.length,
        sz = new Array(n),
        oz;

    for (i = 0; i < n; ++i) {
      for (var ki = kz[i], si = sz[i] = new Array(m), j = 0, sij; j < m; ++j) {
        si[j] = sij = [0, +value(data[j], ki, j, data)];
        sij.data = data[j];
      }

      si.key = ki;
    }

    for (i = 0, oz = order(sz); i < n; ++i) {
      sz[oz[i]].index = i;
    }

    offset(sz, oz);
    return sz;
  }

  stack.keys = function (_) {
    return arguments.length ? (keys = typeof _ === "function" ? _ : (0, _constant.default)(_array.slice.call(_)), stack) : keys;
  };

  stack.value = function (_) {
    return arguments.length ? (value = typeof _ === "function" ? _ : (0, _constant.default)(+_), stack) : value;
  };

  stack.order = function (_) {
    return arguments.length ? (order = _ == null ? _none2.default : typeof _ === "function" ? _ : (0, _constant.default)(_array.slice.call(_)), stack) : order;
  };

  stack.offset = function (_) {
    return arguments.length ? (offset = _ == null ? _none.default : _, stack) : offset;
  };

  return stack;
}
},{"./array.js":"aOxl","./constant.js":"k9An","./offset/none.js":"tuer","./order/none.js":"h5Jt"}],"tbmP":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _none = _interopRequireDefault(require("./none.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(series, order) {
  if (!((n = series.length) > 0)) return;

  for (var i, n, j = 0, m = series[0].length, y; j < m; ++j) {
    for (y = i = 0; i < n; ++i) y += series[i][j][1] || 0;

    if (y) for (i = 0; i < n; ++i) series[i][j][1] /= y;
  }

  (0, _none.default)(series, order);
}
},{"./none.js":"tuer"}],"UlEI":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(series, order) {
  if (!((n = series.length) > 0)) return;

  for (var i, j = 0, d, dy, yp, yn, n, m = series[order[0]].length; j < m; ++j) {
    for (yp = yn = 0, i = 0; i < n; ++i) {
      if ((dy = (d = series[order[i]][j])[1] - d[0]) > 0) {
        d[0] = yp, d[1] = yp += dy;
      } else if (dy < 0) {
        d[1] = yn, d[0] = yn += dy;
      } else {
        d[0] = 0, d[1] = dy;
      }
    }
  }
}
},{}],"kvrQ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _none = _interopRequireDefault(require("./none.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(series, order) {
  if (!((n = series.length) > 0)) return;

  for (var j = 0, s0 = series[order[0]], n, m = s0.length; j < m; ++j) {
    for (var i = 0, y = 0; i < n; ++i) y += series[i][j][1] || 0;

    s0[j][1] += s0[j][0] = -y / 2;
  }

  (0, _none.default)(series, order);
}
},{"./none.js":"tuer"}],"hNk7":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _none = _interopRequireDefault(require("./none.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(series, order) {
  if (!((n = series.length) > 0) || !((m = (s0 = series[order[0]]).length) > 0)) return;

  for (var y = 0, j = 1, s0, m, n; j < m; ++j) {
    for (var i = 0, s1 = 0, s2 = 0; i < n; ++i) {
      var si = series[order[i]],
          sij0 = si[j][1] || 0,
          sij1 = si[j - 1][1] || 0,
          s3 = (sij0 - sij1) / 2;

      for (var k = 0; k < i; ++k) {
        var sk = series[order[k]],
            skj0 = sk[j][1] || 0,
            skj1 = sk[j - 1][1] || 0;
        s3 += skj0 - skj1;
      }

      s1 += sij0, s2 += s3 * sij0;
    }

    s0[j - 1][1] += s0[j - 1][0] = y;
    if (s1) y -= s2 / s1;
  }

  s0[j - 1][1] += s0[j - 1][0] = y;
  (0, _none.default)(series, order);
}
},{"./none.js":"tuer"}],"sKIT":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _none = _interopRequireDefault(require("./none.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(series) {
  var peaks = series.map(peak);
  return (0, _none.default)(series).sort(function (a, b) {
    return peaks[a] - peaks[b];
  });
}

function peak(series) {
  var i = -1,
      j = 0,
      n = series.length,
      vi,
      vj = -Infinity;

  while (++i < n) if ((vi = +series[i][1]) > vj) vj = vi, j = i;

  return j;
}
},{"./none.js":"h5Jt"}],"doTn":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.sum = sum;

var _none = _interopRequireDefault(require("./none.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(series) {
  var sums = series.map(sum);
  return (0, _none.default)(series).sort(function (a, b) {
    return sums[a] - sums[b];
  });
}

function sum(series) {
  var s = 0,
      i = -1,
      n = series.length,
      v;

  while (++i < n) if (v = +series[i][1]) s += v;

  return s;
}
},{"./none.js":"h5Jt"}],"DVmH":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _ascending = _interopRequireDefault(require("./ascending.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(series) {
  return (0, _ascending.default)(series).reverse();
}
},{"./ascending.js":"doTn"}],"NO12":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _appearance = _interopRequireDefault(require("./appearance.js"));

var _ascending = require("./ascending.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(series) {
  var n = series.length,
      i,
      j,
      sums = series.map(_ascending.sum),
      order = (0, _appearance.default)(series),
      top = 0,
      bottom = 0,
      tops = [],
      bottoms = [];

  for (i = 0; i < n; ++i) {
    j = order[i];

    if (top < bottom) {
      top += sums[j];
      tops.push(j);
    } else {
      bottom += sums[j];
      bottoms.push(j);
    }
  }

  return bottoms.reverse().concat(tops);
}
},{"./appearance.js":"sKIT","./ascending.js":"doTn"}],"Eewl":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _none = _interopRequireDefault(require("./none.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(series) {
  return (0, _none.default)(series).reverse();
}
},{"./none.js":"h5Jt"}],"TYWk":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "arc", {
  enumerable: true,
  get: function () {
    return _arc.default;
  }
});
Object.defineProperty(exports, "area", {
  enumerable: true,
  get: function () {
    return _area.default;
  }
});
Object.defineProperty(exports, "line", {
  enumerable: true,
  get: function () {
    return _line.default;
  }
});
Object.defineProperty(exports, "pie", {
  enumerable: true,
  get: function () {
    return _pie.default;
  }
});
Object.defineProperty(exports, "areaRadial", {
  enumerable: true,
  get: function () {
    return _areaRadial.default;
  }
});
Object.defineProperty(exports, "radialArea", {
  enumerable: true,
  get: function () {
    return _areaRadial.default;
  }
});
Object.defineProperty(exports, "lineRadial", {
  enumerable: true,
  get: function () {
    return _lineRadial.default;
  }
});
Object.defineProperty(exports, "radialLine", {
  enumerable: true,
  get: function () {
    return _lineRadial.default;
  }
});
Object.defineProperty(exports, "pointRadial", {
  enumerable: true,
  get: function () {
    return _pointRadial.default;
  }
});
Object.defineProperty(exports, "linkHorizontal", {
  enumerable: true,
  get: function () {
    return _index.linkHorizontal;
  }
});
Object.defineProperty(exports, "linkVertical", {
  enumerable: true,
  get: function () {
    return _index.linkVertical;
  }
});
Object.defineProperty(exports, "linkRadial", {
  enumerable: true,
  get: function () {
    return _index.linkRadial;
  }
});
Object.defineProperty(exports, "symbol", {
  enumerable: true,
  get: function () {
    return _symbol.default;
  }
});
Object.defineProperty(exports, "symbols", {
  enumerable: true,
  get: function () {
    return _symbol.symbols;
  }
});
Object.defineProperty(exports, "symbolCircle", {
  enumerable: true,
  get: function () {
    return _circle.default;
  }
});
Object.defineProperty(exports, "symbolCross", {
  enumerable: true,
  get: function () {
    return _cross.default;
  }
});
Object.defineProperty(exports, "symbolDiamond", {
  enumerable: true,
  get: function () {
    return _diamond.default;
  }
});
Object.defineProperty(exports, "symbolSquare", {
  enumerable: true,
  get: function () {
    return _square.default;
  }
});
Object.defineProperty(exports, "symbolStar", {
  enumerable: true,
  get: function () {
    return _star.default;
  }
});
Object.defineProperty(exports, "symbolTriangle", {
  enumerable: true,
  get: function () {
    return _triangle.default;
  }
});
Object.defineProperty(exports, "symbolWye", {
  enumerable: true,
  get: function () {
    return _wye.default;
  }
});
Object.defineProperty(exports, "curveBasisClosed", {
  enumerable: true,
  get: function () {
    return _basisClosed.default;
  }
});
Object.defineProperty(exports, "curveBasisOpen", {
  enumerable: true,
  get: function () {
    return _basisOpen.default;
  }
});
Object.defineProperty(exports, "curveBasis", {
  enumerable: true,
  get: function () {
    return _basis.default;
  }
});
Object.defineProperty(exports, "curveBundle", {
  enumerable: true,
  get: function () {
    return _bundle.default;
  }
});
Object.defineProperty(exports, "curveCardinalClosed", {
  enumerable: true,
  get: function () {
    return _cardinalClosed.default;
  }
});
Object.defineProperty(exports, "curveCardinalOpen", {
  enumerable: true,
  get: function () {
    return _cardinalOpen.default;
  }
});
Object.defineProperty(exports, "curveCardinal", {
  enumerable: true,
  get: function () {
    return _cardinal.default;
  }
});
Object.defineProperty(exports, "curveCatmullRomClosed", {
  enumerable: true,
  get: function () {
    return _catmullRomClosed.default;
  }
});
Object.defineProperty(exports, "curveCatmullRomOpen", {
  enumerable: true,
  get: function () {
    return _catmullRomOpen.default;
  }
});
Object.defineProperty(exports, "curveCatmullRom", {
  enumerable: true,
  get: function () {
    return _catmullRom.default;
  }
});
Object.defineProperty(exports, "curveLinearClosed", {
  enumerable: true,
  get: function () {
    return _linearClosed.default;
  }
});
Object.defineProperty(exports, "curveLinear", {
  enumerable: true,
  get: function () {
    return _linear.default;
  }
});
Object.defineProperty(exports, "curveMonotoneX", {
  enumerable: true,
  get: function () {
    return _monotone.monotoneX;
  }
});
Object.defineProperty(exports, "curveMonotoneY", {
  enumerable: true,
  get: function () {
    return _monotone.monotoneY;
  }
});
Object.defineProperty(exports, "curveNatural", {
  enumerable: true,
  get: function () {
    return _natural.default;
  }
});
Object.defineProperty(exports, "curveStep", {
  enumerable: true,
  get: function () {
    return _step.default;
  }
});
Object.defineProperty(exports, "curveStepAfter", {
  enumerable: true,
  get: function () {
    return _step.stepAfter;
  }
});
Object.defineProperty(exports, "curveStepBefore", {
  enumerable: true,
  get: function () {
    return _step.stepBefore;
  }
});
Object.defineProperty(exports, "stack", {
  enumerable: true,
  get: function () {
    return _stack.default;
  }
});
Object.defineProperty(exports, "stackOffsetExpand", {
  enumerable: true,
  get: function () {
    return _expand.default;
  }
});
Object.defineProperty(exports, "stackOffsetDiverging", {
  enumerable: true,
  get: function () {
    return _diverging.default;
  }
});
Object.defineProperty(exports, "stackOffsetNone", {
  enumerable: true,
  get: function () {
    return _none.default;
  }
});
Object.defineProperty(exports, "stackOffsetSilhouette", {
  enumerable: true,
  get: function () {
    return _silhouette.default;
  }
});
Object.defineProperty(exports, "stackOffsetWiggle", {
  enumerable: true,
  get: function () {
    return _wiggle.default;
  }
});
Object.defineProperty(exports, "stackOrderAppearance", {
  enumerable: true,
  get: function () {
    return _appearance.default;
  }
});
Object.defineProperty(exports, "stackOrderAscending", {
  enumerable: true,
  get: function () {
    return _ascending.default;
  }
});
Object.defineProperty(exports, "stackOrderDescending", {
  enumerable: true,
  get: function () {
    return _descending.default;
  }
});
Object.defineProperty(exports, "stackOrderInsideOut", {
  enumerable: true,
  get: function () {
    return _insideOut.default;
  }
});
Object.defineProperty(exports, "stackOrderNone", {
  enumerable: true,
  get: function () {
    return _none2.default;
  }
});
Object.defineProperty(exports, "stackOrderReverse", {
  enumerable: true,
  get: function () {
    return _reverse.default;
  }
});

var _arc = _interopRequireDefault(require("./arc.js"));

var _area = _interopRequireDefault(require("./area.js"));

var _line = _interopRequireDefault(require("./line.js"));

var _pie = _interopRequireDefault(require("./pie.js"));

var _areaRadial = _interopRequireDefault(require("./areaRadial.js"));

var _lineRadial = _interopRequireDefault(require("./lineRadial.js"));

var _pointRadial = _interopRequireDefault(require("./pointRadial.js"));

var _index = require("./link/index.js");

var _symbol = _interopRequireWildcard(require("./symbol.js"));

var _circle = _interopRequireDefault(require("./symbol/circle.js"));

var _cross = _interopRequireDefault(require("./symbol/cross.js"));

var _diamond = _interopRequireDefault(require("./symbol/diamond.js"));

var _square = _interopRequireDefault(require("./symbol/square.js"));

var _star = _interopRequireDefault(require("./symbol/star.js"));

var _triangle = _interopRequireDefault(require("./symbol/triangle.js"));

var _wye = _interopRequireDefault(require("./symbol/wye.js"));

var _basisClosed = _interopRequireDefault(require("./curve/basisClosed.js"));

var _basisOpen = _interopRequireDefault(require("./curve/basisOpen.js"));

var _basis = _interopRequireDefault(require("./curve/basis.js"));

var _bundle = _interopRequireDefault(require("./curve/bundle.js"));

var _cardinalClosed = _interopRequireDefault(require("./curve/cardinalClosed.js"));

var _cardinalOpen = _interopRequireDefault(require("./curve/cardinalOpen.js"));

var _cardinal = _interopRequireDefault(require("./curve/cardinal.js"));

var _catmullRomClosed = _interopRequireDefault(require("./curve/catmullRomClosed.js"));

var _catmullRomOpen = _interopRequireDefault(require("./curve/catmullRomOpen.js"));

var _catmullRom = _interopRequireDefault(require("./curve/catmullRom.js"));

var _linearClosed = _interopRequireDefault(require("./curve/linearClosed.js"));

var _linear = _interopRequireDefault(require("./curve/linear.js"));

var _monotone = require("./curve/monotone.js");

var _natural = _interopRequireDefault(require("./curve/natural.js"));

var _step = _interopRequireWildcard(require("./curve/step.js"));

var _stack = _interopRequireDefault(require("./stack.js"));

var _expand = _interopRequireDefault(require("./offset/expand.js"));

var _diverging = _interopRequireDefault(require("./offset/diverging.js"));

var _none = _interopRequireDefault(require("./offset/none.js"));

var _silhouette = _interopRequireDefault(require("./offset/silhouette.js"));

var _wiggle = _interopRequireDefault(require("./offset/wiggle.js"));

var _appearance = _interopRequireDefault(require("./order/appearance.js"));

var _ascending = _interopRequireDefault(require("./order/ascending.js"));

var _descending = _interopRequireDefault(require("./order/descending.js"));

var _insideOut = _interopRequireDefault(require("./order/insideOut.js"));

var _none2 = _interopRequireDefault(require("./order/none.js"));

var _reverse = _interopRequireDefault(require("./order/reverse.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./arc.js":"KUIA","./area.js":"hF4o","./line.js":"ddXz","./pie.js":"wa3i","./areaRadial.js":"xDfm","./lineRadial.js":"xHmW","./pointRadial.js":"lP1e","./link/index.js":"Ha4g","./symbol.js":"JDbG","./symbol/circle.js":"M8zP","./symbol/cross.js":"yk2Q","./symbol/diamond.js":"dxeN","./symbol/square.js":"zJh7","./symbol/star.js":"R9dz","./symbol/triangle.js":"FFoX","./symbol/wye.js":"pUX9","./curve/basisClosed.js":"xXOq","./curve/basisOpen.js":"si4a","./curve/basis.js":"QeRe","./curve/bundle.js":"sNVh","./curve/cardinalClosed.js":"Vmco","./curve/cardinalOpen.js":"qhAo","./curve/cardinal.js":"Xn7T","./curve/catmullRomClosed.js":"VAcR","./curve/catmullRomOpen.js":"ohVI","./curve/catmullRom.js":"Wuon","./curve/linearClosed.js":"FTCL","./curve/linear.js":"QOZc","./curve/monotone.js":"ipSN","./curve/natural.js":"u0Uc","./curve/step.js":"tDZT","./stack.js":"RN2I","./offset/expand.js":"tbmP","./offset/diverging.js":"UlEI","./offset/none.js":"tuer","./offset/silhouette.js":"kvrQ","./offset/wiggle.js":"hNk7","./order/appearance.js":"sKIT","./order/ascending.js":"doTn","./order/descending.js":"DVmH","./order/insideOut.js":"NO12","./order/none.js":"h5Jt","./order/reverse.js":"Eewl"}],"zdzo":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = curves;

var _vegaUtil = require("vega-util");

var _d3Shape = require("d3-shape");

var lookup = {
  'basis': {
    curve: _d3Shape.curveBasis
  },
  'basis-closed': {
    curve: _d3Shape.curveBasisClosed
  },
  'basis-open': {
    curve: _d3Shape.curveBasisOpen
  },
  'bundle': {
    curve: _d3Shape.curveBundle,
    tension: 'beta',
    value: 0.85
  },
  'cardinal': {
    curve: _d3Shape.curveCardinal,
    tension: 'tension',
    value: 0
  },
  'cardinal-open': {
    curve: _d3Shape.curveCardinalOpen,
    tension: 'tension',
    value: 0
  },
  'cardinal-closed': {
    curve: _d3Shape.curveCardinalClosed,
    tension: 'tension',
    value: 0
  },
  'catmull-rom': {
    curve: _d3Shape.curveCatmullRom,
    tension: 'alpha',
    value: 0.5
  },
  'catmull-rom-closed': {
    curve: _d3Shape.curveCatmullRomClosed,
    tension: 'alpha',
    value: 0.5
  },
  'catmull-rom-open': {
    curve: _d3Shape.curveCatmullRomOpen,
    tension: 'alpha',
    value: 0.5
  },
  'linear': {
    curve: _d3Shape.curveLinear
  },
  'linear-closed': {
    curve: _d3Shape.curveLinearClosed
  },
  'monotone': {
    horizontal: _d3Shape.curveMonotoneY,
    vertical: _d3Shape.curveMonotoneX
  },
  'natural': {
    curve: _d3Shape.curveNatural
  },
  'step': {
    curve: _d3Shape.curveStep
  },
  'step-after': {
    curve: _d3Shape.curveStepAfter
  },
  'step-before': {
    curve: _d3Shape.curveStepBefore
  }
};

function curves(type, orientation, tension) {
  var entry = (0, _vegaUtil.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;
}
},{"vega-util":"dejJ","d3-shape":"TYWk"}],"sx1S":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
// Path parsing and rendering code adapted from fabric.js -- Thanks!
var cmdlen = {
  m: 2,
  l: 2,
  h: 1,
  v: 1,
  c: 6,
  s: 4,
  q: 4,
  t: 2,
  a: 7
},
    regexp = [/([MLHVCSQTAZmlhvcsqtaz])/g, /###/, /(\d)([-+])/g, /\s|,|###/];

function _default(pathstr) {
  var result = [],
      path,
      curr,
      chunks,
      parsed,
      param,
      cmd,
      len,
      i,
      j,
      n,
      m; // First, break path into command sequence

  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').split(regexp[3]);
    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) {
      for (j = 1, m = parsed.length; j < m; j += len) {
        result.push([cmd].concat(parsed.slice(j, j + len)));
      }
    } else {
      result.push(parsed);
    }
  }

  return result;
}
},{}],"s6lu":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.HalfSqrt3 = exports.Tau = exports.HalfPi = exports.DegToRad = void 0;
var DegToRad = Math.PI / 180;
exports.DegToRad = DegToRad;
var HalfPi = Math.PI / 2;
exports.HalfPi = HalfPi;
var Tau = Math.PI * 2;
exports.Tau = Tau;
var HalfSqrt3 = Math.sqrt(3) / 2;
exports.HalfSqrt3 = HalfSqrt3;
},{}],"bOWd":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.segments = segments;
exports.bezier = bezier;
exports.bezierCache = exports.segmentCache = void 0;

var _constants = require("../util/constants");

var segmentCache = {};
exports.segmentCache = segmentCache;
var bezierCache = {};
exports.bezierCache = bezierCache;
var join = [].join; // Copied from Inkscape svgtopdf, thanks!

function segments(x, y, rx, ry, large, sweep, rotateX, ox, oy) {
  var key = join.call(arguments);

  if (segmentCache[key]) {
    return segmentCache[key];
  }

  var th = rotateX * _constants.DegToRad;
  var sin_th = Math.sin(th);
  var cos_th = Math.cos(th);
  rx = Math.abs(rx);
  ry = Math.abs(ry);
  var px = cos_th * (ox - x) * 0.5 + sin_th * (oy - y) * 0.5;
  var py = cos_th * (oy - y) * 0.5 - sin_th * (ox - x) * 0.5;
  var pl = px * px / (rx * rx) + py * py / (ry * ry);

  if (pl > 1) {
    pl = Math.sqrt(pl);
    rx *= pl;
    ry *= pl;
  }

  var a00 = cos_th / rx;
  var a01 = sin_th / rx;
  var a10 = -sin_th / ry;
  var a11 = cos_th / ry;
  var x0 = a00 * ox + a01 * oy;
  var y0 = a10 * ox + a11 * oy;
  var x1 = a00 * x + a01 * y;
  var y1 = a10 * x + a11 * y;
  var d = (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0);
  var sfactor_sq = 1 / d - 0.25;
  if (sfactor_sq < 0) sfactor_sq = 0;
  var sfactor = Math.sqrt(sfactor_sq);
  if (sweep == large) sfactor = -sfactor;
  var xc = 0.5 * (x0 + x1) - sfactor * (y1 - y0);
  var yc = 0.5 * (y0 + y1) + sfactor * (x1 - x0);
  var th0 = Math.atan2(y0 - yc, x0 - xc);
  var th1 = Math.atan2(y1 - yc, x1 - xc);
  var th_arc = th1 - th0;

  if (th_arc < 0 && sweep === 1) {
    th_arc += _constants.Tau;
  } else if (th_arc > 0 && sweep === 0) {
    th_arc -= _constants.Tau;
  }

  var segs = Math.ceil(Math.abs(th_arc / (_constants.HalfPi + 0.001)));
  var result = [];

  for (var i = 0; i < segs; ++i) {
    var th2 = th0 + i * th_arc / segs;
    var 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) {
  var 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];
  var a00 = cos_th * rx;
  var a01 = -sin_th * ry;
  var a10 = sin_th * rx;
  var a11 = cos_th * ry;
  var cos_th0 = Math.cos(th0);
  var sin_th0 = Math.sin(th0);
  var cos_th1 = Math.cos(th1);
  var sin_th1 = Math.sin(th1);
  var th_half = 0.5 * (th1 - th0);
  var sin_th_h2 = Math.sin(th_half * 0.5);
  var t = 8 / 3 * sin_th_h2 * sin_th_h2 / Math.sin(th_half);
  var x1 = cx + cos_th0 - t * sin_th0;
  var y1 = cy + sin_th0 + t * cos_th0;
  var x3 = cx + cos_th1;
  var y3 = cy + sin_th1;
  var x2 = x3 + t * sin_th1;
  var 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];
}
},{"../util/constants":"s6lu"}],"AiV4":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _arc = require("./arc");

var temp = ['l', 0, 0, 0, 0, 0, 0, 0];

function scale(current, sX, sY) {
  var c = temp[0] = current[0];

  if (c === 'a' || c === 'A') {
    temp[1] = sX * current[1];
    temp[2] = sY * current[2];
    temp[3] = current[3];
    temp[4] = current[4];
    temp[5] = current[5];
    temp[6] = sX * current[6];
    temp[7] = sY * current[7];
  } else if (c === 'h' || c === 'H') {
    temp[1] = sX * current[1];
  } else if (c === 'v' || c === 'V') {
    temp[1] = sY * current[1];
  } else {
    for (var i = 1, n = current.length; i < n; ++i) {
      temp[i] = (i % 2 == 1 ? sX : sY) * current[i];
    }
  }

  return temp;
}

function _default(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 = scale(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) {
  var seg = (0, _arc.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 (var i = 0; i < seg.length; ++i) {
    var bez = (0, _arc.bezier)(seg[i]);
    context.bezierCurveTo(bez[0], bez[1], bez[2], bez[3], bez[4], bez[5]);
  }
}
},{"./arc":"bOWd"}],"HfTC":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = symbols;

var _parse = _interopRequireDefault(require("./parse"));

var _render = _interopRequireDefault(require("./render"));

var _constants = require("../util/constants");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Tan30 = 0.5773502691896257;
var builtins = {
  'circle': {
    draw: function (context, size) {
      var r = Math.sqrt(size) / 2;
      context.moveTo(r, 0);
      context.arc(0, 0, r, 0, _constants.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) {
      var 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 = _constants.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 = _constants.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 = _constants.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 = _constants.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 = _constants.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 = _constants.HalfSqrt3 * r;
      context.moveTo(-h, 0);
      context.lineTo(h, -r);
      context.lineTo(h, r);
      context.closePath();
    }
  },
  'stroke': {
    draw: function (context, size) {
      var r = Math.sqrt(size) / 2;
      context.moveTo(-r, 0);
      context.lineTo(r, 0);
    }
  }
};

function symbols(_) {
  return (0, _vegaUtil.hasOwnProperty)(builtins, _) ? builtins[_] : customSymbol(_);
}

var custom = {};

function customSymbol(path) {
  if (!(0, _vegaUtil.hasOwnProperty)(custom, path)) {
    var parsed = (0, _parse.default)(path);
    custom[path] = {
      draw: function (context, size) {
        (0, _render.default)(context, parsed, 0, 0, Math.sqrt(size) / 2);
      }
    };
  }

  return custom[path];
}
},{"./parse":"sx1S","./render":"AiV4","../util/constants":"s6lu","vega-util":"dejJ"}],"sfl0":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _d3Path = require("d3-path");

// See http://spencermortensen.com/articles/bezier-circle/
const 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 number(_) {
  return typeof _ === 'function' ? _ : () => +_;
}

function clamp(value, min, max) {
  return Math.max(min, Math.min(value, max));
}

function _default() {
  var x = rectangleX,
      y = rectangleY,
      width = rectangleWidth,
      height = rectangleHeight,
      crTL = 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 = clamp(+crTL.call(this, _), 0, s),
        tr = clamp(+crTR.call(this, _), 0, s),
        bl = clamp(+crBL.call(this, _), 0, s),
        br = clamp(+crBR.call(this, _), 0, s);
    if (!context) context = buffer = (0, _d3Path.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 - C * tr, y1, x2, y1 + C * tr, x2, y1 + tr);
      context.lineTo(x2, y2 - br);
      context.bezierCurveTo(x2, y2 - C * br, x2 - C * br, y2, x2 - br, y2);
      context.lineTo(x1 + bl, y2);
      context.bezierCurveTo(x1 + C * bl, y2, x1, y2 - C * bl, x1, y2 - bl);
      context.lineTo(x1, y1 + tl);
      context.bezierCurveTo(x1, y1 + C * tl, x1 + C * tl, y1, x1 + tl, y1);
      context.closePath();
    }

    if (buffer) {
      context = null;
      return buffer + '' || null;
    }
  }

  rectangle.x = function (_) {
    if (arguments.length) {
      x = number(_);
      return rectangle;
    } else {
      return x;
    }
  };

  rectangle.y = function (_) {
    if (arguments.length) {
      y = number(_);
      return rectangle;
    } else {
      return y;
    }
  };

  rectangle.width = function (_) {
    if (arguments.length) {
      width = number(_);
      return rectangle;
    } else {
      return width;
    }
  };

  rectangle.height = function (_) {
    if (arguments.length) {
      height = number(_);
      return rectangle;
    } else {
      return height;
    }
  };

  rectangle.cornerRadius = function (tl, tr, br, bl) {
    if (arguments.length) {
      crTL = number(tl);
      crTR = tr != null ? number(tr) : crTL;
      crBR = br != null ? number(br) : crTL;
      crBL = bl != null ? number(bl) : crTR;
      return rectangle;
    } else {
      return crTL;
    }
  };

  rectangle.context = function (_) {
    if (arguments.length) {
      context = _ == null ? null : _;
      return rectangle;
    } else {
      return context;
    }
  };

  return rectangle;
}
},{"d3-path":"zaWp"}],"yEsc":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constants = require("../util/constants");

var _d3Path = require("d3-path");

function _default() {
  var x,
      y,
      size,
      defined,
      context = null,
      ready,
      x1,
      y1,
      r1;

  function point(x2, y2, w2) {
    var 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, _constants.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 = (0, _d3Path.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;
}
},{"../util/constants":"s6lu","d3-path":"zaWp"}],"Nd5p":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.hasCornerRadius = hasCornerRadius;
exports.arc = arc;
exports.area = area;
exports.line = line;
exports.rectangle = rectangle;
exports.shape = shape;
exports.symbol = symbol;
exports.trail = trail;

var _curves = _interopRequireDefault(require("./curves"));

var _symbols = _interopRequireDefault(require("./symbols"));

var _rectangle = _interopRequireDefault(require("./rectangle"));

var _trail = _interopRequireDefault(require("./trail"));

var _d3Shape = require("d3-shape");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function value(a, b) {
  return a != null ? a : b;
}

const x = item => item.x || 0,
      y = item => item.y || 0,
      w = item => item.width || 0,
      h = item => item.height || 0,
      xw = item => (item.x || 0) + (item.width || 0),
      yh = item => (item.y || 0) + (item.height || 0),
      sa = item => item.startAngle || 0,
      ea = item => item.endAngle || 0,
      pa = item => item.padAngle || 0,
      ir = item => item.innerRadius || 0,
      or = item => item.outerRadius || 0,
      cr = item => item.cornerRadius || 0,
      tl = item => value(item.cornerRadiusTopLeft, item.cornerRadius) || 0,
      tr = item => value(item.cornerRadiusTopRight, item.cornerRadius) || 0,
      br = item => value(item.cornerRadiusBottomRight, item.cornerRadius) || 0,
      bl = item => value(item.cornerRadiusBottomLeft, item.cornerRadius) || 0,
      sz = item => value(item.size, 64),
      ts = item => item.size || 1,
      def = item => !(item.defined === false),
      type = item => (0, _symbols.default)(item.shape || 'circle');

const arcShape = (0, _d3Shape.arc)().startAngle(sa).endAngle(ea).padAngle(pa).innerRadius(ir).outerRadius(or).cornerRadius(cr),
      areavShape = (0, _d3Shape.area)().x(x).y1(y).y0(yh).defined(def),
      areahShape = (0, _d3Shape.area)().y(y).x1(x).x0(xw).defined(def),
      lineShape = (0, _d3Shape.line)().x(x).y(y).defined(def),
      rectShape = (0, _rectangle.default)().x(x).y(y).width(w).height(h).cornerRadius(tl, tr, br, bl),
      symbolShape = (0, _d3Shape.symbol)().type(type).size(sz),
      trailShape = (0, _trail.default)().x(x).y(y).defined(def).size(ts);

function hasCornerRadius(item) {
  return item.cornerRadius || item.cornerRadiusTopLeft || item.cornerRadiusTopRight || item.cornerRadiusBottomRight || item.cornerRadiusBottomLeft;
}

function arc(context, item) {
  return arcShape.context(context)(item);
}

function area(context, items) {
  var item = items[0],
      interp = item.interpolate || 'linear';
  return (item.orient === 'horizontal' ? areahShape : areavShape).curve((0, _curves.default)(interp, item.orient, item.tension)).context(context)(items);
}

function line(context, items) {
  var item = items[0],
      interp = item.interpolate || 'linear';
  return lineShape.curve((0, _curves.default)(interp, item.orient, item.tension)).context(context)(items);
}

function rectangle(context, item, x, y) {
  return rectShape.context(context)(item, x, y);
}

function shape(context, item) {
  return (item.mark.shape || item.shape).context(context)(item);
}

function symbol(context, item) {
  return symbolShape.context(context)(item);
}

function trail(context, items) {
  return trailShape.context(context)(items);
}
},{"./curves":"zdzo","./symbols":"HfTC","./rectangle":"sfl0","./trail":"yEsc","d3-shape":"TYWk"}],"XdKX":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(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;
}
},{}],"aOFJ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = context;

var _constants = require("../util/constants");

var bounds,
    circleThreshold = _constants.Tau - 1e-8;

function context(_) {
  bounds = _;
  return context;
}

function noop() {}

function add(x, y) {
  bounds.add(x, y);
}

context.beginPath = noop;
context.closePath = noop;
context.moveTo = add;
context.lineTo = add;

context.rect = function (x, y, w, h) {
  add(x, y);
  add(x + w, y + h);
};

context.quadraticCurveTo = function (x1, y1, x2, y2) {
  add(x1, y1);
  add(x2, y2);
};

context.bezierCurveTo = function (x1, y1, x2, y2, x3, y3) {
  add(x1, y1);
  add(x2, y2);
  add(x3, y3);
};

context.arc = function (cx, cy, r, sa, ea, ccw) {
  if (Math.abs(ea - sa) > circleThreshold) {
    add(cx - r, cy - r);
    add(cx + r, cy + r);
    return;
  }

  var xmin = Infinity,
      xmax = -Infinity,
      ymin = Infinity,
      ymax = -Infinity,
      s,
      i,
      x,
      y;

  function update(a) {
    x = r * Math.cos(a);
    y = r * Math.sin(a);
    if (x < xmin) xmin = x;
    if (x > xmax) xmax = x;
    if (y < ymin) ymin = y;
    if (y > ymax) ymax = y;
  } // Sample end points and interior points aligned with 90 degrees


  update(sa);
  update(ea);

  if (ea !== sa) {
    sa = sa % _constants.Tau;
    if (sa < 0) sa += _constants.Tau;
    ea = ea % _constants.Tau;
    if (ea < 0) ea += _constants.Tau;

    if (ea < sa) {
      ccw = !ccw; // flip direction

      s = sa;
      sa = ea;
      ea = s; // swap end-points
    }

    if (ccw) {
      ea -= _constants.Tau;
      s = sa - sa % _constants.HalfPi;

      for (i = 0; i < 4 && s > ea; ++i, s -= _constants.HalfPi) update(s);
    } else {
      s = sa - sa % _constants.HalfPi + _constants.HalfPi;

      for (i = 0; i < 4 && s < ea; ++i, s = s + _constants.HalfPi) update(s);
    }
  }

  add(cx + xmin, cy + ymin);
  add(cx + xmax, cy + ymax);
};
},{"../util/constants":"s6lu"}],"nHtR":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.context = void 0;

var _vegaCanvas = require("vega-canvas");

var context = (exports.context = context = (0, _vegaCanvas.canvas)(1, 1)) ? context.getContext('2d') : null;
exports.context = context;
},{"vega-canvas":"ZLEK"}],"ALsM":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.intersectPath = intersectPath;
exports.intersectPoint = intersectPoint;
exports.intersectRect = intersectRect;
exports.intersectRule = intersectRule;
exports.intersectBoxLine = intersectBoxLine;

var _context = require("./canvas/context");

var _Bounds = _interopRequireDefault(require("../Bounds"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

const b = new _Bounds.default();

function intersectPath(draw) {
  return function (item, brush) {
    // rely on (inaccurate) bounds intersection if no context
    if (!_context.context) return true; // add path to offscreen graphics context

    draw(_context.context, item); // get bounds intersection region

    b.clear().union(item.bounds).intersect(brush).round();
    const {
      x1,
      y1,
      x2,
      y2
    } = 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 (_context.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(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;
}
},{"./canvas/context":"nHtR","../Bounds":"pVXN"}],"Gbmq":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(context, gradient, bounds) {
  const w = bounds.width(),
        h = bounds.height(),
        stop = gradient.stops,
        n = stop.length;
  const canvasGradient = gradient.gradient === 'radial' ? context.createRadialGradient(bounds.x1 + v(gradient.x1, 0.5) * w, bounds.y1 + v(gradient.y1, 0.5) * h, Math.max(w, h) * v(gradient.r1, 0), bounds.x1 + v(gradient.x2, 0.5) * w, bounds.y1 + v(gradient.y2, 0.5) * h, Math.max(w, h) * v(gradient.r2, 0.5)) : context.createLinearGradient(bounds.x1 + v(gradient.x1, 0) * w, bounds.y1 + v(gradient.y1, 0) * h, bounds.x1 + v(gradient.x2, 1) * w, bounds.y1 + v(gradient.y2, 0) * h);

  for (let i = 0; i < n; ++i) {
    canvasGradient.addColorStop(stop[i].offset, stop[i].color);
  }

  return canvasGradient;
}

function v(value, dflt) {
  return value == null ? dflt : value;
}
},{}],"QlS4":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _Gradient = require("../../Gradient");

var _gradient = _interopRequireDefault(require("./gradient"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(context, item, value) {
  return (0, _Gradient.isGradient)(value) ? (0, _gradient.default)(context, value, item.bounds) : value;
}
},{"../../Gradient":"wQA6","./gradient":"Gbmq"}],"iY9z":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _color = _interopRequireDefault(require("./color"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(context, item, opacity) {
  opacity *= item.fillOpacity == null ? 1 : item.fillOpacity;

  if (opacity > 0) {
    context.globalAlpha = opacity;
    context.fillStyle = (0, _color.default)(context, item, item.fill);
    return true;
  } else {
    return false;
  }
}
},{"./color":"QlS4"}],"dVnR":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _color = _interopRequireDefault(require("./color"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Empty = [];

function _default(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 = (0, _color.default)(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 || Empty);
      context.lineDashOffset = item.strokeDashOffset || 0;
    }

    return true;
  } else {
    return false;
  }
}
},{"./color":"QlS4"}],"yR2m":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.zorder = zorder;
exports.visit = visit;
exports.pickVisit = pickVisit;

function 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(compare);
}

function visit(scene, visitor) {
  var items = scene.items,
      i,
      n;
  if (!items || !items.length) return;
  var 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;
  var 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;
}
},{}],"iPOY":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.drawAll = drawAll;
exports.drawOne = drawOne;

var _fill = _interopRequireDefault(require("./fill"));

var _stroke = _interopRequireDefault(require("./stroke"));

var _visit = require("../visit");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function drawAll(path) {
  return function (context, scene, bounds) {
    (0, _visit.visit)(scene, function (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;

  if (item.fill && (0, _fill.default)(context, item, opacity)) {
    context.fill();
  }

  if (item.stroke && (0, _stroke.default)(context, item, opacity)) {
    context.stroke();
  }
}
},{"./fill":"iY9z","./stroke":"dVnR","../visit":"yR2m"}],"xcN6":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.pick = pick;
exports.hitPath = hitPath;
exports.pickPath = pickPath;

var _visit = require("../visit");

var _vegaUtil = require("vega-util");

function pick(test) {
  test = test || _vegaUtil.truthy;
  return function (context, scene, x, y, gx, gy) {
    x *= context.pixelRatio;
    y *= context.pixelRatio;
    return (0, _visit.pickVisit)(scene, function (item) {
      var 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(hitPath(path));
}
},{"../visit":"yR2m","vega-util":"dejJ"}],"qMs6":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.translate = translate;
exports.rotate = rotate;
exports.scale = scale;
exports.translateItem = translateItem;
exports.transformItem = transformItem;

function translate(x, y) {
  return 'translate(' + x + ',' + y + ')';
}

function rotate(a) {
  return 'rotate(' + a + ')';
}

function scale(scaleX, scaleY) {
  return 'scale(' + scaleX + ',' + scaleY + ')';
}

function translateItem(item) {
  return translate(item.x || 0, item.y || 0);
}

function transformItem(item) {
  return translate(item.x || 0, item.y || 0) + (item.angle ? ' ' + rotate(item.angle) : '') + (item.scaleX || item.scaleY ? ' ' + scale(item.scaleX || 1, item.scaleY || 1) : '');
}
},{}],"Qasw":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _boundStroke = _interopRequireDefault(require("../bound/boundStroke"));

var _boundContext = _interopRequireDefault(require("../bound/boundContext"));

var _intersect = require("../util/intersect");

var _draw = require("../util/canvas/draw");

var _pick = require("../util/canvas/pick");

var _transform = require("../util/svg/transform");

var _constants = require("../util/constants");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(type, shape, isect) {
  function attr(emit, item) {
    emit('transform', (0, _transform.transformItem)(item));
    emit('d', shape(null, item));
  }

  function bound(bounds, item) {
    var x = item.x || 0,
        y = item.y || 0;
    shape((0, _boundContext.default)(bounds), item);
    (0, _boundStroke.default)(bounds, item).translate(x, y);

    if (item.angle) {
      bounds.rotate(item.angle * _constants.DegToRad, x, y);
    }

    return bounds;
  }

  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 *= _constants.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: (0, _draw.drawAll)(draw),
    pick: (0, _pick.pickPath)(draw),
    isect: isect || (0, _intersect.intersectPath)(draw)
  };
}
},{"../bound/boundStroke":"XdKX","../bound/boundContext":"aOFJ","../util/intersect":"ALsM","../util/canvas/draw":"iPOY","../util/canvas/pick":"xcN6","../util/svg/transform":"qMs6","../util/constants":"s6lu"}],"gYRV":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _shapes = require("../path/shapes");

var _markItemPath = _interopRequireDefault(require("./markItemPath"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _default = (0, _markItemPath.default)('arc', _shapes.arc);

exports.default = _default;
},{"../path/shapes":"Nd5p","./markItemPath":"Qasw"}],"ON4t":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.pickArea = pickArea;
exports.pickLine = pickLine;
exports.pickTrail = pickTrail;

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;
}
},{}],"KTXl":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _boundStroke = _interopRequireDefault(require("../bound/boundStroke"));

var _boundContext = _interopRequireDefault(require("../bound/boundContext"));

var _intersect = require("../util/intersect");

var _draw = require("../util/canvas/draw");

var _pick = require("../util/canvas/pick");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(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((0, _boundContext.default)(bounds), items);
      return (0, _boundStroke.default)(bounds, items[0]);
    }
  }

  function draw(context, items) {
    context.beginPath();
    shape(context, items);
  }

  var hit = (0, _pick.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: (0, _draw.drawOne)(draw),
    pick: pick,
    isect: _intersect.intersectPoint,
    tip: tip
  };
}
},{"../bound/boundStroke":"XdKX","../bound/boundContext":"aOFJ","../util/intersect":"ALsM","../util/canvas/draw":"iPOY","../util/canvas/pick":"xcN6"}],"PtQk":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _shapes = require("../path/shapes");

var _pickPath = require("../util/pickPath");

var _markMultiItemPath = _interopRequireDefault(require("./markMultiItemPath"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _default = (0, _markMultiItemPath.default)('area', _shapes.area, _pickPath.pickArea);

exports.default = _default;
},{"../path/shapes":"Nd5p","../util/pickPath":"ON4t","./markMultiItemPath":"KTXl"}],"tXYO":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.clipGroup = clipGroup;

var _shapes = require("../../path/shapes");

var _vegaUtil = require("vega-util");

function _default(context, scene) {
  var clip = scene.clip;
  context.save();

  if ((0, _vegaUtil.isFunction)(clip)) {
    context.beginPath();
    clip(context);
    context.clip();
  } else {
    clipGroup(context, scene.group);
  }
}

function clipGroup(context, group) {
  context.beginPath();
  (0, _shapes.hasCornerRadius)(group) ? (0, _shapes.rectangle)(context, group, 0, 0) : context.rect(0, 0, group.width || 0, group.height || 0);
  context.clip();
}
},{"../../path/shapes":"Nd5p","vega-util":"dejJ"}],"qlu9":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.resetSVGClipId = resetSVGClipId;
exports.default = _default;

var _shapes = require("../../path/shapes");

var _vegaUtil = require("vega-util");

var clip_id = 1;

function resetSVGClipId() {
  clip_id = 1;
}

function _default(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 ((0, _vegaUtil.isFunction)(clip)) {
    c.path = clip(null);
  } else if ((0, _shapes.hasCornerRadius)(size)) {
    c.path = (0, _shapes.rectangle)(null, size, 0, 0);
  } else {
    c.width = size.width || 0;
    c.height = size.height || 0;
  }

  return 'url(#' + id + ')';
}
},{"../../path/shapes":"Nd5p","vega-util":"dejJ"}],"EtY9":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _shapes = require("../path/shapes");

var _boundStroke = _interopRequireDefault(require("../bound/boundStroke"));

var _intersect = require("../util/intersect");

var _visit = require("../util/visit");

var _clip = require("../util/canvas/clip");

var _stroke = _interopRequireDefault(require("../util/canvas/stroke"));

var _fill = _interopRequireDefault(require("../util/canvas/fill"));

var _pick = require("../util/canvas/pick");

var _clip2 = _interopRequireDefault(require("../util/svg/clip"));

var _transform = require("../util/svg/transform");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var StrokeOffset = 0.5;

function attr(emit, item) {
  emit('transform', (0, _transform.translateItem)(item));
}

function background(emit, item) {
  var offset = item.stroke ? StrokeOffset : 0;
  emit('class', 'background');
  emit('d', (0, _shapes.rectangle)(null, item, offset, offset));
}

function foreground(emit, item, renderer) {
  var url = item.clip ? (0, _clip2.default)(renderer, item, item) : null;
  emit('clip-path', url);
}

function bound(bounds, group) {
  if (!group.clip && group.items) {
    var items = group.items;

    for (var j = 0, m = items.length; 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);
  }

  (0, _boundStroke.default)(bounds, group);
  return bounds.translate(group.x || 0, group.y || 0);
}

function backgroundPath(context, group) {
  var offset = group.stroke ? StrokeOffset : 0;
  context.beginPath();
  (0, _shapes.rectangle)(context, group, offset, offset);
}

var hitBackground = (0, _pick.hitPath)(backgroundPath);

function draw(context, scene, bounds) {
  var renderer = this;
  (0, _visit.visit)(scene, function (group) {
    var gx = group.x || 0,
        gy = group.y || 0,
        opacity; // setup graphics context

    context.save();
    context.translate(gx, gy); // draw group background

    if (group.stroke || group.fill) {
      opacity = group.opacity == null ? 1 : group.opacity;

      if (opacity > 0) {
        backgroundPath(context, group);

        if (group.fill && (0, _fill.default)(context, group, opacity)) {
          context.fill();
        }

        if (group.stroke && (0, _stroke.default)(context, group, opacity)) {
          context.stroke();
        }
      }
    } // set clip and bounds


    if (group.clip) (0, _clip.clipGroup)(context, group);
    if (bounds) bounds.translate(-gx, -gy); // draw group contents

    (0, _visit.visit)(group, function (item) {
      renderer.draw(context, item, bounds);
    }); // restore graphics context

    if (bounds) bounds.translate(gx, gy);
    context.restore();
  });
}

function pick(context, scene, x, y, gx, gy) {
  if (scene.bounds && !scene.bounds.contains(gx, gy) || !scene.items) {
    return null;
  }

  var handler = this,
      cx = x * context.pixelRatio,
      cy = y * context.pixelRatio;
  return (0, _visit.pickVisit)(scene, function (group) {
    var hit, dx, dy, dw, dh, b, c; // first hit test bounding box

    b = group.bounds;
    if (b && !b.contains(gx, gy)) return; // passed bounds check, test rectangular clip

    dx = group.x || 0;
    dy = group.y || 0;
    dw = dx + (group.width || 0);
    dh = dy + (group.height || 0);
    c = group.clip;
    if (c && (gx < dx || gx > dw || gy < dx || 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 && (0, _shapes.hasCornerRadius)(group) && !hitBackground(context, group, cx, cy)) {
      context.restore();
      return;
    } // hit test against contained marks


    hit = (0, _visit.pickVisit)(group, function (mark) {
      return pickMark(mark, dx, dy) ? handler.pick(mark, x, y, dx, dy) : null;
    }); // hit test against group background

    if (!hit && scene.interactive !== false && (group.fill || 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 _default = {
  type: 'group',
  tag: 'g',
  nested: false,
  attr: attr,
  bound: bound,
  draw: draw,
  pick: pick,
  isect: _intersect.intersectRect,
  background: background,
  foreground: foreground
};
exports.default = _default;
},{"../path/shapes":"Nd5p","../bound/boundStroke":"XdKX","../util/intersect":"ALsM","../util/visit":"yR2m","../util/canvas/clip":"tXYO","../util/canvas/stroke":"dVnR","../util/canvas/fill":"iY9z","../util/canvas/pick":"xcN6","../util/svg/clip":"qlu9","../util/svg/transform":"qMs6"}],"TGnm":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _visit = require("../util/visit");

var _pick = require("../util/canvas/pick");

var _transform = require("../util/svg/transform");

var _vegaUtil = require("vega-util");

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(emit, item, renderer) {
  var image = getImage(item, renderer),
      x = item.x || 0,
      y = item.y || 0,
      w = imageWidth(item, image),
      h = imageHeight(item, image),
      a = item.aspect === false ? 'none' : 'xMidYMid';
  x -= imageXOffset(item.align, w);
  y -= imageYOffset(item.baseline, h);

  if (!image.src && image.toDataURL) {
    emit('href', image.toDataURL(), 'http://www.w3.org/1999/xlink', 'xlink:href');
  } else {
    emit('href', image.src || '', 'http://www.w3.org/1999/xlink', 'xlink:href');
  }

  emit('transform', (0, _transform.translate)(x, y));
  emit('width', w);
  emit('height', h);
  emit('preserveAspectRatio', a);
}

function bound(bounds, item) {
  var image = item.image,
      x = item.x || 0,
      y = item.y || 0,
      w = imageWidth(item, image),
      h = imageHeight(item, image);
  x -= imageXOffset(item.align, w);
  y -= imageYOffset(item.baseline, h);
  return bounds.set(x, y, x + w, y + h);
}

function draw(context, scene, bounds) {
  var renderer = this;
  (0, _visit.visit)(scene, function (item) {
    if (bounds && !bounds.intersects(item.bounds)) return; // bounds check

    var image = getImage(item, renderer),
        x = item.x || 0,
        y = item.y || 0,
        w = imageWidth(item, image),
        h = imageHeight(item, image),
        opacity,
        ar0,
        ar1,
        t;
    x -= imageXOffset(item.align, w);
    y -= imageYOffset(item.baseline, h);

    if (item.aspect !== false) {
      ar0 = image.width / image.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 (image.complete || image.toDataURL) {
      context.globalAlpha = (opacity = item.opacity) != null ? opacity : 1;
      context.imageSmoothingEnabled = item.smooth !== false;
      context.drawImage(image, x, y, w, h);
    }
  });
}

var _default = {
  type: 'image',
  tag: 'image',
  nested: false,
  attr: attr,
  bound: bound,
  draw: draw,
  pick: (0, _pick.pick)(),
  isect: _vegaUtil.truthy,
  // bounds check is sufficient
  get: getImage,
  xOffset: imageXOffset,
  yOffset: imageYOffset
};
exports.default = _default;
},{"../util/visit":"yR2m","../util/canvas/pick":"xcN6","../util/svg/transform":"qMs6","vega-util":"dejJ"}],"WUL8":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _shapes = require("../path/shapes");

var _pickPath = require("../util/pickPath");

var _markMultiItemPath = _interopRequireDefault(require("./markMultiItemPath"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _default = (0, _markMultiItemPath.default)('line', _shapes.line, _pickPath.pickLine);

exports.default = _default;
},{"../path/shapes":"Nd5p","../util/pickPath":"ON4t","./markMultiItemPath":"KTXl"}],"qOhX":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _boundStroke = _interopRequireDefault(require("../bound/boundStroke"));

var _boundContext = _interopRequireDefault(require("../bound/boundContext"));

var _parse = _interopRequireDefault(require("../path/parse"));

var _render = _interopRequireDefault(require("../path/render"));

var _intersect = require("../util/intersect");

var _draw = require("../util/canvas/draw");

var _pick = require("../util/canvas/pick");

var _transform = require("../util/svg/transform");

var _constants = require("../util/constants");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function attr(emit, item) {
  var sx = item.scaleX || 1,
      sy = item.scaleY || 1;

  if (sx !== 1 || sy !== 1) {
    emit('vector-effect', 'non-scaling-stroke');
  }

  emit('transform', (0, _transform.transformItem)(item));
  emit('d', item.path);
}

function path(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) * _constants.DegToRad,
      cache = item.pathCache;

  if (!cache || cache.path !== path) {
    (item.pathCache = cache = (0, _parse.default)(path)).path = path;
  }

  if (a && context.rotate && context.translate) {
    context.translate(x, y);
    context.rotate(a);
    (0, _render.default)(context, cache, 0, 0, sx, sy);
    context.rotate(-a);
    context.translate(-x, -y);
  } else {
    (0, _render.default)(context, cache, x, y, sx, sy);
  }
}

function bound(bounds, item) {
  path((0, _boundContext.default)(bounds), item) ? bounds.set(0, 0, 0, 0) : (0, _boundStroke.default)(bounds, item, true);

  if (item.angle) {
    bounds.rotate(item.angle * _constants.DegToRad, item.x || 0, item.y || 0);
  }

  return bounds;
}

var _default = {
  type: 'path',
  tag: 'path',
  nested: false,
  attr: attr,
  bound: bound,
  draw: (0, _draw.drawAll)(path),
  pick: (0, _pick.pickPath)(path),
  isect: (0, _intersect.intersectPath)(path)
};
exports.default = _default;
},{"../bound/boundStroke":"XdKX","../bound/boundContext":"aOFJ","../path/parse":"sx1S","../path/render":"AiV4","../util/intersect":"ALsM","../util/canvas/draw":"iPOY","../util/canvas/pick":"xcN6","../util/svg/transform":"qMs6","../util/constants":"s6lu"}],"pitT":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _boundStroke = _interopRequireDefault(require("../bound/boundStroke"));

var _shapes = require("../path/shapes");

var _intersect = require("../util/intersect");

var _draw = require("../util/canvas/draw");

var _pick = require("../util/canvas/pick");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function attr(emit, item) {
  emit('d', (0, _shapes.rectangle)(null, item));
}

function bound(bounds, item) {
  var x, y;
  return (0, _boundStroke.default)(bounds.set(x = item.x || 0, y = item.y || 0, x + item.width || 0, y + item.height || 0), item);
}

function draw(context, item) {
  context.beginPath();
  (0, _shapes.rectangle)(context, item);
}

var _default = {
  type: 'rect',
  tag: 'path',
  nested: false,
  attr: attr,
  bound: bound,
  draw: (0, _draw.drawAll)(draw),
  pick: (0, _pick.pickPath)(draw),
  isect: _intersect.intersectRect
};
exports.default = _default;
},{"../bound/boundStroke":"XdKX","../path/shapes":"Nd5p","../util/intersect":"ALsM","../util/canvas/draw":"iPOY","../util/canvas/pick":"xcN6"}],"pR8T":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _boundStroke = _interopRequireDefault(require("../bound/boundStroke"));

var _intersect = require("../util/intersect");

var _visit = require("../util/visit");

var _pick = require("../util/canvas/pick");

var _stroke = _interopRequireDefault(require("../util/canvas/stroke"));

var _transform = require("../util/svg/transform");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function attr(emit, item) {
  emit('transform', (0, _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(bounds, item) {
  var x1, y1;
  return (0, _boundStroke.default)(bounds.set(x1 = item.x || 0, y1 = item.y || 0, item.x2 != null ? item.x2 : x1, item.y2 != null ? item.y2 : y1), item);
}

function path(context, item, opacity) {
  var x1, y1, x2, y2;

  if (item.stroke && (0, _stroke.default)(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(context, scene, bounds) {
  (0, _visit.visit)(scene, function (item) {
    if (bounds && !bounds.intersects(item.bounds)) return; // bounds check

    var opacity = item.opacity == null ? 1 : item.opacity;

    if (opacity && path(context, item, opacity)) {
      context.stroke();
    }
  });
}

function hit(context, item, x, y) {
  if (!context.isPointInStroke) return false;
  return path(context, item, 1) && context.isPointInStroke(x, y);
}

var _default = {
  type: 'rule',
  tag: 'line',
  nested: false,
  attr: attr,
  bound: bound,
  draw: draw,
  pick: (0, _pick.pick)(hit),
  isect: _intersect.intersectRule
};
exports.default = _default;
},{"../bound/boundStroke":"XdKX","../util/intersect":"ALsM","../util/visit":"yR2m","../util/canvas/pick":"xcN6","../util/canvas/stroke":"dVnR","../util/svg/transform":"qMs6"}],"VxJy":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _shapes = require("../path/shapes");

var _markItemPath = _interopRequireDefault(require("./markItemPath"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _default = (0, _markItemPath.default)('shape', _shapes.shape);

exports.default = _default;
},{"../path/shapes":"Nd5p","./markItemPath":"Qasw"}],"oJOr":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _shapes = require("../path/shapes");

var _intersect = require("../util/intersect");

var _markItemPath = _interopRequireDefault(require("./markItemPath"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _default = (0, _markItemPath.default)('symbol', _shapes.symbol, _intersect.intersectPoint);

exports.default = _default;
},{"../path/shapes":"Nd5p","../util/intersect":"ALsM","./markItemPath":"Qasw"}],"MaAN":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.fontSize = fontSize;
exports.lineHeight = lineHeight;
exports.textLines = textLines;
exports.multiLineOffset = multiLineOffset;
exports.textValue = textValue;
exports.fontFamily = fontFamily;
exports.font = font;
exports.offset = offset;
exports.textMetrics = void 0;

var _context = require("./canvas/context");

var _vegaUtil = require("vega-util");

var currFontHeight;
var textMetrics = {
  height: fontSize,
  measureWidth: measureWidth,
  estimateWidth: estimateWidth,
  width: estimateWidth,
  canvas: useCanvas
};
exports.textMetrics = textMetrics;
useCanvas(true); // make dumb, simple estimate if no canvas is available

function estimateWidth(item, text) {
  currFontHeight = fontSize(item);
  return estimate(textValue(item, text));
}

function estimate(text) {
  return ~~(0.8 * text.length * currFontHeight);
} // measure text width if canvas is available


function measureWidth(item, text) {
  return fontSize(item) <= 0 ? 0 : (_context.context.font = font(item), measure(textValue(item, text)));
}

function measure(text) {
  return _context.context.measureText(text).width;
}

function fontSize(item) {
  return item.fontSize != null ? item.fontSize : 11;
}

function useCanvas(use) {
  textMetrics.width = use && _context.context ? measureWidth : estimateWidth;
}

function lineHeight(item) {
  return item.lineHeight != null ? item.lineHeight : fontSize(item) + 2;
}

function lineArray(_) {
  return (0, _vegaUtil.isArray)(_) ? _.length > 1 ? _ : _[0] : _;
}

function textLines(item) {
  return lineArray(item.lineBreak && item.text && !(0, _vegaUtil.isArray)(item.text) ? item.text.split(item.lineBreak) : item.text);
}

function multiLineOffset(item) {
  const tl = textLines(item);
  return ((0, _vegaUtil.isArray)(tl) ? tl.length - 1 : 0) * lineHeight(item);
}

function textValue(item, line) {
  return line == null ? '' : item.limit > 0 ? truncate(item, line) : line + '';
}

function truncate(item, line) {
  var limit = +item.limit,
      text = line + '',
      width;

  if (textMetrics.width === measureWidth) {
    // we are using canvas
    _context.context.font = font(item);
    width = measure;
  } else {
    // we are relying on estimates
    currFontHeight = fontSize(item);
    width = estimate;
  }

  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 font(item, quote) {
  return '' + (item.fontStyle ? item.fontStyle + ' ' : '') + (item.fontVariant ? item.fontVariant + ' ' : '') + (item.fontWeight ? item.fontWeight + ' ' : '') + fontSize(item) + 'px ' + fontFamily(item, quote);
}

function offset(item) {
  // perform our own font baseline calculation
  // why? not all browsers support SVG 1.1 'alignment-baseline' :(
  var baseline = item.baseline,
      h = fontSize(item);
  return Math.round(baseline === 'top' ? 0.79 * h : baseline === 'middle' ? 0.30 * h : baseline === 'bottom' ? -0.21 * h : 0);
}
},{"./canvas/context":"nHtR","vega-util":"dejJ"}],"G2kZ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _Bounds = _interopRequireDefault(require("../Bounds"));

var _constants = require("../util/constants");

var _text = require("../util/text");

var _intersect = require("../util/intersect");

var _visit = require("../util/visit");

var _fill = _interopRequireDefault(require("../util/canvas/fill"));

var _pick = require("../util/canvas/pick");

var _stroke = _interopRequireDefault(require("../util/canvas/stroke"));

var _transform = require("../util/svg/transform");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var textAlign = {
  'left': 'start',
  'center': 'middle',
  'right': 'end'
};
var tempBounds = new _Bounds.default();

function anchorPoint(item) {
  var x = item.x || 0,
      y = item.y || 0,
      r = item.radius || 0,
      t;

  if (r) {
    t = (item.theta || 0) - _constants.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) + (0, _text.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 = (0, _transform.translate)(x, y) + ' ' + (0, _transform.rotate)(a);
    if (dx || dy) t += ' ' + (0, _transform.translate)(dx, dy);
  } else {
    t = (0, _transform.translate)(x + dx, y + dy);
  }

  emit('transform', t);
}

function bound(bounds, item, mode) {
  var h = _text.textMetrics.height(item),
      a = item.align,
      p = anchorPoint(item),
      x = p.x1,
      y = p.y1,
      dx = item.dx || 0,
      dy = (item.dy || 0) + (0, _text.offset)(item) - Math.round(0.8 * h),
      // use 4/5 offset
  tl = (0, _text.textLines)(item),
      w; // get dimensions


  if ((0, _vegaUtil.isArray)(tl)) {
    // multi-line text
    h += (0, _text.lineHeight)(item) * (tl.length - 1);
    w = tl.reduce((w, t) => Math.max(w, _text.textMetrics.width(item, t)), 0);
  } else {
    // single-line text
    w = _text.textMetrics.width(item, tl);
  } // horizontal alignment


  if (a === 'center') {
    dx -= w / 2;
  } else if (a === 'right') {
    dx -= w;
  } else {// left by default, do nothing
  }

  bounds.set(dx += x, dy += y, dx + w, dy + h);

  if (item.angle && !mode) {
    bounds.rotate(item.angle * _constants.DegToRad, x, y);
  } else if (mode === 2) {
    return bounds.rotatedPoints(item.angle * _constants.DegToRad, x, y);
  }

  return bounds;
}

function draw(context, scene, bounds) {
  (0, _visit.visit)(scene, function (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 = (0, _text.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 * _constants.DegToRad);
      x = y = 0; // reset x, y
    }

    x += item.dx || 0;
    y += (item.dy || 0) + (0, _text.offset)(item);
    tl = (0, _text.textLines)(item);

    if ((0, _vegaUtil.isArray)(tl)) {
      lh = (0, _text.lineHeight)(item);

      for (i = 0; i < tl.length; ++i) {
        str = (0, _text.textValue)(item, tl[i]);

        if (item.fill && (0, _fill.default)(context, item, opacity)) {
          context.fillText(str, x, y);
        }

        if (item.stroke && (0, _stroke.default)(context, item, opacity)) {
          context.strokeText(str, x, y);
        }

        y += lh;
      }
    } else {
      str = (0, _text.textValue)(item, tl);

      if (item.fill && (0, _fill.default)(context, item, opacity)) {
        context.fillText(str, x, y);
      }

      if (item.stroke && (0, _stroke.default)(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 = bound(tempBounds, item, 1),
      a = -item.angle * _constants.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) {
  var p = bound(tempBounds, item, 2);
  return (0, _intersect.intersectBoxLine)(box, p[0], p[1], p[2], p[3]) || (0, _intersect.intersectBoxLine)(box, p[0], p[1], p[4], p[5]) || (0, _intersect.intersectBoxLine)(box, p[4], p[5], p[6], p[7]) || (0, _intersect.intersectBoxLine)(box, p[2], p[3], p[6], p[7]);
}

var _default = {
  type: 'text',
  tag: 'text',
  nested: false,
  attr: attr,
  bound: bound,
  draw: draw,
  pick: (0, _pick.pick)(hit),
  isect: intersectText
};
exports.default = _default;
},{"../Bounds":"pVXN","../util/constants":"s6lu","../util/text":"MaAN","../util/intersect":"ALsM","../util/visit":"yR2m","../util/canvas/fill":"iY9z","../util/canvas/pick":"xcN6","../util/canvas/stroke":"dVnR","../util/svg/transform":"qMs6","vega-util":"dejJ"}],"gaB9":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _shapes = require("../path/shapes");

var _pickPath = require("../util/pickPath");

var _markMultiItemPath = _interopRequireDefault(require("./markMultiItemPath"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _default = (0, _markMultiItemPath.default)('trail', _shapes.trail, _pickPath.pickTrail);

exports.default = _default;
},{"../path/shapes":"Nd5p","../util/pickPath":"ON4t","./markMultiItemPath":"KTXl"}],"frXo":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _arc = _interopRequireDefault(require("./arc"));

var _area = _interopRequireDefault(require("./area"));

var _group = _interopRequireDefault(require("./group"));

var _image = _interopRequireDefault(require("./image"));

var _line = _interopRequireDefault(require("./line"));

var _path = _interopRequireDefault(require("./path"));

var _rect = _interopRequireDefault(require("./rect"));

var _rule = _interopRequireDefault(require("./rule"));

var _shape = _interopRequireDefault(require("./shape"));

var _symbol = _interopRequireDefault(require("./symbol"));

var _text = _interopRequireDefault(require("./text"));

var _trail = _interopRequireDefault(require("./trail"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _default = {
  arc: _arc.default,
  area: _area.default,
  group: _group.default,
  image: _image.default,
  line: _line.default,
  path: _path.default,
  rect: _rect.default,
  rule: _rule.default,
  shape: _shape.default,
  symbol: _symbol.default,
  text: _text.default,
  trail: _trail.default
};
exports.default = _default;
},{"./arc":"gYRV","./area":"PtQk","./group":"EtY9","./image":"TGnm","./line":"WUL8","./path":"qOhX","./rect":"pitT","./rule":"pR8T","./shape":"VxJy","./symbol":"oJOr","./text":"G2kZ","./trail":"gaB9"}],"WKKT":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _Bounds = _interopRequireDefault(require("../Bounds"));

var _index = _interopRequireDefault(require("../marks/index"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(item, func, opt) {
  var type = _index.default[item.mark.marktype],
      bound = func || type.bound;
  if (type.nested) item = item.mark;
  return bound(item.bounds || (item.bounds = new _Bounds.default()), item, opt);
}
},{"../Bounds":"pVXN","../marks/index":"frXo"}],"TxR0":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _Bounds = _interopRequireDefault(require("../Bounds"));

var _boundItem = _interopRequireDefault(require("./boundItem"));

var _index = _interopRequireDefault(require("../marks/index"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var DUMMY = {
  mark: null
};

function _default(mark, bounds, opt) {
  var type = _index.default[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 = (0, _boundItem.default)(item, bound, opt);
    bounds = bounds && bounds.union(b) || b;
    return bounds;
  }

  bounds = bounds || mark.bounds && mark.bounds.clear() || new _Bounds.default();

  if (hasItems) {
    for (i = 0, n = items.length; i < n; ++i) {
      bounds.union((0, _boundItem.default)(items[i], bound, opt));
    }
  }

  return mark.bounds = bounds;
}
},{"../Bounds":"pVXN","./boundItem":"WKKT","../marks/index":"frXo"}],"a1RV":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.sceneToJSON = sceneToJSON;
exports.sceneFromJSON = sceneFromJSON;

var _boundMark = _interopRequireDefault(require("../bound/boundMark"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var keys = ['marktype', 'name', 'role', 'interactive', 'clip', 'items', 'zindex', 'x', 'y', 'width', 'height', 'align', 'baseline', // layout
'fill', 'fillOpacity', 'opacity', // fill
'stroke', 'strokeOpacity', 'strokeWidth', 'strokeCap', // stroke
'strokeDash', 'strokeDashOffset', // stroke dash
'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
];

function sceneToJSON(scene, indent) {
  return JSON.stringify(scene, keys, indent);
}

function sceneFromJSON(json) {
  var scene = typeof json === 'string' ? JSON.parse(json) : json;
  return initialize(scene);
}

function 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)) initialize(items[i]);
    }
  }

  if (type) (0, _boundMark.default)(scene);
  return scene;
}
},{"../bound/boundMark":"TxR0"}],"zJ1R":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Scenegraph;

var _Bounds = _interopRequireDefault(require("./Bounds"));

var _GroupItem = _interopRequireDefault(require("./GroupItem"));

var _serialize = require("./util/serialize");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function Scenegraph(scene) {
  if (arguments.length) {
    this.root = (0, _serialize.sceneFromJSON)(scene);
  } else {
    this.root = createMark({
      marktype: 'group',
      name: 'root',
      role: 'frame'
    });
    this.root.items = [new _GroupItem.default(this.root)];
  }
}

var prototype = Scenegraph.prototype;

prototype.toJSON = function (indent) {
  return (0, _serialize.sceneToJSON)(this.root, indent || 0);
};

prototype.mark = function (markdef, group, index) {
  group = group || this.root.items[0];
  var mark = createMark(markdef, group);
  group.items[index] = mark;
  if (mark.zindex) mark.group.zdirty = true;
  return mark;
};

function createMark(def, group) {
  return {
    bounds: new _Bounds.default(),
    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
  };
}
},{"./Bounds":"pVXN","./GroupItem":"pDd9","./util/serialize":"a1RV"}],"ZOTg":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.domCreate = domCreate;
exports.domFind = domFind;
exports.domChild = domChild;
exports.domClear = domClear;
exports.cssClass = cssClass;

// 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 : '');
}
},{}],"EUXH":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(event, el) {
  var rect = el.getBoundingClientRect();
  return [event.clientX - rect.left - (el.clientLeft || 0), event.clientY - rect.top - (el.clientTop || 0)];
}
},{}],"efC6":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _index = _interopRequireDefault(require("../marks/index"));

var _point = _interopRequireDefault(require("./point"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(item, event, el, origin) {
  var mark = item && item.mark,
      mdef,
      p;

  if (mark && (mdef = _index.default[mark.marktype]).tip) {
    p = (0, _point.default)(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;
}
},{"../marks/index":"frXo","./point":"EUXH"}],"Q1a6":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Handler;

var _dom = require("./util/dom");

var _resolveItem = _interopRequireDefault(require("./util/resolveItem"));

var _vegaLoader = require("vega-loader");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * 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 Handler(customLoader, customTooltip) {
  this._active = null;
  this._handlers = {};
  this._loader = customLoader || (0, _vegaLoader.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 || '');
}

var prototype = 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.
 */

prototype.initialize = function (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.
 */


prototype.element = function () {
  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.
 */


prototype.canvas = function () {
  return this._el && this._el.firstChild;
};
/**
 * Get / set the origin coordinates of the visualization.
 */


prototype.origin = function (origin) {
  if (arguments.length) {
    this._origin = origin || [0, 0];
    return this;
  } else {
    return this._origin.slice();
  }
};
/**
 * Get / set the scenegraph root.
 */


prototype.scene = function (scene) {
  if (!arguments.length) return this._scene;
  this._scene = scene;
  return this;
};
/**
 * Add an event handler. Subclasses should override this method.
 */


prototype.on = function ()
/*type, handler*/
{};
/**
 * Remove an event handler. Subclasses should override this method.
 */


prototype.off = function ()
/*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.
 */


prototype._handlerIndex = function (h, type, handler) {
  for (var 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.
 */


prototype.handlers = function (type) {
  var h = this._handlers,
      a = [],
      k;

  if (type) {
    a.push.apply(a, h[this.eventName(type)]);
  } else {
    for (k in h) {
      a.push.apply(a, 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.
 */


prototype.eventName = function (name) {
  var 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.
 */


prototype.handleHref = function (event, item, href) {
  this._loader.sanitize(href, {
    context: 'href'
  }).then(function (opt) {
    var e = new MouseEvent(event.type, event),
        a = (0, _dom.domCreate)(null, 'a');

    for (var name in opt) a.setAttribute(name, opt[name]);

    a.dispatchEvent(e);
  }).catch(function () {
    /* 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.
 */


prototype.handleTooltip = function (event, item, show) {
  if (item && item.tooltip != null) {
    item = (0, _resolveItem.default)(item, event, this.canvas(), this._origin);
    var 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.
 */


prototype.getItemBoundingClientRect = function (item) {
  if (!(el = this.canvas())) return;
  var el,
      rect = el.getBoundingClientRect(),
      origin = this._origin,
      itemBounds = item.bounds,
      x = itemBounds.x1 + origin[0] + rect.left,
      y = itemBounds.y1 + origin[1] + rect.top,
      w = itemBounds.width(),
      h = itemBounds.height(); // 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: x,
    y: y,
    width: w,
    height: h,
    left: x,
    top: y,
    right: x + w,
    bottom: y + h
  };
};
},{"./util/dom":"ZOTg","./util/resolveItem":"efC6","vega-loader":"wGnx"}],"N37r":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Renderer;

var _ResourceLoader = _interopRequireDefault(require("./ResourceLoader"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * 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 Renderer(loader) {
  this._el = null;
  this._bgcolor = null;
  this._loader = new _ResourceLoader.default(loader);
}

var prototype = 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.
 */

prototype.initialize = function (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.
 */


prototype.element = function () {
  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.
 */


prototype.canvas = function () {
  return this._el && this._el.firstChild;
};
/**
 * Get / set the background color.
 */


prototype.background = function (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;
 */


prototype.resize = function (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.
 */


prototype.dirty = function ()
/*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.
 */


prototype.render = function (scene) {
  var 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.
 */


prototype._render = function ()
/*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.
 */


prototype.renderAsync = function (scene) {
  var r = this.render(scene);
  return this._ready ? this._ready.then(function () {
    return 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.
 */


prototype._load = function (method, uri) {
  var r = this,
      p = r._loader[method](uri);

  if (!r._ready) {
    // re-render the scene when loading completes
    var call = r._call;
    r._ready = r._loader.ready().then(function (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.
 */


prototype.sanitizeURL = function (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.
 */


prototype.loadImage = function (uri) {
  return this._load('loadImage', uri);
};
},{"./ResourceLoader":"eoqI"}],"ToUl":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.HrefEvent = exports.TooltipHideEvent = exports.TooltipShowEvent = exports.Events = void 0;
var Events = ['keydown', 'keypress', 'keyup', 'dragenter', 'dragleave', 'dragover', 'mousedown', 'mouseup', 'mousemove', 'mouseout', 'mouseover', 'click', 'dblclick', 'wheel', 'mousewheel', 'touchstart', 'touchmove', 'touchend'];
exports.Events = Events;
var TooltipShowEvent = 'mousemove';
exports.TooltipShowEvent = TooltipShowEvent;
var TooltipHideEvent = 'mouseout';
exports.TooltipHideEvent = TooltipHideEvent;
var HrefEvent = 'click';
exports.HrefEvent = HrefEvent;
},{}],"P3dF":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = CanvasHandler;

var _Handler = _interopRequireDefault(require("./Handler"));

var _index = _interopRequireDefault(require("./marks/index"));

var _events = require("./util/events");

var _point = _interopRequireDefault(require("./util/point"));

var _dom = require("./util/dom");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function CanvasHandler(loader, tooltip) {
  _Handler.default.call(this, loader, tooltip);

  this._down = null;
  this._touch = null;
  this._first = true;
}

var prototype = (0, _vegaUtil.inherits)(CanvasHandler, _Handler.default);

prototype.initialize = function (el, origin, obj) {
  // add event listeners
  var canvas = this._canvas = el && (0, _dom.domFind)(el, 'canvas');

  if (canvas) {
    var that = this;
    this.events.forEach(function (type) {
      canvas.addEventListener(type, function (evt) {
        if (prototype[type]) {
          prototype[type].call(that, evt);
        } else {
          that.fire(type, evt);
        }
      });
    });
  }

  return _Handler.default.prototype.initialize.call(this, el, origin, obj);
}; // return the backing canvas instance


prototype.canvas = function () {
  return this._canvas;
}; // retrieve the current canvas context


prototype.context = function () {
  return this._canvas.getContext('2d');
}; // supported events


prototype.events = _events.Events; // to keep old versions of firefox happy

prototype.DOMMouseScroll = function (evt) {
  this.fire('mousewheel', evt);
};

function move(moveEvent, overEvent, outEvent) {
  return function (evt) {
    var 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;
  };
}

prototype.mousemove = move('mousemove', 'mouseover', 'mouseout');
prototype.dragover = move('dragover', 'dragenter', 'dragleave');
prototype.mouseout = inactive('mouseout');
prototype.dragleave = inactive('dragleave');

prototype.mousedown = function (evt) {
  this._down = this._active;
  this.fire('mousedown', evt);
};

prototype.click = function (evt) {
  if (this._down === this._active) {
    this.fire('click', evt);
    this._down = null;
  }
};

prototype.touchstart = function (evt) {
  this._touch = this.pickEvent(evt.changedTouches[0]);

  if (this._first) {
    this._active = this._touch;
    this._first = false;
  }

  this.fire('touchstart', evt, true);
};

prototype.touchmove = function (evt) {
  this.fire('touchmove', evt, true);
};

prototype.touchend = function (evt) {
  this.fire('touchend', evt, true);
  this._touch = null;
}; // fire an event


prototype.fire = function (type, evt, touch) {
  var a = touch ? this._touch : this._active,
      h = this._handlers[type],
      i,
      len; // set event type relative to scenegraph items

  evt.vegaType = type; // handle hyperlinks and tooltips first

  if (type === _events.HrefEvent && a && a.href) {
    this.handleHref(evt, a, a.href);
  } else if (type === _events.TooltipShowEvent || type === _events.TooltipHideEvent) {
    this.handleTooltip(evt, a, type !== _events.TooltipHideEvent);
  } // invoke all registered handlers


  if (h) {
    for (i = 0, len = h.length; i < len; ++i) {
      h[i].handler.call(this._obj, evt, a);
    }
  }
}; // add an event handler


prototype.on = function (type, handler) {
  var name = this.eventName(type),
      h = this._handlers,
      i = this._handlerIndex(h[name], type, handler);

  if (i < 0) {
    (h[name] || (h[name] = [])).push({
      type: type,
      handler: handler
    });
  }

  return this;
}; // remove an event handler


prototype.off = function (type, handler) {
  var name = this.eventName(type),
      h = this._handlers[name],
      i = this._handlerIndex(h, type, handler);

  if (i >= 0) {
    h.splice(i, 1);
  }

  return this;
};

prototype.pickEvent = function (evt) {
  var p = (0, _point.default)(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


prototype.pick = function (scene, x, y, gx, gy) {
  var g = this.context(),
      mark = _index.default[scene.marktype];
  return mark.pick.call(this, g, scene, x, y, gx, gy);
};
},{"./Handler":"Q1a6","./marks/index":"frXo","./util/events":"ToUl","./util/point":"EUXH","./util/dom":"ZOTg","vega-util":"dejJ"}],"wbjT":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function devicePixelRatio() {
  return typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1;
}

var pixelRatio = devicePixelRatio();

function _default(canvas, width, height, origin, scaleFactor, opt) {
  var inDOM = typeof HTMLElement !== 'undefined' && canvas instanceof HTMLElement && canvas.parentNode != null;
  var context = canvas.getContext('2d'),
      ratio = inDOM ? pixelRatio : scaleFactor,
      key;
  canvas.width = width * ratio;
  canvas.height = height * ratio;

  for (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;
}
},{}],"Rdu2":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = CanvasRenderer;

var _Renderer = _interopRequireDefault(require("./Renderer"));

var _Bounds = _interopRequireDefault(require("./Bounds"));

var _index = _interopRequireDefault(require("./marks/index"));

var _dom = require("./util/dom");

var _clip = _interopRequireDefault(require("./util/canvas/clip"));

var _resize = _interopRequireDefault(require("./util/canvas/resize"));

var _vegaCanvas = require("vega-canvas");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function CanvasRenderer(loader) {
  _Renderer.default.call(this, loader);

  this._redraw = false;
  this._dirty = new _Bounds.default();
}

var prototype = (0, _vegaUtil.inherits)(CanvasRenderer, _Renderer.default),
    base = _Renderer.default.prototype,
    tempBounds = new _Bounds.default();

prototype.initialize = function (el, width, height, origin, scaleFactor, options) {
  this._options = options;
  this._canvas = (0, _vegaCanvas.canvas)(1, 1, options && options.type); // instantiate a small canvas

  if (el) {
    (0, _dom.domClear)(el, 0).appendChild(this._canvas);

    this._canvas.setAttribute('class', 'marks');
  } // this method will invoke resize to size the canvas appropriately


  return base.initialize.call(this, el, width, height, origin, scaleFactor);
};

prototype.resize = function (width, height, origin, scaleFactor) {
  base.resize.call(this, width, height, origin, scaleFactor);
  (0, _resize.default)(this._canvas, this._width, this._height, this._origin, this._scale, this._options && this._options.context);
  this._redraw = true;
  return this;
};

prototype.canvas = function () {
  return this._canvas;
};

prototype.context = function () {
  return this._canvas ? this._canvas.getContext('2d') : null;
};

prototype.dirty = function (item) {
  var b = translate(item.bounds, item.mark.group);

  this._dirty.union(b);
};

function clipToBounds(g, b, origin) {
  // expand bounds by 1 pixel, then round to pixel boundaries
  b.expand(1).round(); // to avoid artifacts translate if origin has fractional pixels

  b.translate(-(origin[0] % 1), -(origin[1] % 1)); // set clipping path

  g.beginPath();
  g.rect(b.x1, b.y1, b.width(), b.height());
  g.clip();
  return b;
}

function viewBounds(origin, width, height) {
  return tempBounds.set(0, 0, width, height).translate(-origin[0], -origin[1]);
}

function translate(bounds, group) {
  if (group == null) return bounds;
  var b = tempBounds.clear().union(bounds);

  for (; group != null; group = group.mark.group) {
    b.translate(group.x || 0, group.y || 0);
  }

  return b;
}

prototype._render = function (scene) {
  var g = this.context(),
      o = this._origin,
      w = this._width,
      h = this._height,
      b = this._dirty; // setup

  g.save();

  if (this._redraw || b.empty()) {
    this._redraw = false;
    b = viewBounds(o, w, h).expand(1);
  } else {
    b = clipToBounds(g, b.intersect(viewBounds(o, w, h)), o, w, h);
  }

  this.clear(-o[0], -o[1], w, h); // render

  this.draw(g, scene, b); // takedown

  g.restore();

  this._dirty.clear();

  return this;
};

prototype.draw = function (ctx, scene, bounds) {
  var mark = _index.default[scene.marktype];
  if (scene.clip) (0, _clip.default)(ctx, scene);
  mark.draw.call(this, ctx, scene, bounds);
  if (scene.clip) ctx.restore();
};

prototype.clear = function (x, y, w, h) {
  var g = this.context();
  g.clearRect(x, y, w, h);

  if (this._bgcolor != null) {
    g.fillStyle = this._bgcolor;
    g.fillRect(x, y, w, h);
  }
};
},{"./Renderer":"N37r","./Bounds":"pVXN","./marks/index":"frXo","./util/dom":"ZOTg","./util/canvas/clip":"tXYO","./util/canvas/resize":"wbjT","vega-canvas":"ZLEK","vega-util":"dejJ"}],"MQXA":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = SVGHandler;

var _Handler = _interopRequireDefault(require("./Handler"));

var _dom = require("./util/dom");

var _events = require("./util/events");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function SVGHandler(loader, tooltip) {
  _Handler.default.call(this, loader, tooltip);

  var h = this;
  h._hrefHandler = listener(h, function (evt, item) {
    if (item && item.href) h.handleHref(evt, item, item.href);
  });
  h._tooltipHandler = listener(h, function (evt, item) {
    h.handleTooltip(evt, item, evt.type !== _events.TooltipHideEvent);
  });
}

var prototype = (0, _vegaUtil.inherits)(SVGHandler, _Handler.default);

prototype.initialize = function (el, origin, obj) {
  var svg = this._svg;

  if (svg) {
    svg.removeEventListener(_events.HrefEvent, this._hrefHandler);
    svg.removeEventListener(_events.TooltipShowEvent, this._tooltipHandler);
    svg.removeEventListener(_events.TooltipHideEvent, this._tooltipHandler);
  }

  this._svg = svg = el && (0, _dom.domFind)(el, 'svg');

  if (svg) {
    svg.addEventListener(_events.HrefEvent, this._hrefHandler);
    svg.addEventListener(_events.TooltipShowEvent, this._tooltipHandler);
    svg.addEventListener(_events.TooltipHideEvent, this._tooltipHandler);
  }

  return _Handler.default.prototype.initialize.call(this, el, origin, obj);
};

prototype.canvas = function () {
  return this._svg;
}; // wrap an event listener for the SVG DOM


function listener(context, handler) {
  return function (evt) {
    var target = evt.target,
        item = target.__data__;
    evt.vegaType = evt.type;
    item = Array.isArray(item) ? item[0] : item;
    handler.call(context._obj, evt, item);
  };
} // add an event handler


prototype.on = function (type, handler) {
  var name = this.eventName(type),
      h = this._handlers,
      i = this._handlerIndex(h[name], type, handler);

  if (i < 0) {
    var x = {
      type: type,
      handler: 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


prototype.off = function (type, handler) {
  var 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;
};
},{"./Handler":"Q1a6","./util/dom":"ZOTg","./util/events":"ToUl","vega-util":"dejJ"}],"OrBP":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.openTag = openTag;
exports.closeTag = closeTag;

// generate string for an opening xml tag
// tag: the name of the xml tag
// attr: hash of attribute name-value pairs to include
// raw: additional raw string to include in tag markup
function openTag(tag, attr, raw) {
  var s = '<' + tag,
      key,
      val;

  if (attr) {
    for (key in attr) {
      val = attr[key];

      if (val != null) {
        s += ' ' + key + '="' + val + '"';
      }
    }
  }

  if (raw) s += ' ' + raw;
  return s + '>';
} // generate string for closing xml tag
// tag: the name of the xml tag


function closeTag(tag) {
  return '</' + tag + '>';
}
},{}],"pUwC":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _default = {
  'version': '1.1',
  'xmlns': 'http://www.w3.org/2000/svg',
  'xmlns:xlink': 'http://www.w3.org/1999/xlink'
};
exports.default = _default;
},{}],"fOMh":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.styleProperties = exports.styles = void 0;
var 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'
};
exports.styles = styles;
var styleProperties = Object.keys(styles);
exports.styleProperties = styleProperties;
},{}],"DBYw":[function(require,module,exports) {
var process = require("process");
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = SVGRenderer;

var _Renderer = _interopRequireDefault(require("./Renderer"));

var _Gradient = require("./Gradient");

var _index = _interopRequireDefault(require("./marks/index"));

var _dom = require("./util/dom");

var _tags = require("./util/tags");

var _text = require("./util/text");

var _visit = require("./util/visit");

var _clip = _interopRequireDefault(require("./util/svg/clip"));

var _metadata = _interopRequireDefault(require("./util/svg/metadata"));

var _styles = require("./util/svg/styles");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var ns = _metadata.default.xmlns;

function SVGRenderer(loader) {
  _Renderer.default.call(this, loader);

  this._dirtyID = 0;
  this._dirty = [];
  this._svg = null;
  this._root = null;
  this._defs = null;
}

var prototype = (0, _vegaUtil.inherits)(SVGRenderer, _Renderer.default);
var base = _Renderer.default.prototype;

prototype.initialize = function (el, width, height, padding) {
  if (el) {
    this._svg = (0, _dom.domChild)(el, 0, 'svg', ns);

    this._svg.setAttribute('class', 'marks');

    (0, _dom.domClear)(el, 1); // set the svg root group

    this._root = (0, _dom.domChild)(this._svg, 0, 'g', ns);
    (0, _dom.domClear)(this._svg, 1);
  } // create the svg definitions cache


  this._defs = {
    gradient: {},
    clipping: {}
  }; // set background color if defined

  this.background(this._bgcolor);
  return base.initialize.call(this, el, width, height, padding);
};

prototype.background = function (bgcolor) {
  if (arguments.length && this._svg) {
    this._svg.style.setProperty('background-color', bgcolor);
  }

  return base.background.apply(this, arguments);
};

prototype.resize = function (width, height, origin, scaleFactor) {
  base.resize.call(this, width, height, origin, scaleFactor);

  if (this._svg) {
    this._svg.setAttribute('width', this._width * this._scale);

    this._svg.setAttribute('height', this._height * this._scale);

    this._svg.setAttribute('viewBox', '0 0 ' + this._width + ' ' + this._height);

    this._root.setAttribute('transform', 'translate(' + this._origin + ')');
  }

  this._dirty = [];
  return this;
};

prototype.canvas = function () {
  return this._svg;
};

prototype.svg = function () {
  if (!this._svg) return null;
  var attr = {
    class: 'marks',
    width: this._width * this._scale,
    height: this._height * this._scale,
    viewBox: '0 0 ' + this._width + ' ' + this._height
  };

  for (var key in _metadata.default) {
    attr[key] = _metadata.default[key];
  }

  var bg = !this._bgcolor ? '' : (0, _tags.openTag)('rect', {
    width: this._width,
    height: this._height,
    style: 'fill: ' + this._bgcolor + ';'
  }) + (0, _tags.closeTag)('rect');
  return (0, _tags.openTag)('svg', attr) + bg + this._svg.innerHTML + (0, _tags.closeTag)('svg');
}; // -- Render entry point --


prototype._render = function (scene) {
  // perform spot updates and re-render markup
  if (this._dirtyCheck()) {
    if (this._dirtyAll) this._resetDefs();
    this.draw(this._root, scene);
    (0, _dom.domClear)(this._root, 1);
  }

  this.updateDefs();
  this._dirty = [];
  ++this._dirtyID;
  return this;
}; // -- Manage SVG definitions ('defs') block --


prototype.updateDefs = function () {
  var svg = this._svg,
      defs = this._defs,
      el = defs.el,
      index = 0,
      id;

  for (id in defs.gradient) {
    if (!el) defs.el = el = (0, _dom.domChild)(svg, 0, 'defs', ns);
    index = updateGradient(el, defs.gradient[id], index);
  }

  for (id in defs.clipping) {
    if (!el) defs.el = el = (0, _dom.domChild)(svg, 0, 'defs', ns);
    index = updateClipping(el, defs.clipping[id], index);
  } // clean-up


  if (el) {
    if (index === 0) {
      svg.removeChild(el);
      defs.el = null;
    } else {
      (0, _dom.domClear)(el, index);
    }
  }
};

function updateGradient(el, grad, index) {
  var 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.
    // So we wrap the radial gradient in a pattern element, allowing us
    // to mantain a circular gradient that matches what canvas provides.
    var pt = (0, _dom.domChild)(el, index++, 'pattern', ns);
    pt.setAttribute('id', _Gradient.patternPrefix + grad.id);
    pt.setAttribute('viewBox', '0,0,1,1');
    pt.setAttribute('width', '100%');
    pt.setAttribute('height', '100%');
    pt.setAttribute('preserveAspectRatio', 'xMidYMid slice');
    pt = (0, _dom.domChild)(pt, 0, 'rect', ns);
    pt.setAttribute('width', '1');
    pt.setAttribute('height', '1');
    pt.setAttribute('fill', 'url(' + href() + '#' + grad.id + ')');
    el = (0, _dom.domChild)(el, index++, 'radialGradient', ns);
    el.setAttribute('id', grad.id);
    el.setAttribute('fx', grad.x1);
    el.setAttribute('fy', grad.y1);
    el.setAttribute('fr', grad.r1);
    el.setAttribute('cx', grad.x2);
    el.setAttribute('cy', grad.y2);
    el.setAttribute('r', grad.r2);
  } else {
    el = (0, _dom.domChild)(el, index++, 'linearGradient', ns);
    el.setAttribute('id', grad.id);
    el.setAttribute('x1', grad.x1);
    el.setAttribute('x2', grad.x2);
    el.setAttribute('y1', grad.y1);
    el.setAttribute('y2', grad.y2);
  }

  for (i = 0, n = grad.stops.length; i < n; ++i) {
    stop = (0, _dom.domChild)(el, i, 'stop', ns);
    stop.setAttribute('offset', grad.stops[i].offset);
    stop.setAttribute('stop-color', grad.stops[i].color);
  }

  (0, _dom.domClear)(el, i);
  return index;
}

function updateClipping(el, clip, index) {
  var mask;
  el = (0, _dom.domChild)(el, index, 'clipPath', ns);
  el.setAttribute('id', clip.id);

  if (clip.path) {
    mask = (0, _dom.domChild)(el, 0, 'path', ns);
    mask.setAttribute('d', clip.path);
  } else {
    mask = (0, _dom.domChild)(el, 0, 'rect', ns);
    mask.setAttribute('x', 0);
    mask.setAttribute('y', 0);
    mask.setAttribute('width', clip.width);
    mask.setAttribute('height', clip.height);
  }

  return index + 1;
}

prototype._resetDefs = function () {
  var def = this._defs;
  def.gradient = {};
  def.clipping = {};
}; // -- Manage rendering of items marked as dirty --


prototype.dirty = function (item) {
  if (item.dirty !== this._dirtyID) {
    item.dirty = this._dirtyID;

    this._dirty.push(item);
  }
};

prototype.isDirty = function (item) {
  return this._dirtyAll || !item._svg || item.dirty === this._dirtyID;
};

prototype._dirtyCheck = function () {
  this._dirtyAll = true;
  var items = this._dirty;
  if (!items.length || !this._dirtyID) return true;
  var id = ++this._dirtyID,
      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 = _index.default[type];
    }

    if (mark.zdirty && mark.dirty !== id) {
      this._dirtyAll = false;
      dirtyParents(item, id);
      mark.items.forEach(function (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;
};

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;
  }
} // -- Construct & maintain scenegraph to SVG mapping ---
// Draw a mark container.


prototype.draw = function (el, scene, prev) {
  if (!this.isDirty(scene)) return scene._svg;
  var renderer = this,
      svg = this._svg,
      mdef = _index.default[scene.marktype],
      events = scene.interactive === false ? 'none' : null,
      isGroup = mdef.tag === 'g',
      sibling = null,
      i = 0,
      parent;
  parent = bind(scene, el, prev, 'g', svg);
  parent.setAttribute('class', (0, _dom.cssClass)(scene));

  if (!isGroup) {
    parent.style.setProperty('pointer-events', events);
  }

  if (scene.clip) {
    parent.setAttribute('clip-path', (0, _clip.default)(renderer, scene, scene.group));
  } else {
    parent.removeAttribute('clip-path');
  }

  function process(item) {
    var dirty = renderer.isDirty(item),
        node = bind(item, parent, sibling, mdef.tag, svg);

    if (dirty) {
      renderer._update(mdef, node, item);

      if (isGroup) recurse(renderer, node, item);
    }

    sibling = node;
    ++i;
  }

  if (mdef.nested) {
    if (scene.items.length) process(scene.items[0]);
  } else {
    (0, _visit.visit)(scene, process);
  }

  (0, _dom.domClear)(parent, i);
  return parent;
}; // Recursively process group contents.


function recurse(renderer, el, group) {
  el = el.lastChild;
  var prev,
      idx = 0;
  (0, _visit.visit)(group, function (item) {
    prev = renderer.draw(el, item, prev);
    ++idx;
  }); // remove any extraneous DOM elements

  (0, _dom.domClear)(el, 1 + idx);
} // Bind a scenegraph item to an SVG DOM element.
// Create new SVG elements as needed.


function bind(item, el, sibling, tag, svg) {
  var node = item._svg,
      doc; // create a new dom node if needed

  if (!node) {
    doc = el.ownerDocument;
    node = (0, _dom.domCreate)(doc, tag, ns);
    item._svg = node;

    if (item.mark) {
      node.__data__ = item;
      node.__values__ = {
        fill: 'default'
      }; // if group, create background and foreground elements

      if (tag === 'g') {
        var bg = (0, _dom.domCreate)(doc, 'path', ns);
        bg.setAttribute('class', 'background');
        node.appendChild(bg);
        bg.__data__ = item;
        var fg = (0, _dom.domCreate)(doc, 'g', ns);
        node.appendChild(fg);
        fg.__data__ = item;
      }
    }
  } // (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;
}

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 ---


var element = null,
    // temp var for current SVG element
values = null; // temp var for current values hash
// Extra configuration for certain mark types

var mark_extras = {
  group: function (mdef, el, item) {
    values = el.__values__; // use parent's values hash

    element = el.childNodes[1];
    mdef.foreground(emit, item, this);
    element = el.childNodes[0];
    mdef.background(emit, item, this);
    var value = item.mark.interactive === false ? 'none' : null;

    if (value !== values.events) {
      element.style.setProperty('pointer-events', value);
      values.events = value;
    }
  },
  image: function (mdef, el, item) {
    if (item.smooth === false) {
      setStyle(el, 'image-rendering', 'optimizeSpeed');
      setStyle(el, 'image-rendering', 'pixelated');
    } else {
      setStyle(el, 'image-rendering', null);
    }
  },
  text: function (mdef, el, item) {
    var tl = (0, _text.textLines)(item),
        key,
        value,
        doc,
        lh;

    if ((0, _vegaUtil.isArray)(tl)) {
      // multi-line text
      value = tl.map(_ => (0, _text.textValue)(item, _));
      key = value.join('\n'); // content cache key

      if (key !== values.text) {
        (0, _dom.domClear)(el, 0);
        doc = el.ownerDocument;
        lh = (0, _text.lineHeight)(item);
        value.forEach((t, i) => {
          const ts = (0, _dom.domCreate)(doc, 'tspan', ns);
          ts.__data__ = item; // data binding

          ts.textContent = t;

          if (i) {
            ts.setAttribute('x', 0);
            ts.setAttribute('dy', lh);
          }

          el.appendChild(ts);
        });
        values.text = key;
      }
    } else {
      // single-line text
      value = (0, _text.textValue)(item, tl);

      if (value !== values.text) {
        el.textContent = value;
        values.text = value;
      }
    }

    setStyle(el, 'font-family', (0, _text.fontFamily)(item));
    setStyle(el, 'font-size', (0, _text.fontSize)(item) + 'px');
    setStyle(el, 'font-style', item.fontStyle);
    setStyle(el, 'font-variant', item.fontVariant);
    setStyle(el, 'font-weight', item.fontWeight);
  }
};

function setStyle(el, name, value) {
  if (value !== values[name]) {
    if (value == null) {
      el.style.removeProperty(name);
    } else {
      el.style.setProperty(name, value + '');
    }

    values[name] = value;
  }
}

prototype._update = function (mdef, el, item) {
  // set dom element and values cache
  // provides access to emit method
  element = el;
  values = el.__values__; // apply svg attributes

  mdef.attr(emit, item, this); // some marks need special treatment

  var extra = mark_extras[mdef.type];
  if (extra) extra.call(this, mdef, el, item); // apply svg css styles
  // note: element may be modified by 'extra' method

  this.style(element, item);
};

function emit(name, value, ns) {
  // early exit if value is unchanged
  if (value === values[name]) return;

  if (value != null) {
    // if value is provided, update DOM attribute
    if (ns) {
      element.setAttributeNS(ns, name, value);
    } else {
      element.setAttribute(name, value);
    }
  } else {
    // else remove DOM attribute
    if (ns) {
      element.removeAttributeNS(ns, name);
    } else {
      element.removeAttribute(name);
    }
  } // note current value for future comparison


  values[name] = value;
}

prototype.style = function (el, o) {
  if (o == null) return;
  var i, n, prop, name, value;

  for (i = 0, n = _styles.styleProperties.length; i < n; ++i) {
    prop = _styles.styleProperties[i];
    value = o[prop];

    if (prop === 'font') {
      value = (0, _text.fontFamily)(o);
    }

    if (value === values[prop]) continue;
    name = _styles.styles[prop];

    if (value == null) {
      if (name === 'fill') {
        el.style.setProperty(name, 'none');
      } else {
        el.style.removeProperty(name);
      }
    } else {
      if ((0, _Gradient.isGradient)(value)) {
        value = (0, _Gradient.gradientRef)(value, this._defs.gradient, href());
      }

      el.style.setProperty(name, value + '');
    }

    values[prop] = value;
  }
};

function href() {
  var loc;
  return typeof window === 'undefined' ? '' : (loc = window.location).hash ? loc.href.slice(0, -loc.hash.length) : loc.href;
}
},{"./Renderer":"N37r","./Gradient":"wQA6","./marks/index":"frXo","./util/dom":"ZOTg","./util/tags":"OrBP","./util/text":"MaAN","./util/visit":"yR2m","./util/svg/clip":"qlu9","./util/svg/metadata":"pUwC","./util/svg/styles":"fOMh","vega-util":"dejJ","process":"r7L2"}],"M2kq":[function(require,module,exports) {
var process = require("process");
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = SVGStringRenderer;

var _Renderer = _interopRequireDefault(require("./Renderer"));

var _Gradient = require("./Gradient");

var _index = _interopRequireDefault(require("./marks/index"));

var _dom = require("./util/dom");

var _tags = require("./util/tags");

var _text = require("./util/text");

var _visit = require("./util/visit");

var _clip = _interopRequireDefault(require("./util/svg/clip"));

var _metadata = _interopRequireDefault(require("./util/svg/metadata"));

var _styles = require("./util/svg/styles");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function SVGStringRenderer(loader) {
  _Renderer.default.call(this, loader);

  this._text = {
    head: '',
    bg: '',
    root: '',
    foot: '',
    defs: '',
    body: ''
  };
  this._defs = {
    gradient: {},
    clipping: {}
  };
}

var prototype = (0, _vegaUtil.inherits)(SVGStringRenderer, _Renderer.default);
var base = _Renderer.default.prototype;

prototype.resize = function (width, height, origin, scaleFactor) {
  base.resize.call(this, width, height, origin, scaleFactor);
  var o = this._origin,
      t = this._text;
  var attr = {
    class: 'marks',
    width: this._width * this._scale,
    height: this._height * this._scale,
    viewBox: '0 0 ' + this._width + ' ' + this._height
  };

  for (var key in _metadata.default) {
    attr[key] = _metadata.default[key];
  }

  t.head = (0, _tags.openTag)('svg', attr);
  var bg = this._bgcolor;
  if (bg === 'transparent' || bg === 'none') bg = null;

  if (bg) {
    t.bg = (0, _tags.openTag)('rect', {
      width: this._width,
      height: this._height,
      style: 'fill: ' + bg + ';'
    }) + (0, _tags.closeTag)('rect');
  } else {
    t.bg = '';
  }

  t.root = (0, _tags.openTag)('g', {
    transform: 'translate(' + o + ')'
  });
  t.foot = (0, _tags.closeTag)('g') + (0, _tags.closeTag)('svg');
  return this;
};

prototype.background = function () {
  var rv = base.background.apply(this, arguments);

  if (arguments.length && this._text.head) {
    this.resize(this._width, this._height, this._origin, this._scale);
  }

  return rv;
};

prototype.svg = function () {
  var t = this._text;
  return t.head + t.bg + t.defs + t.root + t.body + t.foot;
};

prototype._render = function (scene) {
  this._text.body = this.mark(scene);
  this._text.defs = this.buildDefs();
  return this;
};

prototype.buildDefs = function () {
  var all = this._defs,
      defs = '',
      i,
      id,
      def,
      tag,
      stops;

  for (id in all.gradient) {
    def = all.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.
      // So we wrap the radial gradient in a pattern element, allowing us
      // to mantain a circular gradient that matches what canvas provides.
      defs += (0, _tags.openTag)(tag = 'pattern', {
        id: _Gradient.patternPrefix + id,
        viewBox: '0,0,1,1',
        width: '100%',
        height: '100%',
        preserveAspectRatio: 'xMidYMid slice'
      });
      defs += (0, _tags.openTag)('rect', {
        width: '1',
        height: '1',
        fill: 'url(#' + id + ')'
      }) + (0, _tags.closeTag)('rect');
      defs += (0, _tags.closeTag)(tag);
      defs += (0, _tags.openTag)(tag = 'radialGradient', {
        id: id,
        fx: def.x1,
        fy: def.y1,
        fr: def.r1,
        cx: def.x2,
        cy: def.y2,
        r: def.r2
      });
    } else {
      defs += (0, _tags.openTag)(tag = 'linearGradient', {
        id: id,
        x1: def.x1,
        x2: def.x2,
        y1: def.y1,
        y2: def.y2
      });
    }

    for (i = 0; i < stops.length; ++i) {
      defs += (0, _tags.openTag)('stop', {
        offset: stops[i].offset,
        'stop-color': stops[i].color
      }) + (0, _tags.closeTag)('stop');
    }

    defs += (0, _tags.closeTag)(tag);
  }

  for (id in all.clipping) {
    def = all.clipping[id];
    defs += (0, _tags.openTag)('clipPath', {
      id: id
    });

    if (def.path) {
      defs += (0, _tags.openTag)('path', {
        d: def.path
      }) + (0, _tags.closeTag)('path');
    } else {
      defs += (0, _tags.openTag)('rect', {
        x: 0,
        y: 0,
        width: def.width,
        height: def.height
      }) + (0, _tags.closeTag)('rect');
    }

    defs += (0, _tags.closeTag)('clipPath');
  }

  return defs.length > 0 ? (0, _tags.openTag)('defs') + defs + (0, _tags.closeTag)('defs') : '';
};

var object;

function emit(name, value, ns, prefixed) {
  object[prefixed || name] = value;
}

prototype.attributes = function (attr, item) {
  object = {};
  attr(emit, item, this);
  return object;
};

prototype.href = function (item) {
  var that = this,
      href = item.href,
      attr;

  if (href) {
    if (attr = that._hrefs && that._hrefs[href]) {
      return attr;
    } else {
      that.sanitizeURL(href).then(function (attr) {
        // rewrite to use xlink namespace
        // note that this will be deprecated in SVG 2.0
        attr['xlink:href'] = attr.href;
        attr.href = null;
        (that._hrefs || (that._hrefs = {}))[href] = attr;
      });
    }
  }

  return null;
};

prototype.mark = function (scene) {
  var renderer = this,
      mdef = _index.default[scene.marktype],
      tag = mdef.tag,
      defs = this._defs,
      str = '',
      style;

  if (tag !== 'g' && scene.interactive === false) {
    style = 'style="pointer-events: none;"';
  } // render opening group tag


  str += (0, _tags.openTag)('g', {
    'class': (0, _dom.cssClass)(scene),
    'clip-path': scene.clip ? (0, _clip.default)(renderer, scene, scene.group) : null
  }, style); // render contained elements

  function process(item) {
    var href = renderer.href(item);
    if (href) str += (0, _tags.openTag)('a', href);
    style = tag !== 'g' ? applyStyles(item, scene, tag, defs) : null;
    str += (0, _tags.openTag)(tag, renderer.attributes(mdef.attr, item), style);

    if (tag === 'text') {
      const tl = (0, _text.textLines)(item);

      if ((0, _vegaUtil.isArray)(tl)) {
        // multi-line text
        const attrs = {
          x: 0,
          dy: (0, _text.lineHeight)(item)
        };

        for (let i = 0; i < tl.length; ++i) {
          str += (0, _tags.openTag)('tspan', i ? attrs : null) + escape_text((0, _text.textValue)(item, tl[i])) + (0, _tags.closeTag)('tspan');
        }
      } else {
        // single-line text
        str += escape_text((0, _text.textValue)(item, tl));
      }
    } else if (tag === 'g') {
      str += (0, _tags.openTag)('path', renderer.attributes(mdef.background, item), applyStyles(item, scene, 'bgrect', defs)) + (0, _tags.closeTag)('path');
      str += (0, _tags.openTag)('g', renderer.attributes(mdef.foreground, item)) + renderer.markGroup(item) + (0, _tags.closeTag)('g');
    }

    str += (0, _tags.closeTag)(tag);
    if (href) str += (0, _tags.closeTag)('a');
  }

  if (mdef.nested) {
    if (scene.items && scene.items.length) process(scene.items[0]);
  } else {
    (0, _visit.visit)(scene, process);
  } // render closing group tag


  return str + (0, _tags.closeTag)('g');
};

prototype.markGroup = function (scene) {
  var renderer = this,
      str = '';
  (0, _visit.visit)(scene, function (item) {
    str += renderer.mark(item);
  });
  return str;
};

function applyStyles(o, mark, tag, defs) {
  if (o == null) return '';
  var i,
      n,
      prop,
      name,
      value,
      s = '';

  if (tag === 'bgrect' && mark.interactive === false) {
    s += 'pointer-events: none; ';
  }

  if (tag === 'image') {
    if (o.smooth === false) {
      s += 'image-rendering: optimizeSpeed; image-rendering: pixelated; ';
    }
  }

  if (tag === 'text') {
    s += 'font-family: ' + (0, _text.fontFamily)(o) + '; ';
    s += 'font-size: ' + (0, _text.fontSize)(o) + 'px; ';
    if (o.fontStyle) s += 'font-style: ' + o.fontStyle + '; ';
    if (o.fontVariant) s += 'font-variant: ' + o.fontVariant + '; ';
    if (o.fontWeight) s += 'font-weight: ' + o.fontWeight + '; ';
  }

  for (i = 0, n = _styles.styleProperties.length; i < n; ++i) {
    prop = _styles.styleProperties[i];
    name = _styles.styles[prop];
    value = o[prop];

    if (value == null) {
      if (name === 'fill') {
        s += 'fill: none; ';
      }
    } else if (value === 'transparent' && (name === 'fill' || name === 'stroke')) {
      // transparent is not a legal SVG value, so map to none instead
      s += name + ': none; ';
    } else {
      if ((0, _Gradient.isGradient)(value)) {
        value = (0, _Gradient.gradientRef)(value, defs.gradient, '');
      }

      s += name + ': ' + value + '; ';
    }
  }

  return s ? 'style="' + s.trim() + '"' : null;
}

function escape_text(s) {
  return s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
}
},{"./Renderer":"N37r","./Gradient":"wQA6","./marks/index":"frXo","./util/dom":"ZOTg","./util/tags":"OrBP","./util/text":"MaAN","./util/visit":"yR2m","./util/svg/clip":"qlu9","./util/svg/metadata":"pUwC","./util/svg/styles":"fOMh","vega-util":"dejJ","process":"r7L2"}],"DjSB":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.renderModule = renderModule;
exports.RenderType = void 0;

var _CanvasHandler = _interopRequireDefault(require("./CanvasHandler"));

var _CanvasRenderer = _interopRequireDefault(require("./CanvasRenderer"));

var _SVGHandler = _interopRequireDefault(require("./SVGHandler"));

var _SVGRenderer = _interopRequireDefault(require("./SVGRenderer"));

var _SVGStringRenderer = _interopRequireDefault(require("./SVGStringRenderer"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Canvas = 'canvas';
var PNG = 'png';
var SVG = 'svg';
var None = 'none';
var RenderType = {
  Canvas: Canvas,
  PNG: PNG,
  SVG: SVG,
  None: None
};
exports.RenderType = RenderType;
var modules = {};
modules[Canvas] = modules[PNG] = {
  renderer: _CanvasRenderer.default,
  headless: _CanvasRenderer.default,
  handler: _CanvasHandler.default
};
modules[SVG] = {
  renderer: _SVGRenderer.default,
  headless: _SVGStringRenderer.default,
  handler: _SVGHandler.default
};
modules[None] = {};

function renderModule(name, _) {
  name = String(name || '').toLowerCase();

  if (arguments.length > 1) {
    modules[name] = _;
    return this;
  } else {
    return modules[name];
  }
}
},{"./CanvasHandler":"P3dF","./CanvasRenderer":"Rdu2","./SVGHandler":"MQXA","./SVGRenderer":"DBYw","./SVGStringRenderer":"M2kq"}],"Zloa":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.intersect = intersect;

var _index = _interopRequireDefault(require("./marks/index"));

var _vegaUtil = require("vega-util");

var _Bounds = _interopRequireDefault(require("./Bounds"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function intersect(scene, bounds, filter) {
  const hits = [],
        // intersection results
  box = new _Bounds.default().union(bounds),
        // defensive copy
  type = scene.marktype;
  return type ? intersectMark(scene, box, filter, hits) : type === 'group' ? intersectGroup(scene, box, filter, hits) : (0, _vegaUtil.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 = _index.default[type].isect; i < n; ++i) {
        let 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, _index.default.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);
}
},{"./marks/index":"frXo","vega-util":"dejJ","./Bounds":"pVXN"}],"M5bY":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _Bounds = _interopRequireDefault(require("../Bounds"));

var _boundContext = _interopRequireDefault(require("./boundContext"));

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var clipBounds = new _Bounds.default();

function _default(mark) {
  var clip = mark.clip;

  if ((0, _vegaUtil.isFunction)(clip)) {
    clip((0, _boundContext.default)(clipBounds.clear()));
  } else if (clip) {
    clipBounds.set(0, 0, mark.group.width, mark.group.height);
  } else return;

  mark.bounds.intersect(clipBounds);
}
},{"../Bounds":"pVXN","./boundContext":"aOFJ","vega-util":"dejJ"}],"UnCT":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.sceneEqual = sceneEqual;
exports.pathEqual = pathEqual;

var _parse = _interopRequireDefault(require("../path/parse"));

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var 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 : (0, _vegaUtil.isNumber)(a) && (0, _vegaUtil.isNumber)(b) ? Math.abs(a - b) <= TOLERANCE : !a || !b || !(0, _vegaUtil.isObject)(a) && !(0, _vegaUtil.isObject)(b) ? a == b : a == null || b == null ? false : objectEqual(a, b);
}

function pathEqual(a, b) {
  return sceneEqual((0, _parse.default)(a), (0, _parse.default)(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;
}
},{"../path/parse":"sx1S","vega-util":"dejJ"}],"rKdC":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "Bounds", {
  enumerable: true,
  get: function () {
    return _Bounds.default;
  }
});
Object.defineProperty(exports, "Gradient", {
  enumerable: true,
  get: function () {
    return _Gradient.default;
  }
});
Object.defineProperty(exports, "GroupItem", {
  enumerable: true,
  get: function () {
    return _GroupItem.default;
  }
});
Object.defineProperty(exports, "ResourceLoader", {
  enumerable: true,
  get: function () {
    return _ResourceLoader.default;
  }
});
Object.defineProperty(exports, "Item", {
  enumerable: true,
  get: function () {
    return _Item.default;
  }
});
Object.defineProperty(exports, "Scenegraph", {
  enumerable: true,
  get: function () {
    return _Scenegraph.default;
  }
});
Object.defineProperty(exports, "Handler", {
  enumerable: true,
  get: function () {
    return _Handler.default;
  }
});
Object.defineProperty(exports, "Renderer", {
  enumerable: true,
  get: function () {
    return _Renderer.default;
  }
});
Object.defineProperty(exports, "CanvasHandler", {
  enumerable: true,
  get: function () {
    return _CanvasHandler.default;
  }
});
Object.defineProperty(exports, "CanvasRenderer", {
  enumerable: true,
  get: function () {
    return _CanvasRenderer.default;
  }
});
Object.defineProperty(exports, "SVGHandler", {
  enumerable: true,
  get: function () {
    return _SVGHandler.default;
  }
});
Object.defineProperty(exports, "SVGRenderer", {
  enumerable: true,
  get: function () {
    return _SVGRenderer.default;
  }
});
Object.defineProperty(exports, "SVGStringRenderer", {
  enumerable: true,
  get: function () {
    return _SVGStringRenderer.default;
  }
});
Object.defineProperty(exports, "RenderType", {
  enumerable: true,
  get: function () {
    return _modules.RenderType;
  }
});
Object.defineProperty(exports, "renderModule", {
  enumerable: true,
  get: function () {
    return _modules.renderModule;
  }
});
Object.defineProperty(exports, "intersect", {
  enumerable: true,
  get: function () {
    return _intersect.intersect;
  }
});
Object.defineProperty(exports, "Marks", {
  enumerable: true,
  get: function () {
    return _index.default;
  }
});
Object.defineProperty(exports, "boundClip", {
  enumerable: true,
  get: function () {
    return _boundClip.default;
  }
});
Object.defineProperty(exports, "boundContext", {
  enumerable: true,
  get: function () {
    return _boundContext.default;
  }
});
Object.defineProperty(exports, "boundStroke", {
  enumerable: true,
  get: function () {
    return _boundStroke.default;
  }
});
Object.defineProperty(exports, "boundItem", {
  enumerable: true,
  get: function () {
    return _boundItem.default;
  }
});
Object.defineProperty(exports, "boundMark", {
  enumerable: true,
  get: function () {
    return _boundMark.default;
  }
});
Object.defineProperty(exports, "pathCurves", {
  enumerable: true,
  get: function () {
    return _curves.default;
  }
});
Object.defineProperty(exports, "pathSymbols", {
  enumerable: true,
  get: function () {
    return _symbols.default;
  }
});
Object.defineProperty(exports, "pathRectangle", {
  enumerable: true,
  get: function () {
    return _rectangle.default;
  }
});
Object.defineProperty(exports, "pathTrail", {
  enumerable: true,
  get: function () {
    return _trail.default;
  }
});
Object.defineProperty(exports, "pathParse", {
  enumerable: true,
  get: function () {
    return _parse.default;
  }
});
Object.defineProperty(exports, "pathRender", {
  enumerable: true,
  get: function () {
    return _render.default;
  }
});
Object.defineProperty(exports, "point", {
  enumerable: true,
  get: function () {
    return _point.default;
  }
});
Object.defineProperty(exports, "domCreate", {
  enumerable: true,
  get: function () {
    return _dom.domCreate;
  }
});
Object.defineProperty(exports, "domFind", {
  enumerable: true,
  get: function () {
    return _dom.domFind;
  }
});
Object.defineProperty(exports, "domChild", {
  enumerable: true,
  get: function () {
    return _dom.domChild;
  }
});
Object.defineProperty(exports, "domClear", {
  enumerable: true,
  get: function () {
    return _dom.domClear;
  }
});
Object.defineProperty(exports, "openTag", {
  enumerable: true,
  get: function () {
    return _tags.openTag;
  }
});
Object.defineProperty(exports, "closeTag", {
  enumerable: true,
  get: function () {
    return _tags.closeTag;
  }
});
Object.defineProperty(exports, "font", {
  enumerable: true,
  get: function () {
    return _text.font;
  }
});
Object.defineProperty(exports, "fontFamily", {
  enumerable: true,
  get: function () {
    return _text.fontFamily;
  }
});
Object.defineProperty(exports, "fontSize", {
  enumerable: true,
  get: function () {
    return _text.fontSize;
  }
});
Object.defineProperty(exports, "lineHeight", {
  enumerable: true,
  get: function () {
    return _text.lineHeight;
  }
});
Object.defineProperty(exports, "multiLineOffset", {
  enumerable: true,
  get: function () {
    return _text.multiLineOffset;
  }
});
Object.defineProperty(exports, "textMetrics", {
  enumerable: true,
  get: function () {
    return _text.textMetrics;
  }
});
Object.defineProperty(exports, "resetSVGClipId", {
  enumerable: true,
  get: function () {
    return _clip.resetSVGClipId;
  }
});
Object.defineProperty(exports, "sceneEqual", {
  enumerable: true,
  get: function () {
    return _equal.sceneEqual;
  }
});
Object.defineProperty(exports, "pathEqual", {
  enumerable: true,
  get: function () {
    return _equal.pathEqual;
  }
});
Object.defineProperty(exports, "sceneToJSON", {
  enumerable: true,
  get: function () {
    return _serialize.sceneToJSON;
  }
});
Object.defineProperty(exports, "sceneFromJSON", {
  enumerable: true,
  get: function () {
    return _serialize.sceneFromJSON;
  }
});
Object.defineProperty(exports, "intersectPath", {
  enumerable: true,
  get: function () {
    return _intersect2.intersectPath;
  }
});
Object.defineProperty(exports, "intersectPoint", {
  enumerable: true,
  get: function () {
    return _intersect2.intersectPoint;
  }
});
Object.defineProperty(exports, "intersectRule", {
  enumerable: true,
  get: function () {
    return _intersect2.intersectRule;
  }
});
Object.defineProperty(exports, "intersectBoxLine", {
  enumerable: true,
  get: function () {
    return _intersect2.intersectBoxLine;
  }
});
Object.defineProperty(exports, "sceneZOrder", {
  enumerable: true,
  get: function () {
    return _visit.zorder;
  }
});
Object.defineProperty(exports, "sceneVisit", {
  enumerable: true,
  get: function () {
    return _visit.visit;
  }
});
Object.defineProperty(exports, "scenePickVisit", {
  enumerable: true,
  get: function () {
    return _visit.pickVisit;
  }
});

var _Bounds = _interopRequireDefault(require("./src/Bounds"));

var _Gradient = _interopRequireDefault(require("./src/Gradient"));

var _GroupItem = _interopRequireDefault(require("./src/GroupItem"));

var _ResourceLoader = _interopRequireDefault(require("./src/ResourceLoader"));

var _Item = _interopRequireDefault(require("./src/Item"));

var _Scenegraph = _interopRequireDefault(require("./src/Scenegraph"));

var _Handler = _interopRequireDefault(require("./src/Handler"));

var _Renderer = _interopRequireDefault(require("./src/Renderer"));

var _CanvasHandler = _interopRequireDefault(require("./src/CanvasHandler"));

var _CanvasRenderer = _interopRequireDefault(require("./src/CanvasRenderer"));

var _SVGHandler = _interopRequireDefault(require("./src/SVGHandler"));

var _SVGRenderer = _interopRequireDefault(require("./src/SVGRenderer"));

var _SVGStringRenderer = _interopRequireDefault(require("./src/SVGStringRenderer"));

var _modules = require("./src/modules");

var _intersect = require("./src/intersect");

var _index = _interopRequireDefault(require("./src/marks/index"));

var _boundClip = _interopRequireDefault(require("./src/bound/boundClip"));

var _boundContext = _interopRequireDefault(require("./src/bound/boundContext"));

var _boundStroke = _interopRequireDefault(require("./src/bound/boundStroke"));

var _boundItem = _interopRequireDefault(require("./src/bound/boundItem"));

var _boundMark = _interopRequireDefault(require("./src/bound/boundMark"));

var _curves = _interopRequireDefault(require("./src/path/curves"));

var _symbols = _interopRequireDefault(require("./src/path/symbols"));

var _rectangle = _interopRequireDefault(require("./src/path/rectangle"));

var _trail = _interopRequireDefault(require("./src/path/trail"));

var _parse = _interopRequireDefault(require("./src/path/parse"));

var _render = _interopRequireDefault(require("./src/path/render"));

var _point = _interopRequireDefault(require("./src/util/point"));

var _dom = require("./src/util/dom");

var _tags = require("./src/util/tags");

var _text = require("./src/util/text");

var _clip = require("./src/util/svg/clip");

var _equal = require("./src/util/equal");

var _serialize = require("./src/util/serialize");

var _intersect2 = require("./src/util/intersect");

var _visit = require("./src/util/visit");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./src/Bounds":"pVXN","./src/Gradient":"wQA6","./src/GroupItem":"pDd9","./src/ResourceLoader":"eoqI","./src/Item":"JYN2","./src/Scenegraph":"zJ1R","./src/Handler":"Q1a6","./src/Renderer":"N37r","./src/CanvasHandler":"P3dF","./src/CanvasRenderer":"Rdu2","./src/SVGHandler":"MQXA","./src/SVGRenderer":"DBYw","./src/SVGStringRenderer":"M2kq","./src/modules":"DjSB","./src/intersect":"Zloa","./src/marks/index":"frXo","./src/bound/boundClip":"M5bY","./src/bound/boundContext":"aOFJ","./src/bound/boundStroke":"XdKX","./src/bound/boundItem":"WKKT","./src/bound/boundMark":"TxR0","./src/path/curves":"zdzo","./src/path/symbols":"HfTC","./src/path/rectangle":"sfl0","./src/path/trail":"yEsc","./src/path/parse":"sx1S","./src/path/render":"AiV4","./src/util/point":"EUXH","./src/util/dom":"ZOTg","./src/util/tags":"OrBP","./src/util/text":"MaAN","./src/util/svg/clip":"qlu9","./src/util/equal":"UnCT","./src/util/serialize":"a1RV","./src/util/intersect":"ALsM","./src/util/visit":"yR2m"}],"HSCB":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Bound;

var _constants = require("./constants");

var _vegaDataflow = require("vega-dataflow");

var _vegaScenegraph = require("vega-scenegraph");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.Transform.call(this, null, params);
}

var prototype = (0, _vegaUtil.inherits)(Bound, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var view = pulse.dataflow,
      mark = _.mark,
      type = mark.marktype,
      entry = _vegaScenegraph.Marks[type],
      bound = entry.bound,
      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 = boundItem(mark, bound);
    mark.items.forEach(function (item) {
      item.bounds.clear().union(markBounds);
    });
  } else if (type === _constants.Group || _.modified()) {
    // operator parameters modified -> re-bound all items
    // updates group bounds in response to modified group content
    pulse.visit(pulse.MOD, function (item) {
      view.dirty(item);
    });
    markBounds.clear();
    mark.items.forEach(function (item) {
      markBounds.union(boundItem(item, bound));
    }); // force reflow for axes/legends/titles to propagate any layout changes

    switch (mark.role) {
      case _constants.AxisRole:
      case _constants.LegendRole:
      case _constants.TitleRole:
        pulse.reflow();
    }
  } else {
    // incrementally update bounds, re-bound mark as needed
    rebound = pulse.changed(pulse.REM);
    pulse.visit(pulse.ADD, function (item) {
      markBounds.union(boundItem(item, bound));
    });
    pulse.visit(pulse.MOD, function (item) {
      rebound = rebound || markBounds.alignsWith(item.bounds);
      view.dirty(item);
      markBounds.union(boundItem(item, bound));
    });

    if (rebound) {
      markBounds.clear();
      mark.items.forEach(function (item) {
        markBounds.union(item.bounds);
      });
    }
  } // ensure mark bounds do not exceed any clipping region


  (0, _vegaScenegraph.boundClip)(mark);
  return pulse.modifies('bounds');
};

function boundItem(item, bound, opt) {
  return bound(item.bounds.clear(), item, opt);
}
},{"./constants":"NhYQ","vega-dataflow":"UC8n","vega-scenegraph":"rKdC","vega-util":"dejJ"}],"VPd6":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Identifier;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

var 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 Identifier(params) {
  _vegaDataflow.Transform.call(this, 0, params);
}

Identifier.Definition = {
  "type": "Identifier",
  "metadata": {
    "modifies": true
  },
  "params": [{
    "name": "as",
    "type": "string",
    "required": true
  }]
};
var prototype = (0, _vegaUtil.inherits)(Identifier, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var counter = getCounter(pulse.dataflow),
      id = counter.value,
      as = _.as;
  pulse.visit(pulse.ADD, function (t) {
    if (!t[as]) t[as] = ++id;
  });
  counter.set(this.value = id);
  return pulse;
};

function getCounter(view) {
  var counter = view._signals[COUNTER_NAME];

  if (!counter) {
    view._signals[COUNTER_NAME] = counter = view.add(0);
  }

  return counter;
}
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"P39j":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Mark;

var _constants = require("./constants");

var _vegaDataflow = require("vega-dataflow");

var _vegaScenegraph = require("vega-scenegraph");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.Transform.call(this, null, params);
}

var prototype = (0, _vegaUtil.inherits)(Mark, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var mark = this.value; // acquire mark on first invocation, bind context and group

  if (!mark) {
    mark = pulse.dataflow.scenegraph().mark(_.markdef, 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


  var Init = mark.marktype === _constants.Group ? _vegaScenegraph.GroupItem : _vegaScenegraph.Item;
  pulse.visit(pulse.ADD, function (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 lookup(_) {
  var g = _.groups,
      p = _.parent;
  return g && g.size === 1 ? g.get(Object.keys(g.object)[0]) : g && p ? g.lookup(p) : null;
}
},{"./constants":"NhYQ","vega-dataflow":"UC8n","vega-scenegraph":"rKdC","vega-util":"dejJ"}],"ylEA":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Overlap;

var _constants = require("./constants");

var _vegaDataflow = require("vega-dataflow");

var _vegaScenegraph = require("vega-scenegraph");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.Transform.call(this, null, params);
}

var prototype = (0, _vegaUtil.inherits)(Overlap, _vegaDataflow.Transform);
var methods = {
  parity: function (items) {
    return items.filter((item, i) => i % 2 ? item.opacity = 0 : 1);
  },
  greedy: function (items, sep) {
    var a;
    return items.filter((b, i) => {
      if (!i || !intersect(a.bounds, b.bounds, sep)) {
        a = b;
        return 1;
      } else {
        return b.opacity = 0;
      }
    });
  }
}; // compute bounding box intersection
// including padding pixels of separation

function intersect(a, b, sep) {
  return sep > Math.max(b.x1 - a.x2, a.x1 - b.x2, b.y1 - a.y2, a.y1 - b.y2);
}

function hasOverlap(items, pad) {
  for (var i = 1, n = items.length, a = items[0].bounds, b; i < n; a = b, ++i) {
    if (intersect(a, b = items[i].bounds, pad)) return true;
  }
}

function hasBounds(item) {
  var b = item.bounds;
  return b.width() > 1 && b.height() > 1;
}

function boundTest(scale, orient, tolerance) {
  var range = scale.range(),
      b = new _vegaScenegraph.Bounds();

  if (orient === _constants.Top || orient === _constants.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


function 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)


function reflow(pulse, _) {
  return pulse.reflow(_.modified()).modifies('opacity');
}

prototype.transform = function (_, pulse) {
  var reduce = methods[_.method] || methods.parity,
      source = pulse.materialize(pulse.SOURCE).source,
      sep = _.separation || 0,
      items,
      test,
      bounds;
  if (!source || !source.length) return;

  if (!_.method) {
    // early exit if method is falsy
    if (_.modified('method')) {
      reset(source);
      pulse = reflow(pulse, _);
    }

    return pulse;
  }

  if (_.sort) {
    source = source.slice().sort(_.sort);
  } // skip labels with no content


  source = source.filter(hasBounds);
  items = reset(source);
  pulse = 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 && !(0, _vegaUtil.peek)(source).opacity) {
      if (items.length > 1) (0, _vegaUtil.peek)(items).opacity = 0;
      (0, _vegaUtil.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


  bounds = items[0].mark.bounds.clear();
  source.forEach(item => {
    if (item.opacity) bounds.union(item.bounds);
  });
  return pulse;
};
},{"./constants":"NhYQ","vega-dataflow":"UC8n","vega-scenegraph":"rKdC","vega-util":"dejJ"}],"eYJB":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Render;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * Queue modified scenegraph items for rendering.
 * @constructor
 */
function Render(params) {
  _vegaDataflow.Transform.call(this, null, params);
}

var prototype = (0, _vegaUtil.inherits)(Render, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var view = pulse.dataflow;
  pulse.visit(pulse.ALL, function (item) {
    view.dirty(item);
  }); // set z-index dirty flag as needed

  if (pulse.fields && pulse.fields['zindex']) {
    var item = pulse.source && pulse.source[0];
    if (item) item.mark.zdirty = true;
  }
};
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"iHjl":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.set = set;
exports.tempBounds = void 0;

var _vegaScenegraph = require("vega-scenegraph");

const tempBounds = new _vegaScenegraph.Bounds();
exports.tempBounds = tempBounds;

function set(item, property, value) {
  return item[property] === value ? 0 : (item[property] = value, 1);
}
},{"vega-scenegraph":"rKdC"}],"vt7u":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.isYAxis = isYAxis;
exports.axisLayout = axisLayout;

var _constants = require("../constants");

var _util = require("./util");

var _vegaScenegraph = require("vega-scenegraph");

function isYAxis(mark) {
  var orient = mark.items[0].datum.orient;
  return orient === _constants.Left || orient === _constants.Right;
}

function axisIndices(datum) {
  var 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,
      orient = datum.orient,
      delta = datum.translate != null ? datum.translate : 0.5,
      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 && (0, _vegaScenegraph.multiLineOffset)(title),
      x = 0,
      y = 0,
      i,
      s;

  _util.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 _constants.Top:
      x = position || 0;
      y = -offset;
      s = Math.max(minExtent, Math.min(maxExtent, -bounds.y1));
      if (title) s = axisTitleLayout(view, title, s, titlePadding, dl, 0, -1, bounds);
      bounds.add(0, -s).add(range, 0);
      break;

    case _constants.Left:
      x = -offset;
      y = position || 0;
      s = Math.max(minExtent, Math.min(maxExtent, -bounds.x1));
      if (title) s = axisTitleLayout(view, title, s, titlePadding, dl, 1, -1, bounds);
      bounds.add(-s, 0).add(0, range);
      break;

    case _constants.Right:
      x = width + offset;
      y = position || 0;
      s = Math.max(minExtent, Math.min(maxExtent, bounds.x2));
      if (title) s = axisTitleLayout(view, title, s, titlePadding, dl, 1, 1, bounds);
      bounds.add(0, 0).add(s, range);
      break;

    case _constants.Bottom:
      x = position || 0;
      y = height + offset;
      s = Math.max(minExtent, Math.min(maxExtent, bounds.y2));
      if (title) s = axisTitleLayout(view, title, s, titlePadding, 0, 0, 1, bounds);
      bounds.add(0, 0).add(range, s);
      break;

    default:
      x = item.x;
      y = item.y;
  } // update bounds


  (0, _vegaScenegraph.boundStroke)(bounds.translate(x, y), item);

  if ((0, _util.set)(item, 'x', x + delta) | (0, _util.set)(item, 'y', y + delta)) {
    item.bounds = _util.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) {
  var b = title.bounds,
      dx = 0,
      dy = 0;

  if (title.auto) {
    view.dirty(title);
    offset += pad;
    isYAxis ? dx = (title.x || 0) - (title.x = sign * (offset + dl)) : dy = (title.y || 0) - (title.y = sign * (offset + dl));
    title.mark.bounds.clear().union(b.translate(-dx, -dy));
    view.dirty(title);

    if (isYAxis) {
      bounds.add(0, b.y1).add(0, b.y2);
      offset += b.width();
    } else {
      bounds.add(b.x1, 0).add(b.x2, 0);
      offset += b.height();
    }
  } else {
    bounds.union(b);
  }

  return offset;
}
},{"../constants":"NhYQ","./util":"iHjl","vega-scenegraph":"rKdC"}],"zcC7":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.gridLayout = gridLayout;
exports.trellisLayout = trellisLayout;

var _constants = require("../constants");

var _util = require("./util");

var _vegaScenegraph = require("vega-scenegraph");

var _vegaUtil = require("vega-util");

function gridLayoutGroups(group) {
  var groups = group.items,
      n = groups.length,
      i = 0,
      mark,
      items;
  var 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 === _constants.Group) {
      switch (mark.role) {
        case _constants.AxisRole:
        case _constants.LegendRole:
        case _constants.TitleRole:
          break;

        case _constants.RowHeader:
          views.rowheaders.push(...items);
          break;

        case _constants.RowFooter:
          views.rowfooters.push(...items);
          break;

        case _constants.ColHeader:
          views.colheaders.push(...items);
          break;

        case _constants.ColFooter:
          views.colfooters.push(...items);
          break;

        case _constants.RowTitle:
          views.rowtitle = items[0];
          break;

        case _constants.ColTitle:
          views.coltitle = items[0];
          break;

        default:
          views.marks.push(...items);
      }
    }
  }

  return views;
}

function bboxFlush(item) {
  return new _vegaScenegraph.Bounds().set(0, 0, item.width || 0, item.height || 0);
}

function bboxFull(item) {
  var b = item.bounds.clone();
  return b.empty() ? b.set(0, 0, 0, 0) : b.translate(-(item.x || 0), -(item.y || 0));
}

function get(opt, key, d) {
  var v = (0, _vegaUtil.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 === _constants.Flush ? bboxFlush : bboxFull,
      bounds = _util.tempBounds.set(0, 0, 0, 0),
      alignCol = get(opt.align, _constants.Column),
      alignRow = get(opt.align, _constants.Row),
      padCol = get(opt.padding, _constants.Column),
      padRow = get(opt.padding, _constants.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 === _constants.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 === _constants.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 === _constants.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 === _constants.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 && get(opt.center, _constants.Column) && nrows > 1) {
    for (i = 0; i < n; ++i) {
      b = alignCol === _constants.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 && get(opt.center, _constants.Row) && ncols !== 1) {
    for (i = 0; i < n; ++i) {
      b = alignRow === _constants.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 = get(opt.anchor, _constants.X);
  y = get(opt.anchor, _constants.Y);

  switch (get(opt.anchor, _constants.Column)) {
    case _constants.End:
      x -= bounds.width();
      break;

    case _constants.Middle:
      x -= bounds.width() / 2;
  }

  switch (get(opt.anchor, _constants.Row)) {
    case _constants.End:
      y -= bounds.height();
      break;

    case _constants.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 === _constants.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); // -- layout grid headers and footers --
  // perform row header layout

  if (views.rowheaders) {
    band = get(opt.headerBand, _constants.Row, null);
    x = layoutHeaders(view, views.rowheaders, groups, ncols, nrows, -get(off, 'rowHeader'), min, 0, bbox, 'x1', 0, ncols, 1, band);
  } // perform column header layout


  if (views.colheaders) {
    band = get(opt.headerBand, _constants.Column, null);
    y = layoutHeaders(view, views.colheaders, groups, ncols, ncols, -get(off, 'columnHeader'), min, 1, bbox, 'y1', 0, 1, ncols, band);
  } // perform row footer layout


  if (views.rowfooters) {
    band = get(opt.footerBand, _constants.Row, null);
    x2 = layoutHeaders(view, views.rowfooters, groups, ncols, nrows, get(off, 'rowFooter'), max, 0, bbox, 'x2', ncols - 1, ncols, 1, band);
  } // perform column footer layout


  if (views.colfooters) {
    band = get(opt.footerBand, _constants.Column, null);
    y2 = layoutHeaders(view, views.colfooters, groups, ncols, ncols, get(off, 'columnFooter'), max, 1, bbox, 'y2', cells - ncols, 1, ncols, band);
  } // perform row title layout


  if (views.rowtitle) {
    anchor = get(opt.titleAnchor, _constants.Row);
    offset = get(off, 'rowTitle');
    offset = anchor === _constants.End ? x2 + offset : x - offset;
    band = get(opt.titleBand, _constants.Row, 0.5);
    layoutTitle(view, views.rowtitle, offset, 0, bounds, band);
  } // perform column title layout


  if (views.coltitle) {
    anchor = get(opt.titleAnchor, _constants.Column);
    offset = get(off, 'columnTitle');
    offset = anchor === _constants.End ? y2 + offset : y - offset;
    band = get(opt.titleBand, _constants.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];
} // aggregation functions for grid margin determination


function min(a, b) {
  return Math.floor(Math.min(a, b));
}

function max(a, b) {
  return Math.ceil(Math.max(a, b));
}

function 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);
}
},{"../constants":"NhYQ","./util":"iHjl","vega-scenegraph":"rKdC","vega-util":"dejJ"}],"gfCL":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.legendParams = legendParams;
exports.legendLayout = legendLayout;

var _constants = require("../constants");

var _vegaScenegraph = require("vega-scenegraph");

// utility for looking up legend layout configuration
function lookup(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 offsets(legends, value) {
  var 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(config, orient),
        offset = offsets(g, _('offset', 0)),
        anchor = _('anchor', _constants.Start),
        mult = anchor === _constants.End ? 1 : anchor === _constants.Middle ? 0.5 : 0;

  const p = {
    align: _constants.Each,
    bounds: _('bounds', _constants.Flush),
    columns: _('direction') === 'vertical' ? 1 : g.length,
    padding: _('margin', 8),
    center: _('center'),
    nodirty: true
  };

  switch (orient) {
    case _constants.Left:
      p.anchor = {
        x: Math.floor(xb.x1) - offset,
        column: _constants.End,
        y: mult * (h || xb.height() + 2 * xb.y1),
        row: anchor
      };
      break;

    case _constants.Right:
      p.anchor = {
        x: Math.ceil(xb.x2) + offset,
        y: mult * (h || xb.height() + 2 * xb.y1),
        row: anchor
      };
      break;

    case _constants.Top:
      p.anchor = {
        y: Math.floor(yb.y1) - offset,
        row: _constants.End,
        x: mult * (w || yb.width() + 2 * yb.x1),
        column: anchor
      };
      break;

    case _constants.Bottom:
      p.anchor = {
        y: Math.ceil(yb.y2) + offset,
        x: mult * (w || yb.width() + 2 * yb.x1),
        column: anchor
      };
      break;

    case _constants.TopLeft:
      p.anchor = {
        x: offset,
        y: offset
      };
      break;

    case _constants.TopRight:
      p.anchor = {
        x: w - offset,
        y: offset,
        column: _constants.End
      };
      break;

    case _constants.BottomLeft:
      p.anchor = {
        x: offset,
        y: h - offset,
        row: _constants.End
      };
      break;

    case _constants.BottomRight:
      p.anchor = {
        x: w - offset,
        y: h - offset,
        column: _constants.End,
        row: _constants.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 === _constants.Symbols) {
    legendEntryLayout(item.items[0].items[0].items[0].items);
  }

  if (orient !== _constants.None) {
    item.x = x = 0;
    item.y = y = 0;
  }

  item.width = w;
  item.height = h;
  (0, _vegaScenegraph.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) 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 _constants.Left:
        ex += Math.ceil(title.bounds.width()) + tpad;
        break;

      case _constants.Right:
      case _constants.Bottom:
        break;

      default:
        ey += title.bounds.height() + tpad;
    }

    if (ex || ey) translate(view, entry, ex, ey);

    switch (title.orient) {
      case _constants.Left:
        ty += legendTitleOffset(item, entry, title, anchor, 1, 1);
        break;

      case _constants.Right:
        tx += legendTitleOffset(item, entry, title, _constants.End, 0, 0) + tpad;
        ty += legendTitleOffset(item, entry, title, anchor, 1, 1);
        break;

      case _constants.Bottom:
        tx += legendTitleOffset(item, entry, title, anchor, 0, 0);
        ty += legendTitleOffset(item, entry, title, _constants.End, -1, 0, 1) + tpad;
        break;

      default:
        tx += legendTitleOffset(item, entry, title, anchor, 0, 0);
    }

    if (tx || ty) translate(view, title, tx, ty); // translate legend if title pushes into negative coordinates

    if ((tx = Math.round(title.bounds.x1 - pad)) < 0) {
      translate(view, entry, -tx, 0);
      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 : (0, _vegaScenegraph.multiLineOffset)(title);
  return Math.round(anchor === _constants.Start ? u : anchor === _constants.End ? v - o : 0.5 * (s - o));
}

function 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
  var widths = entries.reduce(function (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(function (g) {
    g.width = widths[g.column];
    g.height = g.bounds.y2 - g.y;
  });
}
},{"../constants":"NhYQ","vega-scenegraph":"rKdC"}],"lM4E":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.titleLayout = titleLayout;

var _constants = require("../constants");

var _util = require("./util");

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 === _constants.Left || orient === _constants.Right ? height : width,
      start = 0,
      x = 0,
      y = 0,
      sx = 0,
      sy = 0,
      pos;

  if (frame !== _constants.Group) {
    orient === _constants.Left ? (start = viewBounds.y2, end = viewBounds.y1) : orient === _constants.Right ? (start = viewBounds.y1, end = viewBounds.y2) : (start = viewBounds.x1, end = viewBounds.x2);
  } else if (orient === _constants.Left) {
    start = height, end = 0;
  }

  pos = anchor === _constants.Start ? start : anchor === _constants.End ? end : (start + end) / 2;

  if (subtitle && subtitle.text) {
    // position subtitle
    switch (orient) {
      case _constants.Top:
      case _constants.Bottom:
        sy = title.bounds.height() + padding;
        break;

      case _constants.Left:
        sx = title.bounds.width() + padding;
        break;

      case _constants.Right:
        sx = -title.bounds.width() - padding;
        break;
    }

    _util.tempBounds.clear().union(subtitle.bounds);

    _util.tempBounds.translate(sx - (subtitle.x || 0), sy - (subtitle.y || 0));

    if ((0, _util.set)(subtitle, 'x', sx) | (0, _util.set)(subtitle, 'y', sy)) {
      view.dirty(subtitle);
      subtitle.bounds.clear().union(_util.tempBounds);
      subtitle.mark.bounds.clear().union(_util.tempBounds);
      view.dirty(subtitle);
    }

    _util.tempBounds.clear().union(subtitle.bounds);
  } else {
    _util.tempBounds.clear();
  }

  _util.tempBounds.union(title.bounds); // position title group


  switch (orient) {
    case _constants.Top:
      x = pos;
      y = viewBounds.y1 - _util.tempBounds.height() - offset;
      break;

    case _constants.Left:
      x = viewBounds.x1 - _util.tempBounds.width() - offset;
      y = pos;
      break;

    case _constants.Right:
      x = viewBounds.x2 + _util.tempBounds.width() + offset;
      y = pos;
      break;

    case _constants.Bottom:
      x = pos;
      y = viewBounds.y2 + offset;
      break;

    default:
      x = group.x;
      y = group.y;
  }

  if ((0, _util.set)(group, 'x', x) | (0, _util.set)(group, 'y', y)) {
    _util.tempBounds.translate(x, y);

    view.dirty(group);
    group.bounds.clear().union(_util.tempBounds);
    mark.bounds.clear().union(_util.tempBounds);
    view.dirty(group);
  }

  return group.bounds;
}
},{"../constants":"NhYQ","./util":"iHjl"}],"oDq2":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = ViewLayout;

var _constants = require("./constants");

var _axis = require("./layout/axis");

var _grid = require("./layout/grid");

var _legend = require("./layout/legend");

var _title = require("./layout/title");

var _vegaDataflow = require("vega-dataflow");

var _vegaScenegraph = require("vega-scenegraph");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.Transform.call(this, null, params);
}

var prototype = (0, _vegaUtil.inherits)(ViewLayout, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  // TODO incremental update, output?
  var view = pulse.dataflow;

  _.mark.items.forEach(function (group) {
    if (_.layout) (0, _grid.trellisLayout)(view, group, _.layout);
    layoutGroup(view, group, _);
  });

  if (_.modified()) pulse.reflow();
  return pulse;
};

function layoutGroup(view, group, _) {
  var items = group.items,
      width = Math.max(0, group.width || 0),
      height = Math.max(0, group.height || 0),
      viewBounds = new _vegaScenegraph.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 _constants.AxisRole:
        b = (0, _axis.isYAxis)(mark) ? xBounds : yBounds;
        b.union((0, _axis.axisLayout)(view, mark, width, height));
        break;

      case _constants.TitleRole:
        title = mark;
        break;

      case _constants.LegendRole:
        legends.push((0, _legend.legendLayout)(view, mark));
        break;

      case _constants.FrameRole:
      case _constants.ScopeRole:
      case _constants.RowHeader:
      case _constants.RowFooter:
      case _constants.RowTitle:
      case _constants.ColHeader:
      case _constants.ColFooter:
      case _constants.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 || _constants.Right;
      if (orient !== _constants.None) (l[orient] || (l[orient] = [])).push(item);
    }); // perform grid layout for each orient group

    for (let orient in l) {
      const g = l[orient];
      (0, _grid.gridLayout)(view, g, (0, _legend.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 === _constants.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 _constants.Left:
          case _constants.Right:
            viewBounds.add(b.x1, 0).add(b.x2, 0);
            break;

          case _constants.Top:
          case _constants.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((0, _title.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, _) {
  var auto = _.autosize || {},
      type = auto.type,
      viewWidth = view._width,
      viewHeight = view._height,
      padding = view.padding();
  if (view._autosize < 1 || !type) return;
  var width = Math.max(0, group.width || 0),
      left = Math.max(0, Math.ceil(-viewBounds.x1)),
      right = Math.max(0, Math.ceil(viewBounds.x2 - width)),
      height = Math.max(0, group.height || 0),
      top = Math.max(0, Math.ceil(-viewBounds.y1)),
      bottom = Math.max(0, Math.ceil(viewBounds.y2 - height));

  if (auto.contains === _constants.Padding) {
    viewWidth -= padding.left + padding.right;
    viewHeight -= padding.top + padding.bottom;
  }

  if (type === _constants.None) {
    left = 0;
    top = 0;
    width = viewWidth;
    height = viewHeight;
  } else if (type === _constants.Fit) {
    width = Math.max(0, viewWidth - left - right);
    height = Math.max(0, viewHeight - top - bottom);
  } else if (type === _constants.FitX) {
    width = Math.max(0, viewWidth - left - right);
    viewHeight = height + top + bottom;
  } else if (type === _constants.FitY) {
    viewWidth = width + left + right;
    height = Math.max(0, viewHeight - top - bottom);
  } else if (type === _constants.Pad) {
    viewWidth = width + left + right;
    viewHeight = height + top + bottom;
  }

  view._resizeView(viewWidth, viewHeight, width, height, [left, top], auto.resize);
}
},{"./constants":"NhYQ","./layout/axis":"vt7u","./layout/grid":"zcC7","./layout/legend":"gfCL","./layout/title":"lM4E","vega-dataflow":"UC8n","vega-scenegraph":"rKdC","vega-util":"dejJ"}],"JYoF":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "bound", {
  enumerable: true,
  get: function () {
    return _Bound.default;
  }
});
Object.defineProperty(exports, "identifier", {
  enumerable: true,
  get: function () {
    return _Identifier.default;
  }
});
Object.defineProperty(exports, "mark", {
  enumerable: true,
  get: function () {
    return _Mark.default;
  }
});
Object.defineProperty(exports, "overlap", {
  enumerable: true,
  get: function () {
    return _Overlap.default;
  }
});
Object.defineProperty(exports, "render", {
  enumerable: true,
  get: function () {
    return _Render.default;
  }
});
Object.defineProperty(exports, "viewlayout", {
  enumerable: true,
  get: function () {
    return _ViewLayout.default;
  }
});

var _Bound = _interopRequireDefault(require("./src/Bound"));

var _Identifier = _interopRequireDefault(require("./src/Identifier"));

var _Mark = _interopRequireDefault(require("./src/Mark"));

var _Overlap = _interopRequireDefault(require("./src/Overlap"));

var _Render = _interopRequireDefault(require("./src/Render"));

var _ViewLayout = _interopRequireDefault(require("./src/ViewLayout"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./src/Bound":"HSCB","./src/Identifier":"VPd6","./src/Mark":"P39j","./src/Overlap":"ylEA","./src/Render":"eYJB","./src/ViewLayout":"oDq2"}],"Bt1o":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(count, paddingInner, paddingOuter) {
  var space = count - paddingInner + paddingOuter * 2;
  return count ? space > 0 ? space : 1 : 0;
}
},{}],"KcJD":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.isValidScaleType = isValidScaleType;
exports.isTemporal = isTemporal;
exports.isBinned = isBinned;
exports.isQuantile = isQuantile;
exports.isSequential = isSequential;
exports.isDiverging = isDiverging;
exports.isInterpolating = isInterpolating;
exports.isLogarithmic = isLogarithmic;
exports.isContinuous = isContinuous;
exports.isDiscrete = isDiscrete;
exports.isDiscretizing = isDiscretizing;
exports.BinOrdinal = exports.Band = exports.Point = exports.Ordinal = exports.Threshold = exports.Quantize = exports.Quantile = exports.Diverging = exports.Sequential = exports.UTC = exports.Time = exports.Symlog = exports.Sqrt = exports.Pow = exports.Log = exports.Linear = exports.Identity = void 0;
const Identity = 'identity';
exports.Identity = Identity;
const Linear = 'linear';
exports.Linear = Linear;
const Log = 'log';
exports.Log = Log;
const Pow = 'pow';
exports.Pow = Pow;
const Sqrt = 'sqrt';
exports.Sqrt = Sqrt;
const Symlog = 'symlog';
exports.Symlog = Symlog;
const Time = 'time';
exports.Time = Time;
const UTC = 'utc';
exports.UTC = UTC;
const Sequential = 'sequential';
exports.Sequential = Sequential;
const Diverging = 'diverging';
exports.Diverging = Diverging;
const Quantile = 'quantile';
exports.Quantile = Quantile;
const Quantize = 'quantize';
exports.Quantize = Quantize;
const Threshold = 'threshold';
exports.Threshold = Threshold;
const Ordinal = 'ordinal';
exports.Ordinal = Ordinal;
const Point = 'point';
exports.Point = Point;
const Band = 'band';
exports.Band = Band;
const BinOrdinal = 'bin-ordinal';
exports.BinOrdinal = BinOrdinal;

function isValidScaleType(type) {
  switch (type) {
    case Identity:
    case Linear:
    case Log:
    case Pow:
    case Sqrt:
    case Symlog:
    case Time:
    case UTC:
    case Sequential:
    case Quantile:
    case Quantize:
    case Threshold:
    case Ordinal:
    case Point:
    case Band:
    case BinOrdinal:
      return true;
  }

  return false;
}

function isTemporal(key) {
  return key === Time || key === UTC;
}

function isBinned(key) {
  return key === BinOrdinal;
}

function isQuantile(key) {
  return key === Quantile;
}

function isSequential(key) {
  return key && key.startsWith(Sequential);
}

function isDiverging(key) {
  return key && key.startsWith(Diverging);
}

function isInterpolating(key) {
  return isSequential(key) || isDiverging(key);
}

function isLogarithmic(key) {
  return key === Log || key.endsWith('-log');
}

function isContinuous(key) {
  switch (key) {
    case Linear:
    case Log:
    case Pow:
    case Sqrt:
    case Symlog:
    case Time:
    case UTC:
    case Sequential:
      return true;
  }

  return false;
}

function isDiscrete(key) {
  return key === BinOrdinal || key === Ordinal || key === Band || key === Point;
}

function isDiscretizing(key) {
  return key === BinOrdinal || key === Quantile || key === Quantize || key === Threshold;
}
},{}],"sDew":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(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)];
  };
}
},{}],"dV9l":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(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]];
  };
}
},{}],"K3G9":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.initRange = initRange;
exports.initInterpolator = initInterpolator;

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;
}
},{}],"Yv9Y":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = ordinal;
exports.implicit = void 0;

var _init = require("./init.js");

const implicit = Symbol("implicit");
exports.implicit = implicit;

function ordinal() {
  var index = new Map(),
      domain = [],
      range = [],
      unknown = implicit;

  function scale(d) {
    var key = d + "",
        i = index.get(key);

    if (!i) {
      if (unknown !== 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);
  };

  _init.initRange.apply(scale, arguments);

  return scale;
}
},{"./init.js":"K3G9"}],"GuIC":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = band;
exports.point = point;

var _d3Array = require("d3-array");

var _init = require("./init.js");

var _ordinal = _interopRequireDefault(require("./ordinal.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function band() {
  var scale = (0, _ordinal.default)().unknown(undefined),
      domain = scale.domain,
      ordinalRange = scale.range,
      r0 = 0,
      r1 = 1,
      step,
      bandwidth,
      round = false,
      paddingInner = 0,
      paddingOuter = 0,
      align = 0.5;
  delete scale.unknown;

  function rescale() {
    var n = domain().length,
        reverse = r1 < r0,
        start = reverse ? r1 : r0,
        stop = reverse ? r0 : r1;
    step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2);
    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 = (0, _d3Array.range)(n).map(function (i) {
      return start + step * i;
    });
    return ordinalRange(reverse ? values.reverse() : values);
  }

  scale.domain = function (_) {
    return arguments.length ? (domain(_), rescale()) : domain();
  };

  scale.range = function (_) {
    return arguments.length ? ([r0, r1] = _, r0 = +r0, r1 = +r1, rescale()) : [r0, r1];
  };

  scale.rangeRound = function (_) {
    return [r0, r1] = _, r0 = +r0, r1 = +r1, round = true, rescale();
  };

  scale.bandwidth = function () {
    return bandwidth;
  };

  scale.step = function () {
    return step;
  };

  scale.round = function (_) {
    return arguments.length ? (round = !!_, rescale()) : round;
  };

  scale.padding = function (_) {
    return arguments.length ? (paddingInner = Math.min(1, paddingOuter = +_), rescale()) : paddingInner;
  };

  scale.paddingInner = function (_) {
    return arguments.length ? (paddingInner = Math.min(1, _), rescale()) : paddingInner;
  };

  scale.paddingOuter = function (_) {
    return arguments.length ? (paddingOuter = +_, rescale()) : paddingOuter;
  };

  scale.align = function (_) {
    return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align;
  };

  scale.copy = function () {
    return band(domain(), [r0, r1]).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align);
  };

  return _init.initRange.apply(rescale(), arguments);
}

function pointish(scale) {
  var copy = scale.copy;
  scale.padding = scale.paddingOuter;
  delete scale.paddingInner;
  delete scale.paddingOuter;

  scale.copy = function () {
    return pointish(copy());
  };

  return scale;
}

function point() {
  return pointish(band.apply(null, arguments).paddingInner(1));
}
},{"d3-array":"Rpnd","./init.js":"K3G9","./ordinal.js":"Yv9Y"}],"VvvF":[function(require,module,exports) {

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Color = Color;
exports.default = color;
exports.rgbConvert = rgbConvert;
exports.rgb = rgb;
exports.Rgb = Rgb;
exports.hslConvert = hslConvert;
exports.hsl = hsl;
exports.brighter = exports.darker = void 0;

var _define = _interopRequireWildcard(require("./define.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function Color() {}

var darker = 0.7;
exports.darker = darker;
var brighter = 1 / darker;
exports.brighter = brighter;
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
};
(0, _define.default)(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(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 ? new Rgb(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000
  : l === 4 ? new Rgb(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(o);
  if (!o) return new Rgb();
  o = o.rgb();
  return new Rgb(o.r, o.g, o.b, o.opacity);
}

function 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;
}

(0, _define.default)(Rgb, rgb, (0, _define.extend)(Color, {
  brighter: function (k) {
    k = k == null ? brighter : Math.pow(brighter, k);
    return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
  },
  darker: function (k) {
    k = k == null ? darker : Math.pow(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(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;
}

(0, _define.default)(Hsl, hsl, (0, _define.extend)(Color, {
  brighter: function (k) {
    k = k == null ? brighter : Math.pow(brighter, k);
    return new Hsl(this.h, this.s, this.l * k, this.opacity);
  },
  darker: function (k) {
    k = k == null ? darker : Math.pow(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;
}
},{"./define.js":"Exky"}],"u9JU":[function(require,module,exports) {

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.gray = gray;
exports.default = lab;
exports.Lab = Lab;
exports.lch = lch;
exports.hcl = hcl;
exports.Hcl = Hcl;

var _define = _interopRequireWildcard(require("./define.js"));

var _color = require("./color.js");

var _math = require("./math.js");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// https://observablehq.com/@mbostock/lab-and-rgb
var K = 18,
    Xn = 0.96422,
    Yn = 1,
    Zn = 0.82521,
    t0 = 4 / 29,
    t1 = 6 / 29,
    t2 = 3 * t1 * t1,
    t3 = t1 * t1 * 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 _color.Rgb)) o = (0, _color.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;
}

(0, _define.default)(Lab, lab, (0, _define.extend)(_color.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 _color.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 / t2 + t0;
}

function lab2xyz(t) {
  return t > t1 ? t * t * t : t2 * (t - 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.rad2deg;

  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 * _math.deg2rad;
  return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);
}

(0, _define.default)(Hcl, hcl, (0, _define.extend)(_color.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();
  }
}));
},{"./define.js":"Exky","./color.js":"VvvF","./math.js":"oD7B"}],"jmkd":[function(require,module,exports) {

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = cubehelix;
exports.Cubehelix = Cubehelix;

var _define = _interopRequireWildcard(require("./define.js"));

var _color = require("./color.js");

var _math = require("./math.js");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var A = -0.14861,
    B = +1.78277,
    C = -0.29227,
    D = -0.90649,
    E = +1.97294,
    ED = E * D,
    EB = E * B,
    BC_DA = B * C - D * A;

function cubehelixConvert(o) {
  if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);
  if (!(o instanceof _color.Rgb)) o = (0, _color.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) / 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.rad2deg - 120 : NaN;
  return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);
}

function 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;
}

(0, _define.default)(Cubehelix, cubehelix, (0, _define.extend)(_color.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) * _math.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 * (A * cosh + B * sinh)), 255 * (l + a * (C * cosh + D * sinh)), 255 * (l + a * (E * cosh)), this.opacity);
  }
}));
},{"./define.js":"Exky","./color.js":"VvvF","./math.js":"oD7B"}],"x3do":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "color", {
  enumerable: true,
  get: function () {
    return _color.default;
  }
});
Object.defineProperty(exports, "rgb", {
  enumerable: true,
  get: function () {
    return _color.rgb;
  }
});
Object.defineProperty(exports, "hsl", {
  enumerable: true,
  get: function () {
    return _color.hsl;
  }
});
Object.defineProperty(exports, "lab", {
  enumerable: true,
  get: function () {
    return _lab.default;
  }
});
Object.defineProperty(exports, "hcl", {
  enumerable: true,
  get: function () {
    return _lab.hcl;
  }
});
Object.defineProperty(exports, "lch", {
  enumerable: true,
  get: function () {
    return _lab.lch;
  }
});
Object.defineProperty(exports, "gray", {
  enumerable: true,
  get: function () {
    return _lab.gray;
  }
});
Object.defineProperty(exports, "cubehelix", {
  enumerable: true,
  get: function () {
    return _cubehelix.default;
  }
});

var _color = _interopRequireWildcard(require("./color.js"));

var _lab = _interopRequireWildcard(require("./lab.js"));

var _cubehelix = _interopRequireDefault(require("./cubehelix.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
},{"./color.js":"VvvF","./lab.js":"u9JU","./cubehelix.js":"jmkd"}],"kM48":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.basis = basis;
exports.default = _default;

function 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;
}

function _default(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((t - i / n) * n, v0, v1, v2, v3);
  };
}
},{}],"I8m6":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _basis = require("./basis.js");

function _default(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 (0, _basis.basis)((t - i / n) * n, v0, v1, v2, v3);
  };
}
},{"./basis.js":"kM48"}],"y6MQ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.hue = hue;
exports.gamma = gamma;
exports.default = nogamma;

var _constant = _interopRequireDefault(require("./constant.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function 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 hue(a, b) {
  var d = b - a;
  return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : (0, _constant.default)(isNaN(a) ? b : a);
}

function gamma(y) {
  return (y = +y) === 1 ? nogamma : function (a, b) {
    return b - a ? exponential(a, b, y) : (0, _constant.default)(isNaN(a) ? b : a);
  };
}

function nogamma(a, b) {
  var d = b - a;
  return d ? linear(a, d) : (0, _constant.default)(isNaN(a) ? b : a);
}
},{"./constant.js":"OKWp"}],"uEB8":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.rgbBasisClosed = exports.rgbBasis = exports.default = void 0;

var _d3Color = require("d3-color");

var _basis = _interopRequireDefault(require("./basis.js"));

var _basisClosed = _interopRequireDefault(require("./basisClosed.js"));

var _color = _interopRequireWildcard(require("./color.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _default = function rgbGamma(y) {
  var color = (0, _color.gamma)(y);

  function rgb(start, end) {
    var r = color((start = (0, _d3Color.rgb)(start)).r, (end = (0, _d3Color.rgb)(end)).r),
        g = color(start.g, end.g),
        b = color(start.b, end.b),
        opacity = (0, _color.default)(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);

exports.default = _default;

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 = (0, _d3Color.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(_basis.default);
exports.rgbBasis = rgbBasis;
var rgbBasisClosed = rgbSpline(_basisClosed.default);
exports.rgbBasisClosed = rgbBasisClosed;
},{"d3-color":"x3do","./basis.js":"kM48","./basisClosed.js":"I8m6","./color.js":"y6MQ"}],"sB4t":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.isNumberArray = isNumberArray;

function _default(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);
}
},{}],"ZCGf":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.genericArray = genericArray;

var _value = _interopRequireDefault(require("./value.js"));

var _numberArray = _interopRequireWildcard(require("./numberArray.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(a, b) {
  return ((0, _numberArray.isNumberArray)(b) ? _numberArray.default : 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] = (0, _value.default)(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;
  };
}
},{"./value.js":"sR72","./numberArray.js":"sB4t"}],"PFUW":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(a, b) {
  var d = new Date();
  return a = +a, b = +b, function (t) {
    return d.setTime(a * (1 - t) + b * t), d;
  };
}
},{}],"aNyh":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(a, b) {
  return a = +a, b = +b, function (t) {
    return a * (1 - t) + b * t;
  };
}
},{}],"oqfw":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _value = _interopRequireDefault(require("./value.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(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] = (0, _value.default)(a[k], b[k]);
    } else {
      c[k] = b[k];
    }
  }

  return function (t) {
    for (k in i) c[k] = i[k](t);

    return c;
  };
}
},{"./value.js":"sR72"}],"Brer":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _number = _interopRequireDefault(require("./number.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,
    reB = new RegExp(reA.source, "g");

function zero(b) {
  return function () {
    return b;
  };
}

function one(b) {
  return function (t) {
    return b(t) + "";
  };
}

function _default(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: (0, _number.default)(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) : 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("");
  });
}
},{"./number.js":"aNyh"}],"sR72":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _d3Color = require("d3-color");

var _rgb = _interopRequireDefault(require("./rgb.js"));

var _array = require("./array.js");

var _date = _interopRequireDefault(require("./date.js"));

var _number = _interopRequireDefault(require("./number.js"));

var _object = _interopRequireDefault(require("./object.js"));

var _string = _interopRequireDefault(require("./string.js"));

var _constant = _interopRequireDefault(require("./constant.js"));

var _numberArray = _interopRequireWildcard(require("./numberArray.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(a, b) {
  var t = typeof b,
      c;
  return b == null || t === "boolean" ? (0, _constant.default)(b) : (t === "number" ? _number.default : t === "string" ? (c = (0, _d3Color.color)(b)) ? (b = c, _rgb.default) : _string.default : b instanceof _d3Color.color ? _rgb.default : b instanceof Date ? _date.default : (0, _numberArray.isNumberArray)(b) ? _numberArray.default : Array.isArray(b) ? _array.genericArray : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? _object.default : _number.default)(a, b);
}
},{"d3-color":"x3do","./rgb.js":"uEB8","./array.js":"ZCGf","./date.js":"PFUW","./number.js":"aNyh","./object.js":"oqfw","./string.js":"Brer","./constant.js":"OKWp","./numberArray.js":"sB4t"}],"Erca":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(range) {
  var n = range.length;
  return function (t) {
    return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];
  };
}
},{}],"YmNE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _color = require("./color.js");

function _default(a, b) {
  var i = (0, _color.hue)(+a, +b);
  return function (t) {
    var x = i(t);
    return x - 360 * Math.floor(x / 360);
  };
}
},{"./color.js":"y6MQ"}],"OHSM":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(a, b) {
  return a = +a, b = +b, function (t) {
    return Math.round(a * (1 - t) + b * t);
  };
}
},{}],"k89d":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.identity = void 0;
var degrees = 180 / Math.PI;
var identity = {
  translateX: 0,
  translateY: 0,
  rotate: 0,
  skewX: 0,
  scaleX: 1,
  scaleY: 1
};
exports.identity = identity;

function _default(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
  };
}
},{}],"fUUu":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.parseCss = parseCss;
exports.parseSvg = parseSvg;

var _decompose = _interopRequireWildcard(require("./decompose.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var cssNode, cssRoot, cssView, svgNode;

function parseCss(value) {
  if (value === "none") return _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 (0, _decompose.default)(+value[0], +value[1], +value[2], +value[3], +value[4], +value[5]);
}

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 (0, _decompose.default)(value.a, value.b, value.c, value.d, value.e, value.f);
}
},{"./decompose.js":"k89d"}],"tkkQ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.interpolateTransformSvg = exports.interpolateTransformCss = void 0;

var _number = _interopRequireDefault(require("../number.js"));

var _parse = require("./parse.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

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: (0, _number.default)(xa, xb)
      }, {
        i: i - 2,
        x: (0, _number.default)(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: (0, _number.default)(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: (0, _number.default)(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: (0, _number.default)(xa, xb)
      }, {
        i: i - 2,
        x: (0, _number.default)(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(_parse.parseCss, "px, ", "px)", "deg)");
exports.interpolateTransformCss = interpolateTransformCss;
var interpolateTransformSvg = interpolateTransform(_parse.parseSvg, ", ", ")", ")");
exports.interpolateTransformSvg = interpolateTransformSvg;
},{"../number.js":"aNyh","./parse.js":"fUUu"}],"dKmK":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
var rho = Math.SQRT2,
    rho2 = 2,
    rho4 = 4,
    epsilon2 = 1e-12;

function cosh(x) {
  return ((x = Math.exp(x)) + 1 / x) / 2;
}

function sinh(x) {
  return ((x = Math.exp(x)) - 1 / x) / 2;
}

function tanh(x) {
  return ((x = Math.exp(2 * x)) - 1) / (x + 1);
} // p0 = [ux0, uy0, w0]
// p1 = [ux1, uy1, w1]


function _default(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 = cosh(r0),
            u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));
        return [ux0 + u * dx, uy0 + u * dy, w0 * coshr0 / cosh(rho * s + r0)];
      };
    }

  i.duration = S * 1000;
  return i;
}
},{}],"RzWG":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.hslLong = exports.default = void 0;

var _d3Color = require("d3-color");

var _color = _interopRequireWildcard(require("./color.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function hsl(hue) {
  return function (start, end) {
    var h = hue((start = (0, _d3Color.hsl)(start)).h, (end = (0, _d3Color.hsl)(end)).h),
        s = (0, _color.default)(start.s, end.s),
        l = (0, _color.default)(start.l, end.l),
        opacity = (0, _color.default)(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 + "";
    };
  };
}

var _default = hsl(_color.hue);

exports.default = _default;
var hslLong = hsl(_color.default);
exports.hslLong = hslLong;
},{"d3-color":"x3do","./color.js":"y6MQ"}],"lMlk":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = lab;

var _d3Color = require("d3-color");

var _color = _interopRequireDefault(require("./color.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function lab(start, end) {
  var l = (0, _color.default)((start = (0, _d3Color.lab)(start)).l, (end = (0, _d3Color.lab)(end)).l),
      a = (0, _color.default)(start.a, end.a),
      b = (0, _color.default)(start.b, end.b),
      opacity = (0, _color.default)(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 + "";
  };
}
},{"d3-color":"x3do","./color.js":"y6MQ"}],"csIY":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.hclLong = exports.default = void 0;

var _d3Color = require("d3-color");

var _color = _interopRequireWildcard(require("./color.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function hcl(hue) {
  return function (start, end) {
    var h = hue((start = (0, _d3Color.hcl)(start)).h, (end = (0, _d3Color.hcl)(end)).h),
        c = (0, _color.default)(start.c, end.c),
        l = (0, _color.default)(start.l, end.l),
        opacity = (0, _color.default)(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 + "";
    };
  };
}

var _default = hcl(_color.hue);

exports.default = _default;
var hclLong = hcl(_color.default);
exports.hclLong = hclLong;
},{"d3-color":"x3do","./color.js":"y6MQ"}],"F9uV":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.cubehelixLong = exports.default = void 0;

var _d3Color = require("d3-color");

var _color = _interopRequireWildcard(require("./color.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function cubehelix(hue) {
  return function cubehelixGamma(y) {
    y = +y;

    function cubehelix(start, end) {
      var h = hue((start = (0, _d3Color.cubehelix)(start)).h, (end = (0, _d3Color.cubehelix)(end)).h),
          s = (0, _color.default)(start.s, end.s),
          l = (0, _color.default)(start.l, end.l),
          opacity = (0, _color.default)(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);
}

var _default = cubehelix(_color.hue);

exports.default = _default;
var cubehelixLong = cubehelix(_color.default);
exports.cubehelixLong = cubehelixLong;
},{"d3-color":"x3do","./color.js":"y6MQ"}],"wh72":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = piecewise;

function 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);
  };
}
},{}],"Edvl":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(interpolator, n) {
  var samples = new Array(n);

  for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1));

  return samples;
}
},{}],"y8gx":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "interpolate", {
  enumerable: true,
  get: function () {
    return _value.default;
  }
});
Object.defineProperty(exports, "interpolateArray", {
  enumerable: true,
  get: function () {
    return _array.default;
  }
});
Object.defineProperty(exports, "interpolateBasis", {
  enumerable: true,
  get: function () {
    return _basis.default;
  }
});
Object.defineProperty(exports, "interpolateBasisClosed", {
  enumerable: true,
  get: function () {
    return _basisClosed.default;
  }
});
Object.defineProperty(exports, "interpolateDate", {
  enumerable: true,
  get: function () {
    return _date.default;
  }
});
Object.defineProperty(exports, "interpolateDiscrete", {
  enumerable: true,
  get: function () {
    return _discrete.default;
  }
});
Object.defineProperty(exports, "interpolateHue", {
  enumerable: true,
  get: function () {
    return _hue.default;
  }
});
Object.defineProperty(exports, "interpolateNumber", {
  enumerable: true,
  get: function () {
    return _number.default;
  }
});
Object.defineProperty(exports, "interpolateNumberArray", {
  enumerable: true,
  get: function () {
    return _numberArray.default;
  }
});
Object.defineProperty(exports, "interpolateObject", {
  enumerable: true,
  get: function () {
    return _object.default;
  }
});
Object.defineProperty(exports, "interpolateRound", {
  enumerable: true,
  get: function () {
    return _round.default;
  }
});
Object.defineProperty(exports, "interpolateString", {
  enumerable: true,
  get: function () {
    return _string.default;
  }
});
Object.defineProperty(exports, "interpolateTransformCss", {
  enumerable: true,
  get: function () {
    return _index.interpolateTransformCss;
  }
});
Object.defineProperty(exports, "interpolateTransformSvg", {
  enumerable: true,
  get: function () {
    return _index.interpolateTransformSvg;
  }
});
Object.defineProperty(exports, "interpolateZoom", {
  enumerable: true,
  get: function () {
    return _zoom.default;
  }
});
Object.defineProperty(exports, "interpolateRgb", {
  enumerable: true,
  get: function () {
    return _rgb.default;
  }
});
Object.defineProperty(exports, "interpolateRgbBasis", {
  enumerable: true,
  get: function () {
    return _rgb.rgbBasis;
  }
});
Object.defineProperty(exports, "interpolateRgbBasisClosed", {
  enumerable: true,
  get: function () {
    return _rgb.rgbBasisClosed;
  }
});
Object.defineProperty(exports, "interpolateHsl", {
  enumerable: true,
  get: function () {
    return _hsl.default;
  }
});
Object.defineProperty(exports, "interpolateHslLong", {
  enumerable: true,
  get: function () {
    return _hsl.hslLong;
  }
});
Object.defineProperty(exports, "interpolateLab", {
  enumerable: true,
  get: function () {
    return _lab.default;
  }
});
Object.defineProperty(exports, "interpolateHcl", {
  enumerable: true,
  get: function () {
    return _hcl.default;
  }
});
Object.defineProperty(exports, "interpolateHclLong", {
  enumerable: true,
  get: function () {
    return _hcl.hclLong;
  }
});
Object.defineProperty(exports, "interpolateCubehelix", {
  enumerable: true,
  get: function () {
    return _cubehelix.default;
  }
});
Object.defineProperty(exports, "interpolateCubehelixLong", {
  enumerable: true,
  get: function () {
    return _cubehelix.cubehelixLong;
  }
});
Object.defineProperty(exports, "piecewise", {
  enumerable: true,
  get: function () {
    return _piecewise.default;
  }
});
Object.defineProperty(exports, "quantize", {
  enumerable: true,
  get: function () {
    return _quantize.default;
  }
});

var _value = _interopRequireDefault(require("./value.js"));

var _array = _interopRequireDefault(require("./array.js"));

var _basis = _interopRequireDefault(require("./basis.js"));

var _basisClosed = _interopRequireDefault(require("./basisClosed.js"));

var _date = _interopRequireDefault(require("./date.js"));

var _discrete = _interopRequireDefault(require("./discrete.js"));

var _hue = _interopRequireDefault(require("./hue.js"));

var _number = _interopRequireDefault(require("./number.js"));

var _numberArray = _interopRequireDefault(require("./numberArray.js"));

var _object = _interopRequireDefault(require("./object.js"));

var _round = _interopRequireDefault(require("./round.js"));

var _string = _interopRequireDefault(require("./string.js"));

var _index = require("./transform/index.js");

var _zoom = _interopRequireDefault(require("./zoom.js"));

var _rgb = _interopRequireWildcard(require("./rgb.js"));

var _hsl = _interopRequireWildcard(require("./hsl.js"));

var _lab = _interopRequireDefault(require("./lab.js"));

var _hcl = _interopRequireWildcard(require("./hcl.js"));

var _cubehelix = _interopRequireWildcard(require("./cubehelix.js"));

var _piecewise = _interopRequireDefault(require("./piecewise.js"));

var _quantize = _interopRequireDefault(require("./quantize.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./value.js":"sR72","./array.js":"ZCGf","./basis.js":"kM48","./basisClosed.js":"I8m6","./date.js":"PFUW","./discrete.js":"Erca","./hue.js":"YmNE","./number.js":"aNyh","./numberArray.js":"sB4t","./object.js":"oqfw","./round.js":"OHSM","./string.js":"Brer","./transform/index.js":"tkkQ","./zoom.js":"dKmK","./rgb.js":"uEB8","./hsl.js":"RzWG","./lab.js":"lMlk","./hcl.js":"csIY","./cubehelix.js":"F9uV","./piecewise.js":"wh72","./quantize.js":"Edvl"}],"BTzj":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(x) {
  return +x;
}
},{}],"kGze":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.identity = identity;
exports.copy = copy;
exports.transformer = transformer;
exports.default = continuous;

var _d3Array = require("d3-array");

var _d3Interpolate = require("d3-interpolate");

var _constant = _interopRequireDefault(require("./constant.js"));

var _number = _interopRequireDefault(require("./number.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var unit = [0, 1];

function identity(x) {
  return x;
}

function normalize(a, b) {
  return (b -= a = +a) ? function (x) {
    return (x - a) / b;
  } : (0, _constant.default)(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 = normalize(d1, d0), r0 = interpolate(r1, r0);else d0 = 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] = normalize(domain[i], domain[i + 1]);
    r[i] = interpolate(range[i], range[i + 1]);
  }

  return function (x) {
    var i = (0, _d3Array.bisect)(domain, x, 1, j) - 1;
    return r[i](d[i](x));
  };
}

function copy(source, target) {
  return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown());
}

function transformer() {
  var domain = unit,
      range = unit,
      interpolate = _d3Interpolate.interpolate,
      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 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), _d3Interpolate.interpolateNumber)))(y)));
  };

  scale.domain = function (_) {
    return arguments.length ? (domain = Array.from(_, _number.default), rescale()) : domain.slice();
  };

  scale.range = function (_) {
    return arguments.length ? (range = Array.from(_), rescale()) : range.slice();
  };

  scale.rangeRound = function (_) {
    return range = Array.from(_), interpolate = _d3Interpolate.interpolateRound, 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);
}
},{"d3-array":"Rpnd","d3-interpolate":"y8gx","./constant.js":"OKWp","./number.js":"BTzj"}],"G46r":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _formatDecimal = _interopRequireDefault(require("./formatDecimal.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(x) {
  return x = (0, _formatDecimal.default)(Math.abs(x)), x ? x[1] : NaN;
}
},{"./formatDecimal.js":"RMp2"}],"WMxc":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.prefixExponent = void 0;

var _formatDecimal = _interopRequireDefault(require("./formatDecimal.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var prefixExponent;
exports.prefixExponent = prefixExponent;

function _default(x, p) {
  var d = (0, _formatDecimal.default)(x, p);
  if (!d) return x + "";
  var coefficient = d[0],
      exponent = d[1],
      i = exponent - (exports.prefixExponent = 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") + (0, _formatDecimal.default)(x, Math.max(0, p + i - 1))[0]; // less than 1y!
}
},{"./formatDecimal.js":"RMp2"}],"gMFS":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _formatDecimal = _interopRequireDefault(require("./formatDecimal.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(x, p) {
  var d = (0, _formatDecimal.default)(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");
}
},{"./formatDecimal.js":"RMp2"}],"w40g":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _formatPrefixAuto = _interopRequireDefault(require("./formatPrefixAuto.js"));

var _formatRounded = _interopRequireDefault(require("./formatRounded.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _default = {
  "%": function (x, p) {
    return (x * 100).toFixed(p);
  },
  "b": function (x) {
    return Math.round(x).toString(2);
  },
  "c": function (x) {
    return x + "";
  },
  "d": function (x) {
    return Math.round(x).toString(10);
  },
  "e": function (x, p) {
    return x.toExponential(p);
  },
  "f": function (x, p) {
    return x.toFixed(p);
  },
  "g": function (x, p) {
    return x.toPrecision(p);
  },
  "o": function (x) {
    return Math.round(x).toString(8);
  },
  "p": function (x, p) {
    return (0, _formatRounded.default)(x * 100, p);
  },
  "r": _formatRounded.default,
  "s": _formatPrefixAuto.default,
  "X": function (x) {
    return Math.round(x).toString(16).toUpperCase();
  },
  "x": function (x) {
    return Math.round(x).toString(16);
  }
};
exports.default = _default;
},{"./formatPrefixAuto.js":"WMxc","./formatRounded.js":"gMFS"}],"Iakc":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _exponent = _interopRequireDefault(require("./exponent.js"));

var _formatGroup = _interopRequireDefault(require("./formatGroup.js"));

var _formatNumerals = _interopRequireDefault(require("./formatNumerals.js"));

var _formatSpecifier = _interopRequireDefault(require("./formatSpecifier.js"));

var _formatTrim = _interopRequireDefault(require("./formatTrim.js"));

var _formatTypes = _interopRequireDefault(require("./formatTypes.js"));

var _formatPrefixAuto = require("./formatPrefixAuto.js");

var _identity = _interopRequireDefault(require("./identity.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var map = Array.prototype.map,
    prefixes = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];

function _default(locale) {
  var group = locale.grouping === undefined || locale.thousands === undefined ? _identity.default : (0, _formatGroup.default)(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.default : (0, _formatNumerals.default)(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 = (0, _formatSpecifier.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.default[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.default[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; // Perform the initial formatting.

        var valueNegative = value < 0;
        value = isNaN(value) ? nan : formatType(Math.abs(value), precision); // Trim insignificant zeros.

        if (trim) value = (0, _formatTrim.default)(value); // If a negative value rounds to zero during formatting, treat as positive.

        if (valueNegative && +value === 0) valueNegative = false; // Compute the prefix and suffix.

        valuePrefix = (valueNegative ? sign === "(" ? sign : minus : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
        valueSuffix = (type === "s" ? prefixes[8 + _formatPrefixAuto.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 = (0, _formatSpecifier.default)(specifier), specifier.type = "f", specifier)),
        e = Math.max(-8, Math.min(8, Math.floor((0, _exponent.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
  };
}
},{"./exponent.js":"G46r","./formatGroup.js":"Ylox","./formatNumerals.js":"Rlk1","./formatSpecifier.js":"t9Q3","./formatTrim.js":"ZJU7","./formatTypes.js":"w40g","./formatPrefixAuto.js":"WMxc","./identity.js":"LuEH"}],"VIed":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = defaultLocale;
exports.formatPrefix = exports.format = void 0;

var _locale = _interopRequireDefault(require("./locale.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var locale;
var format;
exports.format = format;
var formatPrefix;
exports.formatPrefix = formatPrefix;
defaultLocale({
  decimal: ".",
  thousands: ",",
  grouping: [3],
  currency: ["$", ""],
  minus: "-"
});

function defaultLocale(definition) {
  locale = (0, _locale.default)(definition);
  exports.format = format = locale.format;
  exports.formatPrefix = formatPrefix = locale.formatPrefix;
  return locale;
}
},{"./locale.js":"Iakc"}],"cTEw":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _exponent = _interopRequireDefault(require("./exponent.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(step) {
  return Math.max(0, -(0, _exponent.default)(Math.abs(step)));
}
},{"./exponent.js":"G46r"}],"aFxy":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _exponent = _interopRequireDefault(require("./exponent.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(step, value) {
  return Math.max(0, Math.max(-8, Math.min(8, Math.floor((0, _exponent.default)(value) / 3))) * 3 - (0, _exponent.default)(Math.abs(step)));
}
},{"./exponent.js":"G46r"}],"we8G":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _exponent = _interopRequireDefault(require("./exponent.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(step, max) {
  step = Math.abs(step), max = Math.abs(max) - step;
  return Math.max(0, (0, _exponent.default)(max) - (0, _exponent.default)(step)) + 1;
}
},{"./exponent.js":"G46r"}],"SA6z":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "formatDefaultLocale", {
  enumerable: true,
  get: function () {
    return _defaultLocale.default;
  }
});
Object.defineProperty(exports, "format", {
  enumerable: true,
  get: function () {
    return _defaultLocale.format;
  }
});
Object.defineProperty(exports, "formatPrefix", {
  enumerable: true,
  get: function () {
    return _defaultLocale.formatPrefix;
  }
});
Object.defineProperty(exports, "formatLocale", {
  enumerable: true,
  get: function () {
    return _locale.default;
  }
});
Object.defineProperty(exports, "formatSpecifier", {
  enumerable: true,
  get: function () {
    return _formatSpecifier.default;
  }
});
Object.defineProperty(exports, "FormatSpecifier", {
  enumerable: true,
  get: function () {
    return _formatSpecifier.FormatSpecifier;
  }
});
Object.defineProperty(exports, "precisionFixed", {
  enumerable: true,
  get: function () {
    return _precisionFixed.default;
  }
});
Object.defineProperty(exports, "precisionPrefix", {
  enumerable: true,
  get: function () {
    return _precisionPrefix.default;
  }
});
Object.defineProperty(exports, "precisionRound", {
  enumerable: true,
  get: function () {
    return _precisionRound.default;
  }
});

var _defaultLocale = _interopRequireWildcard(require("./defaultLocale.js"));

var _locale = _interopRequireDefault(require("./locale.js"));

var _formatSpecifier = _interopRequireWildcard(require("./formatSpecifier.js"));

var _precisionFixed = _interopRequireDefault(require("./precisionFixed.js"));

var _precisionPrefix = _interopRequireDefault(require("./precisionPrefix.js"));

var _precisionRound = _interopRequireDefault(require("./precisionRound.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
},{"./defaultLocale.js":"VIed","./locale.js":"Iakc","./formatSpecifier.js":"t9Q3","./precisionFixed.js":"cTEw","./precisionPrefix.js":"aFxy","./precisionRound.js":"we8G"}],"xMUV":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _d3Array = require("d3-array");

var _d3Format = require("d3-format");

function _default(start, stop, count, specifier) {
  var step = (0, _d3Array.tickStep)(start, stop, count),
      precision;
  specifier = (0, _d3Format.formatSpecifier)(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 = (0, _d3Format.precisionPrefix)(step, value))) specifier.precision = precision;
        return (0, _d3Format.formatPrefix)(specifier, value);
      }

    case "":
    case "e":
    case "g":
    case "p":
    case "r":
      {
        if (specifier.precision == null && !isNaN(precision = (0, _d3Format.precisionRound)(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 = (0, _d3Format.precisionFixed)(step))) specifier.precision = precision - (specifier.type === "%") * 2;
        break;
      }
  }

  return (0, _d3Format.format)(specifier);
}
},{"d3-array":"Rpnd","d3-format":"SA6z"}],"WtG2":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.linearish = linearish;
exports.default = linear;

var _d3Array = require("d3-array");

var _continuous = _interopRequireWildcard(require("./continuous.js"));

var _init = require("./init.js");

var _tickFormat = _interopRequireDefault(require("./tickFormat.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function linearish(scale) {
  var domain = scale.domain;

  scale.ticks = function (count) {
    var d = domain();
    return (0, _d3Array.ticks)(d[0], d[d.length - 1], count == null ? 10 : count);
  };

  scale.tickFormat = function (count, specifier) {
    var d = domain();
    return (0, _tickFormat.default)(d[0], d[d.length - 1], count == null ? 10 : count, specifier);
  };

  scale.nice = function (count) {
    if (count == null) count = 10;
    var d = domain(),
        i0 = 0,
        i1 = d.length - 1,
        start = d[i0],
        stop = d[i1],
        step;

    if (stop < start) {
      step = start, start = stop, stop = step;
      step = i0, i0 = i1, i1 = step;
    }

    step = (0, _d3Array.tickIncrement)(start, stop, count);

    if (step > 0) {
      start = Math.floor(start / step) * step;
      stop = Math.ceil(stop / step) * step;
      step = (0, _d3Array.tickIncrement)(start, stop, count);
    } else if (step < 0) {
      start = Math.ceil(start * step) / step;
      stop = Math.floor(stop * step) / step;
      step = (0, _d3Array.tickIncrement)(start, stop, count);
    }

    if (step > 0) {
      d[i0] = Math.floor(start / step) * step;
      d[i1] = Math.ceil(stop / step) * step;
      domain(d);
    } else if (step < 0) {
      d[i0] = Math.ceil(start * step) / step;
      d[i1] = Math.floor(stop * step) / step;
      domain(d);
    }

    return scale;
  };

  return scale;
}

function linear() {
  var scale = (0, _continuous.default)();

  scale.copy = function () {
    return (0, _continuous.copy)(scale, linear());
  };

  _init.initRange.apply(scale, arguments);

  return linearish(scale);
}
},{"d3-array":"Rpnd","./continuous.js":"kGze","./init.js":"K3G9","./tickFormat.js":"xMUV"}],"L2v5":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = identity;

var _linear = require("./linear.js");

var _number = _interopRequireDefault(require("./number.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function identity(domain) {
  var unknown;

  function scale(x) {
    return isNaN(x = +x) ? unknown : x;
  }

  scale.invert = scale;

  scale.domain = scale.range = function (_) {
    return arguments.length ? (domain = Array.from(_, _number.default), scale) : domain.slice();
  };

  scale.unknown = function (_) {
    return arguments.length ? (unknown = _, scale) : unknown;
  };

  scale.copy = function () {
    return identity(domain).unknown(unknown);
  };

  domain = arguments.length ? Array.from(domain, _number.default) : [0, 1];
  return (0, _linear.linearish)(scale);
}
},{"./linear.js":"WtG2","./number.js":"BTzj"}],"xl3A":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(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;
}
},{}],"fBKL":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.loggish = loggish;
exports.default = log;

var _d3Array = require("d3-array");

var _d3Format = require("d3-format");

var _nice = _interopRequireDefault(require("./nice.js"));

var _continuous = require("./continuous.js");

var _init = require("./init.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

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 = (0, _d3Array.ticks)(u, v, n);
    } else {
      z = (0, _d3Array.ticks)(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 = (0, _d3Format.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((0, _nice.default)(domain(), {
      floor: function (x) {
        return pows(Math.floor(logs(x)));
      },
      ceil: function (x) {
        return pows(Math.ceil(logs(x)));
      }
    }));
  };

  return scale;
}

function log() {
  var scale = loggish((0, _continuous.transformer)()).domain([1, 10]);

  scale.copy = function () {
    return (0, _continuous.copy)(scale, log()).base(scale.base());
  };

  _init.initRange.apply(scale, arguments);

  return scale;
}
},{"d3-array":"Rpnd","d3-format":"SA6z","./nice.js":"xl3A","./continuous.js":"kGze","./init.js":"K3G9"}],"XN8h":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.symlogish = symlogish;
exports.default = symlog;

var _linear = require("./linear.js");

var _continuous = require("./continuous.js");

var _init = require("./init.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 (0, _linear.linearish)(scale);
}

function symlog() {
  var scale = symlogish((0, _continuous.transformer)());

  scale.copy = function () {
    return (0, _continuous.copy)(scale, symlog()).constant(scale.constant());
  };

  return _init.initRange.apply(scale, arguments);
}
},{"./linear.js":"WtG2","./continuous.js":"kGze","./init.js":"K3G9"}],"f2wX":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.powish = powish;
exports.default = pow;
exports.sqrt = sqrt;

var _linear = require("./linear.js");

var _continuous = require("./continuous.js");

var _init = require("./init.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(_continuous.identity, _continuous.identity),
      exponent = 1;

  function rescale() {
    return exponent === 1 ? transform(_continuous.identity, _continuous.identity) : exponent === 0.5 ? transform(transformSqrt, transformSquare) : transform(transformPow(exponent), transformPow(1 / exponent));
  }

  scale.exponent = function (_) {
    return arguments.length ? (exponent = +_, rescale()) : exponent;
  };

  return (0, _linear.linearish)(scale);
}

function pow() {
  var scale = powish((0, _continuous.transformer)());

  scale.copy = function () {
    return (0, _continuous.copy)(scale, pow()).exponent(scale.exponent());
  };

  _init.initRange.apply(scale, arguments);

  return scale;
}

function sqrt() {
  return pow.apply(null, arguments).exponent(0.5);
}
},{"./linear.js":"WtG2","./continuous.js":"kGze","./init.js":"K3G9"}],"jaFS":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = radial;

var _continuous = _interopRequireDefault(require("./continuous.js"));

var _init = require("./init.js");

var _linear = require("./linear.js");

var _number = _interopRequireDefault(require("./number.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function square(x) {
  return Math.sign(x) * x * x;
}

function unsquare(x) {
  return Math.sign(x) * Math.sqrt(Math.abs(x));
}

function radial() {
  var squared = (0, _continuous.default)(),
      range = [0, 1],
      round = false,
      unknown;

  function scale(x) {
    var y = unsquare(squared(x));
    return isNaN(y) ? unknown : round ? Math.round(y) : y;
  }

  scale.invert = function (y) {
    return squared.invert(square(y));
  };

  scale.domain = function (_) {
    return arguments.length ? (squared.domain(_), scale) : squared.domain();
  };

  scale.range = function (_) {
    return arguments.length ? (squared.range((range = Array.from(_, _number.default)).map(square)), scale) : range.slice();
  };

  scale.rangeRound = function (_) {
    return scale.range(_).round(true);
  };

  scale.round = function (_) {
    return arguments.length ? (round = !!_, scale) : round;
  };

  scale.clamp = function (_) {
    return arguments.length ? (squared.clamp(_), scale) : squared.clamp();
  };

  scale.unknown = function (_) {
    return arguments.length ? (unknown = _, scale) : unknown;
  };

  scale.copy = function () {
    return radial(squared.domain(), range).round(round).clamp(squared.clamp()).unknown(unknown);
  };

  _init.initRange.apply(scale, arguments);

  return (0, _linear.linearish)(scale);
}
},{"./continuous.js":"kGze","./init.js":"K3G9","./linear.js":"WtG2","./number.js":"BTzj"}],"Dilz":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = quantile;

var _d3Array = require("d3-array");

var _init = require("./init.js");

function 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] = (0, _d3Array.quantile)(domain, i / n);

    return scale;
  }

  function scale(x) {
    return isNaN(x = +x) ? unknown : range[(0, _d3Array.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(_d3Array.ascending);
    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 quantile().domain(domain).range(range).unknown(unknown);
  };

  return _init.initRange.apply(scale, arguments);
}
},{"d3-array":"Rpnd","./init.js":"K3G9"}],"j3Jj":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = quantize;

var _d3Array = require("d3-array");

var _linear = require("./linear.js");

var _init = require("./init.js");

function quantize() {
  var x0 = 0,
      x1 = 1,
      n = 1,
      domain = [0.5],
      range = [0, 1],
      unknown;

  function scale(x) {
    return x <= x ? range[(0, _d3Array.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 _init.initRange.apply((0, _linear.linearish)(scale), arguments);
}
},{"d3-array":"Rpnd","./linear.js":"WtG2","./init.js":"K3G9"}],"DmfT":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = threshold;

var _d3Array = require("d3-array");

var _init = require("./init.js");

function threshold() {
  var domain = [0.5],
      range = [0, 1],
      unknown,
      n = 1;

  function scale(x) {
    return x <= x ? range[(0, _d3Array.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().domain(domain).range(range).unknown(unknown);
  };

  return _init.initRange.apply(scale, arguments);
}
},{"d3-array":"Rpnd","./init.js":"K3G9"}],"h0Y0":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.calendar = calendar;
exports.default = _default;

var _d3Array = require("d3-array");

var _d3Time = require("d3-time");

var _d3TimeFormat = require("d3-time-format");

var _continuous = _interopRequireWildcard(require("./continuous.js"));

var _init = require("./init.js");

var _nice = _interopRequireDefault(require("./nice.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var durationSecond = 1000,
    durationMinute = durationSecond * 60,
    durationHour = durationMinute * 60,
    durationDay = durationHour * 24,
    durationWeek = durationDay * 7,
    durationMonth = durationDay * 30,
    durationYear = durationDay * 365;

function date(t) {
  return new Date(t);
}

function number(t) {
  return t instanceof Date ? +t : +new Date(+t);
}

function calendar(year, month, week, day, hour, minute, second, millisecond, format) {
  var scale = (0, _continuous.default)(),
      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");
  var tickIntervals = [[second, 1, durationSecond], [second, 5, 5 * durationSecond], [second, 15, 15 * durationSecond], [second, 30, 30 * durationSecond], [minute, 1, durationMinute], [minute, 5, 5 * durationMinute], [minute, 15, 15 * durationMinute], [minute, 30, 30 * durationMinute], [hour, 1, durationHour], [hour, 3, 3 * durationHour], [hour, 6, 6 * durationHour], [hour, 12, 12 * durationHour], [day, 1, durationDay], [day, 2, 2 * durationDay], [week, 1, durationWeek], [month, 1, durationMonth], [month, 3, 3 * durationMonth], [year, 1, durationYear]];

  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);
  }

  function tickInterval(interval, start, stop) {
    if (interval == null) interval = 10; // If a desired tick count is specified, pick a reasonable tick interval
    // based on the extent of the domain and a rough estimate of tick size.
    // Otherwise, assume interval is already a time interval and use it.

    if (typeof interval === "number") {
      var target = Math.abs(stop - start) / interval,
          i = (0, _d3Array.bisector)(function (i) {
        return i[2];
      }).right(tickIntervals, target),
          step;

      if (i === tickIntervals.length) {
        step = (0, _d3Array.tickStep)(start / durationYear, stop / durationYear, interval);
        interval = year;
      } else if (i) {
        i = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];
        step = i[1];
        interval = i[0];
      } else {
        step = Math.max((0, _d3Array.tickStep)(start, stop, interval), 1);
        interval = millisecond;
      }

      return interval.every(step);
    }

    return interval;
  }

  scale.invert = function (y) {
    return new Date(invert(y));
  };

  scale.domain = function (_) {
    return arguments.length ? domain(Array.from(_, number)) : domain().map(date);
  };

  scale.ticks = function (interval) {
    var d = domain(),
        t0 = d[0],
        t1 = d[d.length - 1],
        r = t1 < t0,
        t;
    if (r) t = t0, t0 = t1, t1 = t;
    t = tickInterval(interval, t0, t1);
    t = t ? t.range(t0, t1 + 1) : []; // inclusive stop

    return r ? t.reverse() : t;
  };

  scale.tickFormat = function (count, specifier) {
    return specifier == null ? tickFormat : format(specifier);
  };

  scale.nice = function (interval) {
    var d = domain();
    return (interval = tickInterval(interval, d[0], d[d.length - 1])) ? domain((0, _nice.default)(d, interval)) : scale;
  };

  scale.copy = function () {
    return (0, _continuous.copy)(scale, calendar(year, month, week, day, hour, minute, second, millisecond, format));
  };

  return scale;
}

function _default() {
  return _init.initRange.apply(calendar(_d3Time.timeYear, _d3Time.timeMonth, _d3Time.timeWeek, _d3Time.timeDay, _d3Time.timeHour, _d3Time.timeMinute, _d3Time.timeSecond, _d3Time.timeMillisecond, _d3TimeFormat.timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]), arguments);
}
},{"d3-array":"Rpnd","d3-time":"QBVT","d3-time-format":"fort","./continuous.js":"kGze","./init.js":"K3G9","./nice.js":"xl3A"}],"qF83":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _time = require("./time.js");

var _d3TimeFormat = require("d3-time-format");

var _d3Time = require("d3-time");

var _init = require("./init.js");

function _default() {
  return _init.initRange.apply((0, _time.calendar)(_d3Time.utcYear, _d3Time.utcMonth, _d3Time.utcWeek, _d3Time.utcDay, _d3Time.utcHour, _d3Time.utcMinute, _d3Time.utcSecond, _d3Time.utcMillisecond, _d3TimeFormat.utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]), arguments);
}
},{"./time.js":"h0Y0","d3-time-format":"fort","d3-time":"QBVT","./init.js":"K3G9"}],"BKE3":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.copy = copy;
exports.default = sequential;
exports.sequentialLog = sequentialLog;
exports.sequentialSymlog = sequentialSymlog;
exports.sequentialPow = sequentialPow;
exports.sequentialSqrt = sequentialSqrt;

var _d3Interpolate = require("d3-interpolate");

var _continuous = require("./continuous.js");

var _init = require("./init.js");

var _linear = require("./linear.js");

var _log = require("./log.js");

var _symlog = require("./symlog.js");

var _pow = require("./pow.js");

function transformer() {
  var x0 = 0,
      x1 = 1,
      t0,
      t1,
      k10,
      transform,
      interpolator = _continuous.identity,
      clamp = false,
      unknown;

  function scale(x) {
    return 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(_d3Interpolate.interpolate);
  scale.rangeRound = range(_d3Interpolate.interpolateRound);

  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 copy(source, target) {
  return target.domain(source.domain()).interpolator(source.interpolator()).clamp(source.clamp()).unknown(source.unknown());
}

function sequential() {
  var scale = (0, _linear.linearish)(transformer()(_continuous.identity));

  scale.copy = function () {
    return copy(scale, sequential());
  };

  return _init.initInterpolator.apply(scale, arguments);
}

function sequentialLog() {
  var scale = (0, _log.loggish)(transformer()).domain([1, 10]);

  scale.copy = function () {
    return copy(scale, sequentialLog()).base(scale.base());
  };

  return _init.initInterpolator.apply(scale, arguments);
}

function sequentialSymlog() {
  var scale = (0, _symlog.symlogish)(transformer());

  scale.copy = function () {
    return copy(scale, sequentialSymlog()).constant(scale.constant());
  };

  return _init.initInterpolator.apply(scale, arguments);
}

function sequentialPow() {
  var scale = (0, _pow.powish)(transformer());

  scale.copy = function () {
    return copy(scale, sequentialPow()).exponent(scale.exponent());
  };

  return _init.initInterpolator.apply(scale, arguments);
}

function sequentialSqrt() {
  return sequentialPow.apply(null, arguments).exponent(0.5);
}
},{"d3-interpolate":"y8gx","./continuous.js":"kGze","./init.js":"K3G9","./linear.js":"WtG2","./log.js":"fBKL","./symlog.js":"XN8h","./pow.js":"f2wX"}],"oF1I":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = sequentialQuantile;

var _d3Array = require("d3-array");

var _continuous = require("./continuous.js");

var _init = require("./init.js");

function sequentialQuantile() {
  var domain = [],
      interpolator = _continuous.identity;

  function scale(x) {
    if (!isNaN(x = +x)) return interpolator(((0, _d3Array.bisect)(domain, x, 1) - 1) / (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(_d3Array.ascending);
    return scale;
  };

  scale.interpolator = function (_) {
    return arguments.length ? (interpolator = _, scale) : interpolator;
  };

  scale.range = function () {
    return domain.map((d, i) => interpolator(i / (domain.length - 1)));
  };

  scale.quantiles = function (n) {
    return Array.from({
      length: n + 1
    }, (_, i) => (0, _d3Array.quantile)(domain, i / n));
  };

  scale.copy = function () {
    return sequentialQuantile(interpolator).domain(domain);
  };

  return _init.initInterpolator.apply(scale, arguments);
}
},{"d3-array":"Rpnd","./continuous.js":"kGze","./init.js":"K3G9"}],"Fh1I":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = diverging;
exports.divergingLog = divergingLog;
exports.divergingSymlog = divergingSymlog;
exports.divergingPow = divergingPow;
exports.divergingSqrt = divergingSqrt;

var _d3Interpolate = require("d3-interpolate");

var _continuous = require("./continuous.js");

var _init = require("./init.js");

var _linear = require("./linear.js");

var _log = require("./log.js");

var _sequential = require("./sequential.js");

var _symlog = require("./symlog.js");

var _pow = require("./pow.js");

function transformer() {
  var x0 = 0,
      x1 = 0.5,
      x2 = 1,
      s = 1,
      t0,
      t1,
      t2,
      k10,
      k21,
      interpolator = _continuous.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 = (0, _d3Interpolate.piecewise)(interpolate, [r0, r1, r2]), scale) : [interpolator(0), interpolator(0.5), interpolator(1)];
    };
  }

  scale.range = range(_d3Interpolate.interpolate);
  scale.rangeRound = range(_d3Interpolate.interpolateRound);

  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 = (0, _linear.linearish)(transformer()(_continuous.identity));

  scale.copy = function () {
    return (0, _sequential.copy)(scale, diverging());
  };

  return _init.initInterpolator.apply(scale, arguments);
}

function divergingLog() {
  var scale = (0, _log.loggish)(transformer()).domain([0.1, 1, 10]);

  scale.copy = function () {
    return (0, _sequential.copy)(scale, divergingLog()).base(scale.base());
  };

  return _init.initInterpolator.apply(scale, arguments);
}

function divergingSymlog() {
  var scale = (0, _symlog.symlogish)(transformer());

  scale.copy = function () {
    return (0, _sequential.copy)(scale, divergingSymlog()).constant(scale.constant());
  };

  return _init.initInterpolator.apply(scale, arguments);
}

function divergingPow() {
  var scale = (0, _pow.powish)(transformer());

  scale.copy = function () {
    return (0, _sequential.copy)(scale, divergingPow()).exponent(scale.exponent());
  };

  return _init.initInterpolator.apply(scale, arguments);
}

function divergingSqrt() {
  return divergingPow.apply(null, arguments).exponent(0.5);
}
},{"d3-interpolate":"y8gx","./continuous.js":"kGze","./init.js":"K3G9","./linear.js":"WtG2","./log.js":"fBKL","./sequential.js":"BKE3","./symlog.js":"XN8h","./pow.js":"f2wX"}],"UBb5":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "scaleBand", {
  enumerable: true,
  get: function () {
    return _band.default;
  }
});
Object.defineProperty(exports, "scalePoint", {
  enumerable: true,
  get: function () {
    return _band.point;
  }
});
Object.defineProperty(exports, "scaleIdentity", {
  enumerable: true,
  get: function () {
    return _identity.default;
  }
});
Object.defineProperty(exports, "scaleLinear", {
  enumerable: true,
  get: function () {
    return _linear.default;
  }
});
Object.defineProperty(exports, "scaleLog", {
  enumerable: true,
  get: function () {
    return _log.default;
  }
});
Object.defineProperty(exports, "scaleSymlog", {
  enumerable: true,
  get: function () {
    return _symlog.default;
  }
});
Object.defineProperty(exports, "scaleOrdinal", {
  enumerable: true,
  get: function () {
    return _ordinal.default;
  }
});
Object.defineProperty(exports, "scaleImplicit", {
  enumerable: true,
  get: function () {
    return _ordinal.implicit;
  }
});
Object.defineProperty(exports, "scalePow", {
  enumerable: true,
  get: function () {
    return _pow.default;
  }
});
Object.defineProperty(exports, "scaleSqrt", {
  enumerable: true,
  get: function () {
    return _pow.sqrt;
  }
});
Object.defineProperty(exports, "scaleRadial", {
  enumerable: true,
  get: function () {
    return _radial.default;
  }
});
Object.defineProperty(exports, "scaleQuantile", {
  enumerable: true,
  get: function () {
    return _quantile.default;
  }
});
Object.defineProperty(exports, "scaleQuantize", {
  enumerable: true,
  get: function () {
    return _quantize.default;
  }
});
Object.defineProperty(exports, "scaleThreshold", {
  enumerable: true,
  get: function () {
    return _threshold.default;
  }
});
Object.defineProperty(exports, "scaleTime", {
  enumerable: true,
  get: function () {
    return _time.default;
  }
});
Object.defineProperty(exports, "scaleUtc", {
  enumerable: true,
  get: function () {
    return _utcTime.default;
  }
});
Object.defineProperty(exports, "scaleSequential", {
  enumerable: true,
  get: function () {
    return _sequential.default;
  }
});
Object.defineProperty(exports, "scaleSequentialLog", {
  enumerable: true,
  get: function () {
    return _sequential.sequentialLog;
  }
});
Object.defineProperty(exports, "scaleSequentialPow", {
  enumerable: true,
  get: function () {
    return _sequential.sequentialPow;
  }
});
Object.defineProperty(exports, "scaleSequentialSqrt", {
  enumerable: true,
  get: function () {
    return _sequential.sequentialSqrt;
  }
});
Object.defineProperty(exports, "scaleSequentialSymlog", {
  enumerable: true,
  get: function () {
    return _sequential.sequentialSymlog;
  }
});
Object.defineProperty(exports, "scaleSequentialQuantile", {
  enumerable: true,
  get: function () {
    return _sequentialQuantile.default;
  }
});
Object.defineProperty(exports, "scaleDiverging", {
  enumerable: true,
  get: function () {
    return _diverging.default;
  }
});
Object.defineProperty(exports, "scaleDivergingLog", {
  enumerable: true,
  get: function () {
    return _diverging.divergingLog;
  }
});
Object.defineProperty(exports, "scaleDivergingPow", {
  enumerable: true,
  get: function () {
    return _diverging.divergingPow;
  }
});
Object.defineProperty(exports, "scaleDivergingSqrt", {
  enumerable: true,
  get: function () {
    return _diverging.divergingSqrt;
  }
});
Object.defineProperty(exports, "scaleDivergingSymlog", {
  enumerable: true,
  get: function () {
    return _diverging.divergingSymlog;
  }
});
Object.defineProperty(exports, "tickFormat", {
  enumerable: true,
  get: function () {
    return _tickFormat.default;
  }
});

var _band = _interopRequireWildcard(require("./band.js"));

var _identity = _interopRequireDefault(require("./identity.js"));

var _linear = _interopRequireDefault(require("./linear.js"));

var _log = _interopRequireDefault(require("./log.js"));

var _symlog = _interopRequireDefault(require("./symlog.js"));

var _ordinal = _interopRequireWildcard(require("./ordinal.js"));

var _pow = _interopRequireWildcard(require("./pow.js"));

var _radial = _interopRequireDefault(require("./radial.js"));

var _quantile = _interopRequireDefault(require("./quantile.js"));

var _quantize = _interopRequireDefault(require("./quantize.js"));

var _threshold = _interopRequireDefault(require("./threshold.js"));

var _time = _interopRequireDefault(require("./time.js"));

var _utcTime = _interopRequireDefault(require("./utcTime.js"));

var _sequential = _interopRequireWildcard(require("./sequential.js"));

var _sequentialQuantile = _interopRequireDefault(require("./sequentialQuantile.js"));

var _diverging = _interopRequireWildcard(require("./diverging.js"));

var _tickFormat = _interopRequireDefault(require("./tickFormat.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
},{"./band.js":"GuIC","./identity.js":"L2v5","./linear.js":"WtG2","./log.js":"fBKL","./symlog.js":"XN8h","./ordinal.js":"Yv9Y","./pow.js":"f2wX","./radial.js":"jaFS","./quantile.js":"Dilz","./quantize.js":"j3Jj","./threshold.js":"DmfT","./time.js":"h0Y0","./utcTime.js":"qF83","./sequential.js":"BKE3","./sequentialQuantile.js":"oF1I","./diverging.js":"Fh1I","./tickFormat.js":"xMUV"}],"BMKi":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.band = band;
exports.point = point;

var _bandSpace = _interopRequireDefault(require("./bandSpace"));

var _d3Array = require("d3-array");

var _d3Scale = require("d3-scale");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function band() {
  var scale = (0, _d3Scale.scaleOrdinal)().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 = (0, _bandSpace.default)(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 = (0, _d3Array.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, (0, _d3Array.bisectRight)(values, lo) - 1);
    b = lo === hi ? a : (0, _d3Array.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 band().domain(domain()).range(range).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align);
  };

  return rescale();
}

function pointish(scale) {
  var copy = scale.copy;
  scale.padding = scale.paddingOuter;
  delete scale.paddingInner;

  scale.copy = function () {
    return pointish(copy());
  };

  return scale;
}

function point() {
  return pointish(band().paddingInner(1));
}
},{"./bandSpace":"Bt1o","d3-array":"Rpnd","d3-scale":"UBb5"}],"MyLb":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.numbers = numbers;
var map = Array.prototype.map;

function numbers(_) {
  return map.call(_, function (x) {
    return +x;
  });
}
},{}],"CkwR":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.scaleBinOrdinal = scaleBinOrdinal;

var _d3Array = require("d3-array");

var _d3Scale = require("d3-scale");

var _vegaUtil = require("vega-util");

var _numbers = require("./numbers");

var _slice = require("./slice");

function scaleBinOrdinal() {
  var domain = [],
      range = [];

  function scale(x) {
    return x == null || x !== x ? undefined : range[((0, _d3Array.bisect)(domain, x) - 1) % range.length];
  }

  scale.domain = function (_) {
    if (arguments.length) {
      domain = (0, _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 (0, _d3Scale.tickFormat)(domain[0], (0, _vegaUtil.peek)(domain), count == null ? 10 : count, specifier);
  };

  scale.copy = function () {
    return scaleBinOrdinal().domain(scale.domain()).range(scale.range());
  };

  return scale;
}
},{"d3-array":"Rpnd","d3-scale":"UBb5","vega-util":"dejJ","./numbers":"MyLb","./slice":"aOxl"}],"HU9Q":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = scale;

var _vegaUtil = require("vega-util");

var _invertRange = _interopRequireDefault(require("./scales/invertRange"));

var _invertRangeExtent = _interopRequireDefault(require("./scales/invertRangeExtent"));

var _types = require("./scales/types");

var _scaleBand = require("./scales/scaleBand");

var _scaleBinOrdinal = require("./scales/scaleBinOrdinal");

var $ = _interopRequireWildcard(require("d3-scale"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * Augment scales with their type and needed inverse methods.
 */
function create(type, constructor) {
  return function scale() {
    var s = constructor();

    if (!s.invertRange) {
      s.invertRange = s.invert ? (0, _invertRange.default)(s) : s.invertExtent ? (0, _invertRangeExtent.default)(s) : undefined;
    }

    s.type = type;
    return s;
  };
}

function scale(type, scale) {
  if (arguments.length > 1) {
    scales[type] = create(type, scale);
    return this;
  } else {
    return (0, _vegaUtil.hasOwnProperty)(scales, type) ? scales[type] : undefined;
  }
}

var scales = {
  // identity scale
  [_types.Identity]: $.scaleIdentity,
  // continuous scales
  [_types.Linear]: $.scaleLinear,
  [_types.Log]: $.scaleLog,
  [_types.Pow]: $.scalePow,
  [_types.Sqrt]: $.scaleSqrt,
  [_types.Symlog]: $.scaleSymlog,
  [_types.Time]: $.scaleTime,
  [_types.UTC]: $.scaleUtc,
  // sequential scales
  [_types.Sequential]: $.scaleSequential,
  // backwards compat
  [_types.Sequential + '-' + _types.Linear]: $.scaleSequential,
  [_types.Sequential + '-' + _types.Log]: $.scaleSequentialLog,
  [_types.Sequential + '-' + _types.Pow]: $.scaleSequentialPow,
  [_types.Sequential + '-' + _types.Sqrt]: $.scaleSequentialSqrt,
  [_types.Sequential + '-' + _types.Symlog]: $.scaleSequentialSymlog,
  // diverging scales
  [_types.Diverging + '-' + _types.Linear]: $.scaleDiverging,
  [_types.Diverging + '-' + _types.Log]: $.scaleDivergingLog,
  [_types.Diverging + '-' + _types.Pow]: $.scaleDivergingPow,
  [_types.Diverging + '-' + _types.Sqrt]: $.scaleDivergingSqrt,
  [_types.Diverging + '-' + _types.Symlog]: $.scaleDivergingSymlog,
  // discretizing scales
  [_types.Quantile]: $.scaleQuantile,
  [_types.Quantize]: $.scaleQuantize,
  [_types.Threshold]: $.scaleThreshold,
  // discrete scales
  [_types.BinOrdinal]: _scaleBinOrdinal.scaleBinOrdinal,
  [_types.Ordinal]: $.scaleOrdinal,
  [_types.Band]: _scaleBand.band,
  [_types.Point]: _scaleBand.point
};

for (var key in scales) {
  scale(key, scales[key]);
}
},{"vega-util":"dejJ","./scales/invertRange":"sDew","./scales/invertRangeExtent":"dV9l","./scales/types":"KcJD","./scales/scaleBand":"BMKi","./scales/scaleBinOrdinal":"CkwR","d3-scale":"UBb5"}],"s4Ys":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.interpolateRange = interpolateRange;
exports.interpolateColors = interpolateColors;
exports.quantizeInterpolator = quantizeInterpolator;
exports.scaleCopy = scaleCopy;
exports.scaleFraction = scaleFraction;
exports.interpolate = interpolate;

var _scales = _interopRequireDefault(require("./scales"));

var _vegaUtil = require("vega-util");

var $ = _interopRequireWildcard(require("d3-interpolate"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

const scaleProps = ['clamp', 'base', 'constant', 'exponent'];

function interpolateRange(interpolator, range) {
  var start = range[0],
      span = (0, _vegaUtil.peek)(range) - start;
  return function (i) {
    return interpolator(start + i * span);
  };
}

function interpolateColors(colors, type, gamma) {
  return $.piecewise(interpolate(type || 'rgb', gamma), colors);
}

function 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 scaleCopy(scale) {
  const t = scale.type,
        s = scale.copy();
  s.type = t;
  return s;
}

function scaleFraction(scale, min, max) {
  var delta = max - min,
      i,
      t,
      s;

  if (!delta || !Number.isFinite(delta)) {
    return (0, _vegaUtil.constant)(0.5);
  } else {
    i = (t = scale.type).indexOf('-');
    t = i < 0 ? t : t.slice(i + 1);
    s = (0, _scales.default)(t)().domain([min, max]).range([0, 1]);
    scaleProps.forEach(m => scale[m] ? s[m](scale[m]()) : 0);
    return s;
  }
}

function interpolate(type, gamma) {
  var interp = $[method(type)];
  return gamma != null && interp && interp.gamma ? interp.gamma(gamma) : interp;
}

function method(type) {
  return 'interpolate' + type.toLowerCase().split('-').map(function (s) {
    return s[0].toUpperCase() + s.slice(1);
  }).join('');
}
},{"./scales":"HU9Q","vega-util":"dejJ","d3-interpolate":"y8gx"}],"sWPE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.discrete = exports.continuous = void 0;
const 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'
};
exports.continuous = continuous;
const 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'
};
exports.discrete = discrete;
},{}],"OGcI":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.scheme = scheme;

var _palettes = require("./palettes");

var _interpolate = require("./interpolate");

function 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 apply(_, f) {
  for (let k in _) scheme(k, f(_[k]));
}

const schemes = {};
apply(_palettes.discrete, colors);
apply(_palettes.continuous, _ => (0, _interpolate.interpolateColors)(colors(_)));

function scheme(name, scheme) {
  name = name && name.toLowerCase();

  if (arguments.length > 1) {
    schemes[name] = scheme;
    return this;
  } else {
    return schemes[name];
  }
}
},{"./palettes":"sWPE","./interpolate":"s4Ys"}],"VE6e":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "bandSpace", {
  enumerable: true,
  get: function () {
    return _bandSpace.default;
  }
});
Object.defineProperty(exports, "Identity", {
  enumerable: true,
  get: function () {
    return _types.Identity;
  }
});
Object.defineProperty(exports, "Linear", {
  enumerable: true,
  get: function () {
    return _types.Linear;
  }
});
Object.defineProperty(exports, "Log", {
  enumerable: true,
  get: function () {
    return _types.Log;
  }
});
Object.defineProperty(exports, "Pow", {
  enumerable: true,
  get: function () {
    return _types.Pow;
  }
});
Object.defineProperty(exports, "Sqrt", {
  enumerable: true,
  get: function () {
    return _types.Sqrt;
  }
});
Object.defineProperty(exports, "Symlog", {
  enumerable: true,
  get: function () {
    return _types.Symlog;
  }
});
Object.defineProperty(exports, "Time", {
  enumerable: true,
  get: function () {
    return _types.Time;
  }
});
Object.defineProperty(exports, "UTC", {
  enumerable: true,
  get: function () {
    return _types.UTC;
  }
});
Object.defineProperty(exports, "Sequential", {
  enumerable: true,
  get: function () {
    return _types.Sequential;
  }
});
Object.defineProperty(exports, "Diverging", {
  enumerable: true,
  get: function () {
    return _types.Diverging;
  }
});
Object.defineProperty(exports, "Quantile", {
  enumerable: true,
  get: function () {
    return _types.Quantile;
  }
});
Object.defineProperty(exports, "Quantize", {
  enumerable: true,
  get: function () {
    return _types.Quantize;
  }
});
Object.defineProperty(exports, "Threshold", {
  enumerable: true,
  get: function () {
    return _types.Threshold;
  }
});
Object.defineProperty(exports, "BinOrdinal", {
  enumerable: true,
  get: function () {
    return _types.BinOrdinal;
  }
});
Object.defineProperty(exports, "Ordinal", {
  enumerable: true,
  get: function () {
    return _types.Ordinal;
  }
});
Object.defineProperty(exports, "Band", {
  enumerable: true,
  get: function () {
    return _types.Band;
  }
});
Object.defineProperty(exports, "Point", {
  enumerable: true,
  get: function () {
    return _types.Point;
  }
});
Object.defineProperty(exports, "isValidScaleType", {
  enumerable: true,
  get: function () {
    return _types.isValidScaleType;
  }
});
Object.defineProperty(exports, "isTemporal", {
  enumerable: true,
  get: function () {
    return _types.isTemporal;
  }
});
Object.defineProperty(exports, "isQuantile", {
  enumerable: true,
  get: function () {
    return _types.isQuantile;
  }
});
Object.defineProperty(exports, "isSequential", {
  enumerable: true,
  get: function () {
    return _types.isSequential;
  }
});
Object.defineProperty(exports, "isDiverging", {
  enumerable: true,
  get: function () {
    return _types.isDiverging;
  }
});
Object.defineProperty(exports, "isInterpolating", {
  enumerable: true,
  get: function () {
    return _types.isInterpolating;
  }
});
Object.defineProperty(exports, "isContinuous", {
  enumerable: true,
  get: function () {
    return _types.isContinuous;
  }
});
Object.defineProperty(exports, "isLogarithmic", {
  enumerable: true,
  get: function () {
    return _types.isLogarithmic;
  }
});
Object.defineProperty(exports, "isDiscrete", {
  enumerable: true,
  get: function () {
    return _types.isDiscrete;
  }
});
Object.defineProperty(exports, "isDiscretizing", {
  enumerable: true,
  get: function () {
    return _types.isDiscretizing;
  }
});
Object.defineProperty(exports, "interpolate", {
  enumerable: true,
  get: function () {
    return _interpolate.interpolate;
  }
});
Object.defineProperty(exports, "interpolateColors", {
  enumerable: true,
  get: function () {
    return _interpolate.interpolateColors;
  }
});
Object.defineProperty(exports, "interpolateRange", {
  enumerable: true,
  get: function () {
    return _interpolate.interpolateRange;
  }
});
Object.defineProperty(exports, "scaleCopy", {
  enumerable: true,
  get: function () {
    return _interpolate.scaleCopy;
  }
});
Object.defineProperty(exports, "scaleFraction", {
  enumerable: true,
  get: function () {
    return _interpolate.scaleFraction;
  }
});
Object.defineProperty(exports, "quantizeInterpolator", {
  enumerable: true,
  get: function () {
    return _interpolate.quantizeInterpolator;
  }
});
Object.defineProperty(exports, "scale", {
  enumerable: true,
  get: function () {
    return _scales.default;
  }
});
Object.defineProperty(exports, "scheme", {
  enumerable: true,
  get: function () {
    return _schemes.scheme;
  }
});
Object.defineProperty(exports, "scaleImplicit", {
  enumerable: true,
  get: function () {
    return _d3Scale.scaleImplicit;
  }
});
Object.defineProperty(exports, "tickFormat", {
  enumerable: true,
  get: function () {
    return _d3Scale.tickFormat;
  }
});

var _bandSpace = _interopRequireDefault(require("./src/scales/bandSpace"));

var _types = require("./src/scales/types");

var _interpolate = require("./src/interpolate");

var _scales = _interopRequireDefault(require("./src/scales"));

var _schemes = require("./src/schemes");

var _d3Scale = require("d3-scale");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./src/scales/bandSpace":"Bt1o","./src/scales/types":"KcJD","./src/interpolate":"s4Ys","./src/scales":"HU9Q","./src/schemes":"OGcI","d3-scale":"UBb5"}],"creK":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.tickCount = tickCount;
exports.validTicks = validTicks;
exports.tickValues = tickValues;
exports.tickFormat = tickFormat;

var _vegaScale = require("vega-scale");

var _vegaTime = require("vega-time");

var _vegaUtil = require("vega-util");

var _d3Format = require("d3-format");

/**
 * 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) {
  var step;

  if ((0, _vegaUtil.isNumber)(count)) {
    if (scale.bins) {
      count = Math.max(count, scale.bins.length);
    }

    if (minStep != null) {
      count = Math.min(count, ~~((0, _vegaUtil.span)(scale.domain()) / minStep) || 1);
    }
  }

  if ((0, _vegaUtil.isObject)(count)) {
    step = count.step;
    count = count.interval;
  }

  if ((0, _vegaUtil.isString)(count)) {
    count = scale.type === _vegaScale.Time ? (0, _vegaTime.timeInterval)(count) : scale.type == _vegaScale.UTC ? (0, _vegaTime.utcInterval)(count) : (0, _vegaUtil.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) {
  var range = scale.range(),
      lo = Math.floor(range[0]),
      hi = Math.ceil((0, _vegaUtil.peek)(range));

  if (lo > hi) {
    range = hi;
    hi = lo;
    lo = range;
  }

  ticks = ticks.filter(function (v) {
    v = scale(v);
    return lo <= v && v <= hi;
  });

  if (count > 0 && ticks.length > 1) {
    var endpoints = [ticks[0], (0, _vegaUtil.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 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 tickFormat(scale, count, specifier, formatType, noSkip) {
  var type = scale.type,
      format = type === _vegaScale.Time || formatType === _vegaScale.Time ? (0, _vegaTime.timeFormat)(specifier) : type === _vegaScale.UTC || formatType === _vegaScale.UTC ? (0, _vegaTime.utcFormat)(specifier) : scale.tickFormat ? scale.tickFormat(count, specifier) : specifier ? (0, _d3Format.format)(specifier) : String;

  if ((0, _vegaScale.isLogarithmic)(type)) {
    var logfmt = variablePrecision(specifier);
    format = noSkip || scale.bins ? logfmt : filter(format, logfmt);
  }

  return format;
}

function filter(sourceFormat, targetFormat) {
  return _ => sourceFormat(_) ? targetFormat(_) : '';
}

function variablePrecision(specifier) {
  var s = (0, _d3Format.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((0, _d3Format.format)(s), // number format
    (0, _d3Format.format)('.1f')(1)[1] // decimal point character
    );
  } else {
    return (0, _d3Format.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
  }
}
},{"vega-scale":"VE6e","vega-time":"j8qo","vega-util":"dejJ","d3-format":"SA6z"}],"zQzp":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = AxisTicks;

var _ticks = require("./ticks");

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.Transform.call(this, null, params);
}

var prototype = (0, _vegaUtil.inherits)(AxisTicks, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  if (this.value && !_.modified()) {
    return pulse.StopPropagation;
  }

  var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
      ticks = this.value,
      scale = _.scale,
      tally = _.count == null ? _.values ? _.values.length : 10 : _.count,
      count = (0, _ticks.tickCount)(scale, tally, _.minstep),
      format = _.format || (0, _ticks.tickFormat)(scale, count, _.formatSpecifier, _.formatType, !!_.values),
      values = _.values ? (0, _ticks.validTicks)(scale, _.values, count) : (0, _ticks.tickValues)(scale, count);
  if (ticks) out.rem = ticks;
  ticks = values.map(function (value, i) {
    return (0, _vegaDataflow.ingest)({
      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((0, _vegaDataflow.ingest)({
      index: -1,
      extra: {
        value: ticks[0].value
      },
      label: ''
    }));
  }

  out.source = ticks;
  out.add = ticks;
  this.value = ticks;
  return out;
};
},{"./ticks":"creK","vega-dataflow":"UC8n","vega-util":"dejJ"}],"uz6y":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = DataJoin;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.Transform.call(this, null, params);
}

var prototype = (0, _vegaUtil.inherits)(DataJoin, _vegaDataflow.Transform);

function defaultItemCreate() {
  return (0, _vegaDataflow.ingest)({});
}

function isExit(t) {
  return t.exit;
}

prototype.transform = function (_, pulse) {
  var df = pulse.dataflow,
      out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
      item = _.item || defaultItemCreate,
      key = _.key || _vegaDataflow.tupleid,
      map = this.value; // prevent transient (e.g., hover) requests from
  // cascading across marks derived from marks

  if ((0, _vegaUtil.isArray)(out.encode)) {
    out.encode = null;
  }

  if (map && (_.modified('key') || pulse.modified(key))) {
    (0, _vegaUtil.error)('DataJoin does not support modified key function or fields.');
  }

  if (!map) {
    pulse = pulse.addAll();
    this.value = map = (0, _vegaUtil.fastmap)().test(isExit);

    map.lookup = function (t) {
      return map.get(key(t));
    };
  }

  pulse.visit(pulse.ADD, function (t) {
    var k = key(t),
        x = map.get(k);

    if (x) {
      if (x.exit) {
        map.empty--;
        out.add.push(x);
      } else {
        out.mod.push(x);
      }
    } else {
      map.set(k, x = item(t));
      out.add.push(x);
    }

    x.datum = t;
    x.exit = false;
  });
  pulse.visit(pulse.MOD, function (t) {
    var k = key(t),
        x = map.get(k);

    if (x) {
      x.datum = t;
      out.mod.push(x);
    }
  });
  pulse.visit(pulse.REM, function (t) {
    var 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 (_.clean && map.empty > df.cleanThreshold) df.runAfter(map.clean);
  return out;
};
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"Pe3W":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Encode;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.Transform.call(this, null, params);
}

var prototype = (0, _vegaUtil.inherits)(Encode, _vegaDataflow.Transform);

prototype.transform = function (_, 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 ((0, _vegaUtil.isArray)(encode)) {
    if (out.changed() || encode.every(function (e) {
      return 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 || _vegaUtil.falsy,
      enter = encoders.enter || _vegaUtil.falsy,
      exit = encoders.exit || _vegaUtil.falsy,
      set = (encode && !reenter ? encoders[encode] : update) || _vegaUtil.falsy;

  if (pulse.changed(pulse.ADD)) {
    pulse.visit(pulse.ADD, function (t) {
      enter(t, _);
      update(t, _);
    });
    out.modifies(enter.output);
    out.modifies(update.output);

    if (set !== _vegaUtil.falsy && set !== update) {
      pulse.visit(pulse.ADD, function (t) {
        set(t, _);
      });
      out.modifies(set.output);
    }
  }

  if (pulse.changed(pulse.REM) && exit !== _vegaUtil.falsy) {
    pulse.visit(pulse.REM, function (t) {
      exit(t, _);
    });
    out.modifies(exit.output);
  }

  if (reenter || set !== _vegaUtil.falsy) {
    var flag = pulse.MOD | (_.modified() ? pulse.REFLOW : 0);

    if (reenter) {
      pulse.visit(flag, function (t) {
        var mod = enter(t, _) || fmod;
        if (set(t, _) || mod) out.mod.push(t);
      });
      if (out.mod.length) out.modifies(enter.output);
    } else {
      pulse.visit(flag, function (t) {
        if (set(t, _) || fmod) out.mod.push(t);
      });
    }

    if (out.mod.length) out.modifies(set.output);
  }

  return out.changed() ? out : pulse.StopPropagation;
};
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"qKIp":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Gradient = exports.Discrete = exports.Symbols = void 0;
var Symbols = 'symbol';
exports.Symbols = Symbols;
var Discrete = 'discrete';
exports.Discrete = Discrete;
var Gradient = 'gradient';
exports.Gradient = Gradient;
},{}],"BKkP":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.labelValues = labelValues;
exports.thresholdFormat = thresholdFormat;
exports.labelFormat = labelFormat;
exports.labelFraction = labelFraction;

var _legendTypes = require("./legend-types");

var _ticks = require("./ticks");

var _vegaUtil = require("vega-util");

var _vegaScale = require("vega-scale");

const symbols = {
  [_vegaScale.Quantile]: 'quantiles',
  [_vegaScale.Quantize]: 'thresholds',
  [_vegaScale.Threshold]: 'domain'
};
const formats = {
  [_vegaScale.Quantile]: 'quantiles',
  [_vegaScale.Quantize]: 'domain'
};

function labelValues(scale, count) {
  return scale.bins ? binValues(scale.bins) : symbols[scale.type] ? thresholdValues(scale[symbols[scale.type]]()) : (0, _ticks.tickValues)(scale, count);
}

function thresholdFormat(scale, specifier) {
  var _ = scale[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]);
  } // 3 ticks times 10 for increased resolution


  return (0, _vegaScale.tickFormat)(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 = (0, _vegaUtil.peek)(bins);
  return values;
}

function isDiscreteRange(scale) {
  return symbols[scale.type] || scale.bins;
}

function labelFormat(scale, count, type, specifier, formatType, noSkip) {
  const format = formats[scale.type] && formatType !== _vegaScale.Time && formatType !== _vegaScale.UTC ? thresholdFormat(scale, specifier) : (0, _ticks.tickFormat)(scale, count, specifier, formatType, noSkip);
  return type === _legendTypes.Symbols && isDiscreteRange(scale) ? formatRange(format) : type === _legendTypes.Discrete ? formatDiscrete(format) : formatPoint(format);
}

function formatRange(format) {
  return function (value, index, array) {
    var limit = array[index + 1] || array.max || +Infinity,
        lo = formatValue(value, format),
        hi = formatValue(limit, format);
    return lo && hi ? lo + '\u2013' + hi : hi ? '< ' + hi : '\u2265 ' + lo;
  };
}

function formatDiscrete(format) {
  return function (value, index) {
    return index ? format(value) : null;
  };
}

function formatPoint(format) {
  return function (value) {
    return format(value);
  };
}

function formatValue(value, format) {
  return Number.isFinite(value) ? format(value) : null;
}

function labelFraction(scale) {
  var domain = scale.domain(),
      count = domain.length - 1,
      lo = +domain[0],
      hi = +(0, _vegaUtil.peek)(domain),
      span = hi - lo;

  if (scale.type === _vegaScale.Threshold) {
    var adjust = count ? span / count : 0.1;
    lo -= adjust;
    hi += adjust;
    span = hi - lo;
  }

  return function (value) {
    return (value - lo) / span;
  };
}
},{"./legend-types":"qKIp","./ticks":"creK","vega-util":"dejJ","vega-scale":"VE6e"}],"mQpK":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = LegendEntries;

var _labels = require("./labels");

var _legendTypes = require("./legend-types");

var _ticks = require("./ticks");

var _vegaDataflow = require("vega-dataflow");

var _vegaScale = require("vega-scale");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.Transform.call(this, [], params);
}

var prototype = (0, _vegaUtil.inherits)(LegendEntries, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  if (this.value != null && !_.modified()) {
    return pulse.StopPropagation;
  }

  var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
      items = this.value,
      type = _.type || _legendTypes.Symbols,
      scale = _.scale,
      limit = +_.limit,
      count = (0, _ticks.tickCount)(scale, _.count == null ? 5 : _.count, _.minstep),
      format = _.format || (0, _labels.labelFormat)(scale, count, type, _.formatSpecifier, _.formatType, !!_.values),
      values = _.values || (0, _labels.labelValues)(scale, count, type),
      domain,
      fraction,
      size,
      offset,
      ellipsis;
  if (items) out.rem = items;

  if (type === _legendTypes.Symbols) {
    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 ((0, _vegaUtil.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(function (max, value) {
        return Math.max(max, size(value, _));
      }, 0);
    } else {
      size = (0, _vegaUtil.constant)(offset = size || 8);
    }

    items = items.map(function (value, index) {
      return (0, _vegaDataflow.ingest)({
        index: index,
        label: format(value, index, values),
        value: value,
        offset: offset,
        size: size(value, _)
      });
    });

    if (ellipsis) {
      ellipsis = values[items.length];
      items.push((0, _vegaDataflow.ingest)({
        index: items.length,
        label: `\u2026${values.length - items.length} entries`,
        value: ellipsis,
        offset: offset,
        size: size(ellipsis, _)
      }));
    }
  } else if (type === _legendTypes.Gradient) {
    domain = scale.domain(), fraction = (0, _vegaScale.scaleFraction)(scale, domain[0], (0, _vegaUtil.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] !== (0, _vegaUtil.peek)(domain)) {
      values = [domain[0], (0, _vegaUtil.peek)(domain)];
    }

    items = values.map(function (value, index) {
      return (0, _vegaDataflow.ingest)({
        index: index,
        label: format(value, index, values),
        value: value,
        perc: fraction(value)
      });
    });
  } else {
    size = values.length - 1;
    fraction = (0, _labels.labelFraction)(scale);
    items = values.map(function (value, index) {
      return (0, _vegaDataflow.ingest)({
        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;
};
},{"./labels":"BKkP","./legend-types":"qKIp","./ticks":"creK","vega-dataflow":"UC8n","vega-scale":"VE6e","vega-util":"dejJ"}],"Hy6o":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = LinkPath;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

var Paths = (0, _vegaUtil.fastmap)({
  'line': line,
  'line-radial': lineR,
  'arc': arc,
  'arc-radial': arcR,
  'curve': curve,
  'curve-radial': curveR,
  'orthogonal-horizontal': orthoX,
  'orthogonal-vertical': orthoY,
  'orthogonal-radial': orthoR,
  'diagonal-horizontal': diagonalX,
  'diagonal-vertical': diagonalY,
  'diagonal-radial': diagonalR
});

function sourceX(t) {
  return t.source.x;
}

function sourceY(t) {
  return t.source.y;
}

function targetX(t) {
  return t.target.x;
}

function targetY(t) {
  return t.target.y;
}
/**
 * Layout paths linking source and target elements.
 * @constructor
 * @param {object} params - The parameters for this operator.
 */


function LinkPath(params) {
  _vegaDataflow.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"
  }]
};
var prototype = (0, _vegaUtil.inherits)(LinkPath, _vegaDataflow.Transform);

prototype.transform = function (_, 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) {
    (0, _vegaUtil.error)('LinkPath unsupported type: ' + _.shape + (_.orient ? '-' + _.orient : ''));
  }

  pulse.visit(pulse.SOURCE, function (t) {
    t[as] = path(sx(t), sy(t), tx(t), ty(t));
  });
  return pulse.reflow(_.modified()).modifies(as);
}; // -- Link Path Generation Methods -----


function line(sx, sy, tx, ty) {
  return 'M' + sx + ',' + sy + 'L' + tx + ',' + ty;
}

function lineR(sa, sr, ta, tr) {
  return line(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta));
}

function 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;
}

function arcR(sa, sr, ta, tr) {
  return arc(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta));
}

function curve(sx, sy, tx, ty) {
  var 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;
}

function curveR(sa, sr, ta, tr) {
  return curve(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta));
}

function orthoX(sx, sy, tx, ty) {
  return 'M' + sx + ',' + sy + 'V' + ty + 'H' + tx;
}

function orthoY(sx, sy, tx, ty) {
  return 'M' + sx + ',' + sy + 'H' + tx + 'V' + ty;
}

function orthoR(sa, sr, ta, tr) {
  var 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;
}

function diagonalX(sx, sy, tx, ty) {
  var m = (sx + tx) / 2;
  return 'M' + sx + ',' + sy + 'C' + m + ',' + sy + ' ' + m + ',' + ty + ' ' + tx + ',' + ty;
}

function diagonalY(sx, sy, tx, ty) {
  var m = (sy + ty) / 2;
  return 'M' + sx + ',' + sy + 'C' + sx + ',' + m + ' ' + tx + ',' + m + ' ' + tx + ',' + ty;
}

function diagonalR(sa, sr, ta, tr) {
  var 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;
}
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"HQqr":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Pie;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

var _d3Array = require("d3-array");

/**
 * 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) {
  _vegaDataflow.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"]
  }]
};
var prototype = (0, _vegaUtil.inherits)(Pie, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var as = _.as || ['startAngle', 'endAngle'],
      startAngle = as[0],
      endAngle = as[1],
      field = _.field || _vegaUtil.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) / (0, _d3Array.sum)(values),
      index = (0, _d3Array.range)(n),
      i,
      t,
      v;

  if (_.sort) {
    index.sort(function (a, b) {
      return 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);
};
},{"vega-dataflow":"UC8n","vega-util":"dejJ","d3-array":"Rpnd"}],"rLka":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Scale;

var _ticks = require("./ticks");

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

var _vegaScale = require("vega-scale");

var _d3Array = require("d3-array");

var _d3Interpolate = require("d3-interpolate");

var DEFAULT_COUNT = 5;

function includeZero(scale) {
  const type = scale.type;
  return !scale.bins && (type === _vegaScale.Linear || type === _vegaScale.Pow || type === _vegaScale.Sqrt);
}

function includePad(type) {
  return (0, _vegaScale.isContinuous)(type) && type !== _vegaScale.Sequential;
}

var SKIP = (0, _vegaUtil.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) {
  _vegaDataflow.Transform.call(this, null, params);

  this.modified(true); // always treat as modified
}

var prototype = (0, _vegaUtil.inherits)(Scale, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var df = pulse.dataflow,
      scale = this.value,
      key = scaleKey(_);

  if (!scale || key !== scale.type) {
    this.value = scale = (0, _vegaScale.scale)(key)();
  }

  for (key in _) if (!SKIP[key]) {
    // padding is a scale property for band/point but not others
    if (key === 'padding' && includePad(scale.type)) continue; // invoke scale property setter, raise warning if not found

    (0, _vegaUtil.isFunction)(scale[key]) ? scale[key](_[key]) : df.warn('Unsupported scale property: ' + key);
  }

  configureRange(scale, _, configureBins(scale, _, configureDomain(scale, _, df)));
  return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);
};

function scaleKey(_) {
  var t = _.type,
      d = '',
      n; // backwards compatibility pre Vega 5.

  if (t === _vegaScale.Sequential) return _vegaScale.Sequential + '-' + _vegaScale.Linear;

  if (isContinuousColor(_)) {
    n = _.rawDomain ? _.rawDomain.length : _.domain ? _.domain.length + +(_.domainMid != null) : 0;
    d = n === 2 ? _vegaScale.Sequential + '-' : n === 3 ? _vegaScale.Diverging + '-' : '';
  }

  return (d + t || _vegaScale.Linear).toLowerCase();
}

function isContinuousColor(_) {
  const t = _.type;
  return (0, _vegaScale.isContinuous)(t) && t !== _vegaScale.Time && t !== _vegaScale.UTC && (_.scheme || _.range && _.range.length && _.range.every(_vegaUtil.isString));
}

function configureDomain(scale, _, df) {
  // check raw domain, if provided use that and exit early
  var 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] !== (0, _vegaUtil.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;

      if (mid < domain[0] || mid > domain[n]) {
        df.warn('Scale domainMid exceeds domain min or max.', mid);
      }

      domain.splice(n, 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 === _vegaScale.Ordinal) {
    scale.unknown(_.domainImplicit ? _vegaScale.scaleImplicit : undefined);
  } // perform 'nice' adjustment as requested


  if (_.nice && scale.nice) {
    scale.nice(_.nice !== true && (0, _ticks.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((0, _vegaUtil.peek)(range) - range[0]),
      frac = span / (span - 2 * pad),
      d = type === _vegaScale.Log ? (0, _vegaUtil.zoomLog)(domain, null, frac) : type === _vegaScale.Sqrt ? (0, _vegaUtil.zoomPow)(domain, null, frac, 0.5) : type === _vegaScale.Pow ? (0, _vegaUtil.zoomPow)(domain, null, frac, exponent || 1) : type === _vegaScale.Symlog ? (0, _vegaUtil.zoomSymlog)(domain, null, frac, constant || 1) : (0, _vegaUtil.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 ((0, _vegaScale.isLogarithmic)(type)) {
    // sum signs of domain values
    // if all pos or all neg, abs(sum) === domain.length
    var s = Math.abs(domain.reduce(function (s, v) {
      return s + (v < 0 ? -1 : v > 0 ? 1 : 0);
    }, 0));

    if (s !== domain.length) {
      df.warn('Log scale domain includes zero: ' + (0, _vegaUtil.stringValue)(domain));
    }
  }

  return domain;
}

function configureBins(scale, _, count) {
  let bins = _.bins;

  if (bins && !(0, _vegaUtil.isArray)(bins)) {
    // generate bin boundary array
    let domain = scale.domain(),
        lo = domain[0],
        hi = (0, _vegaUtil.peek)(domain),
        start = bins.start == null ? lo : bins.start,
        stop = bins.stop == null ? hi : bins.stop,
        step = bins.step;
    if (!step) (0, _vegaUtil.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 = (0, _d3Array.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 === _vegaScale.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 ((0, _vegaUtil.isFunction)(range)) {
        if (scale.interpolator) {
          return scale.interpolator(range);
        } else {
          (0, _vegaUtil.error)(`Scale type ${type} does not support interpolating color schemes.`);
        }
      }
    } // given a range array for an interpolating scale, convert to interpolator


  if (range && (0, _vegaScale.isInterpolating)(type)) {
    return scale.interpolator((0, _vegaScale.interpolateColors)(flip(range, _.reverse), _.interpolate, _.interpolateGamma));
  } // configure rounding / interpolation


  if (range && _.interpolate && scale.interpolate) {
    scale.interpolate((0, _vegaScale.interpolate)(_.interpolate, _.interpolateGamma));
  } else if ((0, _vegaUtil.isFunction)(scale.round)) {
    scale.round(round);
  } else if ((0, _vegaUtil.isFunction)(scale.rangeRound)) {
    scale.interpolate(round ? _d3Interpolate.interpolateRound : _d3Interpolate.interpolate);
  }

  if (range) scale.range(flip(range, _.reverse));
}

function configureRangeStep(type, _, count) {
  if (type !== _vegaScale.Band && type !== _vegaScale.Point) {
    (0, _vegaUtil.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 === _vegaScale.Point ? 1 : (_.paddingInner != null ? _.paddingInner : _.padding) || 0;
  return [0, _.rangeStep * (0, _vegaScale.bandSpace)(count, inner, outer)];
}

function configureScheme(type, _, count) {
  var extent = _.schemeExtent,
      name,
      scheme;

  if ((0, _vegaUtil.isArray)(_.scheme)) {
    scheme = (0, _vegaScale.interpolateColors)(_.scheme, _.interpolate, _.interpolateGamma);
  } else {
    name = _.scheme.toLowerCase();
    scheme = (0, _vegaScale.scheme)(name);
    if (!scheme) (0, _vegaUtil.error)(`Unrecognized scheme name: ${_.scheme}`);
  } // determine size for potential discrete range


  count = type === _vegaScale.Threshold ? count + 1 : type === _vegaScale.BinOrdinal ? count - 1 : type === _vegaScale.Quantile || type === _vegaScale.Quantize ? +_.schemeCount || DEFAULT_COUNT : count; // adjust and/or quantize scheme as appropriate

  return (0, _vegaScale.isInterpolating)(type) ? adjustScheme(scheme, extent, _.reverse) : (0, _vegaUtil.isFunction)(scheme) ? (0, _vegaScale.quantizeInterpolator)(adjustScheme(scheme, extent), count) : type === _vegaScale.Ordinal ? scheme : scheme.slice(0, count);
}

function adjustScheme(scheme, extent, reverse) {
  return (0, _vegaUtil.isFunction)(scheme) && (extent || reverse) ? (0, _vegaScale.interpolateRange)(scheme, flip(extent || [0, 1], reverse)) : scheme;
}

function flip(array, reverse) {
  return reverse ? array.slice().reverse() : array;
}
},{"./ticks":"creK","vega-dataflow":"UC8n","vega-util":"dejJ","vega-scale":"VE6e","d3-array":"Rpnd","d3-interpolate":"y8gx"}],"dicv":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = SortItems;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.Transform.call(this, null, params);
}

var prototype = (0, _vegaUtil.inherits)(SortItems, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var mod = _.modified('sort') || pulse.changed(pulse.ADD) || pulse.modified(_.sort.fields) || pulse.modified('datum');
  if (mod) pulse.source.sort((0, _vegaDataflow.stableCompare)(_.sort));
  this.modified(mod);
  return pulse;
};
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"sSMT":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Stack;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

var 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) {
  _vegaDataflow.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
  }]
};
var prototype = (0, _vegaUtil.inherits)(Stack, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var as = _.as || DefOutput,
      y0 = as[0],
      y1 = as[1],
      sort = (0, _vegaDataflow.stableCompare)(_.sort),
      field = _.field || _vegaUtil.one,
      stack = _.offset === Center ? stackCenter : _.offset === Normalize ? stackNormalize : stackZero,
      groups,
      i,
      n,
      max; // partition, sum, and sort the stack groups

  groups = 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 partition(data, groupby, sort, field) {
  var groups = [],
      get = function (f) {
    return 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;
}
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"m51Y":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "axisticks", {
  enumerable: true,
  get: function () {
    return _AxisTicks.default;
  }
});
Object.defineProperty(exports, "datajoin", {
  enumerable: true,
  get: function () {
    return _DataJoin.default;
  }
});
Object.defineProperty(exports, "encode", {
  enumerable: true,
  get: function () {
    return _Encode.default;
  }
});
Object.defineProperty(exports, "legendentries", {
  enumerable: true,
  get: function () {
    return _LegendEntries.default;
  }
});
Object.defineProperty(exports, "linkpath", {
  enumerable: true,
  get: function () {
    return _LinkPath.default;
  }
});
Object.defineProperty(exports, "pie", {
  enumerable: true,
  get: function () {
    return _Pie.default;
  }
});
Object.defineProperty(exports, "scale", {
  enumerable: true,
  get: function () {
    return _Scale.default;
  }
});
Object.defineProperty(exports, "sortitems", {
  enumerable: true,
  get: function () {
    return _SortItems.default;
  }
});
Object.defineProperty(exports, "stack", {
  enumerable: true,
  get: function () {
    return _Stack.default;
  }
});
Object.defineProperty(exports, "validTicks", {
  enumerable: true,
  get: function () {
    return _ticks.validTicks;
  }
});

var _AxisTicks = _interopRequireDefault(require("./src/AxisTicks"));

var _DataJoin = _interopRequireDefault(require("./src/DataJoin"));

var _Encode = _interopRequireDefault(require("./src/Encode"));

var _LegendEntries = _interopRequireDefault(require("./src/LegendEntries"));

var _LinkPath = _interopRequireDefault(require("./src/LinkPath"));

var _Pie = _interopRequireDefault(require("./src/Pie"));

var _Scale = _interopRequireDefault(require("./src/Scale"));

var _SortItems = _interopRequireDefault(require("./src/SortItems"));

var _Stack = _interopRequireDefault(require("./src/Stack"));

var _ticks = require("./src/ticks");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./src/AxisTicks":"zQzp","./src/DataJoin":"uz6y","./src/Encode":"Pe3W","./src/LegendEntries":"mQpK","./src/LinkPath":"Hy6o","./src/Pie":"HQqr","./src/Scale":"rLka","./src/SortItems":"dicv","./src/Stack":"sSMT","./src/ticks":"creK"}],"zI9x":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _vegaUtil = require("vega-util");

function 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 _default() {
  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, function (ring) {
      smooth(ring, values, value);
      if (area(ring) > 0) polygons.push([ring]);else holes.push(ring);
    });
    holes.forEach(function (hole) {
      for (var i = 0, n = polygons.length, polygon; i < n; ++i) {
        if (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(function (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.ceil(_[0]),
        _1 = Math.ceil(_[1]);

    if (!(_0 > 0) || !(_1 > 0)) (0, _vegaUtil.error)('invalid size');
    return dx = _0, dy = _1, contours;
  };

  contours.smooth = function (_) {
    return arguments.length ? (smooth = _ ? smoothLinear : noop, contours) : smooth === smoothLinear;
  };

  return contours;
}

function 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 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;
}
},{"vega-util":"dejJ"}],"KLFN":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _d3Array = require("d3-array");

var _vegaUtil = require("vega-util");

function _default(k, nice, zero) {
  return function (values) {
    var ex = (0, _vegaUtil.extent)(values),
        start = zero ? Math.min(ex[0], 0) : ex[0],
        stop = ex[1],
        span = stop - start,
        step = nice ? (0, _d3Array.tickStep)(start, stop, k) : span / (k + 1);
    return (0, _d3Array.range)(step, stop, step);
  };
}
},{"d3-array":"Rpnd","vega-util":"dejJ"}],"MUq0":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Isocontour;
exports.transform = transform;

var _d3Array = require("d3-array");

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

var _contours = _interopRequireDefault(require("./util/contours"));

var _quantize = _interopRequireDefault(require("./util/quantize"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * 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) {
  _vegaDataflow.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": "as",
    "type": "string",
    "null": true,
    "default": "contour"
  }]
};
var prototype = (0, _vegaUtil.inherits)(Isocontour, _vegaDataflow.Transform);

prototype.transform = function (_, 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 || _vegaUtil.identity,
      contour = (0, _contours.default)().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, (0, _vegaUtil.isArray)(tz) ? tz : tz(grid.values)); // adjust contour path coordinates as needed

    if (_.scale || grid.x1 || grid.y1 || grid.scale) {
      var s = _.scale;
      paths.forEach(transform(grid, (0, _vegaUtil.isFunction)(s) ? s(t, _) : s));
    } // ingest; copy source data properties to output


    paths.forEach(p => {
      values.push((0, _vegaDataflow.rederive)(t, (0, _vegaDataflow.ingest)(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 = (0, _quantize.default)(_.levels || 10, _.nice, _.zero !== false);
  return _.resolve !== 'shared' ? q : q(values.map(t => (0, _d3Array.max)(f(t).values)));
}

function transform(grid, scale) {
  const x1 = grid.x1 || 0,
        y1 = grid.y1 || 0,
        s = scale != null ? scale : grid.scale || 1;

  function transformPolygon(coordinates) {
    coordinates.forEach(transformRing);
  }

  function transformRing(coordinates) {
    coordinates.forEach(transformPoint);
  }

  function transformPoint(coordinates) {
    coordinates[0] = (coordinates[0] - x1) * s;
    coordinates[1] = (coordinates[1] - y1) * s;
  }

  return function (geometry) {
    geometry.coordinates.forEach(transformPolygon);
    return geometry;
  };
}
},{"d3-array":"Rpnd","vega-dataflow":"UC8n","vega-util":"dejJ","./util/contours":"zI9x","./util/quantize":"KLFN"}],"KW5t":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _vegaStatistics = require("vega-statistics");

var _vegaUtil = require("vega-util");

var _d3Array = require("d3-array");

function radius(bw, data, f) {
  const v = bw >= 0 ? bw : (0, _vegaStatistics.bandwidthNRD)(data, f);
  return Math.round((Math.sqrt(4 * v * v + 1) - 1) / 2);
}

function number(_) {
  return (0, _vegaUtil.isFunction)(_) ? _ : (0, _vegaUtil.constant)(+_);
} // Implementation adapted from d3/d3-contour. Thanks!


function _default() {
  var x = d => d[0],
      y = d => d[1],
      weight = _vegaUtil.one,
      bandwidth = [-1, -1],
      dx = 960,
      dy = 500,
      k = 2; // log2(cellSize)


  function density(data, counts) {
    const rx = radius(bandwidth[0], data, x) >> k,
          // blur x-radius
    ry = 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


    let s = counts ? Math.pow(2, -2 * k) : 1 / (0, _d3Array.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 = number(_), density) : x;
  };

  density.y = function (_) {
    return arguments.length ? (y = number(_), density) : y;
  };

  density.weight = function (_) {
    return arguments.length ? (weight = number(_), density) : weight;
  };

  density.size = function (_) {
    if (!arguments.length) return [dx, dy];

    var _0 = Math.ceil(_[0]),
        _1 = Math.ceil(_[1]);

    if (!(_0 >= 0) && !(_0 >= 0)) (0, _vegaUtil.error)('invalid size');
    return dx = _0, dy = _1, density;
  };

  density.cellSize = function (_) {
    if (!arguments.length) return 1 << k;
    if (!((_ = +_) >= 1)) (0, _vegaUtil.error)('invalid cell size');
    k = Math.floor(Math.log(_) / Math.LN2);
    return density;
  };

  density.bandwidth = function (_) {
    if (!arguments.length) return bandwidth;
    _ = (0, _vegaUtil.array)(_);
    if (_.length === 1) _ = [+_[0], +_[0]];
    if (_.length !== 2) (0, _vegaUtil.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);
      }
    }
  }
}
},{"vega-statistics":"yUSi","vega-util":"dejJ","d3-array":"Rpnd"}],"wy1Z":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = KDE2D;
exports.params = params;
exports.partition = partition;

var _density2D = _interopRequireDefault(require("./util/density2D"));

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * 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) {
  _vegaDataflow.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"
  }]
};
var prototype = (0, _vegaUtil.inherits)(KDE2D, _vegaDataflow.Transform);
const PARAMS = ['x', 'y', 'weight', 'size', 'cellSize', 'bandwidth'];

function params(obj, _) {
  PARAMS.forEach(param => _[param] != null ? obj[param](_[param]) : 0);
  return obj;
}

prototype.transform = function (_, 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 = partition(source, _.groupby),
      names = (_.groupby || []).map(_vegaUtil.accessorName),
      kde = params((0, _density2D.default)(), _),
      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 => (0, _vegaDataflow.ingest)(set({
    [as]: kde(g, _.counts)
  }, g.dims)));
  if (this.value) out.rem = this.value;
  this.value = out.source = out.add = values;
  return out;
};

function 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;
}
},{"./util/density2D":"KW5t","vega-dataflow":"UC8n","vega-util":"dejJ"}],"Dkrm":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Contour;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

var _Isocontour = require("./Isocontour");

var _KDE2D = require("./KDE2D");

var _contours = _interopRequireDefault(require("./util/contours"));

var _density2D = _interopRequireDefault(require("./util/density2D"));

var _quantize = _interopRequireDefault(require("./util/quantize"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * 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) {
  _vegaDataflow.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
  }]
};
var prototype = (0, _vegaUtil.inherits)(Contour, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  if (this.value && !pulse.changed() && !_.modified()) {
    return pulse.StopPropagation;
  }

  var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
      contour = (0, _contours.default)().smooth(_.smooth !== false),
      values = _.values,
      thresh = _.thresholds || (0, _quantize.default)(_.count || 10, _.nice, !!values),
      size = _.size,
      grid,
      post;

  if (!values) {
    values = pulse.materialize(pulse.SOURCE).source;
    grid = (0, _KDE2D.params)((0, _density2D.default)(), _)(values, true);
    post = (0, _Isocontour.transform)(grid);
    size = [grid.width, grid.height];
    values = grid.values;
  }

  thresh = (0, _vegaUtil.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(_vegaDataflow.ingest);
  return out;
};
},{"vega-dataflow":"UC8n","vega-util":"dejJ","./Isocontour":"MUq0","./KDE2D":"wy1Z","./util/contours":"zI9x","./util/density2D":"KW5t","./util/quantize":"KLFN"}],"QVyQ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.MultiPoint = exports.FeatureCollection = exports.Feature = void 0;
var Feature = 'Feature';
exports.Feature = Feature;
var FeatureCollection = 'FeatureCollection';
exports.FeatureCollection = FeatureCollection;
var MultiPoint = 'MultiPoint';
exports.MultiPoint = MultiPoint;
},{}],"mXU8":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = GeoJSON;

var _constants = require("./constants");

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.Transform.call(this, null, params);
}

GeoJSON.Definition = {
  "type": "GeoJSON",
  "metadata": {},
  "params": [{
    "name": "fields",
    "type": "field",
    "array": true,
    "length": 2
  }, {
    "name": "geojson",
    "type": "field"
  }]
};
var prototype = (0, _vegaUtil.inherits)(GeoJSON, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var features = this._features,
      points = this._points,
      fields = _.fields,
      lon = fields && fields[0],
      lat = fields && fields[1],
      geojson = _.geojson || !fields && _vegaUtil.identity,
      flag = pulse.ADD,
      mod;
  mod = _.modified() || pulse.changed(pulse.REM) || pulse.modified((0, _vegaUtil.accessorFields)(geojson)) || lon && pulse.modified((0, _vegaUtil.accessorFields)(lon)) || lat && pulse.modified((0, _vegaUtil.accessorFields)(lat));

  if (!this.value || mod) {
    flag = pulse.SOURCE;
    this._features = features = [];
    this._points = points = [];
  }

  if (geojson) {
    pulse.visit(flag, function (t) {
      features.push(geojson(t));
    });
  }

  if (lon && lat) {
    pulse.visit(flag, function (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: _constants.Feature,
      geometry: {
        type: _constants.MultiPoint,
        coordinates: points
      }
    });
  }

  this.value = {
    type: _constants.FeatureCollection,
    features: features
  };
};
},{"./constants":"QVyQ","vega-dataflow":"UC8n","vega-util":"dejJ"}],"cq11":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

// Adds floating point numbers with twice the normal precision.
// Reference: J. R. Shewchuk, Adaptive Precision Floating-Point Arithmetic and
// Fast Robust Geometric Predicates, Discrete & Computational Geometry 18(3)
// 305–363 (1997).
// Code adapted from GeographicLib by Charles F. F. Karney,
// http://geographiclib.sourceforge.net/
function _default() {
  return new Adder();
}

function Adder() {
  this.reset();
}

Adder.prototype = {
  constructor: Adder,
  reset: function () {
    this.s = // rounded value
    this.t = 0; // exact error
  },
  add: function (y) {
    add(temp, y, this.t);
    add(this, temp.s, this.s);
    if (this.s) this.t += temp.t;else this.s = temp.t;
  },
  valueOf: function () {
    return this.s;
  }
};
var temp = new Adder();

function add(adder, a, b) {
  var x = adder.s = a + b,
      bv = x - a,
      av = x - bv;
  adder.t = a - av + (b - bv);
}
},{}],"Stis":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.acos = acos;
exports.asin = asin;
exports.haversin = haversin;
exports.tan = exports.sqrt = exports.sign = exports.sin = exports.pow = exports.log = exports.floor = exports.exp = exports.ceil = exports.cos = exports.atan2 = exports.atan = exports.abs = exports.radians = exports.degrees = exports.tau = exports.quarterPi = exports.halfPi = exports.pi = exports.epsilon2 = exports.epsilon = void 0;
var epsilon = 1e-6;
exports.epsilon = epsilon;
var epsilon2 = 1e-12;
exports.epsilon2 = epsilon2;
var pi = Math.PI;
exports.pi = pi;
var halfPi = pi / 2;
exports.halfPi = halfPi;
var quarterPi = pi / 4;
exports.quarterPi = quarterPi;
var tau = pi * 2;
exports.tau = tau;
var degrees = 180 / pi;
exports.degrees = degrees;
var radians = pi / 180;
exports.radians = radians;
var abs = Math.abs;
exports.abs = abs;
var atan = Math.atan;
exports.atan = atan;
var atan2 = Math.atan2;
exports.atan2 = atan2;
var cos = Math.cos;
exports.cos = cos;
var ceil = Math.ceil;
exports.ceil = ceil;
var exp = Math.exp;
exports.exp = exp;
var floor = Math.floor;
exports.floor = floor;
var log = Math.log;
exports.log = log;
var pow = Math.pow;
exports.pow = pow;
var sin = Math.sin;
exports.sin = sin;

var sign = Math.sign || function (x) {
  return x > 0 ? 1 : x < 0 ? -1 : 0;
};

exports.sign = sign;
var sqrt = Math.sqrt;
exports.sqrt = sqrt;
var tan = Math.tan;
exports.tan = tan;

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);
}

function haversin(x) {
  return (x = sin(x / 2)) * x;
}
},{}],"gEqK":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = noop;

function noop() {}
},{}],"AcnE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

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();
}

function _default(object, stream) {
  if (object && streamObjectType.hasOwnProperty(object.type)) {
    streamObjectType[object.type](object, stream);
  } else {
    streamGeometry(object, stream);
  }
}
},{}],"tTg2":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.areaStream = exports.areaRingSum = void 0;

var _adder = _interopRequireDefault(require("./adder.js"));

var _math = require("./math.js");

var _noop = _interopRequireDefault(require("./noop.js"));

var _stream = _interopRequireDefault(require("./stream.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var areaRingSum = (0, _adder.default)();
exports.areaRingSum = areaRingSum;
var areaSum = (0, _adder.default)(),
    lambda00,
    phi00,
    lambda0,
    cosPhi0,
    sinPhi0;
var areaStream = {
  point: _noop.default,
  lineStart: _noop.default,
  lineEnd: _noop.default,
  polygonStart: function () {
    areaRingSum.reset();
    areaStream.lineStart = areaRingStart;
    areaStream.lineEnd = areaRingEnd;
  },
  polygonEnd: function () {
    var areaRing = +areaRingSum;
    areaSum.add(areaRing < 0 ? _math.tau + areaRing : areaRing);
    this.lineStart = this.lineEnd = this.point = _noop.default;
  },
  sphere: function () {
    areaSum.add(_math.tau);
  }
};
exports.areaStream = areaStream;

function areaRingStart() {
  areaStream.point = areaPointFirst;
}

function areaRingEnd() {
  areaPoint(lambda00, phi00);
}

function areaPointFirst(lambda, phi) {
  areaStream.point = areaPoint;
  lambda00 = lambda, phi00 = phi;
  lambda *= _math.radians, phi *= _math.radians;
  lambda0 = lambda, cosPhi0 = (0, _math.cos)(phi = phi / 2 + _math.quarterPi), sinPhi0 = (0, _math.sin)(phi);
}

function areaPoint(lambda, phi) {
  lambda *= _math.radians, phi *= _math.radians;
  phi = phi / 2 + _math.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 - lambda0,
      sdLambda = dLambda >= 0 ? 1 : -1,
      adLambda = sdLambda * dLambda,
      cosPhi = (0, _math.cos)(phi),
      sinPhi = (0, _math.sin)(phi),
      k = sinPhi0 * sinPhi,
      u = cosPhi0 * cosPhi + k * (0, _math.cos)(adLambda),
      v = k * sdLambda * (0, _math.sin)(adLambda);
  areaRingSum.add((0, _math.atan2)(v, u)); // Advance the previous points.

  lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi;
}

function _default(object) {
  areaSum.reset();
  (0, _stream.default)(object, areaStream);
  return areaSum * 2;
}
},{"./adder.js":"cq11","./math.js":"Stis","./noop.js":"gEqK","./stream.js":"AcnE"}],"Jmo8":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.spherical = spherical;
exports.cartesian = cartesian;
exports.cartesianDot = cartesianDot;
exports.cartesianCross = cartesianCross;
exports.cartesianAddInPlace = cartesianAddInPlace;
exports.cartesianScale = cartesianScale;
exports.cartesianNormalizeInPlace = cartesianNormalizeInPlace;

var _math = require("./math.js");

function spherical(cartesian) {
  return [(0, _math.atan2)(cartesian[1], cartesian[0]), (0, _math.asin)(cartesian[2])];
}

function cartesian(spherical) {
  var lambda = spherical[0],
      phi = spherical[1],
      cosPhi = (0, _math.cos)(phi);
  return [cosPhi * (0, _math.cos)(lambda), cosPhi * (0, _math.sin)(lambda), (0, _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 = (0, _math.sqrt)(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);
  d[0] /= l, d[1] /= l, d[2] /= l;
}
},{"./math.js":"Stis"}],"L2Ww":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _adder = _interopRequireDefault(require("./adder.js"));

var _area = require("./area.js");

var _cartesian = require("./cartesian.js");

var _math = require("./math.js");

var _stream = _interopRequireDefault(require("./stream.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var lambda0,
    phi0,
    lambda1,
    phi1,
    // bounds
lambda2,
    // previous lambda-coordinate
lambda00,
    phi00,
    // first point
p0,
    // previous 3D point
deltaSum = (0, _adder.default)(),
    ranges,
    range;
var boundsStream = {
  point: boundsPoint,
  lineStart: boundsLineStart,
  lineEnd: boundsLineEnd,
  polygonStart: function () {
    boundsStream.point = boundsRingPoint;
    boundsStream.lineStart = boundsRingStart;
    boundsStream.lineEnd = boundsRingEnd;
    deltaSum.reset();

    _area.areaStream.polygonStart();
  },
  polygonEnd: function () {
    _area.areaStream.polygonEnd();

    boundsStream.point = boundsPoint;
    boundsStream.lineStart = boundsLineStart;
    boundsStream.lineEnd = boundsLineEnd;
    if (_area.areaRingSum < 0) lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90);else if (deltaSum > _math.epsilon) phi1 = 90;else if (deltaSum < -_math.epsilon) phi0 = -90;
    range[0] = lambda0, range[1] = lambda1;
  },
  sphere: function () {
    lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90);
  }
};

function boundsPoint(lambda, phi) {
  ranges.push(range = [lambda0 = lambda, lambda1 = lambda]);
  if (phi < phi0) phi0 = phi;
  if (phi > phi1) phi1 = phi;
}

function linePoint(lambda, phi) {
  var p = (0, _cartesian.cartesian)([lambda * _math.radians, phi * _math.radians]);

  if (p0) {
    var normal = (0, _cartesian.cartesianCross)(p0, p),
        equatorial = [normal[1], -normal[0], 0],
        inflection = (0, _cartesian.cartesianCross)(equatorial, normal);
    (0, _cartesian.cartesianNormalizeInPlace)(inflection);
    inflection = (0, _cartesian.spherical)(inflection);
    var delta = lambda - lambda2,
        sign = delta > 0 ? 1 : -1,
        lambdai = inflection[0] * _math.degrees * sign,
        phii,
        antimeridian = (0, _math.abs)(delta) > 180;

    if (antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) {
      phii = inflection[1] * _math.degrees;
      if (phii > phi1) phi1 = phii;
    } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) {
      phii = -inflection[1] * _math.degrees;
      if (phii < phi0) phi0 = phii;
    } else {
      if (phi < phi0) phi0 = phi;
      if (phi > phi1) phi1 = phi;
    }

    if (antimeridian) {
      if (lambda < lambda2) {
        if (angle(lambda0, lambda) > angle(lambda0, lambda1)) lambda1 = lambda;
      } else {
        if (angle(lambda, lambda1) > angle(lambda0, lambda1)) lambda0 = lambda;
      }
    } else {
      if (lambda1 >= lambda0) {
        if (lambda < lambda0) lambda0 = lambda;
        if (lambda > lambda1) lambda1 = lambda;
      } else {
        if (lambda > lambda2) {
          if (angle(lambda0, lambda) > angle(lambda0, lambda1)) lambda1 = lambda;
        } else {
          if (angle(lambda, lambda1) > angle(lambda0, lambda1)) lambda0 = lambda;
        }
      }
    }
  } else {
    ranges.push(range = [lambda0 = lambda, lambda1 = lambda]);
  }

  if (phi < phi0) phi0 = phi;
  if (phi > phi1) phi1 = phi;
  p0 = p, lambda2 = lambda;
}

function boundsLineStart() {
  boundsStream.point = linePoint;
}

function boundsLineEnd() {
  range[0] = lambda0, range[1] = lambda1;
  boundsStream.point = boundsPoint;
  p0 = null;
}

function boundsRingPoint(lambda, phi) {
  if (p0) {
    var delta = lambda - lambda2;
    deltaSum.add((0, _math.abs)(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta);
  } else {
    lambda00 = lambda, phi00 = phi;
  }

  _area.areaStream.point(lambda, phi);

  linePoint(lambda, phi);
}

function boundsRingStart() {
  _area.areaStream.lineStart();
}

function boundsRingEnd() {
  boundsRingPoint(lambda00, phi00);

  _area.areaStream.lineEnd();

  if ((0, _math.abs)(deltaSum) > _math.epsilon) lambda0 = -(lambda1 = 180);
  range[0] = lambda0, range[1] = lambda1;
  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 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;
}

function _default(feature) {
  var i, n, a, b, merged, deltaMax, delta;
  phi1 = lambda1 = -(lambda0 = phi0 = Infinity);
  ranges = [];
  (0, _stream.default)(feature, 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 (angle(a[0], b[1]) > angle(a[0], a[1])) a[1] = b[1];
        if (angle(b[0], a[1]) > 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 = angle(a[1], b[0])) > deltaMax) deltaMax = delta, lambda0 = b[0], lambda1 = a[1];
    }
  }

  ranges = range = null;
  return lambda0 === Infinity || phi0 === Infinity ? [[NaN, NaN], [NaN, NaN]] : [[lambda0, phi0], [lambda1, phi1]];
}
},{"./adder.js":"cq11","./area.js":"tTg2","./cartesian.js":"Jmo8","./math.js":"Stis","./stream.js":"AcnE"}],"Xabc":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _math = require("./math.js");

var _noop = _interopRequireDefault(require("./noop.js"));

var _stream = _interopRequireDefault(require("./stream.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var W0, W1, X0, Y0, Z0, X1, Y1, Z1, X2, Y2, Z2, lambda00, phi00, // first point
x0, y0, z0; // previous point

var centroidStream = {
  sphere: _noop.default,
  point: centroidPoint,
  lineStart: centroidLineStart,
  lineEnd: centroidLineEnd,
  polygonStart: function () {
    centroidStream.lineStart = centroidRingStart;
    centroidStream.lineEnd = centroidRingEnd;
  },
  polygonEnd: function () {
    centroidStream.lineStart = centroidLineStart;
    centroidStream.lineEnd = centroidLineEnd;
  }
}; // Arithmetic mean of Cartesian vectors.

function centroidPoint(lambda, phi) {
  lambda *= _math.radians, phi *= _math.radians;
  var cosPhi = (0, _math.cos)(phi);
  centroidPointCartesian(cosPhi * (0, _math.cos)(lambda), cosPhi * (0, _math.sin)(lambda), (0, _math.sin)(phi));
}

function centroidPointCartesian(x, y, z) {
  ++W0;
  X0 += (x - X0) / W0;
  Y0 += (y - Y0) / W0;
  Z0 += (z - Z0) / W0;
}

function centroidLineStart() {
  centroidStream.point = centroidLinePointFirst;
}

function centroidLinePointFirst(lambda, phi) {
  lambda *= _math.radians, phi *= _math.radians;
  var cosPhi = (0, _math.cos)(phi);
  x0 = cosPhi * (0, _math.cos)(lambda);
  y0 = cosPhi * (0, _math.sin)(lambda);
  z0 = (0, _math.sin)(phi);
  centroidStream.point = centroidLinePoint;
  centroidPointCartesian(x0, y0, z0);
}

function centroidLinePoint(lambda, phi) {
  lambda *= _math.radians, phi *= _math.radians;
  var cosPhi = (0, _math.cos)(phi),
      x = cosPhi * (0, _math.cos)(lambda),
      y = cosPhi * (0, _math.sin)(lambda),
      z = (0, _math.sin)(phi),
      w = (0, _math.atan2)((0, _math.sqrt)((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z);
  W1 += w;
  X1 += w * (x0 + (x0 = x));
  Y1 += w * (y0 + (y0 = y));
  Z1 += w * (z0 + (z0 = z));
  centroidPointCartesian(x0, y0, z0);
}

function centroidLineEnd() {
  centroidStream.point = centroidPoint;
} // See J. E. Brock, The Inertia Tensor for a Spherical Triangle,
// J. Applied Mechanics 42, 239 (1975).


function centroidRingStart() {
  centroidStream.point = centroidRingPointFirst;
}

function centroidRingEnd() {
  centroidRingPoint(lambda00, phi00);
  centroidStream.point = centroidPoint;
}

function centroidRingPointFirst(lambda, phi) {
  lambda00 = lambda, phi00 = phi;
  lambda *= _math.radians, phi *= _math.radians;
  centroidStream.point = centroidRingPoint;
  var cosPhi = (0, _math.cos)(phi);
  x0 = cosPhi * (0, _math.cos)(lambda);
  y0 = cosPhi * (0, _math.sin)(lambda);
  z0 = (0, _math.sin)(phi);
  centroidPointCartesian(x0, y0, z0);
}

function centroidRingPoint(lambda, phi) {
  lambda *= _math.radians, phi *= _math.radians;
  var cosPhi = (0, _math.cos)(phi),
      x = cosPhi * (0, _math.cos)(lambda),
      y = cosPhi * (0, _math.sin)(lambda),
      z = (0, _math.sin)(phi),
      cx = y0 * z - z0 * y,
      cy = z0 * x - x0 * z,
      cz = x0 * y - y0 * x,
      m = (0, _math.sqrt)(cx * cx + cy * cy + cz * cz),
      w = (0, _math.asin)(m),
      // line weight = angle
  v = m && -w / m; // area weight multiplier

  X2 += v * cx;
  Y2 += v * cy;
  Z2 += v * cz;
  W1 += w;
  X1 += w * (x0 + (x0 = x));
  Y1 += w * (y0 + (y0 = y));
  Z1 += w * (z0 + (z0 = z));
  centroidPointCartesian(x0, y0, z0);
}

function _default(object) {
  W0 = W1 = X0 = Y0 = Z0 = X1 = Y1 = Z1 = X2 = Y2 = Z2 = 0;
  (0, _stream.default)(object, centroidStream);
  var x = X2,
      y = Y2,
      z = Z2,
      m = x * x + y * y + z * z; // If the area-weighted ccentroid is undefined, fall back to length-weighted ccentroid.

  if (m < _math.epsilon2) {
    x = X1, y = Y1, z = Z1; // If the feature has zero length, fall back to arithmetic mean of point vectors.

    if (W1 < _math.epsilon) x = X0, y = Y0, z = Z0;
    m = x * x + y * y + z * z; // If the feature still has an undefined ccentroid, then return.

    if (m < _math.epsilon2) return [NaN, NaN];
  }

  return [(0, _math.atan2)(y, x) * _math.degrees, (0, _math.asin)(z / (0, _math.sqrt)(m)) * _math.degrees];
}
},{"./math.js":"Stis","./noop.js":"gEqK","./stream.js":"AcnE"}],"BHP2":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(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;
}
},{}],"hFnY":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.rotateRadians = rotateRadians;
exports.default = _default;

var _compose = _interopRequireDefault(require("./compose.js"));

var _math = require("./math.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function rotationIdentity(lambda, phi) {
  return [(0, _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 ? (0, _compose.default)(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 = (0, _math.cos)(deltaPhi),
      sinDeltaPhi = (0, _math.sin)(deltaPhi),
      cosDeltaGamma = (0, _math.cos)(deltaGamma),
      sinDeltaGamma = (0, _math.sin)(deltaGamma);

  function rotation(lambda, phi) {
    var cosPhi = (0, _math.cos)(phi),
        x = (0, _math.cos)(lambda) * cosPhi,
        y = (0, _math.sin)(lambda) * cosPhi,
        z = (0, _math.sin)(phi),
        k = z * cosDeltaPhi + x * sinDeltaPhi;
    return [(0, _math.atan2)(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi), (0, _math.asin)(k * cosDeltaGamma + y * sinDeltaGamma)];
  }

  rotation.invert = function (lambda, phi) {
    var cosPhi = (0, _math.cos)(phi),
        x = (0, _math.cos)(lambda) * cosPhi,
        y = (0, _math.sin)(lambda) * cosPhi,
        z = (0, _math.sin)(phi),
        k = z * cosDeltaGamma - y * sinDeltaGamma;
    return [(0, _math.atan2)(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi), (0, _math.asin)(k * cosDeltaPhi - x * sinDeltaPhi)];
  };

  return rotation;
}

function _default(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] *= _math.degrees, coordinates[1] *= _math.degrees, coordinates;
  }

  forward.invert = function (coordinates) {
    coordinates = rotate.invert(coordinates[0] * _math.radians, coordinates[1] * _math.radians);
    return coordinates[0] *= _math.degrees, coordinates[1] *= _math.degrees, coordinates;
  };

  return forward;
}
},{"./compose.js":"BHP2","./math.js":"Stis"}],"exZ4":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.circleStream = circleStream;
exports.default = _default;

var _cartesian = require("./cartesian.js");

var _constant = _interopRequireDefault(require("./constant.js"));

var _math = require("./math.js");

var _rotation = require("./rotation.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// 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 = (0, _math.cos)(radius),
      sinRadius = (0, _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 = (0, _cartesian.spherical)([cosRadius, -sinRadius * (0, _math.cos)(t), -sinRadius * (0, _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 = (0, _cartesian.cartesian)(point), point[0] -= cosRadius;
  (0, _cartesian.cartesianNormalizeInPlace)(point);
  var radius = (0, _math.acos)(-point[1]);
  return ((-point[2] < 0 ? -radius : radius) + _math.tau - _math.epsilon) % _math.tau;
}

function _default() {
  var center = (0, _constant.default)([0, 0]),
      radius = (0, _constant.default)(90),
      precision = (0, _constant.default)(6),
      ring,
      rotate,
      stream = {
    point: point
  };

  function point(x, y) {
    ring.push(x = rotate(x, y));
    x[0] *= _math.degrees, x[1] *= _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 = (0, _rotation.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" ? _ : (0, _constant.default)([+_[0], +_[1]]), circle) : center;
  };

  circle.radius = function (_) {
    return arguments.length ? (radius = typeof _ === "function" ? _ : (0, _constant.default)(+_), circle) : radius;
  };

  circle.precision = function (_) {
    return arguments.length ? (precision = typeof _ === "function" ? _ : (0, _constant.default)(+_), circle) : precision;
  };

  return circle;
}
},{"./cartesian.js":"Jmo8","./constant.js":"OKWp","./math.js":"Stis","./rotation.js":"hFnY"}],"e3vZ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _noop = _interopRequireDefault(require("../noop.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default() {
  var lines = [],
      line;
  return {
    point: function (x, y) {
      line.push([x, y]);
    },
    lineStart: function () {
      lines.push(line = []);
    },
    lineEnd: _noop.default,
    rejoin: function () {
      if (lines.length > 1) lines.push(lines.pop().concat(lines.shift()));
    },
    result: function () {
      var result = lines;
      lines = [];
      line = null;
      return result;
    }
  };
}
},{"../noop.js":"gEqK"}],"QfPV":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _math = require("./math.js");

function _default(a, b) {
  return (0, _math.abs)(a[0] - b[0]) < _math.epsilon && (0, _math.abs)(a[1] - b[1]) < _math.epsilon;
}
},{"./math.js":"Stis"}],"tY5q":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _pointEqual = _interopRequireDefault(require("../pointEqual.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

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.


function _default(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 the first and last points of a segment are coincident, then treat as a
    // closed ring. TODO if all rings are closed, then the winding order of the
    // exterior ring should be checked.

    if ((0, _pointEqual.default)(p0, p1)) {
      stream.lineStart();

      for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);

      stream.lineEnd();
      return;
    }

    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);
  link(subject);
  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 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;
}
},{"../pointEqual.js":"QfPV"}],"AbY4":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _adder = _interopRequireDefault(require("./adder.js"));

var _cartesian = require("./cartesian.js");

var _math = require("./math.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var sum = (0, _adder.default)();

function longitude(point) {
  if ((0, _math.abs)(point[0]) <= _math.pi) return point[0];else return (0, _math.sign)(point[0]) * (((0, _math.abs)(point[0]) + _math.pi) % _math.tau - _math.pi);
}

function _default(polygon, point) {
  var lambda = longitude(point),
      phi = point[1],
      sinPhi = (0, _math.sin)(phi),
      normal = [(0, _math.sin)(lambda), -(0, _math.cos)(lambda), 0],
      angle = 0,
      winding = 0;
  sum.reset();
  if (sinPhi === 1) phi = _math.halfPi + _math.epsilon;else if (sinPhi === -1) phi = -_math.halfPi - _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 + _math.quarterPi,
        sinPhi0 = (0, _math.sin)(phi0),
        cosPhi0 = (0, _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 + _math.quarterPi,
          sinPhi1 = (0, _math.sin)(phi1),
          cosPhi1 = (0, _math.cos)(phi1),
          delta = lambda1 - lambda0,
          sign = delta >= 0 ? 1 : -1,
          absDelta = sign * delta,
          antimeridian = absDelta > _math.pi,
          k = sinPhi0 * sinPhi1;
      sum.add((0, _math.atan2)(k * sign * (0, _math.sin)(absDelta), cosPhi0 * cosPhi1 + k * (0, _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 = (0, _cartesian.cartesianCross)((0, _cartesian.cartesian)(point0), (0, _cartesian.cartesian)(point1));
        (0, _cartesian.cartesianNormalizeInPlace)(arc);
        var intersection = (0, _cartesian.cartesianCross)(normal, arc);
        (0, _cartesian.cartesianNormalizeInPlace)(intersection);
        var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * (0, _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 < -_math.epsilon || angle < _math.epsilon && sum < -_math.epsilon) ^ winding & 1;
}
},{"./adder.js":"cq11","./cartesian.js":"Jmo8","./math.js":"Stis"}],"xbDs":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _ascending = _interopRequireDefault(require("./ascending"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(compare) {
  if (compare.length === 1) compare = ascendingComparator(compare);
  return {
    left: function (a, x, lo, hi) {
      if (lo == null) lo = 0;
      if (hi == null) hi = a.length;

      while (lo < hi) {
        var mid = lo + hi >>> 1;
        if (compare(a[mid], x) < 0) lo = mid + 1;else hi = mid;
      }

      return lo;
    },
    right: function (a, x, lo, hi) {
      if (lo == null) lo = 0;
      if (hi == null) hi = a.length;

      while (lo < hi) {
        var mid = lo + hi >>> 1;
        if (compare(a[mid], x) > 0) hi = mid;else lo = mid + 1;
      }

      return lo;
    }
  };
}

function ascendingComparator(f) {
  return function (d, x) {
    return (0, _ascending.default)(f(d), x);
  };
}
},{"./ascending":"CHz1"}],"iC3Y":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.bisectLeft = exports.bisectRight = void 0;

var _ascending = _interopRequireDefault(require("./ascending"));

var _bisector = _interopRequireDefault(require("./bisector"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var ascendingBisect = (0, _bisector.default)(_ascending.default);
var bisectRight = ascendingBisect.right;
exports.bisectRight = bisectRight;
var bisectLeft = ascendingBisect.left;
exports.bisectLeft = bisectLeft;
var _default = bisectRight;
exports.default = _default;
},{"./ascending":"CHz1","./bisector":"xbDs"}],"ZO9R":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.pair = pair;

function _default(array, f) {
  if (f == null) f = pair;
  var i = 0,
      n = array.length - 1,
      p = array[0],
      pairs = new Array(n < 0 ? 0 : n);

  while (i < n) pairs[i] = f(p, p = array[++i]);

  return pairs;
}

function pair(a, b) {
  return [a, b];
}
},{}],"btrA":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _pairs = require("./pairs");

function _default(values0, values1, reduce) {
  var n0 = values0.length,
      n1 = values1.length,
      values = new Array(n0 * n1),
      i0,
      i1,
      i,
      value0;
  if (reduce == null) reduce = _pairs.pair;

  for (i0 = i = 0; i0 < n0; ++i0) {
    for (value0 = values0[i0], i1 = 0; i1 < n1; ++i1, ++i) {
      values[i] = reduce(value0, values1[i1]);
    }
  }

  return values;
}
},{"./pairs":"ZO9R"}],"LqOB":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(x) {
  return x === null ? NaN : +x;
}
},{}],"h5et":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _number = _interopRequireDefault(require("./number"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(values, valueof) {
  var n = values.length,
      m = 0,
      i = -1,
      mean = 0,
      value,
      delta,
      sum = 0;

  if (valueof == null) {
    while (++i < n) {
      if (!isNaN(value = (0, _number.default)(values[i]))) {
        delta = value - mean;
        mean += delta / ++m;
        sum += delta * (value - mean);
      }
    }
  } else {
    while (++i < n) {
      if (!isNaN(value = (0, _number.default)(valueof(values[i], i, values)))) {
        delta = value - mean;
        mean += delta / ++m;
        sum += delta * (value - mean);
      }
    }
  }

  if (m > 1) return sum / (m - 1);
}
},{"./number":"LqOB"}],"gXIP":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _variance = _interopRequireDefault(require("./variance"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(array, f) {
  var v = (0, _variance.default)(array, f);
  return v ? Math.sqrt(v) : v;
}
},{"./variance":"h5et"}],"xpz9":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(values, valueof) {
  var n = values.length,
      i = -1,
      value,
      min,
      max;

  if (valueof == null) {
    while (++i < n) {
      // Find the first comparable value.
      if ((value = values[i]) != null && value >= value) {
        min = max = value;

        while (++i < n) {
          // Compare the remaining values.
          if ((value = values[i]) != null) {
            if (min > value) min = value;
            if (max < value) max = value;
          }
        }
      }
    }
  } else {
    while (++i < n) {
      // Find the first comparable value.
      if ((value = valueof(values[i], i, values)) != null && value >= value) {
        min = max = value;

        while (++i < n) {
          // Compare the remaining values.
          if ((value = valueof(values[i], i, values)) != null) {
            if (min > value) min = value;
            if (max < value) max = value;
          }
        }
      }
    }
  }

  return [min, max];
}
},{}],"nukp":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(values) {
  return Math.ceil(Math.log(values.length) / Math.LN2) + 1;
}
},{}],"e83F":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _array = require("./array");

var _bisect = _interopRequireDefault(require("./bisect"));

var _constant = _interopRequireDefault(require("./constant"));

var _extent = _interopRequireDefault(require("./extent"));

var _identity = _interopRequireDefault(require("./identity"));

var _range = _interopRequireDefault(require("./range"));

var _ticks = require("./ticks");

var _sturges = _interopRequireDefault(require("./threshold/sturges"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default() {
  var value = _identity.default,
      domain = _extent.default,
      threshold = _sturges.default;

  function histogram(data) {
    var i,
        n = data.length,
        x,
        values = new Array(n);

    for (i = 0; i < n; ++i) {
      values[i] = value(data[i], i, data);
    }

    var xz = domain(values),
        x0 = xz[0],
        x1 = xz[1],
        tz = threshold(values, x0, x1); // Convert number of thresholds into uniform thresholds.

    if (!Array.isArray(tz)) {
      tz = (0, _ticks.tickStep)(x0, x1, tz);
      tz = (0, _range.default)(Math.ceil(x0 / tz) * tz, x1, tz); // exclusive
    } // Remove any thresholds outside the domain.


    var m = tz.length;

    while (tz[0] <= x0) tz.shift(), --m;

    while (tz[m - 1] > x1) tz.pop(), --m;

    var bins = new Array(m + 1),
        bin; // Initialize bins.

    for (i = 0; i <= m; ++i) {
      bin = bins[i] = [];
      bin.x0 = i > 0 ? tz[i - 1] : x0;
      bin.x1 = i < m ? tz[i] : x1;
    } // Assign data to bins by value, ignoring any outside the domain.


    for (i = 0; i < n; ++i) {
      x = values[i];

      if (x0 <= x && x <= x1) {
        bins[(0, _bisect.default)(tz, x, 0, m)].push(data[i]);
      }
    }

    return bins;
  }

  histogram.value = function (_) {
    return arguments.length ? (value = typeof _ === "function" ? _ : (0, _constant.default)(_), histogram) : value;
  };

  histogram.domain = function (_) {
    return arguments.length ? (domain = typeof _ === "function" ? _ : (0, _constant.default)([_[0], _[1]]), histogram) : domain;
  };

  histogram.thresholds = function (_) {
    return arguments.length ? (threshold = typeof _ === "function" ? _ : Array.isArray(_) ? (0, _constant.default)(_array.slice.call(_)) : (0, _constant.default)(_), histogram) : threshold;
  };

  return histogram;
}
},{"./array":"gb1M","./bisect":"iC3Y","./constant":"OKWp","./extent":"xpz9","./identity":"LuEH","./range":"p0JS","./ticks":"ZDeh","./threshold/sturges":"nukp"}],"Tzo1":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _number = _interopRequireDefault(require("./number"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(values, p, valueof) {
  if (valueof == null) valueof = _number.default;
  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);
}
},{"./number":"LqOB"}],"daVJ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _array = require("../array");

var _ascending = _interopRequireDefault(require("../ascending"));

var _number = _interopRequireDefault(require("../number"));

var _quantile = _interopRequireDefault(require("../quantile"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(values, min, max) {
  values = _array.map.call(values, _number.default).sort(_ascending.default);
  return Math.ceil((max - min) / (2 * ((0, _quantile.default)(values, 0.75) - (0, _quantile.default)(values, 0.25)) * Math.pow(values.length, -1 / 3)));
}
},{"../array":"gb1M","../ascending":"CHz1","../number":"LqOB","../quantile":"Tzo1"}],"DJ5e":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _deviation = _interopRequireDefault(require("../deviation"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(values, min, max) {
  return Math.ceil((max - min) / (3.5 * (0, _deviation.default)(values) * Math.pow(values.length, -1 / 3)));
}
},{"../deviation":"gXIP"}],"nVOH":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(values, valueof) {
  var n = values.length,
      i = -1,
      value,
      max;

  if (valueof == null) {
    while (++i < n) {
      // Find the first comparable value.
      if ((value = values[i]) != null && value >= value) {
        max = value;

        while (++i < n) {
          // Compare the remaining values.
          if ((value = values[i]) != null && value > max) {
            max = value;
          }
        }
      }
    }
  } else {
    while (++i < n) {
      // Find the first comparable value.
      if ((value = valueof(values[i], i, values)) != null && value >= value) {
        max = value;

        while (++i < n) {
          // Compare the remaining values.
          if ((value = valueof(values[i], i, values)) != null && value > max) {
            max = value;
          }
        }
      }
    }
  }

  return max;
}
},{}],"tch9":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _number = _interopRequireDefault(require("./number"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(values, valueof) {
  var n = values.length,
      m = n,
      i = -1,
      value,
      sum = 0;

  if (valueof == null) {
    while (++i < n) {
      if (!isNaN(value = (0, _number.default)(values[i]))) sum += value;else --m;
    }
  } else {
    while (++i < n) {
      if (!isNaN(value = (0, _number.default)(valueof(values[i], i, values)))) sum += value;else --m;
    }
  }

  if (m) return sum / m;
}
},{"./number":"LqOB"}],"HdUj":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _ascending = _interopRequireDefault(require("./ascending"));

var _number = _interopRequireDefault(require("./number"));

var _quantile = _interopRequireDefault(require("./quantile"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(values, valueof) {
  var n = values.length,
      i = -1,
      value,
      numbers = [];

  if (valueof == null) {
    while (++i < n) {
      if (!isNaN(value = (0, _number.default)(values[i]))) {
        numbers.push(value);
      }
    }
  } else {
    while (++i < n) {
      if (!isNaN(value = (0, _number.default)(valueof(values[i], i, values)))) {
        numbers.push(value);
      }
    }
  }

  return (0, _quantile.default)(numbers.sort(_ascending.default), 0.5);
}
},{"./ascending":"CHz1","./number":"LqOB","./quantile":"Tzo1"}],"aFIu":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(arrays) {
  var n = arrays.length,
      m,
      i = -1,
      j = 0,
      merged,
      array;

  while (++i < n) j += arrays[i].length;

  merged = new Array(j);

  while (--n >= 0) {
    array = arrays[n];
    m = array.length;

    while (--m >= 0) {
      merged[--j] = array[m];
    }
  }

  return merged;
}
},{}],"COMv":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(values, valueof) {
  var n = values.length,
      i = -1,
      value,
      min;

  if (valueof == null) {
    while (++i < n) {
      // Find the first comparable value.
      if ((value = values[i]) != null && value >= value) {
        min = value;

        while (++i < n) {
          // Compare the remaining values.
          if ((value = values[i]) != null && min > value) {
            min = value;
          }
        }
      }
    }
  } else {
    while (++i < n) {
      // Find the first comparable value.
      if ((value = valueof(values[i], i, values)) != null && value >= value) {
        min = value;

        while (++i < n) {
          // Compare the remaining values.
          if ((value = valueof(values[i], i, values)) != null && min > value) {
            min = value;
          }
        }
      }
    }
  }

  return min;
}
},{}],"H8zr":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(array, indexes) {
  var i = indexes.length,
      permutes = new Array(i);

  while (i--) permutes[i] = array[indexes[i]];

  return permutes;
}
},{}],"MpwE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _ascending = _interopRequireDefault(require("./ascending"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(values, compare) {
  if (!(n = values.length)) return;
  var n,
      i = 0,
      j = 0,
      xi,
      xj = values[j];
  if (compare == null) compare = _ascending.default;

  while (++i < n) {
    if (compare(xi = values[i], xj) < 0 || compare(xj, xj) !== 0) {
      xj = xi, j = i;
    }
  }

  if (compare(xj, xj) === 0) return j;
}
},{"./ascending":"CHz1"}],"yDFY":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(array, i0, i1) {
  var m = (i1 == null ? array.length : i1) - (i0 = i0 == null ? 0 : +i0),
      t,
      i;

  while (m) {
    i = Math.random() * m-- | 0;
    t = array[m + i0];
    array[m + i0] = array[i + i0];
    array[i + i0] = t;
  }

  return array;
}
},{}],"OigB":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(values, valueof) {
  var n = values.length,
      i = -1,
      value,
      sum = 0;

  if (valueof == null) {
    while (++i < n) {
      if (value = +values[i]) sum += value; // Note: zero and null are equivalent.
    }
  } else {
    while (++i < n) {
      if (value = +valueof(values[i], i, values)) sum += value;
    }
  }

  return sum;
}
},{}],"ts29":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _min = _interopRequireDefault(require("./min"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(matrix) {
  if (!(n = matrix.length)) return [];

  for (var i = -1, m = (0, _min.default)(matrix, length), transpose = new Array(m); ++i < m;) {
    for (var j = -1, n, row = transpose[i] = new Array(n); ++j < n;) {
      row[j] = matrix[j][i];
    }
  }

  return transpose;
}

function length(d) {
  return d.length;
}
},{"./min":"COMv"}],"QgcN":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _transpose = _interopRequireDefault(require("./transpose"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default() {
  return (0, _transpose.default)(arguments);
}
},{"./transpose":"ts29"}],"L9JG":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "bisect", {
  enumerable: true,
  get: function () {
    return _bisect.default;
  }
});
Object.defineProperty(exports, "bisectRight", {
  enumerable: true,
  get: function () {
    return _bisect.bisectRight;
  }
});
Object.defineProperty(exports, "bisectLeft", {
  enumerable: true,
  get: function () {
    return _bisect.bisectLeft;
  }
});
Object.defineProperty(exports, "ascending", {
  enumerable: true,
  get: function () {
    return _ascending.default;
  }
});
Object.defineProperty(exports, "bisector", {
  enumerable: true,
  get: function () {
    return _bisector.default;
  }
});
Object.defineProperty(exports, "cross", {
  enumerable: true,
  get: function () {
    return _cross.default;
  }
});
Object.defineProperty(exports, "descending", {
  enumerable: true,
  get: function () {
    return _descending.default;
  }
});
Object.defineProperty(exports, "deviation", {
  enumerable: true,
  get: function () {
    return _deviation.default;
  }
});
Object.defineProperty(exports, "extent", {
  enumerable: true,
  get: function () {
    return _extent.default;
  }
});
Object.defineProperty(exports, "histogram", {
  enumerable: true,
  get: function () {
    return _histogram.default;
  }
});
Object.defineProperty(exports, "thresholdFreedmanDiaconis", {
  enumerable: true,
  get: function () {
    return _freedmanDiaconis.default;
  }
});
Object.defineProperty(exports, "thresholdScott", {
  enumerable: true,
  get: function () {
    return _scott.default;
  }
});
Object.defineProperty(exports, "thresholdSturges", {
  enumerable: true,
  get: function () {
    return _sturges.default;
  }
});
Object.defineProperty(exports, "max", {
  enumerable: true,
  get: function () {
    return _max.default;
  }
});
Object.defineProperty(exports, "mean", {
  enumerable: true,
  get: function () {
    return _mean.default;
  }
});
Object.defineProperty(exports, "median", {
  enumerable: true,
  get: function () {
    return _median.default;
  }
});
Object.defineProperty(exports, "merge", {
  enumerable: true,
  get: function () {
    return _merge.default;
  }
});
Object.defineProperty(exports, "min", {
  enumerable: true,
  get: function () {
    return _min.default;
  }
});
Object.defineProperty(exports, "pairs", {
  enumerable: true,
  get: function () {
    return _pairs.default;
  }
});
Object.defineProperty(exports, "permute", {
  enumerable: true,
  get: function () {
    return _permute.default;
  }
});
Object.defineProperty(exports, "quantile", {
  enumerable: true,
  get: function () {
    return _quantile.default;
  }
});
Object.defineProperty(exports, "range", {
  enumerable: true,
  get: function () {
    return _range.default;
  }
});
Object.defineProperty(exports, "scan", {
  enumerable: true,
  get: function () {
    return _scan.default;
  }
});
Object.defineProperty(exports, "shuffle", {
  enumerable: true,
  get: function () {
    return _shuffle.default;
  }
});
Object.defineProperty(exports, "sum", {
  enumerable: true,
  get: function () {
    return _sum.default;
  }
});
Object.defineProperty(exports, "ticks", {
  enumerable: true,
  get: function () {
    return _ticks.default;
  }
});
Object.defineProperty(exports, "tickIncrement", {
  enumerable: true,
  get: function () {
    return _ticks.tickIncrement;
  }
});
Object.defineProperty(exports, "tickStep", {
  enumerable: true,
  get: function () {
    return _ticks.tickStep;
  }
});
Object.defineProperty(exports, "transpose", {
  enumerable: true,
  get: function () {
    return _transpose.default;
  }
});
Object.defineProperty(exports, "variance", {
  enumerable: true,
  get: function () {
    return _variance.default;
  }
});
Object.defineProperty(exports, "zip", {
  enumerable: true,
  get: function () {
    return _zip.default;
  }
});

var _bisect = _interopRequireWildcard(require("./bisect"));

var _ascending = _interopRequireDefault(require("./ascending"));

var _bisector = _interopRequireDefault(require("./bisector"));

var _cross = _interopRequireDefault(require("./cross"));

var _descending = _interopRequireDefault(require("./descending"));

var _deviation = _interopRequireDefault(require("./deviation"));

var _extent = _interopRequireDefault(require("./extent"));

var _histogram = _interopRequireDefault(require("./histogram"));

var _freedmanDiaconis = _interopRequireDefault(require("./threshold/freedmanDiaconis"));

var _scott = _interopRequireDefault(require("./threshold/scott"));

var _sturges = _interopRequireDefault(require("./threshold/sturges"));

var _max = _interopRequireDefault(require("./max"));

var _mean = _interopRequireDefault(require("./mean"));

var _median = _interopRequireDefault(require("./median"));

var _merge = _interopRequireDefault(require("./merge"));

var _min = _interopRequireDefault(require("./min"));

var _pairs = _interopRequireDefault(require("./pairs"));

var _permute = _interopRequireDefault(require("./permute"));

var _quantile = _interopRequireDefault(require("./quantile"));

var _range = _interopRequireDefault(require("./range"));

var _scan = _interopRequireDefault(require("./scan"));

var _shuffle = _interopRequireDefault(require("./shuffle"));

var _sum = _interopRequireDefault(require("./sum"));

var _ticks = _interopRequireWildcard(require("./ticks"));

var _transpose = _interopRequireDefault(require("./transpose"));

var _variance = _interopRequireDefault(require("./variance"));

var _zip = _interopRequireDefault(require("./zip"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
},{"./bisect":"iC3Y","./ascending":"CHz1","./bisector":"xbDs","./cross":"btrA","./descending":"s7oJ","./deviation":"gXIP","./extent":"xpz9","./histogram":"e83F","./threshold/freedmanDiaconis":"daVJ","./threshold/scott":"DJ5e","./threshold/sturges":"nukp","./max":"nVOH","./mean":"tch9","./median":"HdUj","./merge":"aFIu","./min":"COMv","./pairs":"ZO9R","./permute":"H8zr","./quantile":"Tzo1","./range":"p0JS","./scan":"MpwE","./shuffle":"yDFY","./sum":"OigB","./ticks":"ZDeh","./transpose":"ts29","./variance":"h5et","./zip":"QgcN"}],"mgsE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _buffer = _interopRequireDefault(require("./buffer.js"));

var _rejoin = _interopRequireDefault(require("./rejoin.js"));

var _math = require("../math.js");

var _polygonContains = _interopRequireDefault(require("../polygonContains.js"));

var _d3Array = require("d3-array");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(pointVisible, clipLine, interpolate, start) {
  return function (sink) {
    var line = clipLine(sink),
        ringBuffer = (0, _buffer.default)(),
        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 = (0, _d3Array.merge)(segments);
        var startInside = (0, _polygonContains.default)(polygon, start);

        if (segments.length) {
          if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
          (0, _rejoin.default)(segments, 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 compareIntersection(a, b) {
  return ((a = a.x)[0] < 0 ? a[1] - _math.halfPi - _math.epsilon : _math.halfPi - a[1]) - ((b = b.x)[0] < 0 ? b[1] - _math.halfPi - _math.epsilon : _math.halfPi - b[1]);
}
},{"./buffer.js":"e3vZ","./rejoin.js":"tY5q","../math.js":"Stis","../polygonContains.js":"AbY4","d3-array":"L9JG"}],"zgVO":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _index = _interopRequireDefault(require("./index.js"));

var _math = require("../math.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _default = (0, _index.default)(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.


exports.default = _default;

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 = (0, _math.abs)(lambda1 - lambda0);

      if ((0, _math.abs)(delta - _math.pi) < _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 ((0, _math.abs)(lambda0 - sign0) < _math.epsilon) lambda0 -= sign0 * _math.epsilon; // handle degeneracies

        if ((0, _math.abs)(lambda1 - sign1) < _math.epsilon) lambda1 -= sign1 * _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 = (0, _math.sin)(lambda0 - lambda1);
  return (0, _math.abs)(sinLambda0Lambda1) > _math.epsilon ? (0, _math.atan)(((0, _math.sin)(phi0) * (cosPhi1 = (0, _math.cos)(phi1)) * (0, _math.sin)(lambda1) - (0, _math.sin)(phi1) * (cosPhi0 = (0, _math.cos)(phi0)) * (0, _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 ((0, _math.abs)(from[0] - to[0]) > _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]);
  }
}
},{"./index.js":"mgsE","../math.js":"Stis"}],"rPdY":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _cartesian = require("../cartesian.js");

var _circle = require("../circle.js");

var _math = require("../math.js");

var _pointEqual = _interopRequireDefault(require("../pointEqual.js"));

var _index = _interopRequireDefault(require("./index.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(radius) {
  var cr = (0, _math.cos)(radius),
      delta = 6 * _math.radians,
      smallRadius = cr > 0,
      notHemisphere = (0, _math.abs)(cr) > _math.epsilon; // TODO optimise for this common case


  function interpolate(from, to, direction, stream) {
    (0, _circle.circleStream)(stream, radius, delta, direction, from, to);
  }

  function visible(lambda, phi) {
    return (0, _math.cos)(lambda) * (0, _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(); // Handle degeneracies.
        // TODO ignore if not clipping polygons.

        if (v !== v0) {
          point2 = intersect(point0, point1);

          if (!point2 || (0, _pointEqual.default)(point0, point2) || (0, _pointEqual.default)(point1, point2)) {
            point1[0] += _math.epsilon;
            point1[1] += _math.epsilon;
            v = visible(point1[0], point1[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]);
            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]);
            }
          }
        }

        if (v && (!point0 || !(0, _pointEqual.default)(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 = (0, _cartesian.cartesian)(a),
        pb = (0, _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 = (0, _cartesian.cartesianCross)(pa, pb),
        n2n2 = (0, _cartesian.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 = (0, _cartesian.cartesianCross)(n1, n2),
        A = (0, _cartesian.cartesianScale)(n1, c1),
        B = (0, _cartesian.cartesianScale)(n2, c2);
    (0, _cartesian.cartesianAddInPlace)(A, B); // Solve |p(t)|^2 = 1.

    var u = n1xn2,
        w = (0, _cartesian.cartesianDot)(A, u),
        uu = (0, _cartesian.cartesianDot)(u, u),
        t2 = w * w - uu * ((0, _cartesian.cartesianDot)(A, A) - 1);
    if (t2 < 0) return;
    var t = (0, _math.sqrt)(t2),
        q = (0, _cartesian.cartesianScale)(u, (-w - t) / uu);
    (0, _cartesian.cartesianAddInPlace)(q, A);
    q = (0, _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 = (0, _math.abs)(delta - _math.pi) < _math.epsilon,
        meridian = polar || delta < _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] < ((0, _math.abs)(q[0] - lambda0) < _math.epsilon ? phi0 : phi1) : phi0 <= q[1] && q[1] <= phi1 : delta > _math.pi ^ (lambda0 <= q[0] && q[0] <= lambda1)) {
      var q1 = (0, _cartesian.cartesianScale)(u, (-w + t) / uu);
      (0, _cartesian.cartesianAddInPlace)(q1, A);
      return [q, (0, _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 (0, _index.default)(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-_math.pi, radius - _math.pi]);
}
},{"../cartesian.js":"Jmo8","../circle.js":"exZ4","../math.js":"Stis","../pointEqual.js":"QfPV","./index.js":"mgsE"}],"yYyd":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(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;
}
},{}],"wNQ8":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = clipRectangle;

var _math = require("../math.js");

var _buffer = _interopRequireDefault(require("./buffer.js"));

var _line = _interopRequireDefault(require("./line.js"));

var _rejoin = _interopRequireDefault(require("./rejoin.js"));

var _d3Array = require("d3-array");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

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 (0, _math.abs)(p[0] - x0) < _math.epsilon ? direction > 0 ? 0 : 3 : (0, _math.abs)(p[0] - x1) < _math.epsilon ? direction > 0 ? 2 : 1 : (0, _math.abs)(p[1] - y0) < _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 = (0, _buffer.default)(),
        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 = (0, _d3Array.merge)(segments)).length;

      if (cleanInside || visible) {
        stream.polygonStart();

        if (cleanInside) {
          stream.lineStart();
          interpolate(null, null, 1, stream);
          stream.lineEnd();
        }

        if (visible) {
          (0, _rejoin.default)(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 ((0, _line.default)(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;
  };
}
},{"../math.js":"Stis","./buffer.js":"e3vZ","./line.js":"yYyd","./rejoin.js":"tY5q","d3-array":"L9JG"}],"iwSF":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _rectangle = _interopRequireDefault(require("./rectangle.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default() {
  var x0 = 0,
      y0 = 0,
      x1 = 960,
      y1 = 500,
      cache,
      cacheStream,
      clip;
  return clip = {
    stream: function (stream) {
      return cache && cacheStream === stream ? cache : cache = (0, _rectangle.default)(x0, y0, x1, y1)(cacheStream = stream);
    },
    extent: function (_) {
      return arguments.length ? (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1], cache = cacheStream = null, clip) : [[x0, y0], [x1, y1]];
    }
  };
}
},{"./rectangle.js":"wNQ8"}],"a487":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _adder = _interopRequireDefault(require("./adder.js"));

var _math = require("./math.js");

var _noop = _interopRequireDefault(require("./noop.js"));

var _stream = _interopRequireDefault(require("./stream.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var lengthSum = (0, _adder.default)(),
    lambda0,
    sinPhi0,
    cosPhi0;
var lengthStream = {
  sphere: _noop.default,
  point: _noop.default,
  lineStart: lengthLineStart,
  lineEnd: _noop.default,
  polygonStart: _noop.default,
  polygonEnd: _noop.default
};

function lengthLineStart() {
  lengthStream.point = lengthPointFirst;
  lengthStream.lineEnd = lengthLineEnd;
}

function lengthLineEnd() {
  lengthStream.point = lengthStream.lineEnd = _noop.default;
}

function lengthPointFirst(lambda, phi) {
  lambda *= _math.radians, phi *= _math.radians;
  lambda0 = lambda, sinPhi0 = (0, _math.sin)(phi), cosPhi0 = (0, _math.cos)(phi);
  lengthStream.point = lengthPoint;
}

function lengthPoint(lambda, phi) {
  lambda *= _math.radians, phi *= _math.radians;
  var sinPhi = (0, _math.sin)(phi),
      cosPhi = (0, _math.cos)(phi),
      delta = (0, _math.abs)(lambda - lambda0),
      cosDelta = (0, _math.cos)(delta),
      sinDelta = (0, _math.sin)(delta),
      x = cosPhi * sinDelta,
      y = cosPhi0 * sinPhi - sinPhi0 * cosPhi * cosDelta,
      z = sinPhi0 * sinPhi + cosPhi0 * cosPhi * cosDelta;
  lengthSum.add((0, _math.atan2)((0, _math.sqrt)(x * x + y * y), z));
  lambda0 = lambda, sinPhi0 = sinPhi, cosPhi0 = cosPhi;
}

function _default(object) {
  lengthSum.reset();
  (0, _stream.default)(object, lengthStream);
  return +lengthSum;
}
},{"./adder.js":"cq11","./math.js":"Stis","./noop.js":"gEqK","./stream.js":"AcnE"}],"Xqqx":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _length = _interopRequireDefault(require("./length.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var coordinates = [null, null],
    object = {
  type: "LineString",
  coordinates: coordinates
};

function _default(a, b) {
  coordinates[0] = a;
  coordinates[1] = b;
  return (0, _length.default)(object);
}
},{"./length.js":"a487"}],"lYqy":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _polygonContains = _interopRequireDefault(require("./polygonContains.js"));

var _distance = _interopRequireDefault(require("./distance.js"));

var _math = require("./math.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var containsObjectType = {
  Feature: function (object, point) {
    return containsGeometry(object.geometry, point);
  },
  FeatureCollection: function (object, point) {
    var features = object.features,
        i = -1,
        n = features.length;

    while (++i < n) if (containsGeometry(features[i].geometry, point)) return true;

    return false;
  }
};
var containsGeometryType = {
  Sphere: function () {
    return true;
  },
  Point: function (object, point) {
    return containsPoint(object.coordinates, point);
  },
  MultiPoint: function (object, point) {
    var coordinates = object.coordinates,
        i = -1,
        n = coordinates.length;

    while (++i < n) if (containsPoint(coordinates[i], point)) return true;

    return false;
  },
  LineString: function (object, point) {
    return containsLine(object.coordinates, point);
  },
  MultiLineString: function (object, point) {
    var coordinates = object.coordinates,
        i = -1,
        n = coordinates.length;

    while (++i < n) if (containsLine(coordinates[i], point)) return true;

    return false;
  },
  Polygon: function (object, point) {
    return containsPolygon(object.coordinates, point);
  },
  MultiPolygon: function (object, point) {
    var coordinates = object.coordinates,
        i = -1,
        n = coordinates.length;

    while (++i < n) if (containsPolygon(coordinates[i], point)) return true;

    return false;
  },
  GeometryCollection: function (object, point) {
    var geometries = object.geometries,
        i = -1,
        n = geometries.length;

    while (++i < n) if (containsGeometry(geometries[i], point)) return true;

    return false;
  }
};

function containsGeometry(geometry, point) {
  return geometry && containsGeometryType.hasOwnProperty(geometry.type) ? containsGeometryType[geometry.type](geometry, point) : false;
}

function containsPoint(coordinates, point) {
  return (0, _distance.default)(coordinates, point) === 0;
}

function containsLine(coordinates, point) {
  var ao, bo, ab;

  for (var i = 0, n = coordinates.length; i < n; i++) {
    bo = (0, _distance.default)(coordinates[i], point);
    if (bo === 0) return true;

    if (i > 0) {
      ab = (0, _distance.default)(coordinates[i], coordinates[i - 1]);
      if (ab > 0 && ao <= ab && bo <= ab && (ao + bo - ab) * (1 - Math.pow((ao - bo) / ab, 2)) < _math.epsilon2 * ab) return true;
    }

    ao = bo;
  }

  return false;
}

function containsPolygon(coordinates, point) {
  return !!(0, _polygonContains.default)(coordinates.map(ringRadians), pointRadians(point));
}

function ringRadians(ring) {
  return ring = ring.map(pointRadians), ring.pop(), ring;
}

function pointRadians(point) {
  return [point[0] * _math.radians, point[1] * _math.radians];
}

function _default(object, point) {
  return (object && containsObjectType.hasOwnProperty(object.type) ? containsObjectType[object.type] : containsGeometry)(object, point);
}
},{"./polygonContains.js":"AbY4","./distance.js":"Xqqx","./math.js":"Stis"}],"pBbd":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = graticule;
exports.graticule10 = graticule10;

var _d3Array = require("d3-array");

var _math = require("./math.js");

function graticuleX(y0, y1, dy) {
  var y = (0, _d3Array.range)(y0, y1 - _math.epsilon, dy).concat(y1);
  return function (x) {
    return y.map(function (y) {
      return [x, y];
    });
  };
}

function graticuleY(x0, x1, dx) {
  var x = (0, _d3Array.range)(x0, x1 - _math.epsilon, dx).concat(x1);
  return function (y) {
    return x.map(function (x) {
      return [x, y];
    });
  };
}

function 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 (0, _d3Array.range)((0, _math.ceil)(X0 / DX) * DX, X1, DX).map(X).concat((0, _d3Array.range)((0, _math.ceil)(Y0 / DY) * DY, Y1, DY).map(Y)).concat((0, _d3Array.range)((0, _math.ceil)(x0 / dx) * dx, x1, dx).filter(function (x) {
      return (0, _math.abs)(x % DX) > _math.epsilon;
    }).map(x)).concat((0, _d3Array.range)((0, _math.ceil)(y0 / dy) * dy, y1, dy).filter(function (y) {
      return (0, _math.abs)(y % DY) > _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 + _math.epsilon], [180, 90 - _math.epsilon]]).extentMinor([[-180, -80 - _math.epsilon], [180, 80 + _math.epsilon]]);
}

function graticule10() {
  return graticule()();
}
},{"d3-array":"L9JG","./math.js":"Stis"}],"eVSx":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _math = require("./math.js");

function _default(a, b) {
  var x0 = a[0] * _math.radians,
      y0 = a[1] * _math.radians,
      x1 = b[0] * _math.radians,
      y1 = b[1] * _math.radians,
      cy0 = (0, _math.cos)(y0),
      sy0 = (0, _math.sin)(y0),
      cy1 = (0, _math.cos)(y1),
      sy1 = (0, _math.sin)(y1),
      kx0 = cy0 * (0, _math.cos)(x0),
      ky0 = cy0 * (0, _math.sin)(x0),
      kx1 = cy1 * (0, _math.cos)(x1),
      ky1 = cy1 * (0, _math.sin)(x1),
      d = 2 * (0, _math.asin)((0, _math.sqrt)((0, _math.haversin)(y1 - y0) + cy0 * cy1 * (0, _math.haversin)(x1 - x0))),
      k = (0, _math.sin)(d);
  var interpolate = d ? function (t) {
    var B = (0, _math.sin)(t *= d) / k,
        A = (0, _math.sin)(d - t) / k,
        x = A * kx0 + B * kx1,
        y = A * ky0 + B * ky1,
        z = A * sy0 + B * sy1;
    return [(0, _math.atan2)(y, x) * _math.degrees, (0, _math.atan2)(z, (0, _math.sqrt)(x * x + y * y)) * _math.degrees];
  } : function () {
    return [x0 * _math.degrees, y0 * _math.degrees];
  };
  interpolate.distance = d;
  return interpolate;
}
},{"./math.js":"Stis"}],"LPf1":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _adder = _interopRequireDefault(require("../adder.js"));

var _math = require("../math.js");

var _noop = _interopRequireDefault(require("../noop.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var areaSum = (0, _adder.default)(),
    areaRingSum = (0, _adder.default)(),
    x00,
    y00,
    x0,
    y0;
var areaStream = {
  point: _noop.default,
  lineStart: _noop.default,
  lineEnd: _noop.default,
  polygonStart: function () {
    areaStream.lineStart = areaRingStart;
    areaStream.lineEnd = areaRingEnd;
  },
  polygonEnd: function () {
    areaStream.lineStart = areaStream.lineEnd = areaStream.point = _noop.default;
    areaSum.add((0, _math.abs)(areaRingSum));
    areaRingSum.reset();
  },
  result: function () {
    var area = areaSum / 2;
    areaSum.reset();
    return area;
  }
};

function areaRingStart() {
  areaStream.point = areaPointFirst;
}

function areaPointFirst(x, y) {
  areaStream.point = areaPoint;
  x00 = x0 = x, y00 = y0 = y;
}

function areaPoint(x, y) {
  areaRingSum.add(y0 * x - x0 * y);
  x0 = x, y0 = y;
}

function areaRingEnd() {
  areaPoint(x00, y00);
}

var _default = areaStream;
exports.default = _default;
},{"../adder.js":"cq11","../math.js":"Stis","../noop.js":"gEqK"}],"Cv5M":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _noop = _interopRequireDefault(require("../noop.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var x0 = Infinity,
    y0 = x0,
    x1 = -x0,
    y1 = x1;
var boundsStream = {
  point: boundsPoint,
  lineStart: _noop.default,
  lineEnd: _noop.default,
  polygonStart: _noop.default,
  polygonEnd: _noop.default,
  result: function () {
    var bounds = [[x0, y0], [x1, y1]];
    x1 = y1 = -(y0 = x0 = Infinity);
    return bounds;
  }
};

function boundsPoint(x, y) {
  if (x < x0) x0 = x;
  if (x > x1) x1 = x;
  if (y < y0) y0 = y;
  if (y > y1) y1 = y;
}

var _default = boundsStream;
exports.default = _default;
},{"../noop.js":"gEqK"}],"zcTP":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _math = require("../math.js");

// TODO Enforce positive area for exterior, negative area for interior?
var X0 = 0,
    Y0 = 0,
    Z0 = 0,
    X1 = 0,
    Y1 = 0,
    Z1 = 0,
    X2 = 0,
    Y2 = 0,
    Z2 = 0,
    x00,
    y00,
    x0,
    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 ? [X1 / Z1, Y1 / Z1] : Z0 ? [X0 / Z0, Y0 / Z0] : [NaN, NaN];
    X0 = Y0 = Z0 = X1 = Y1 = Z1 = X2 = Y2 = Z2 = 0;
    return centroid;
  }
};

function centroidPoint(x, y) {
  X0 += x;
  Y0 += y;
  ++Z0;
}

function centroidLineStart() {
  centroidStream.point = centroidPointFirstLine;
}

function centroidPointFirstLine(x, y) {
  centroidStream.point = centroidPointLine;
  centroidPoint(x0 = x, y0 = y);
}

function centroidPointLine(x, y) {
  var dx = x - x0,
      dy = y - y0,
      z = (0, _math.sqrt)(dx * dx + dy * dy);
  X1 += z * (x0 + x) / 2;
  Y1 += z * (y0 + y) / 2;
  Z1 += z;
  centroidPoint(x0 = x, y0 = y);
}

function centroidLineEnd() {
  centroidStream.point = centroidPoint;
}

function centroidRingStart() {
  centroidStream.point = centroidPointFirstRing;
}

function centroidRingEnd() {
  centroidPointRing(x00, y00);
}

function centroidPointFirstRing(x, y) {
  centroidStream.point = centroidPointRing;
  centroidPoint(x00 = x0 = x, y00 = y0 = y);
}

function centroidPointRing(x, y) {
  var dx = x - x0,
      dy = y - y0,
      z = (0, _math.sqrt)(dx * dx + dy * dy);
  X1 += z * (x0 + x) / 2;
  Y1 += z * (y0 + y) / 2;
  Z1 += z;
  z = y0 * x - x0 * y;
  X2 += z * (x0 + x);
  Y2 += z * (y0 + y);
  Z2 += z * 3;
  centroidPoint(x0 = x, y0 = y);
}

var _default = centroidStream;
exports.default = _default;
},{"../math.js":"Stis"}],"RRtG":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = PathContext;

var _math = require("../math.js");

var _noop = _interopRequireDefault(require("../noop.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

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.default
};
},{"../math.js":"Stis","../noop.js":"gEqK"}],"rYGy":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _adder = _interopRequireDefault(require("../adder.js"));

var _math = require("../math.js");

var _noop = _interopRequireDefault(require("../noop.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var lengthSum = (0, _adder.default)(),
    lengthRing,
    x00,
    y00,
    x0,
    y0;
var lengthStream = {
  point: _noop.default,
  lineStart: function () {
    lengthStream.point = lengthPointFirst;
  },
  lineEnd: function () {
    if (lengthRing) lengthPoint(x00, y00);
    lengthStream.point = _noop.default;
  },
  polygonStart: function () {
    lengthRing = true;
  },
  polygonEnd: function () {
    lengthRing = null;
  },
  result: function () {
    var length = +lengthSum;
    lengthSum.reset();
    return length;
  }
};

function lengthPointFirst(x, y) {
  lengthStream.point = lengthPoint;
  x00 = x0 = x, y00 = y0 = y;
}

function lengthPoint(x, y) {
  x0 -= x, y0 -= y;
  lengthSum.add((0, _math.sqrt)(x0 * x0 + y0 * y0));
  x0 = x, y0 = y;
}

var _default = lengthStream;
exports.default = _default;
},{"../adder.js":"cq11","../math.js":"Stis","../noop.js":"gEqK"}],"u4Ic":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = PathString;

function PathString() {
  this._string = [];
}

PathString.prototype = {
  _radius: 4.5,
  _circle: 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 = 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 circle(radius) {
  return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius + "z";
}
},{}],"Ixq3":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _identity = _interopRequireDefault(require("../identity.js"));

var _stream = _interopRequireDefault(require("../stream.js"));

var _area = _interopRequireDefault(require("./area.js"));

var _bounds = _interopRequireDefault(require("./bounds.js"));

var _centroid = _interopRequireDefault(require("./centroid.js"));

var _context = _interopRequireDefault(require("./context.js"));

var _measure = _interopRequireDefault(require("./measure.js"));

var _string = _interopRequireDefault(require("./string.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(projection, context) {
  var pointRadius = 4.5,
      projectionStream,
      contextStream;

  function path(object) {
    if (object) {
      if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments));
      (0, _stream.default)(object, projectionStream(contextStream));
    }

    return contextStream.result();
  }

  path.area = function (object) {
    (0, _stream.default)(object, projectionStream(_area.default));
    return _area.default.result();
  };

  path.measure = function (object) {
    (0, _stream.default)(object, projectionStream(_measure.default));
    return _measure.default.result();
  };

  path.bounds = function (object) {
    (0, _stream.default)(object, projectionStream(_bounds.default));
    return _bounds.default.result();
  };

  path.centroid = function (object) {
    (0, _stream.default)(object, projectionStream(_centroid.default));
    return _centroid.default.result();
  };

  path.projection = function (_) {
    return arguments.length ? (projectionStream = _ == null ? (projection = null, _identity.default) : (projection = _).stream, path) : projection;
  };

  path.context = function (_) {
    if (!arguments.length) return context;
    contextStream = _ == null ? (context = null, new _string.default()) : new _context.default(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);
}
},{"../identity.js":"LuEH","../stream.js":"AcnE","./area.js":"LPf1","./bounds.js":"Cv5M","./centroid.js":"zcTP","./context.js":"RRtG","./measure.js":"rYGy","./string.js":"u4Ic"}],"SUNr":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.transformer = transformer;

function _default(methods) {
  return {
    stream: transformer(methods)
  };
}

function 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();
  }
};
},{}],"Jpsc":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.fitExtent = fitExtent;
exports.fitSize = fitSize;
exports.fitWidth = fitWidth;
exports.fitHeight = fitHeight;

var _stream = _interopRequireDefault(require("../stream.js"));

var _bounds = _interopRequireDefault(require("../path/bounds.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function fit(projection, fitBounds, object) {
  var clip = projection.clipExtent && projection.clipExtent();
  projection.scale(150).translate([0, 0]);
  if (clip != null) projection.clipExtent(null);
  (0, _stream.default)(object, projection.stream(_bounds.default));
  fitBounds(_bounds.default.result());
  if (clip != null) projection.clipExtent(clip);
  return projection;
}

function fitExtent(projection, extent, object) {
  return 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(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(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);
}
},{"../stream.js":"AcnE","../path/bounds.js":"Cv5M"}],"bR5j":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _cartesian = require("../cartesian.js");

var _math = require("../math.js");

var _transform = require("../transform.js");

var maxDepth = 16,
    // maximum depth of subdivision
cosMinDistance = (0, _math.cos)(30 * _math.radians); // cos(minimum angular distance)

function _default(project, delta2) {
  return +delta2 ? resample(project, delta2) : resampleNone(project);
}

function resampleNone(project) {
  return (0, _transform.transformer)({
    point: function (x, y) {
      x = project(x, y);
      this.stream.point(x[0], x[1]);
    }
  });
}

function 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 = (0, _math.sqrt)(a * a + b * b + c * c),
          phi2 = (0, _math.asin)(c /= m),
          lambda2 = (0, _math.abs)((0, _math.abs)(c) - 1) < _math.epsilon || (0, _math.abs)(lambda0 - lambda1) < _math.epsilon ? (lambda0 + lambda1) / 2 : (0, _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
      || (0, _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 = (0, _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], 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, maxDepth, stream);
      resampleStream.lineEnd = lineEnd;
      lineEnd();
    }

    return resampleStream;
  };
}
},{"../cartesian.js":"Jmo8","../math.js":"Stis","../transform.js":"SUNr"}],"mrcH":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = projection;
exports.projectionMutator = projectionMutator;

var _antimeridian = _interopRequireDefault(require("../clip/antimeridian.js"));

var _circle = _interopRequireDefault(require("../clip/circle.js"));

var _rectangle = _interopRequireDefault(require("../clip/rectangle.js"));

var _compose = _interopRequireDefault(require("../compose.js"));

var _identity = _interopRequireDefault(require("../identity.js"));

var _math = require("../math.js");

var _rotation = require("../rotation.js");

var _transform = require("../transform.js");

var _fit = require("./fit.js");

var _resample = _interopRequireDefault(require("./resample.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var transformRadians = (0, _transform.transformer)({
  point: function (x, y) {
    this.stream.point(x * _math.radians, y * _math.radians);
  }
});

function transformRotate(rotate) {
  return (0, _transform.transformer)({
    point: function (x, y) {
      var r = rotate(x, y);
      return this.stream.point(r[0], r[1]);
    }
  });
}

function scaleTranslate(k, dx, dy) {
  function transform(x, y) {
    return [dx + k * x, dy - k * y];
  }

  transform.invert = function (x, y) {
    return [(x - dx) / k, (dy - y) / k];
  };

  return transform;
}

function scaleTranslateRotate(k, dx, dy, alpha) {
  var cosAlpha = (0, _math.cos)(alpha),
      sinAlpha = (0, _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) {
    return [a * x - b * y + dx, dy - b * x - a * y];
  }

  transform.invert = function (x, y) {
    return [ai * x - bi * y + ci, fi - bi * x - ai * y];
  };

  return transform;
}

function 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
  theta = null,
      preclip = _antimeridian.default,
      // pre-clip angle
  x0 = null,
      y0,
      x1,
      y1,
      postclip = _identity.default,
      // 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] * _math.degrees, point[1] * _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 = +_ ? (0, _circle.default)(theta = _ * _math.radians) : (theta = null, _antimeridian.default), reset()) : theta * _math.degrees;
  };

  projection.clipExtent = function (_) {
    return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, _identity.default) : (0, _rectangle.default)(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 * _math.degrees, phi * _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 * _math.degrees, deltaPhi * _math.degrees, deltaGamma * _math.degrees];
  };

  projection.angle = function (_) {
    return arguments.length ? (alpha = _ % 360 * _math.radians, recenter()) : alpha * _math.degrees;
  };

  projection.precision = function (_) {
    return arguments.length ? (projectResample = (0, _resample.default)(projectTransform, delta2 = _ * _), reset()) : (0, _math.sqrt)(delta2);
  };

  projection.fitExtent = function (extent, object) {
    return (0, _fit.fitExtent)(projection, extent, object);
  };

  projection.fitSize = function (size, object) {
    return (0, _fit.fitSize)(projection, size, object);
  };

  projection.fitWidth = function (width, object) {
    return (0, _fit.fitWidth)(projection, width, object);
  };

  projection.fitHeight = function (height, object) {
    return (0, _fit.fitHeight)(projection, height, object);
  };

  function recenter() {
    var center = scaleTranslateRotate(k, 0, 0, alpha).apply(null, project(lambda, phi)),
        transform = (alpha ? scaleTranslateRotate : scaleTranslate)(k, x - center[0], y - center[1], alpha);
    rotate = (0, _rotation.rotateRadians)(deltaLambda, deltaPhi, deltaGamma);
    projectTransform = (0, _compose.default)(project, transform);
    projectRotateTransform = (0, _compose.default)(rotate, projectTransform);
    projectResample = (0, _resample.default)(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();
  };
}
},{"../clip/antimeridian.js":"zgVO","../clip/circle.js":"rPdY","../clip/rectangle.js":"wNQ8","../compose.js":"BHP2","../identity.js":"LuEH","../math.js":"Stis","../rotation.js":"hFnY","../transform.js":"SUNr","./fit.js":"Jpsc","./resample.js":"bR5j"}],"tLZN":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.conicProjection = conicProjection;

var _math = require("../math.js");

var _index = require("./index.js");

function conicProjection(projectAt) {
  var phi0 = 0,
      phi1 = _math.pi / 3,
      m = (0, _index.projectionMutator)(projectAt),
      p = m(phi0, phi1);

  p.parallels = function (_) {
    return arguments.length ? m(phi0 = _[0] * _math.radians, phi1 = _[1] * _math.radians) : [phi0 * _math.degrees, phi1 * _math.degrees];
  };

  return p;
}
},{"../math.js":"Stis","./index.js":"mrcH"}],"TRyd":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.cylindricalEqualAreaRaw = cylindricalEqualAreaRaw;

var _math = require("../math.js");

function cylindricalEqualAreaRaw(phi0) {
  var cosPhi0 = (0, _math.cos)(phi0);

  function forward(lambda, phi) {
    return [lambda * cosPhi0, (0, _math.sin)(phi) / cosPhi0];
  }

  forward.invert = function (x, y) {
    return [x / cosPhi0, (0, _math.asin)(y * cosPhi0)];
  };

  return forward;
}
},{"../math.js":"Stis"}],"TTxy":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.conicEqualAreaRaw = conicEqualAreaRaw;
exports.default = _default;

var _math = require("../math.js");

var _conic = require("./conic.js");

var _cylindricalEqualArea = require("./cylindricalEqualArea.js");

function conicEqualAreaRaw(y0, y1) {
  var sy0 = (0, _math.sin)(y0),
      n = (sy0 + (0, _math.sin)(y1)) / 2; // Are the parallels symmetrical around the Equator?

  if ((0, _math.abs)(n) < _math.epsilon) return (0, _cylindricalEqualArea.cylindricalEqualAreaRaw)(y0);
  var c = 1 + sy0 * (2 * n - sy0),
      r0 = (0, _math.sqrt)(c) / n;

  function project(x, y) {
    var r = (0, _math.sqrt)(c - 2 * n * (0, _math.sin)(y)) / n;
    return [r * (0, _math.sin)(x *= n), r0 - r * (0, _math.cos)(x)];
  }

  project.invert = function (x, y) {
    var r0y = r0 - y;
    return [(0, _math.atan2)(x, (0, _math.abs)(r0y)) / n * (0, _math.sign)(r0y), (0, _math.asin)((c - (x * x + r0y * r0y) * n * n) / (2 * n))];
  };

  return project;
}

function _default() {
  return (0, _conic.conicProjection)(conicEqualAreaRaw).scale(155.424).center([0, 33.6442]);
}
},{"../math.js":"Stis","./conic.js":"tLZN","./cylindricalEqualArea.js":"TRyd"}],"zp4D":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _conicEqualArea = _interopRequireDefault(require("./conicEqualArea.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default() {
  return (0, _conicEqualArea.default)().parallels([29.5, 45.5]).scale(1070).translate([480, 250]).rotate([96, 0]).center([-0.6, 38.7]);
}
},{"./conicEqualArea.js":"TTxy"}],"VbRR":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _math = require("../math.js");

var _albers = _interopRequireDefault(require("./albers.js"));

var _conicEqualArea = _interopRequireDefault(require("./conicEqualArea.js"));

var _fit = require("./fit.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// 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


function _default() {
  var cache,
      cacheStream,
      lower48 = (0, _albers.default)(),
      lower48Point,
      alaska = (0, _conicEqualArea.default)().rotate([154, 0]).center([-2, 58.5]).parallels([55, 65]),
      alaskaPoint,
      // EPSG:3338
  hawaii = (0, _conicEqualArea.default)().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 + _math.epsilon, y + 0.120 * k + _math.epsilon], [x - 0.214 * k - _math.epsilon, y + 0.234 * k - _math.epsilon]]).stream(pointStream);
    hawaiiPoint = hawaii.translate([x - 0.205 * k, y + 0.212 * k]).clipExtent([[x - 0.214 * k + _math.epsilon, y + 0.166 * k + _math.epsilon], [x - 0.115 * k - _math.epsilon, y + 0.234 * k - _math.epsilon]]).stream(pointStream);
    return reset();
  };

  albersUsa.fitExtent = function (extent, object) {
    return (0, _fit.fitExtent)(albersUsa, extent, object);
  };

  albersUsa.fitSize = function (size, object) {
    return (0, _fit.fitSize)(albersUsa, size, object);
  };

  albersUsa.fitWidth = function (width, object) {
    return (0, _fit.fitWidth)(albersUsa, width, object);
  };

  albersUsa.fitHeight = function (height, object) {
    return (0, _fit.fitHeight)(albersUsa, height, object);
  };

  function reset() {
    cache = cacheStream = null;
    return albersUsa;
  }

  return albersUsa.scale(1070);
}
},{"../math.js":"Stis","./albers.js":"zp4D","./conicEqualArea.js":"TTxy","./fit.js":"Jpsc"}],"nG4u":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.azimuthalRaw = azimuthalRaw;
exports.azimuthalInvert = azimuthalInvert;

var _math = require("../math.js");

function azimuthalRaw(scale) {
  return function (x, y) {
    var cx = (0, _math.cos)(x),
        cy = (0, _math.cos)(y),
        k = scale(cx * cy);
    return [k * cy * (0, _math.sin)(x), k * (0, _math.sin)(y)];
  };
}

function azimuthalInvert(angle) {
  return function (x, y) {
    var z = (0, _math.sqrt)(x * x + y * y),
        c = angle(z),
        sc = (0, _math.sin)(c),
        cc = (0, _math.cos)(c);
    return [(0, _math.atan2)(x * sc, z * cc), (0, _math.asin)(z && y * sc / z)];
  };
}
},{"../math.js":"Stis"}],"uNRF":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.azimuthalEqualAreaRaw = void 0;

var _math = require("../math.js");

var _azimuthal = require("./azimuthal.js");

var _index = _interopRequireDefault(require("./index.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var azimuthalEqualAreaRaw = (0, _azimuthal.azimuthalRaw)(function (cxcy) {
  return (0, _math.sqrt)(2 / (1 + cxcy));
});
exports.azimuthalEqualAreaRaw = azimuthalEqualAreaRaw;
azimuthalEqualAreaRaw.invert = (0, _azimuthal.azimuthalInvert)(function (z) {
  return 2 * (0, _math.asin)(z / 2);
});

function _default() {
  return (0, _index.default)(azimuthalEqualAreaRaw).scale(124.75).clipAngle(180 - 1e-3);
}
},{"../math.js":"Stis","./azimuthal.js":"nG4u","./index.js":"mrcH"}],"lpU0":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.azimuthalEquidistantRaw = void 0;

var _math = require("../math.js");

var _azimuthal = require("./azimuthal.js");

var _index = _interopRequireDefault(require("./index.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var azimuthalEquidistantRaw = (0, _azimuthal.azimuthalRaw)(function (c) {
  return (c = (0, _math.acos)(c)) && c / (0, _math.sin)(c);
});
exports.azimuthalEquidistantRaw = azimuthalEquidistantRaw;
azimuthalEquidistantRaw.invert = (0, _azimuthal.azimuthalInvert)(function (z) {
  return z;
});

function _default() {
  return (0, _index.default)(azimuthalEquidistantRaw).scale(79.4188).clipAngle(180 - 1e-3);
}
},{"../math.js":"Stis","./azimuthal.js":"nG4u","./index.js":"mrcH"}],"NzJ3":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.mercatorRaw = mercatorRaw;
exports.default = _default;
exports.mercatorProjection = mercatorProjection;

var _math = require("../math.js");

var _rotation = _interopRequireDefault(require("../rotation.js"));

var _index = _interopRequireDefault(require("./index.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function mercatorRaw(lambda, phi) {
  return [lambda, (0, _math.log)((0, _math.tan)((_math.halfPi + phi) / 2))];
}

mercatorRaw.invert = function (x, y) {
  return [x, 2 * (0, _math.atan)((0, _math.exp)(y)) - _math.halfPi];
};

function _default() {
  return mercatorProjection(mercatorRaw).scale(961 / _math.tau);
}

function mercatorProjection(project) {
  var m = (0, _index.default)(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((0, _rotation.default)(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();
}
},{"../math.js":"Stis","../rotation.js":"hFnY","./index.js":"mrcH"}],"TD2P":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.conicConformalRaw = conicConformalRaw;
exports.default = _default;

var _math = require("../math.js");

var _conic = require("./conic.js");

var _mercator = require("./mercator.js");

function tany(y) {
  return (0, _math.tan)((_math.halfPi + y) / 2);
}

function conicConformalRaw(y0, y1) {
  var cy0 = (0, _math.cos)(y0),
      n = y0 === y1 ? (0, _math.sin)(y0) : (0, _math.log)(cy0 / (0, _math.cos)(y1)) / (0, _math.log)(tany(y1) / tany(y0)),
      f = cy0 * (0, _math.pow)(tany(y0), n) / n;
  if (!n) return _mercator.mercatorRaw;

  function project(x, y) {
    if (f > 0) {
      if (y < -_math.halfPi + _math.epsilon) y = -_math.halfPi + _math.epsilon;
    } else {
      if (y > _math.halfPi - _math.epsilon) y = _math.halfPi - _math.epsilon;
    }

    var r = f / (0, _math.pow)(tany(y), n);
    return [r * (0, _math.sin)(n * x), f - r * (0, _math.cos)(n * x)];
  }

  project.invert = function (x, y) {
    var fy = f - y,
        r = (0, _math.sign)(n) * (0, _math.sqrt)(x * x + fy * fy);
    return [(0, _math.atan2)(x, (0, _math.abs)(fy)) / n * (0, _math.sign)(fy), 2 * (0, _math.atan)((0, _math.pow)(f / r, 1 / n)) - _math.halfPi];
  };

  return project;
}

function _default() {
  return (0, _conic.conicProjection)(conicConformalRaw).scale(109.5).parallels([30, 30]);
}
},{"../math.js":"Stis","./conic.js":"tLZN","./mercator.js":"NzJ3"}],"F74N":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.equirectangularRaw = equirectangularRaw;
exports.default = _default;

var _index = _interopRequireDefault(require("./index.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function equirectangularRaw(lambda, phi) {
  return [lambda, phi];
}

equirectangularRaw.invert = equirectangularRaw;

function _default() {
  return (0, _index.default)(equirectangularRaw).scale(152.63);
}
},{"./index.js":"mrcH"}],"qChj":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.conicEquidistantRaw = conicEquidistantRaw;
exports.default = _default;

var _math = require("../math.js");

var _conic = require("./conic.js");

var _equirectangular = require("./equirectangular.js");

function conicEquidistantRaw(y0, y1) {
  var cy0 = (0, _math.cos)(y0),
      n = y0 === y1 ? (0, _math.sin)(y0) : (cy0 - (0, _math.cos)(y1)) / (y1 - y0),
      g = cy0 / n + y0;
  if ((0, _math.abs)(n) < _math.epsilon) return _equirectangular.equirectangularRaw;

  function project(x, y) {
    var gy = g - y,
        nx = n * x;
    return [gy * (0, _math.sin)(nx), g - gy * (0, _math.cos)(nx)];
  }

  project.invert = function (x, y) {
    var gy = g - y;
    return [(0, _math.atan2)(x, (0, _math.abs)(gy)) / n * (0, _math.sign)(gy), g - (0, _math.sign)(n) * (0, _math.sqrt)(x * x + gy * gy)];
  };

  return project;
}

function _default() {
  return (0, _conic.conicProjection)(conicEquidistantRaw).scale(131.154).center([0, 13.9389]);
}
},{"../math.js":"Stis","./conic.js":"tLZN","./equirectangular.js":"F74N"}],"bA9m":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.equalEarthRaw = equalEarthRaw;
exports.default = _default;

var _index = _interopRequireDefault(require("./index.js"));

var _math = require("../math.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var A1 = 1.340264,
    A2 = -0.081106,
    A3 = 0.000893,
    A4 = 0.003796,
    M = (0, _math.sqrt)(3) / 2,
    iterations = 12;

function equalEarthRaw(lambda, phi) {
  var l = (0, _math.asin)(M * (0, _math.sin)(phi)),
      l2 = l * l,
      l6 = l2 * l2 * l2;
  return [lambda * (0, _math.cos)(l) / (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 < 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 ((0, _math.abs)(delta) < _math.epsilon2) break;
  }

  return [M * x * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2)) / (0, _math.cos)(l), (0, _math.asin)((0, _math.sin)(l) / M)];
};

function _default() {
  return (0, _index.default)(equalEarthRaw).scale(177.158);
}
},{"./index.js":"mrcH","../math.js":"Stis"}],"aA3N":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.gnomonicRaw = gnomonicRaw;
exports.default = _default;

var _math = require("../math.js");

var _azimuthal = require("./azimuthal.js");

var _index = _interopRequireDefault(require("./index.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function gnomonicRaw(x, y) {
  var cy = (0, _math.cos)(y),
      k = (0, _math.cos)(x) * cy;
  return [cy * (0, _math.sin)(x) / k, (0, _math.sin)(y) / k];
}

gnomonicRaw.invert = (0, _azimuthal.azimuthalInvert)(_math.atan);

function _default() {
  return (0, _index.default)(gnomonicRaw).scale(144.049).clipAngle(60);
}
},{"../math.js":"Stis","./azimuthal.js":"nG4u","./index.js":"mrcH"}],"E2Si":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _rectangle = _interopRequireDefault(require("../clip/rectangle.js"));

var _identity = _interopRequireDefault(require("../identity.js"));

var _transform = require("../transform.js");

var _fit = require("./fit.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function scaleTranslate(kx, ky, tx, ty) {
  return kx === 1 && ky === 1 && tx === 0 && ty === 0 ? _identity.default : (0, _transform.transformer)({
    point: function (x, y) {
      this.stream.point(x * kx + tx, y * ky + ty);
    }
  });
}

function _default() {
  var k = 1,
      tx = 0,
      ty = 0,
      sx = 1,
      sy = 1,
      transform = _identity.default,
      // scale, translate and reflect
  x0 = null,
      y0,
      x1,
      y1,
      // clip extent
  postclip = _identity.default,
      cache,
      cacheStream,
      projection;

  function reset() {
    cache = cacheStream = null;
    return projection;
  }

  return projection = {
    stream: function (stream) {
      return cache && cacheStream === stream ? cache : cache = transform(postclip(cacheStream = stream));
    },
    postclip: function (_) {
      return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip;
    },
    clipExtent: function (_) {
      return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, _identity.default) : (0, _rectangle.default)(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]];
    },
    scale: function (_) {
      return arguments.length ? (transform = scaleTranslate((k = +_) * sx, k * sy, tx, ty), reset()) : k;
    },
    translate: function (_) {
      return arguments.length ? (transform = scaleTranslate(k * sx, k * sy, tx = +_[0], ty = +_[1]), reset()) : [tx, ty];
    },
    reflectX: function (_) {
      return arguments.length ? (transform = scaleTranslate(k * (sx = _ ? -1 : 1), k * sy, tx, ty), reset()) : sx < 0;
    },
    reflectY: function (_) {
      return arguments.length ? (transform = scaleTranslate(k * sx, k * (sy = _ ? -1 : 1), tx, ty), reset()) : sy < 0;
    },
    fitExtent: function (extent, object) {
      return (0, _fit.fitExtent)(projection, extent, object);
    },
    fitSize: function (size, object) {
      return (0, _fit.fitSize)(projection, size, object);
    },
    fitWidth: function (width, object) {
      return (0, _fit.fitWidth)(projection, width, object);
    },
    fitHeight: function (height, object) {
      return (0, _fit.fitHeight)(projection, height, object);
    }
  };
}
},{"../clip/rectangle.js":"wNQ8","../identity.js":"LuEH","../transform.js":"SUNr","./fit.js":"Jpsc"}],"DFKq":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.naturalEarth1Raw = naturalEarth1Raw;
exports.default = _default;

var _index = _interopRequireDefault(require("./index.js"));

var _math = require("../math.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

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 ((0, _math.abs)(delta) > _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];
};

function _default() {
  return (0, _index.default)(naturalEarth1Raw).scale(175.295);
}
},{"./index.js":"mrcH","../math.js":"Stis"}],"gYB8":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.orthographicRaw = orthographicRaw;
exports.default = _default;

var _math = require("../math.js");

var _azimuthal = require("./azimuthal.js");

var _index = _interopRequireDefault(require("./index.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function orthographicRaw(x, y) {
  return [(0, _math.cos)(y) * (0, _math.sin)(x), (0, _math.sin)(y)];
}

orthographicRaw.invert = (0, _azimuthal.azimuthalInvert)(_math.asin);

function _default() {
  return (0, _index.default)(orthographicRaw).scale(249.5).clipAngle(90 + _math.epsilon);
}
},{"../math.js":"Stis","./azimuthal.js":"nG4u","./index.js":"mrcH"}],"WS09":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.stereographicRaw = stereographicRaw;
exports.default = _default;

var _math = require("../math.js");

var _azimuthal = require("./azimuthal.js");

var _index = _interopRequireDefault(require("./index.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function stereographicRaw(x, y) {
  var cy = (0, _math.cos)(y),
      k = 1 + (0, _math.cos)(x) * cy;
  return [cy * (0, _math.sin)(x) / k, (0, _math.sin)(y) / k];
}

stereographicRaw.invert = (0, _azimuthal.azimuthalInvert)(function (z) {
  return 2 * (0, _math.atan)(z);
});

function _default() {
  return (0, _index.default)(stereographicRaw).scale(250).clipAngle(142);
}
},{"../math.js":"Stis","./azimuthal.js":"nG4u","./index.js":"mrcH"}],"hT5Y":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.transverseMercatorRaw = transverseMercatorRaw;
exports.default = _default;

var _math = require("../math.js");

var _mercator = require("./mercator.js");

function transverseMercatorRaw(lambda, phi) {
  return [(0, _math.log)((0, _math.tan)((_math.halfPi + phi) / 2)), -lambda];
}

transverseMercatorRaw.invert = function (x, y) {
  return [-y, 2 * (0, _math.atan)((0, _math.exp)(x)) - _math.halfPi];
};

function _default() {
  var m = (0, _mercator.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);
}
},{"../math.js":"Stis","./mercator.js":"NzJ3"}],"YztC":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "geoArea", {
  enumerable: true,
  get: function () {
    return _area.default;
  }
});
Object.defineProperty(exports, "geoBounds", {
  enumerable: true,
  get: function () {
    return _bounds.default;
  }
});
Object.defineProperty(exports, "geoCentroid", {
  enumerable: true,
  get: function () {
    return _centroid.default;
  }
});
Object.defineProperty(exports, "geoCircle", {
  enumerable: true,
  get: function () {
    return _circle.default;
  }
});
Object.defineProperty(exports, "geoClipAntimeridian", {
  enumerable: true,
  get: function () {
    return _antimeridian.default;
  }
});
Object.defineProperty(exports, "geoClipCircle", {
  enumerable: true,
  get: function () {
    return _circle2.default;
  }
});
Object.defineProperty(exports, "geoClipExtent", {
  enumerable: true,
  get: function () {
    return _extent.default;
  }
});
Object.defineProperty(exports, "geoClipRectangle", {
  enumerable: true,
  get: function () {
    return _rectangle.default;
  }
});
Object.defineProperty(exports, "geoContains", {
  enumerable: true,
  get: function () {
    return _contains.default;
  }
});
Object.defineProperty(exports, "geoDistance", {
  enumerable: true,
  get: function () {
    return _distance.default;
  }
});
Object.defineProperty(exports, "geoGraticule", {
  enumerable: true,
  get: function () {
    return _graticule.default;
  }
});
Object.defineProperty(exports, "geoGraticule10", {
  enumerable: true,
  get: function () {
    return _graticule.graticule10;
  }
});
Object.defineProperty(exports, "geoInterpolate", {
  enumerable: true,
  get: function () {
    return _interpolate.default;
  }
});
Object.defineProperty(exports, "geoLength", {
  enumerable: true,
  get: function () {
    return _length.default;
  }
});
Object.defineProperty(exports, "geoPath", {
  enumerable: true,
  get: function () {
    return _index.default;
  }
});
Object.defineProperty(exports, "geoAlbers", {
  enumerable: true,
  get: function () {
    return _albers.default;
  }
});
Object.defineProperty(exports, "geoAlbersUsa", {
  enumerable: true,
  get: function () {
    return _albersUsa.default;
  }
});
Object.defineProperty(exports, "geoAzimuthalEqualArea", {
  enumerable: true,
  get: function () {
    return _azimuthalEqualArea.default;
  }
});
Object.defineProperty(exports, "geoAzimuthalEqualAreaRaw", {
  enumerable: true,
  get: function () {
    return _azimuthalEqualArea.azimuthalEqualAreaRaw;
  }
});
Object.defineProperty(exports, "geoAzimuthalEquidistant", {
  enumerable: true,
  get: function () {
    return _azimuthalEquidistant.default;
  }
});
Object.defineProperty(exports, "geoAzimuthalEquidistantRaw", {
  enumerable: true,
  get: function () {
    return _azimuthalEquidistant.azimuthalEquidistantRaw;
  }
});
Object.defineProperty(exports, "geoConicConformal", {
  enumerable: true,
  get: function () {
    return _conicConformal.default;
  }
});
Object.defineProperty(exports, "geoConicConformalRaw", {
  enumerable: true,
  get: function () {
    return _conicConformal.conicConformalRaw;
  }
});
Object.defineProperty(exports, "geoConicEqualArea", {
  enumerable: true,
  get: function () {
    return _conicEqualArea.default;
  }
});
Object.defineProperty(exports, "geoConicEqualAreaRaw", {
  enumerable: true,
  get: function () {
    return _conicEqualArea.conicEqualAreaRaw;
  }
});
Object.defineProperty(exports, "geoConicEquidistant", {
  enumerable: true,
  get: function () {
    return _conicEquidistant.default;
  }
});
Object.defineProperty(exports, "geoConicEquidistantRaw", {
  enumerable: true,
  get: function () {
    return _conicEquidistant.conicEquidistantRaw;
  }
});
Object.defineProperty(exports, "geoEqualEarth", {
  enumerable: true,
  get: function () {
    return _equalEarth.default;
  }
});
Object.defineProperty(exports, "geoEqualEarthRaw", {
  enumerable: true,
  get: function () {
    return _equalEarth.equalEarthRaw;
  }
});
Object.defineProperty(exports, "geoEquirectangular", {
  enumerable: true,
  get: function () {
    return _equirectangular.default;
  }
});
Object.defineProperty(exports, "geoEquirectangularRaw", {
  enumerable: true,
  get: function () {
    return _equirectangular.equirectangularRaw;
  }
});
Object.defineProperty(exports, "geoGnomonic", {
  enumerable: true,
  get: function () {
    return _gnomonic.default;
  }
});
Object.defineProperty(exports, "geoGnomonicRaw", {
  enumerable: true,
  get: function () {
    return _gnomonic.gnomonicRaw;
  }
});
Object.defineProperty(exports, "geoIdentity", {
  enumerable: true,
  get: function () {
    return _identity.default;
  }
});
Object.defineProperty(exports, "geoProjection", {
  enumerable: true,
  get: function () {
    return _index2.default;
  }
});
Object.defineProperty(exports, "geoProjectionMutator", {
  enumerable: true,
  get: function () {
    return _index2.projectionMutator;
  }
});
Object.defineProperty(exports, "geoMercator", {
  enumerable: true,
  get: function () {
    return _mercator.default;
  }
});
Object.defineProperty(exports, "geoMercatorRaw", {
  enumerable: true,
  get: function () {
    return _mercator.mercatorRaw;
  }
});
Object.defineProperty(exports, "geoNaturalEarth1", {
  enumerable: true,
  get: function () {
    return _naturalEarth.default;
  }
});
Object.defineProperty(exports, "geoNaturalEarth1Raw", {
  enumerable: true,
  get: function () {
    return _naturalEarth.naturalEarth1Raw;
  }
});
Object.defineProperty(exports, "geoOrthographic", {
  enumerable: true,
  get: function () {
    return _orthographic.default;
  }
});
Object.defineProperty(exports, "geoOrthographicRaw", {
  enumerable: true,
  get: function () {
    return _orthographic.orthographicRaw;
  }
});
Object.defineProperty(exports, "geoStereographic", {
  enumerable: true,
  get: function () {
    return _stereographic.default;
  }
});
Object.defineProperty(exports, "geoStereographicRaw", {
  enumerable: true,
  get: function () {
    return _stereographic.stereographicRaw;
  }
});
Object.defineProperty(exports, "geoTransverseMercator", {
  enumerable: true,
  get: function () {
    return _transverseMercator.default;
  }
});
Object.defineProperty(exports, "geoTransverseMercatorRaw", {
  enumerable: true,
  get: function () {
    return _transverseMercator.transverseMercatorRaw;
  }
});
Object.defineProperty(exports, "geoRotation", {
  enumerable: true,
  get: function () {
    return _rotation.default;
  }
});
Object.defineProperty(exports, "geoStream", {
  enumerable: true,
  get: function () {
    return _stream.default;
  }
});
Object.defineProperty(exports, "geoTransform", {
  enumerable: true,
  get: function () {
    return _transform.default;
  }
});

var _area = _interopRequireDefault(require("./area.js"));

var _bounds = _interopRequireDefault(require("./bounds.js"));

var _centroid = _interopRequireDefault(require("./centroid.js"));

var _circle = _interopRequireDefault(require("./circle.js"));

var _antimeridian = _interopRequireDefault(require("./clip/antimeridian.js"));

var _circle2 = _interopRequireDefault(require("./clip/circle.js"));

var _extent = _interopRequireDefault(require("./clip/extent.js"));

var _rectangle = _interopRequireDefault(require("./clip/rectangle.js"));

var _contains = _interopRequireDefault(require("./contains.js"));

var _distance = _interopRequireDefault(require("./distance.js"));

var _graticule = _interopRequireWildcard(require("./graticule.js"));

var _interpolate = _interopRequireDefault(require("./interpolate.js"));

var _length = _interopRequireDefault(require("./length.js"));

var _index = _interopRequireDefault(require("./path/index.js"));

var _albers = _interopRequireDefault(require("./projection/albers.js"));

var _albersUsa = _interopRequireDefault(require("./projection/albersUsa.js"));

var _azimuthalEqualArea = _interopRequireWildcard(require("./projection/azimuthalEqualArea.js"));

var _azimuthalEquidistant = _interopRequireWildcard(require("./projection/azimuthalEquidistant.js"));

var _conicConformal = _interopRequireWildcard(require("./projection/conicConformal.js"));

var _conicEqualArea = _interopRequireWildcard(require("./projection/conicEqualArea.js"));

var _conicEquidistant = _interopRequireWildcard(require("./projection/conicEquidistant.js"));

var _equalEarth = _interopRequireWildcard(require("./projection/equalEarth.js"));

var _equirectangular = _interopRequireWildcard(require("./projection/equirectangular.js"));

var _gnomonic = _interopRequireWildcard(require("./projection/gnomonic.js"));

var _identity = _interopRequireDefault(require("./projection/identity.js"));

var _index2 = _interopRequireWildcard(require("./projection/index.js"));

var _mercator = _interopRequireWildcard(require("./projection/mercator.js"));

var _naturalEarth = _interopRequireWildcard(require("./projection/naturalEarth1.js"));

var _orthographic = _interopRequireWildcard(require("./projection/orthographic.js"));

var _stereographic = _interopRequireWildcard(require("./projection/stereographic.js"));

var _transverseMercator = _interopRequireWildcard(require("./projection/transverseMercator.js"));

var _rotation = _interopRequireDefault(require("./rotation.js"));

var _stream = _interopRequireDefault(require("./stream.js"));

var _transform = _interopRequireDefault(require("./transform.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./area.js":"tTg2","./bounds.js":"L2Ww","./centroid.js":"Xabc","./circle.js":"exZ4","./clip/antimeridian.js":"zgVO","./clip/circle.js":"rPdY","./clip/extent.js":"iwSF","./clip/rectangle.js":"wNQ8","./contains.js":"lYqy","./distance.js":"Xqqx","./graticule.js":"pBbd","./interpolate.js":"eVSx","./length.js":"a487","./path/index.js":"Ixq3","./projection/albers.js":"zp4D","./projection/albersUsa.js":"VbRR","./projection/azimuthalEqualArea.js":"uNRF","./projection/azimuthalEquidistant.js":"lpU0","./projection/conicConformal.js":"TD2P","./projection/conicEqualArea.js":"TTxy","./projection/conicEquidistant.js":"qChj","./projection/equalEarth.js":"bA9m","./projection/equirectangular.js":"F74N","./projection/gnomonic.js":"aA3N","./projection/identity.js":"E2Si","./projection/index.js":"mrcH","./projection/mercator.js":"NzJ3","./projection/naturalEarth1.js":"DFKq","./projection/orthographic.js":"gYB8","./projection/stereographic.js":"WS09","./projection/transverseMercator.js":"hT5Y","./rotation.js":"hFnY","./stream.js":"AcnE","./transform.js":"SUNr"}],"MPMu":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.projection = projection;
exports.getProjectionPath = getProjectionPath;
exports.projectionProperties = void 0;

var _d3Geo = require("d3-geo");

var defaultPath = (0, _d3Geo.geoPath)();
var 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.
 */

exports.projectionProperties = projectionProperties;

function create(type, constructor) {
  return function projection() {
    var p = constructor();
    p.type = type;
    p.path = (0, _d3Geo.geoPath)().projection(p);

    p.copy = p.copy || function () {
      var c = projection();
      projectionProperties.forEach(function (prop) {
        if (p[prop]) c[prop](p[prop]());
      });
      c.path.pointRadius(p.path.pointRadius());
      return c;
    };

    return p;
  };
}

function 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) {
    projections[type] = create(type, proj);
    return this;
  } else {
    return projections[type] || null;
  }
}

function getProjectionPath(proj) {
  return proj && proj.path || defaultPath;
}

var projections = {
  // base d3-geo projection types
  albers: _d3Geo.geoAlbers,
  albersusa: _d3Geo.geoAlbersUsa,
  azimuthalequalarea: _d3Geo.geoAzimuthalEqualArea,
  azimuthalequidistant: _d3Geo.geoAzimuthalEquidistant,
  conicconformal: _d3Geo.geoConicConformal,
  conicequalarea: _d3Geo.geoConicEqualArea,
  conicequidistant: _d3Geo.geoConicEquidistant,
  equalEarth: _d3Geo.geoEqualEarth,
  equirectangular: _d3Geo.geoEquirectangular,
  gnomonic: _d3Geo.geoGnomonic,
  identity: _d3Geo.geoIdentity,
  mercator: _d3Geo.geoMercator,
  naturalEarth1: _d3Geo.geoNaturalEarth1,
  orthographic: _d3Geo.geoOrthographic,
  stereographic: _d3Geo.geoStereographic,
  transversemercator: _d3Geo.geoTransverseMercator
};

for (var key in projections) {
  projection(key, projections[key]);
}
},{"d3-geo":"YztC"}],"FdWH":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "projection", {
  enumerable: true,
  get: function () {
    return _projections.projection;
  }
});
Object.defineProperty(exports, "projectionProperties", {
  enumerable: true,
  get: function () {
    return _projections.projectionProperties;
  }
});
Object.defineProperty(exports, "getProjectionPath", {
  enumerable: true,
  get: function () {
    return _projections.getProjectionPath;
  }
});

var _projections = require("./src/projections");
},{"./src/projections":"MPMu"}],"jwPw":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = GeoPath;

var _vegaDataflow = require("vega-dataflow");

var _vegaProjection = require("vega-projection");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.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"
  }]
};
var prototype = (0, _vegaUtil.inherits)(GeoPath, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var out = pulse.fork(pulse.ALL),
      path = this.value,
      field = _.field || _vegaUtil.identity,
      as = _.as || 'path',
      flag = out.SOURCE;

  function set(t) {
    t[as] = path(field(t));
  }

  if (!path || _.modified()) {
    // parameters updated, reset and reflow
    this.value = path = (0, _vegaProjection.getProjectionPath)(_.projection);
    out.materialize().reflow();
  } else {
    flag = field === _vegaUtil.identity || pulse.modified(field.fields) ? out.ADD_MOD : out.ADD;
  }

  var prev = initPath(path, _.pointRadius);
  out.visit(flag, set);
  path.pointRadius(prev);
  return out.modifies(as);
};

function initPath(path, pointRadius) {
  var prev = path.pointRadius();
  path.context(null);

  if (pointRadius != null) {
    path.pointRadius(pointRadius);
  }

  return prev;
}
},{"vega-dataflow":"UC8n","vega-projection":"FdWH","vega-util":"dejJ"}],"cOwg":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = GeoPoint;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.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"]
  }]
};
var prototype = (0, _vegaUtil.inherits)(GeoPoint, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var proj = _.projection,
      lon = _.fields[0],
      lat = _.fields[1],
      as = _.as || ['x', 'y'],
      x = as[0],
      y = as[1],
      mod;

  function set(t) {
    var 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);
};
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"pkXx":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = GeoShape;

var _vegaDataflow = require("vega-dataflow");

var _vegaProjection = require("vega-projection");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.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"
  }]
};
var prototype = (0, _vegaUtil.inherits)(GeoShape, _vegaDataflow.Transform);

prototype.transform = function (_, 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((0, _vegaProjection.getProjectionPath)(_.projection), _.field || (0, _vegaUtil.field)('datum'), _.pointRadius);
    out.materialize().reflow();
    flag = out.SOURCE;
  }

  out.visit(flag, function (t) {
    t[as] = shape;
  });
  return out.modifies(as);
};

function shapeGenerator(path, field, pointRadius) {
  var shape = pointRadius == null ? function (_) {
    return path(field(_));
  } : function (_) {
    var prev = path.pointRadius(),
        value = path.pointRadius(pointRadius)(field(_));
    path.pointRadius(prev);
    return value;
  };

  shape.context = function (_) {
    path.context(_);
    return shape;
  };

  return shape;
}
},{"vega-dataflow":"UC8n","vega-projection":"FdWH","vega-util":"dejJ"}],"nEFz":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Graticule;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

var _d3Geo = require("d3-geo");

/**
 * GeoJSON feature generator for creating graticules.
 * @constructor
 */
function Graticule(params) {
  _vegaDataflow.Transform.call(this, [], params);

  this.generator = (0, _d3Geo.geoGraticule)();
}

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
  }]
};
var prototype = (0, _vegaUtil.inherits)(Graticule, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var src = this.value,
      gen = this.generator,
      t;

  if (!src.length || _.modified()) {
    for (var prop in _) {
      if ((0, _vegaUtil.isFunction)(gen[prop])) {
        gen[prop](_[prop]);
      }
    }
  }

  t = gen();

  if (src.length) {
    pulse.mod.push((0, _vegaDataflow.replace)(src[0], t));
  } else {
    pulse.add.push((0, _vegaDataflow.ingest)(t));
  }

  src[0] = t;
  return pulse;
};
},{"vega-dataflow":"UC8n","vega-util":"dejJ","d3-geo":"YztC"}],"OO0w":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Heatmap;

var _d3Array = require("d3-array");

var _d3Color = require("d3-color");

var _vegaCanvas = require("vega-canvas");

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.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"
  }]
};
var prototype = (0, _vegaUtil.inherits)(Heatmap, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  if (!pulse.changed() && !_.modified()) {
    return pulse.StopPropagation;
  }

  var source = pulse.materialize(pulse.SOURCE).source,
      shared = _.resolve === 'shared',
      field = _.field || _vegaUtil.identity,
      opacity = opacity_(_.opacity, _),
      color = color_(_.color, _),
      as = _.as || 'image',
      obj = {
    $x: 0,
    $y: 0,
    $value: 0,
    $max: shared ? (0, _d3Array.max)(source.map(t => (0, _d3Array.max)(field(t).values))) : 0
  };
  source.forEach(t => {
    const v = field(t); // build proxy data object

    const o = (0, _vegaUtil.extend)({}, t, obj); // set maximum value if not globally shared

    if (!shared) o.$max = (0, _d3Array.max)(v.values || []); // generate canvas image
    // optimize color/opacity if not pixel-dependent

    t[as] = toCanvas(v, o, color.dep ? color : (0, _vegaUtil.constant)(color(o)), opacity.dep ? opacity : (0, _vegaUtil.constant)(opacity(o)));
  });
  return pulse.reflow(true).modifies(as);
}; // get image color function


function color_(color, _) {
  let f;

  if ((0, _vegaUtil.isFunction)(color)) {
    f = obj => (0, _d3Color.rgb)(color(obj, _));

    f.dep = dependency(color);
  } else {
    // default to mid-grey
    f = (0, _vegaUtil.constant)((0, _d3Color.rgb)(color || '#888'));
  }

  return f;
} // get image opacity function


function opacity_(opacity, _) {
  let f;

  if ((0, _vegaUtil.isFunction)(opacity)) {
    f = obj => opacity(obj, _);

    f.dep = dependency(opacity);
  } else if (opacity) {
    f = (0, _vegaUtil.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 (!(0, _vegaUtil.isFunction)(f)) return false;
  const set = (0, _vegaUtil.toSet)((0, _vegaUtil.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] : _vegaUtil.zero,
        can = (0, _vegaCanvas.canvas)(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;
}
},{"d3-array":"Rpnd","d3-color":"x3do","vega-canvas":"ZLEK","vega-dataflow":"UC8n","vega-util":"dejJ"}],"lj3M":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Projection;
exports.collectGeoJSON = collectGeoJSON;

var _constants = require("./constants");

var _vegaDataflow = require("vega-dataflow");

var _vegaProjection = require("vega-projection");

var _vegaUtil = require("vega-util");

/**
 * Maintains a cartographic projection.
 * @constructor
 * @param {object} params - The parameters for this operator.
 */
function Projection(params) {
  _vegaDataflow.Transform.call(this, null, params);

  this.modified(true); // always treat as modified
}

var prototype = (0, _vegaUtil.inherits)(Projection, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var proj = this.value;

  if (!proj || _.modified('type')) {
    this.value = proj = create(_.type);

    _vegaProjection.projectionProperties.forEach(function (prop) {
      if (_[prop] != null) set(proj, prop, _[prop]);
    });
  } else {
    _vegaProjection.projectionProperties.forEach(function (prop) {
      if (_.modified(prop)) set(proj, prop, _[prop]);
    });
  }

  if (_.pointRadius != null) proj.path.pointRadius(_.pointRadius);
  if (_.fit) fit(proj, _);
  return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);
};

function fit(proj, _) {
  var data = collectGeoJSON(_.fit);
  _.extent ? proj.fitExtent(_.extent, data) : _.size ? proj.fitSize(_.size, data) : 0;
}

function create(type) {
  var constructor = (0, _vegaProjection.projection)((type || 'mercator').toLowerCase());
  if (!constructor) (0, _vegaUtil.error)('Unrecognized projection type: ' + type);
  return constructor();
}

function set(proj, key, value) {
  if ((0, _vegaUtil.isFunction)(proj[key])) proj[key](value);
}

function collectGeoJSON(data) {
  data = (0, _vegaUtil.array)(data);
  return data.length === 1 ? data[0] : {
    type: _constants.FeatureCollection,
    features: data.reduce((a, f) => a.concat(featurize(f)), [])
  };
}

function featurize(f) {
  return f.type === _constants.FeatureCollection ? f.features : (0, _vegaUtil.array)(f).filter(d => d != null).map(d => d.type === _constants.Feature ? d : {
    type: _constants.Feature,
    geometry: d
  });
}
},{"./constants":"QVyQ","vega-dataflow":"UC8n","vega-projection":"FdWH","vega-util":"dejJ"}],"mZS8":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "contour", {
  enumerable: true,
  get: function () {
    return _Contour.default;
  }
});
Object.defineProperty(exports, "geojson", {
  enumerable: true,
  get: function () {
    return _GeoJSON.default;
  }
});
Object.defineProperty(exports, "geopath", {
  enumerable: true,
  get: function () {
    return _GeoPath.default;
  }
});
Object.defineProperty(exports, "geopoint", {
  enumerable: true,
  get: function () {
    return _GeoPoint.default;
  }
});
Object.defineProperty(exports, "geoshape", {
  enumerable: true,
  get: function () {
    return _GeoShape.default;
  }
});
Object.defineProperty(exports, "graticule", {
  enumerable: true,
  get: function () {
    return _Graticule.default;
  }
});
Object.defineProperty(exports, "heatmap", {
  enumerable: true,
  get: function () {
    return _Heatmap.default;
  }
});
Object.defineProperty(exports, "isocontour", {
  enumerable: true,
  get: function () {
    return _Isocontour.default;
  }
});
Object.defineProperty(exports, "kde2d", {
  enumerable: true,
  get: function () {
    return _KDE2D.default;
  }
});
Object.defineProperty(exports, "projection", {
  enumerable: true,
  get: function () {
    return _Projection.default;
  }
});

var _Contour = _interopRequireDefault(require("./src/Contour"));

var _GeoJSON = _interopRequireDefault(require("./src/GeoJSON"));

var _GeoPath = _interopRequireDefault(require("./src/GeoPath"));

var _GeoPoint = _interopRequireDefault(require("./src/GeoPoint"));

var _GeoShape = _interopRequireDefault(require("./src/GeoShape"));

var _Graticule = _interopRequireDefault(require("./src/Graticule"));

var _Heatmap = _interopRequireDefault(require("./src/Heatmap"));

var _Isocontour = _interopRequireDefault(require("./src/Isocontour"));

var _KDE2D = _interopRequireDefault(require("./src/KDE2D"));

var _Projection = _interopRequireDefault(require("./src/Projection"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./src/Contour":"Dkrm","./src/GeoJSON":"mXU8","./src/GeoPath":"jwPw","./src/GeoPoint":"cOwg","./src/GeoShape":"pkXx","./src/Graticule":"nEFz","./src/Heatmap":"OO0w","./src/Isocontour":"MUq0","./src/KDE2D":"wy1Z","./src/Projection":"lj3M"}],"UZKW":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(x, y) {
  var nodes;
  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, sy = sy / n - y, 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;
  };

  return force;
}
},{}],"NcXW":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.addAll = addAll;

function _default(d) {
  var x = +this._x.call(null, d),
      y = +this._y.call(null, d);
  return add(this.cover(x, y), x, y, d);
}

function 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(this, xz[i], yz[i], data[i]);
  }

  return this;
}
},{}],"ZvbQ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(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,
          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;
}
},{}],"lRCo":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default() {
  var data = [];
  this.visit(function (node) {
    if (!node.length) do data.push(node.data); while (node = node.next);
  });
  return data;
}
},{}],"d2F2":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(_) {
  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]];
}
},{}],"liND":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(node, x0, y0, x1, y1) {
  this.node = node;
  this.x0 = x0;
  this.y0 = y0;
  this.x1 = x1;
  this.y1 = y1;
}
},{}],"ee5c":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _quad = _interopRequireDefault(require("./quad.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(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 _quad.default(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 _quad.default(node[3], xm, ym, x2, y2), new _quad.default(node[2], x1, ym, xm, y2), new _quad.default(node[1], xm, y1, x2, ym), new _quad.default(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;
}
},{"./quad.js":"liND"}],"VX1t":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.removeAll = removeAll;

function _default(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;
}
},{}],"fBnL":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default() {
  return this._root;
}
},{}],"roFL":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default() {
  var size = 0;
  this.visit(function (node) {
    if (!node.length) do ++size; while (node = node.next);
  });
  return size;
}
},{}],"h8yk":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _quad = _interopRequireDefault(require("./quad.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(callback) {
  var quads = [],
      q,
      node = this._root,
      child,
      x0,
      y0,
      x1,
      y1;
  if (node) quads.push(new _quad.default(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 _quad.default(child, xm, ym, x1, y1));
      if (child = node[2]) quads.push(new _quad.default(child, x0, ym, xm, y1));
      if (child = node[1]) quads.push(new _quad.default(child, xm, y0, x1, ym));
      if (child = node[0]) quads.push(new _quad.default(child, x0, y0, xm, ym));
    }
  }

  return this;
}
},{"./quad.js":"liND"}],"RYOP":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _quad = _interopRequireDefault(require("./quad.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(callback) {
  var quads = [],
      next = [],
      q;
  if (this._root) quads.push(new _quad.default(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 _quad.default(child, x0, y0, xm, ym));
      if (child = node[1]) quads.push(new _quad.default(child, xm, y0, x1, ym));
      if (child = node[2]) quads.push(new _quad.default(child, x0, ym, xm, y1));
      if (child = node[3]) quads.push(new _quad.default(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;
}
},{"./quad.js":"liND"}],"ze7i":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.defaultX = defaultX;
exports.default = _default;

function defaultX(d) {
  return d[0];
}

function _default(_) {
  return arguments.length ? (this._x = _, this) : this._x;
}
},{}],"AQOZ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.defaultY = defaultY;
exports.default = _default;

function defaultY(d) {
  return d[1];
}

function _default(_) {
  return arguments.length ? (this._y = _, this) : this._y;
}
},{}],"UZAx":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = quadtree;

var _add = _interopRequireWildcard(require("./add.js"));

var _cover = _interopRequireDefault(require("./cover.js"));

var _data = _interopRequireDefault(require("./data.js"));

var _extent = _interopRequireDefault(require("./extent.js"));

var _find = _interopRequireDefault(require("./find.js"));

var _remove = _interopRequireWildcard(require("./remove.js"));

var _root = _interopRequireDefault(require("./root.js"));

var _size = _interopRequireDefault(require("./size.js"));

var _visit = _interopRequireDefault(require("./visit.js"));

var _visitAfter = _interopRequireDefault(require("./visitAfter.js"));

var _x = _interopRequireWildcard(require("./x.js"));

var _y = _interopRequireWildcard(require("./y.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function quadtree(nodes, x, y) {
  var tree = new Quadtree(x == null ? _x.defaultX : x, y == null ? _y.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 = _add.default;
treeProto.addAll = _add.addAll;
treeProto.cover = _cover.default;
treeProto.data = _data.default;
treeProto.extent = _extent.default;
treeProto.find = _find.default;
treeProto.remove = _remove.default;
treeProto.removeAll = _remove.removeAll;
treeProto.root = _root.default;
treeProto.size = _size.default;
treeProto.visit = _visit.default;
treeProto.visitAfter = _visitAfter.default;
treeProto.x = _x.default;
treeProto.y = _y.default;
},{"./add.js":"NcXW","./cover.js":"ZvbQ","./data.js":"lRCo","./extent.js":"d2F2","./find.js":"ee5c","./remove.js":"VX1t","./root.js":"fBnL","./size.js":"roFL","./visit.js":"h8yk","./visitAfter.js":"RYOP","./x.js":"ze7i","./y.js":"AQOZ"}],"Fgm3":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "quadtree", {
  enumerable: true,
  get: function () {
    return _quadtree.default;
  }
});

var _quadtree = _interopRequireDefault(require("./quadtree.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./quadtree.js":"UZAx"}],"ymhS":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default() {
  return (Math.random() - 0.5) * 1e-6;
}
},{}],"EkNx":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _d3Quadtree = require("d3-quadtree");

var _constant = _interopRequireDefault(require("./constant.js"));

var _jiggle = _interopRequireDefault(require("./jiggle.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function x(d) {
  return d.x + d.vx;
}

function y(d) {
  return d.y + d.vy;
}

function _default(radius) {
  var nodes,
      radii,
      strength = 1,
      iterations = 1;
  if (typeof radius !== "function") radius = (0, _constant.default)(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 = (0, _d3Quadtree.quadtree)(nodes, x, 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 = (0, _jiggle.default)(), l += x * x;
            if (y === 0) y = (0, _jiggle.default)(), 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 = _;
    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" ? _ : (0, _constant.default)(+_), initialize(), force) : radius;
  };

  return force;
}
},{"d3-quadtree":"Fgm3","./constant.js":"OKWp","./jiggle.js":"ymhS"}],"IPmr":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constant = _interopRequireDefault(require("./constant.js"));

var _jiggle = _interopRequireDefault(require("./jiggle.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function index(d) {
  return d.index;
}

function find(nodeById, nodeId) {
  var node = nodeById.get(nodeId);
  if (!node) throw new Error("missing: " + nodeId);
  return node;
}

function _default(links) {
  var id = index,
      strength = defaultStrength,
      strengths,
      distance = (0, _constant.default)(30),
      distances,
      nodes,
      count,
      bias,
      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 || (0, _jiggle.default)();
        y = target.y + target.vy - source.y - source.vy || (0, _jiggle.default)();
        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 = find(nodeById, link.source);
      if (typeof link.target !== "object") link.target = 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 = _;
    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" ? _ : (0, _constant.default)(+_), initializeStrength(), force) : strength;
  };

  force.distance = function (_) {
    return arguments.length ? (distance = typeof _ === "function" ? _ : (0, _constant.default)(+_), initializeDistance(), force) : distance;
  };

  return force;
}
},{"./constant.js":"OKWp","./jiggle.js":"ymhS"}],"SYAW":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var noop = {
  value: function () {}
};

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 = 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] = set(_[t], typename.name, callback);else if (callback == null) for (t in _) _[t] = 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 get(type, name) {
  for (var i = 0, n = type.length, c; i < n; ++i) {
    if ((c = type[i]).name === name) {
      return c.value;
    }
  }
}

function set(type, name, callback) {
  for (var i = 0, n = type.length; i < n; ++i) {
    if (type[i].name === name) {
      type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1));
      break;
    }
  }

  if (callback != null) type.push({
    name: name,
    value: callback
  });
  return type;
}

var _default = dispatch;
exports.default = _default;
},{}],"cNf8":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "dispatch", {
  enumerable: true,
  get: function () {
    return _dispatch.default;
  }
});

var _dispatch = _interopRequireDefault(require("./dispatch.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./dispatch.js":"SYAW"}],"VMoR":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.now = now;
exports.Timer = Timer;
exports.timer = timer;
exports.timerFlush = timerFlush;
var frame = 0,
    // is an animation frame pending?
timeout = 0,
    // is a timeout pending?
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.

  ++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;
  }

  --frame;
}

function wake() {
  clockNow = (clockLast = clock.now()) + clockSkew;
  frame = timeout = 0;

  try {
    timerFlush();
  } finally {
    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 (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 (interval) interval = clearInterval(interval);
  } else {
    if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
    frame = 1, setFrame(wake);
  }
}
},{}],"ELFE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _timer = require("./timer.js");

function _default(callback, delay, time) {
  var t = new _timer.Timer();
  delay = delay == null ? 0 : +delay;
  t.restart(function (elapsed) {
    t.stop();
    callback(elapsed + delay);
  }, delay, time);
  return t;
}
},{"./timer.js":"VMoR"}],"ngd6":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _timer = require("./timer.js");

function _default(callback, delay, time) {
  var t = new _timer.Timer(),
      total = delay;
  if (delay == null) return t.restart(callback, delay, time), t;
  delay = +delay, time = time == null ? (0, _timer.now)() : +time;
  t.restart(function tick(elapsed) {
    elapsed += total;
    t.restart(tick, total += delay, time);
    callback(elapsed);
  }, delay, time);
  return t;
}
},{"./timer.js":"VMoR"}],"yaK5":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "now", {
  enumerable: true,
  get: function () {
    return _timer.now;
  }
});
Object.defineProperty(exports, "timer", {
  enumerable: true,
  get: function () {
    return _timer.timer;
  }
});
Object.defineProperty(exports, "timerFlush", {
  enumerable: true,
  get: function () {
    return _timer.timerFlush;
  }
});
Object.defineProperty(exports, "timeout", {
  enumerable: true,
  get: function () {
    return _timeout.default;
  }
});
Object.defineProperty(exports, "interval", {
  enumerable: true,
  get: function () {
    return _interval.default;
  }
});

var _timer = require("./timer.js");

var _timeout = _interopRequireDefault(require("./timeout.js"));

var _interval = _interopRequireDefault(require("./interval.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./timer.js":"VMoR","./timeout.js":"ELFE","./interval.js":"ngd6"}],"pbYj":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.x = x;
exports.y = y;
exports.default = _default;

var _d3Dispatch = require("d3-dispatch");

var _d3Timer = require("d3-timer");

function x(d) {
  return d.x;
}

function y(d) {
  return d.y;
}

var initialRadius = 10,
    initialAngle = Math.PI * (3 - Math.sqrt(5));

function _default(nodes) {
  var simulation,
      alpha = 1,
      alphaMin = 0.001,
      alphaDecay = 1 - Math.pow(alphaMin, 1 / 300),
      alphaTarget = 0,
      velocityDecay = 0.6,
      forces = new Map(),
      stepper = (0, _d3Timer.timer)(step),
      event = (0, _d3Dispatch.dispatch)("tick", "end");
  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(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);
    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;
    },
    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);
    }
  };
}
},{"d3-dispatch":"cNf8","d3-timer":"yaK5"}],"F7kN":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _d3Quadtree = require("d3-quadtree");

var _constant = _interopRequireDefault(require("./constant.js"));

var _jiggle = _interopRequireDefault(require("./jiggle.js"));

var _simulation = require("./simulation.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default() {
  var nodes,
      node,
      alpha,
      strength = (0, _constant.default)(-30),
      strengths,
      distanceMin2 = 1,
      distanceMax2 = Infinity,
      theta2 = 0.81;

  function force(_) {
    var i,
        n = nodes.length,
        tree = (0, _d3Quadtree.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 = (0, _jiggle.default)(), l += x * x;
        if (y === 0) y = (0, _jiggle.default)(), 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 = (0, _jiggle.default)(), l += x * x;
      if (y === 0) y = (0, _jiggle.default)(), 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 = _;
    initialize();
  };

  force.strength = function (_) {
    return arguments.length ? (strength = typeof _ === "function" ? _ : (0, _constant.default)(+_), 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;
}
},{"d3-quadtree":"Fgm3","./constant.js":"OKWp","./jiggle.js":"ymhS","./simulation.js":"pbYj"}],"M2cA":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constant = _interopRequireDefault(require("./constant.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(radius, x, y) {
  var nodes,
      strength = (0, _constant.default)(0.1),
      strengths,
      radiuses;
  if (typeof radius !== "function") radius = (0, _constant.default)(+radius);
  if (x == null) x = 0;
  if (y == null) y = 0;

  function force(alpha) {
    for (var i = 0, n = nodes.length; i < n; ++i) {
      var node = nodes[i],
          dx = node.x - x || 1e-6,
          dy = node.y - y || 1e-6,
          r = Math.sqrt(dx * dx + dy * dy),
          k = (radiuses[i] - r) * strengths[i] * alpha / r;
      node.vx += dx * k;
      node.vy += dy * k;
    }
  }

  function initialize() {
    if (!nodes) return;
    var i,
        n = nodes.length;
    strengths = new Array(n);
    radiuses = new Array(n);

    for (i = 0; i < n; ++i) {
      radiuses[i] = +radius(nodes[i], i, nodes);
      strengths[i] = isNaN(radiuses[i]) ? 0 : +strength(nodes[i], i, nodes);
    }
  }

  force.initialize = function (_) {
    nodes = _, initialize();
  };

  force.strength = function (_) {
    return arguments.length ? (strength = typeof _ === "function" ? _ : (0, _constant.default)(+_), initialize(), force) : strength;
  };

  force.radius = function (_) {
    return arguments.length ? (radius = typeof _ === "function" ? _ : (0, _constant.default)(+_), initialize(), force) : radius;
  };

  force.x = function (_) {
    return arguments.length ? (x = +_, force) : x;
  };

  force.y = function (_) {
    return arguments.length ? (y = +_, force) : y;
  };

  return force;
}
},{"./constant.js":"OKWp"}],"c5Mo":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constant = _interopRequireDefault(require("./constant.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(x) {
  var strength = (0, _constant.default)(0.1),
      nodes,
      strengths,
      xz;
  if (typeof x !== "function") x = (0, _constant.default)(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" ? _ : (0, _constant.default)(+_), initialize(), force) : strength;
  };

  force.x = function (_) {
    return arguments.length ? (x = typeof _ === "function" ? _ : (0, _constant.default)(+_), initialize(), force) : x;
  };

  return force;
}
},{"./constant.js":"OKWp"}],"ldpf":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constant = _interopRequireDefault(require("./constant.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(y) {
  var strength = (0, _constant.default)(0.1),
      nodes,
      strengths,
      yz;
  if (typeof y !== "function") y = (0, _constant.default)(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" ? _ : (0, _constant.default)(+_), initialize(), force) : strength;
  };

  force.y = function (_) {
    return arguments.length ? (y = typeof _ === "function" ? _ : (0, _constant.default)(+_), initialize(), force) : y;
  };

  return force;
}
},{"./constant.js":"OKWp"}],"mlFe":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "forceCenter", {
  enumerable: true,
  get: function () {
    return _center.default;
  }
});
Object.defineProperty(exports, "forceCollide", {
  enumerable: true,
  get: function () {
    return _collide.default;
  }
});
Object.defineProperty(exports, "forceLink", {
  enumerable: true,
  get: function () {
    return _link.default;
  }
});
Object.defineProperty(exports, "forceManyBody", {
  enumerable: true,
  get: function () {
    return _manyBody.default;
  }
});
Object.defineProperty(exports, "forceRadial", {
  enumerable: true,
  get: function () {
    return _radial.default;
  }
});
Object.defineProperty(exports, "forceSimulation", {
  enumerable: true,
  get: function () {
    return _simulation.default;
  }
});
Object.defineProperty(exports, "forceX", {
  enumerable: true,
  get: function () {
    return _x.default;
  }
});
Object.defineProperty(exports, "forceY", {
  enumerable: true,
  get: function () {
    return _y.default;
  }
});

var _center = _interopRequireDefault(require("./center"));

var _collide = _interopRequireDefault(require("./collide"));

var _link = _interopRequireDefault(require("./link"));

var _manyBody = _interopRequireDefault(require("./manyBody"));

var _radial = _interopRequireDefault(require("./radial"));

var _simulation = _interopRequireDefault(require("./simulation"));

var _x = _interopRequireDefault(require("./x"));

var _y = _interopRequireDefault(require("./y"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./center":"UZKW","./collide":"EkNx","./link":"IPmr","./manyBody":"F7kN","./radial":"M2cA","./simulation":"pbYj","./x":"c5Mo","./y":"ldpf"}],"gnW7":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Force;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

var _d3Force = require("d3-force");

var ForceMap = {
  center: _d3Force.forceCenter,
  collide: _d3Force.forceCollide,
  nbody: _d3Force.forceManyBody,
  link: _d3Force.forceLink,
  x: _d3Force.forceX,
  y: _d3Force.forceY
};
var 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) {
  _vegaDataflow.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
  }]
};
var prototype = (0, _vegaUtil.inherits)(Force, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var sim = this.value,
      change = pulse.changed(pulse.ADD_REM),
      params = _.modified(ForceParams),
      iters = _.iterations || 300; // configure simulation


  if (!sim) {
    this.value = sim = 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);
};

prototype.finish = function (_, pulse) {
  var dataflow = pulse.dataflow; // inspect dependencies, touch link source data

  for (var 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 function () {
    df.touch(op).run();
  };
}

function simulation(nodes, _) {
  var sim = (0, _d3Force.forceSimulation)(nodes),
      stopped = false,
      stop = sim.stop,
      restart = sim.restart;

  sim.stopped = function () {
    return stopped;
  };

  sim.restart = function () {
    stopped = false;
    return restart();
  };

  sim.stop = function () {
    stopped = true;
    return stop();
  };

  return setup(sim, _, true).on('end', function () {
    stopped = true;
  });
}

function setup(sim, _, init, pulse) {
  var f = (0, _vegaUtil.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 ((0, _vegaUtil.isFunction)(v = f[k]) && pulse.modified((0, _vegaUtil.accessorFields)(v))) return 1;
  }

  return 0;
}

function getForce(_) {
  var f, p;

  if (!(0, _vegaUtil.hasOwnProperty)(ForceMap, _.force)) {
    (0, _vegaUtil.error)('Unrecognized force: ' + _.force);
  }

  f = ForceMap[_.force]();

  for (p in _) {
    if ((0, _vegaUtil.isFunction)(f[p])) setForceParam(f[p], _[p], _);
  }

  return f;
}

function setForceParam(f, v, _) {
  f((0, _vegaUtil.isFunction)(v) ? function (d) {
    return v(d, _);
  } : v);
}
},{"vega-dataflow":"UC8n","vega-util":"dejJ","d3-force":"mlFe"}],"fXAp":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "force", {
  enumerable: true,
  get: function () {
    return _Force.default;
  }
});

var _Force = _interopRequireDefault(require("./src/Force"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./src/Force":"gnW7"}],"k90h":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

// Build lookup table mapping tuple keys to tree node instances
function _default(tree, key, filter) {
  var map = {};
  tree.each(function (node) {
    var t = node.data;
    if (filter(t)) map[key(t)] = node;
  });
  tree.lookup = map;
  return tree;
}
},{}],"npog":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function 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;
}

function _default() {
  var separation = 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;
}
},{}],"gwJQ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function 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;
}

function _default() {
  return this.eachAfter(count);
}
},{}],"ootC":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(callback) {
  var node = this,
      current,
      next = [node],
      children,
      i,
      n;

  do {
    current = next.reverse(), next = [];

    while (node = current.pop()) {
      callback(node), children = node.children;
      if (children) for (i = 0, n = children.length; i < n; ++i) {
        next.push(children[i]);
      }
    }
  } while (next.length);

  return this;
}
},{}],"v8XQ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(callback) {
  var node = this,
      nodes = [node],
      children,
      i;

  while (node = nodes.pop()) {
    callback(node), children = node.children;
    if (children) for (i = children.length - 1; i >= 0; --i) {
      nodes.push(children[i]);
    }
  }

  return this;
}
},{}],"P6uJ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(callback) {
  var node = this,
      nodes = [node],
      next = [],
      children,
      i,
      n;

  while (node = nodes.pop()) {
    next.push(node), children = node.children;
    if (children) for (i = 0, n = children.length; i < n; ++i) {
      nodes.push(children[i]);
    }
  }

  while (node = next.pop()) {
    callback(node);
  }

  return this;
}
},{}],"gWUA":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(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;
  });
}
},{}],"j5Cl":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(compare) {
  return this.eachBefore(function (node) {
    if (node.children) {
      node.children.sort(compare);
    }
  });
}
},{}],"wdBo":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(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;
}
},{}],"b4Rq":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default() {
  var node = this,
      nodes = [node];

  while (node = node.parent) {
    nodes.push(node);
  }

  return nodes;
}
},{}],"mj9L":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default() {
  var nodes = [];
  this.each(function (node) {
    nodes.push(node);
  });
  return nodes;
}
},{}],"dlF0":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default() {
  var leaves = [];
  this.eachBefore(function (node) {
    if (!node.children) {
      leaves.push(node);
    }
  });
  return leaves;
}
},{}],"iDpf":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default() {
  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;
}
},{}],"awbY":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = hierarchy;
exports.computeHeight = computeHeight;
exports.Node = Node;

var _count = _interopRequireDefault(require("./count.js"));

var _each = _interopRequireDefault(require("./each.js"));

var _eachBefore = _interopRequireDefault(require("./eachBefore.js"));

var _eachAfter = _interopRequireDefault(require("./eachAfter.js"));

var _sum = _interopRequireDefault(require("./sum.js"));

var _sort = _interopRequireDefault(require("./sort.js"));

var _path = _interopRequireDefault(require("./path.js"));

var _ancestors = _interopRequireDefault(require("./ancestors.js"));

var _descendants = _interopRequireDefault(require("./descendants.js"));

var _leaves = _interopRequireDefault(require("./leaves.js"));

var _links = _interopRequireDefault(require("./links.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function hierarchy(data, children) {
  var root = new Node(data),
      valued = +data.value && (root.value = data.value),
      node,
      nodes = [root],
      child,
      childs,
      i,
      n;
  if (children == null) children = defaultChildren;

  while (node = nodes.pop()) {
    if (valued) node.value = +node.data.value;

    if ((childs = children(node.data)) && (n = childs.length)) {
      node.children = new Array(n);

      for (i = n - 1; i >= 0; --i) {
        nodes.push(child = node.children[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 defaultChildren(d) {
  return d.children;
}

function copyData(node) {
  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: _count.default,
  each: _each.default,
  eachAfter: _eachAfter.default,
  eachBefore: _eachBefore.default,
  sum: _sum.default,
  sort: _sort.default,
  path: _path.default,
  ancestors: _ancestors.default,
  descendants: _descendants.default,
  leaves: _leaves.default,
  links: _links.default,
  copy: node_copy
};
},{"./count.js":"gwJQ","./each.js":"ootC","./eachBefore.js":"v8XQ","./eachAfter.js":"P6uJ","./sum.js":"gWUA","./sort.js":"j5Cl","./path.js":"wdBo","./ancestors.js":"b4Rq","./descendants.js":"mj9L","./leaves.js":"dlF0","./links.js":"iDpf"}],"g97z":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.shuffle = shuffle;
exports.slice = void 0;
var slice = Array.prototype.slice;
exports.slice = slice;

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;
}
},{}],"Ph5L":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _array = require("../array.js");

function _default(circles) {
  var i = 0,
      n = (circles = (0, _array.shuffle)(_array.slice.call(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 + 1e-6,
      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
  };
}
},{"../array.js":"g97z"}],"tCEz":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.packEnclose = packEnclose;
exports.default = _default;

var _enclose = _interopRequireDefault(require("./enclose.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function 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 Node(circle) {
  this._ = circle;
  this.next = null;
  this.previous = null;
}

function packEnclose(circles) {
  if (!(n = 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.

  place(b, a, c = circles[2]); // Initialize the front-chain using the first three circles a, b and c.

  a = new Node(a), b = new Node(b), c = new 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) {
    place(a._, b._, c = circles[i]), c = new 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 = (0, _enclose.default)(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;
}

function _default(circles) {
  packEnclose(circles);
  return circles;
}
},{"./enclose.js":"Ph5L"}],"ConL":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.optional = optional;
exports.required = required;

function optional(f) {
  return f == null ? null : required(f);
}

function required(f) {
  if (typeof f !== "function") throw new Error();
  return f;
}
},{}],"CPwG":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.constantZero = constantZero;
exports.default = _default;

function constantZero() {
  return 0;
}

function _default(x) {
  return function () {
    return x;
  };
}
},{}],"iLjI":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _siblings = require("./siblings.js");

var _accessors = require("../accessors.js");

var _constant = _interopRequireWildcard(require("../constant.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function defaultRadius(d) {
  return Math.sqrt(d.value);
}

function _default() {
  var radius = null,
      dx = 1,
      dy = 1,
      padding = _constant.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(_constant.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 = (0, _accessors.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 : (0, _constant.default)(+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 = (0, _siblings.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;
    }
  };
}
},{"./siblings.js":"tCEz","../accessors.js":"ConL","../constant.js":"CPwG"}],"c41W":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(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);
}
},{}],"lDeM":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(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;
  }
}
},{}],"aOXa":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _round = _interopRequireDefault(require("./treemap/round.js"));

var _dice = _interopRequireDefault(require("./treemap/dice.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default() {
  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(_round.default);
    return root;
  }

  function positionNode(dy, n) {
    return function (node) {
      if (node.children) {
        (0, _dice.default)(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;
}
},{"./treemap/round.js":"c41W","./treemap/dice.js":"lDeM"}],"l7QX":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _accessors = require("./accessors.js");

var _index = require("./hierarchy/index.js");

var keyPrefix = "$",
    // Protect against keys like “__proto__”.
preroot = {
  depth: -1
},
    ambiguous = {};

function defaultId(d) {
  return d.id;
}

function defaultParentId(d) {
  return d.parentId;
}

function _default() {
  var id = defaultId,
      parentId = defaultParentId;

  function stratify(data) {
    var d,
        i,
        n = data.length,
        root,
        parent,
        node,
        nodes = new Array(n),
        nodeId,
        nodeKey,
        nodeByKey = {};

    for (i = 0; i < n; ++i) {
      d = data[i], node = nodes[i] = new _index.Node(d);

      if ((nodeId = id(d, i, data)) != null && (nodeId += "")) {
        nodeKey = keyPrefix + (node.id = nodeId);
        nodeByKey[nodeKey] = nodeKey in nodeByKey ? ambiguous : node;
      }
    }

    for (i = 0; i < n; ++i) {
      node = nodes[i], nodeId = parentId(data[i], i, data);

      if (nodeId == null || !(nodeId += "")) {
        if (root) throw new Error("multiple roots");
        root = node;
      } else {
        parent = nodeByKey[keyPrefix + 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;
      }
    }

    if (!root) throw new Error("no root");
    root.parent = preroot;
    root.eachBefore(function (node) {
      node.depth = node.parent.depth + 1;
      --n;
    }).eachBefore(_index.computeHeight);
    root.parent = null;
    if (n > 0) throw new Error("cycle");
    return root;
  }

  stratify.id = function (x) {
    return arguments.length ? (id = (0, _accessors.required)(x), stratify) : id;
  };

  stratify.parentId = function (x) {
    return arguments.length ? (parentId = (0, _accessors.required)(x), stratify) : parentId;
  };

  return stratify;
}
},{"./accessors.js":"ConL","./hierarchy/index.js":"awbY"}],"spqv":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _index = require("./hierarchy/index.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(_index.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


function _default() {
  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;
}
},{"./hierarchy/index.js":"awbY"}],"HMFn":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(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;
  }
}
},{}],"jOK3":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.squarifyRatio = squarifyRatio;
exports.default = exports.phi = void 0;

var _dice = _interopRequireDefault(require("./dice.js"));

var _slice = _interopRequireDefault(require("./slice.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var phi = (1 + Math.sqrt(5)) / 2;
exports.phi = phi;

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) (0, _dice.default)(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1);else (0, _slice.default)(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1);
    value -= sumValue, i0 = i1;
  }

  return rows;
}

var _default = 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;
}(phi);

exports.default = _default;
},{"./dice.js":"lDeM","./slice.js":"HMFn"}],"zTYD":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _round = _interopRequireDefault(require("./round.js"));

var _squarify = _interopRequireDefault(require("./squarify.js"));

var _accessors = require("../accessors.js");

var _constant = _interopRequireWildcard(require("../constant.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default() {
  var tile = _squarify.default,
      round = false,
      dx = 1,
      dy = 1,
      paddingStack = [0],
      paddingInner = _constant.constantZero,
      paddingTop = _constant.constantZero,
      paddingRight = _constant.constantZero,
      paddingBottom = _constant.constantZero,
      paddingLeft = _constant.constantZero;

  function treemap(root) {
    root.x0 = root.y0 = 0;
    root.x1 = dx;
    root.y1 = dy;
    root.eachBefore(positionNode);
    paddingStack = [0];
    if (round) root.eachBefore(_round.default);
    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 = (0, _accessors.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 : (0, _constant.default)(+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 : (0, _constant.default)(+x), treemap) : paddingTop;
  };

  treemap.paddingRight = function (x) {
    return arguments.length ? (paddingRight = typeof x === "function" ? x : (0, _constant.default)(+x), treemap) : paddingRight;
  };

  treemap.paddingBottom = function (x) {
    return arguments.length ? (paddingBottom = typeof x === "function" ? x : (0, _constant.default)(+x), treemap) : paddingBottom;
  };

  treemap.paddingLeft = function (x) {
    return arguments.length ? (paddingLeft = typeof x === "function" ? x : (0, _constant.default)(+x), treemap) : paddingLeft;
  };

  return treemap;
}
},{"./round.js":"c41W","./squarify.js":"jOK3","../accessors.js":"ConL","../constant.js":"CPwG"}],"B9FY":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(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 = (x0 * valueRight + x1 * valueLeft) / value;
      partition(i, k, valueLeft, x0, y0, xk, y1);
      partition(k, j, valueRight, xk, y0, x1, y1);
    } else {
      var yk = (y0 * valueRight + y1 * valueLeft) / value;
      partition(i, k, valueLeft, x0, y0, x1, yk);
      partition(k, j, valueRight, x0, yk, x1, y1);
    }
  }
}
},{}],"aii9":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _dice = _interopRequireDefault(require("./dice.js"));

var _slice = _interopRequireDefault(require("./slice.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(parent, x0, y0, x1, y1) {
  (parent.depth & 1 ? _slice.default : _dice.default)(parent, x0, y0, x1, y1);
}
},{"./dice.js":"lDeM","./slice.js":"HMFn"}],"F98V":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _dice = _interopRequireDefault(require("./dice.js"));

var _slice = _interopRequireDefault(require("./slice.js"));

var _squarify = require("./squarify.js");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _default = 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) (0, _dice.default)(row, x0, y0, x1, y0 += (y1 - y0) * row.value / value);else (0, _slice.default)(row, x0, y0, x0 += (x1 - x0) * row.value / value, y1);
        value -= row.value;
      }
    } else {
      parent._squarify = rows = (0, _squarify.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);

exports.default = _default;
},{"./dice.js":"lDeM","./slice.js":"HMFn","./squarify.js":"jOK3"}],"vZwX":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "cluster", {
  enumerable: true,
  get: function () {
    return _cluster.default;
  }
});
Object.defineProperty(exports, "hierarchy", {
  enumerable: true,
  get: function () {
    return _index.default;
  }
});
Object.defineProperty(exports, "pack", {
  enumerable: true,
  get: function () {
    return _index2.default;
  }
});
Object.defineProperty(exports, "packSiblings", {
  enumerable: true,
  get: function () {
    return _siblings.default;
  }
});
Object.defineProperty(exports, "packEnclose", {
  enumerable: true,
  get: function () {
    return _enclose.default;
  }
});
Object.defineProperty(exports, "partition", {
  enumerable: true,
  get: function () {
    return _partition.default;
  }
});
Object.defineProperty(exports, "stratify", {
  enumerable: true,
  get: function () {
    return _stratify.default;
  }
});
Object.defineProperty(exports, "tree", {
  enumerable: true,
  get: function () {
    return _tree.default;
  }
});
Object.defineProperty(exports, "treemap", {
  enumerable: true,
  get: function () {
    return _index3.default;
  }
});
Object.defineProperty(exports, "treemapBinary", {
  enumerable: true,
  get: function () {
    return _binary.default;
  }
});
Object.defineProperty(exports, "treemapDice", {
  enumerable: true,
  get: function () {
    return _dice.default;
  }
});
Object.defineProperty(exports, "treemapSlice", {
  enumerable: true,
  get: function () {
    return _slice.default;
  }
});
Object.defineProperty(exports, "treemapSliceDice", {
  enumerable: true,
  get: function () {
    return _sliceDice.default;
  }
});
Object.defineProperty(exports, "treemapSquarify", {
  enumerable: true,
  get: function () {
    return _squarify.default;
  }
});
Object.defineProperty(exports, "treemapResquarify", {
  enumerable: true,
  get: function () {
    return _resquarify.default;
  }
});

var _cluster = _interopRequireDefault(require("./cluster.js"));

var _index = _interopRequireDefault(require("./hierarchy/index.js"));

var _index2 = _interopRequireDefault(require("./pack/index.js"));

var _siblings = _interopRequireDefault(require("./pack/siblings.js"));

var _enclose = _interopRequireDefault(require("./pack/enclose.js"));

var _partition = _interopRequireDefault(require("./partition.js"));

var _stratify = _interopRequireDefault(require("./stratify.js"));

var _tree = _interopRequireDefault(require("./tree.js"));

var _index3 = _interopRequireDefault(require("./treemap/index.js"));

var _binary = _interopRequireDefault(require("./treemap/binary.js"));

var _dice = _interopRequireDefault(require("./treemap/dice.js"));

var _slice = _interopRequireDefault(require("./treemap/slice.js"));

var _sliceDice = _interopRequireDefault(require("./treemap/sliceDice.js"));

var _squarify = _interopRequireDefault(require("./treemap/squarify.js"));

var _resquarify = _interopRequireDefault(require("./treemap/resquarify.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./cluster.js":"npog","./hierarchy/index.js":"awbY","./pack/index.js":"iLjI","./pack/siblings.js":"tCEz","./pack/enclose.js":"Ph5L","./partition.js":"aOXa","./stratify.js":"l7QX","./tree.js":"spqv","./treemap/index.js":"zTYD","./treemap/binary.js":"B9FY","./treemap/dice.js":"lDeM","./treemap/slice.js":"HMFn","./treemap/sliceDice.js":"aii9","./treemap/squarify.js":"jOK3","./treemap/resquarify.js":"F98V"}],"S7Xu":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Nest;

var _lookup = _interopRequireDefault(require("./lookup"));

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

var _d3Hierarchy = require("d3-hierarchy");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * 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) {
  _vegaDataflow.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"
  }]
};
var prototype = (0, _vegaUtil.inherits)(Nest, _vegaDataflow.Transform);

function children(n) {
  return n.values;
}

prototype.transform = function (_, pulse) {
  if (!pulse.source) {
    (0, _vegaUtil.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 && (0, _vegaDataflow.isTuple)(node.data)) {
          out.rem.push(node.data);
        }
      });
    } // generate new tree structure


    this.value = tree = (0, _d3Hierarchy.hierarchy)({
      values: (0, _vegaUtil.array)(_.keys).reduce((n, k) => {
        n.key(k);
        return n;
      }, nest()).entries(out.source)
    }, children); // collect nodes to add

    if (gen) {
      tree.each(node => {
        if (node.children) {
          node = (0, _vegaDataflow.ingest)(node.data);
          out.add.push(node);
          out.source.push(node);
        }
      });
    } // build lookup table


    (0, _lookup.default)(tree, _vegaDataflow.tupleid, _vegaDataflow.tupleid);
  }

  out.source.root = tree;
  return out;
};

function nest() {
  var keys = [],
      nest;

  function apply(array, depth) {
    if (depth >= keys.length) {
      return array;
    }

    var i = -1,
        n = array.length,
        key = keys[depth++],
        keyValue,
        value,
        valuesByKey = {},
        values,
        result = {};

    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;
    var array = [],
        k;

    for (k in map) {
      array.push({
        key: k,
        values: entries(map[k], depth)
      });
    }

    return array;
  }

  return nest = {
    entries: array => entries(apply(array, 0), 0),
    key: d => {
      keys.push(d);
      return nest;
    }
  };
}
},{"./lookup":"k90h","vega-dataflow":"UC8n","vega-util":"dejJ","d3-hierarchy":"vZwX"}],"gEz9":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = HierarchyLayout;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * Abstract class for tree layout.
 * @constructor
 * @param {object} params - The parameters for this operator.
 */
function HierarchyLayout(params) {
  _vegaDataflow.Transform.call(this, null, params);
}

var prototype = (0, _vegaUtil.inherits)(HierarchyLayout, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  if (!pulse.source || !pulse.source.root) {
    (0, _vegaUtil.error)(this.constructor.name + ' transform requires a backing tree data source.');
  }

  var 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((0, _vegaDataflow.stableCompare)(_.sort, d => d.data));
  setParams(layout, this.params, _);

  if (layout.separation) {
    layout.separation(_.separation !== false ? defaultSeparation : _vegaUtil.one);
  }

  try {
    this.value = layout(root);
  } catch (err) {
    (0, _vegaUtil.error)(err);
  }

  root.each(function (node) {
    setFields(node, fields, as);
  });
  return pulse.reflow(_.modified()).modifies(as).modifies('leaf');
};

function setParams(layout, params, _) {
  for (var p, i = 0, n = params.length; i < n; ++i) {
    p = params[i];
    if (p in _) layout[p](_[p]);
  }
}

function setFields(node, fields, as) {
  var t = node.data;

  for (var i = 0, n = fields.length - 1; i < n; ++i) {
    t[as[i]] = node[fields[i]];
  }

  t[as[n]] = node.children ? node.children.length : 0;
}

function defaultSeparation(a, b) {
  return a.parent === b.parent ? 1 : 2;
}
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"iP0a":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Pack;

var _HierarchyLayout = _interopRequireDefault(require("./HierarchyLayout"));

var _vegaUtil = require("vega-util");

var _d3Hierarchy = require("d3-hierarchy");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var 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.default.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": Output.length,
    "default": Output
  }]
};
var prototype = (0, _vegaUtil.inherits)(Pack, _HierarchyLayout.default);
prototype.layout = _d3Hierarchy.pack;
prototype.params = ['radius', 'size', 'padding'];
prototype.fields = Output;
},{"./HierarchyLayout":"gEz9","vega-util":"dejJ","d3-hierarchy":"vZwX"}],"DU2D":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Partition;

var _HierarchyLayout = _interopRequireDefault(require("./HierarchyLayout"));

var _vegaUtil = require("vega-util");

var _d3Hierarchy = require("d3-hierarchy");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Output = ['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.default.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.length,
    "default": Output
  }]
};
var prototype = (0, _vegaUtil.inherits)(Partition, _HierarchyLayout.default);
prototype.layout = _d3Hierarchy.partition;
prototype.params = ['size', 'round', 'padding'];
prototype.fields = Output;
},{"./HierarchyLayout":"gEz9","vega-util":"dejJ","d3-hierarchy":"vZwX"}],"ql99":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Stratify;

var _lookup = _interopRequireDefault(require("./lookup"));

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

var _d3Hierarchy = require("d3-hierarchy");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * 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) {
  _vegaDataflow.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
  }]
};
var prototype = (0, _vegaUtil.inherits)(Stratify, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  if (!pulse.source) {
    (0, _vegaUtil.error)('Stratify transform requires an upstream data source.');
  }

  var tree = this.value,
      mod = _.modified(),
      out = pulse.fork(pulse.ALL).materialize(pulse.SOURCE),
      run = !this.value || 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) {
    if (out.source.length) {
      tree = (0, _lookup.default)((0, _d3Hierarchy.stratify)().id(_.key).parentId(_.parentKey)(out.source), _.key, _vegaUtil.truthy);
    } else {
      tree = (0, _lookup.default)((0, _d3Hierarchy.stratify)()([{}]), _.key, _.key);
    }
  }

  out.source.root = this.value = tree;
  return out;
};
},{"./lookup":"k90h","vega-dataflow":"UC8n","vega-util":"dejJ","d3-hierarchy":"vZwX"}],"aH48":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Tree;

var _HierarchyLayout = _interopRequireDefault(require("./HierarchyLayout"));

var _vegaUtil = require("vega-util");

var _d3Hierarchy = require("d3-hierarchy");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Layouts = {
  tidy: _d3Hierarchy.tree,
  cluster: _d3Hierarchy.cluster
};
var Output = ['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.default.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.length,
    "default": Output
  }]
};
var prototype = (0, _vegaUtil.inherits)(Tree, _HierarchyLayout.default);
/**
 * Tree layout generator. Supports both 'tidy' and 'cluster' layouts.
 */

prototype.layout = function (method) {
  var m = method || 'tidy';
  if ((0, _vegaUtil.hasOwnProperty)(Layouts, m)) return Layouts[m]();else (0, _vegaUtil.error)('Unrecognized Tree layout method: ' + m);
};

prototype.params = ['size', 'nodeSize'];
prototype.fields = Output;
},{"./HierarchyLayout":"gEz9","vega-util":"dejJ","d3-hierarchy":"vZwX"}],"c9bk":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = TreeLinks;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.Transform.call(this, [], params);
}

TreeLinks.Definition = {
  "type": "TreeLinks",
  "metadata": {
    "tree": true,
    "generates": true,
    "changes": true
  },
  "params": []
};
var prototype = (0, _vegaUtil.inherits)(TreeLinks, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var links = this.value,
      tree = pulse.source && pulse.source.root,
      out = pulse.fork(pulse.NO_SOURCE),
      lut = {};
  if (!tree) (0, _vegaUtil.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, function (t) {
      lut[(0, _vegaDataflow.tupleid)(t)] = 1;
    }); // generate links for all edges incident on valid tuples

    tree.each(function (node) {
      var t = node.data,
          p = node.parent && node.parent.data;

      if (p && lut[(0, _vegaDataflow.tupleid)(t)] && lut[(0, _vegaDataflow.tupleid)(p)]) {
        out.add.push((0, _vegaDataflow.ingest)({
          source: p,
          target: t
        }));
      }
    });
    this.value = out.add;
  } else if (pulse.changed(pulse.MOD)) {
    // build lookup table of modified tuples
    pulse.visit(pulse.MOD, function (t) {
      lut[(0, _vegaDataflow.tupleid)(t)] = 1;
    }); // gather links incident on modified tuples

    links.forEach(function (link) {
      if (lut[(0, _vegaDataflow.tupleid)(link.source)] || lut[(0, _vegaDataflow.tupleid)(link.target)]) {
        out.mod.push(link);
      }
    });
  }

  return out;
};
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"g4Sj":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Treemap;

var _HierarchyLayout = _interopRequireDefault(require("./HierarchyLayout"));

var _vegaUtil = require("vega-util");

var _d3Hierarchy = require("d3-hierarchy");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Tiles = {
  binary: _d3Hierarchy.treemapBinary,
  dice: _d3Hierarchy.treemapDice,
  slice: _d3Hierarchy.treemapSlice,
  slicedice: _d3Hierarchy.treemapSliceDice,
  squarify: _d3Hierarchy.treemapSquarify,
  resquarify: _d3Hierarchy.treemapResquarify
};
var Output = ['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.default.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.length,
    "default": Output
  }]
};
var prototype = (0, _vegaUtil.inherits)(Treemap, _HierarchyLayout.default);
/**
 * Treemap layout generator. Adds 'method' and 'ratio' parameters
 * to configure the underlying tile method.
 */

prototype.layout = function () {
  var x = (0, _d3Hierarchy.treemap)();

  x.ratio = function (_) {
    var t = x.tile();
    if (t.ratio) x.tile(t.ratio(_));
  };

  x.method = function (_) {
    if ((0, _vegaUtil.hasOwnProperty)(Tiles, _)) x.tile(Tiles[_]);else (0, _vegaUtil.error)('Unrecognized Treemap layout method: ' + _);
  };

  return x;
};

prototype.params = ['method', 'ratio', 'size', 'round', 'padding', 'paddingInner', 'paddingOuter', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft'];
prototype.fields = Output;
},{"./HierarchyLayout":"gEz9","vega-util":"dejJ","d3-hierarchy":"vZwX"}],"cflr":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "nest", {
  enumerable: true,
  get: function () {
    return _Nest.default;
  }
});
Object.defineProperty(exports, "pack", {
  enumerable: true,
  get: function () {
    return _Pack.default;
  }
});
Object.defineProperty(exports, "partition", {
  enumerable: true,
  get: function () {
    return _Partition.default;
  }
});
Object.defineProperty(exports, "stratify", {
  enumerable: true,
  get: function () {
    return _Stratify.default;
  }
});
Object.defineProperty(exports, "tree", {
  enumerable: true,
  get: function () {
    return _Tree.default;
  }
});
Object.defineProperty(exports, "treelinks", {
  enumerable: true,
  get: function () {
    return _TreeLinks.default;
  }
});
Object.defineProperty(exports, "treemap", {
  enumerable: true,
  get: function () {
    return _Treemap.default;
  }
});

var _Nest = _interopRequireDefault(require("./src/Nest"));

var _Pack = _interopRequireDefault(require("./src/Pack"));

var _Partition = _interopRequireDefault(require("./src/Partition"));

var _Stratify = _interopRequireDefault(require("./src/Stratify"));

var _Tree = _interopRequireDefault(require("./src/Tree"));

var _TreeLinks = _interopRequireDefault(require("./src/TreeLinks"));

var _Treemap = _interopRequireDefault(require("./src/Treemap"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./src/Nest":"S7Xu","./src/Pack":"iP0a","./src/Partition":"DU2D","./src/Stratify":"ql99","./src/Tree":"aH48","./src/TreeLinks":"c9bk","./src/Treemap":"g4Sj"}],"dPzQ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(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;
}
},{}],"kttn":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Loess;

var _partition = _interopRequireDefault(require("./partition"));

var _vegaStatistics = require("vega-statistics");

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * 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) {
  _vegaDataflow.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
  }]
};
var prototype = (0, _vegaUtil.inherits)(Loess, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);

  if (!this.value || pulse.changed() || _.modified()) {
    const source = pulse.materialize(pulse.SOURCE).source,
          groups = (0, _partition.default)(source, _.groupby),
          names = (_.groupby || []).map(_vegaUtil.accessorName),
          m = names.length,
          as = _.as || [(0, _vegaUtil.accessorName)(_.x), (0, _vegaUtil.accessorName)(_.y)],
          values = [];
    groups.forEach(g => {
      (0, _vegaStatistics.regressionLoess)(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((0, _vegaDataflow.ingest)(t));
      });
    });
    if (this.value) out.rem = this.value;
    this.value = out.add = out.source = values;
  }

  return out;
};
},{"./partition":"dPzQ","vega-statistics":"yUSi","vega-dataflow":"UC8n","vega-util":"dejJ"}],"CG12":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Regression;

var _partition = _interopRequireDefault(require("./partition"));

var _vegaDataflow = require("vega-dataflow");

var _vegaStatistics = require("vega-statistics");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

const Methods = {
  linear: _vegaStatistics.regressionLinear,
  log: _vegaStatistics.regressionLog,
  exp: _vegaStatistics.regressionExp,
  pow: _vegaStatistics.regressionPow,
  quad: _vegaStatistics.regressionQuad,
  poly: _vegaStatistics.regressionPoly
};

function degreesOfFreedom(method, order) {
  return 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) {
  _vegaDataflow.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(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
  }]
};
var prototype = (0, _vegaUtil.inherits)(Regression, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);

  if (!this.value || pulse.changed() || _.modified()) {
    const source = pulse.materialize(pulse.SOURCE).source,
          groups = (0, _partition.default)(source, _.groupby),
          names = (_.groupby || []).map(_vegaUtil.accessorName),
          method = _.method || 'linear',
          order = _.order || 3,
          dof = degreesOfFreedom(method, order),
          as = _.as || [(0, _vegaUtil.accessorName)(_.x), (0, _vegaUtil.accessorName)(_.y)],
          fit = Methods[method],
          values = [];
    let domain = _.extent;

    if (!(0, _vegaUtil.hasOwnProperty)(Methods, method)) {
      (0, _vegaUtil.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((0, _vegaDataflow.ingest)({
          keys: g.dims,
          coef: model.coef,
          rSquared: model.rSquared
        }));
        return;
      }

      const dom = domain || (0, _vegaUtil.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((0, _vegaDataflow.ingest)(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
        (0, _vegaStatistics.sampleCurve)(model.predict, dom, 25, 200).forEach(add);
      }
    });
    if (this.value) out.rem = this.value;
    this.value = out.add = out.source = values;
  }

  return out;
};
},{"./partition":"dPzQ","vega-dataflow":"UC8n","vega-statistics":"yUSi","vega-util":"dejJ"}],"RK92":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "loess", {
  enumerable: true,
  get: function () {
    return _Loess.default;
  }
});
Object.defineProperty(exports, "regression", {
  enumerable: true,
  get: function () {
    return _Regression.default;
  }
});

var _Loess = _interopRequireDefault(require("./src/Loess"));

var _Regression = _interopRequireDefault(require("./src/Regression"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./src/Loess":"kttn","./src/Regression":"CG12"}],"x4Bn":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
const 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 = 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 = 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 (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] = 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) <= EPSILON && Math.abs(y - yp) <= 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], !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], 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], 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


exports.default = Delaunator;

function pseudoAngle(dx, dy) {
  const p = dx / (Math.abs(dx) + Math.abs(dy));
  return (dy > 0 ? 3 - p : 1 + p) / 4; // [0..1]
}

function 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 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;
    swap(ids, median, i);
    if (dists[ids[left]] > dists[ids[right]]) swap(ids, left, right);
    if (dists[ids[i]] > dists[ids[right]]) swap(ids, i, right);
    if (dists[ids[left]] > dists[ids[i]]) 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;
      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 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];
}
},{}],"yRh8":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
const epsilon = 1e-6;

class 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) > epsilon || Math.abs(this._y1 - y0) > 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;
  }

}

exports.default = Path;
},{}],"LQUD":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

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;
  }

}

exports.default = Polygon;
},{}],"PWXi":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _path = _interopRequireDefault(require("./path.js"));

var _polygon = _interopRequireDefault(require("./polygon.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

class 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.default() : 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.default() : 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.default() : undefined;

    const points = this._clip(i);

    if (points === null) 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) yield cell;
    }
  }

  cellPolygon(i) {
    const polygon = new _polygon.default();
    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;
  }

  _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);
  }

}

exports.default = Voronoi;
},{"./path.js":"yRh8","./polygon.js":"LQUD"}],"TTNd":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _delaunator = _interopRequireDefault(require("delaunator"));

var _path = _interopRequireDefault(require("./path.js"));

var _polygon = _interopRequireDefault(require("./polygon.js"));

var _voronoi = _interopRequireDefault(require("./voronoi.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

const tau = 2 * Math.PI;

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 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 {
  constructor(points) {
    this._delaunator = new _delaunator.default(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 && 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.sqrt((bounds[3] - bounds[1]) ** 2 + (bounds[2] - bounds[0]) ** 2);

      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.default(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.default(this, bounds);
  }

  *neighbors(i) {
    const {
      inedges,
      hull,
      _hullIndex,
      halfedges,
      triangles
    } = this; // degenerate case with several collinear points

    if (this.collinear) {
      const l = this.collinear.indexOf(i);
      if (l > 0) yield this.collinear[l - 1];
      if (l < this.collinear.length - 1) yield this.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 = (x - points[i * 2]) ** 2 + (y - points[i * 2 + 1]) ** 2;
    const e0 = inedges[i];
    let e = e0;

    do {
      let t = triangles[e];
      const dt = (x - points[t * 2]) ** 2 + (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 ((x - points[e * 2]) ** 2 + (y - points[e * 2 + 1]) ** 2 < dc) return e;
        }

        break;
      }
    } while (e !== e0);

    return c;
  }

  render(context) {
    const buffer = context == null ? context = new _path.default() : 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.default() : 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, tau);
    }

    return buffer && buffer.value();
  }

  renderHull(context) {
    const buffer = context == null ? context = new _path.default() : 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.default();
    this.renderHull(polygon);
    return polygon.value();
  }

  renderTriangle(i, context) {
    const buffer = context == null ? context = new _path.default() : 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.default();
    this.renderTriangle(i, polygon);
    return polygon.value();
  }

}

exports.default = Delaunay;

Delaunay.from = function (points, fx = pointX, fy = pointY, that) {
  return new Delaunay("length" in points ? flatArray(points, fx, fy, that) : Float64Array.from(flatIterable(points, fx, fy, that)));
};

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;
  }
}
},{"delaunator":"x4Bn","./path.js":"yRh8","./polygon.js":"LQUD","./voronoi.js":"PWXi"}],"MXym":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "Delaunay", {
  enumerable: true,
  get: function () {
    return _delaunay.default;
  }
});
Object.defineProperty(exports, "Voronoi", {
  enumerable: true,
  get: function () {
    return _voronoi.default;
  }
});

var _delaunay = _interopRequireDefault(require("./delaunay.js"));

var _voronoi = _interopRequireDefault(require("./voronoi.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./delaunay.js":"TTNd","./voronoi.js":"PWXi"}],"ttuI":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Voronoi;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

var _d3Delaunay = require("d3-delaunay");

function Voronoi(params) {
  _vegaDataflow.Transform.call(this, null, params);
}

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 prototype = (0, _vegaUtil.inherits)(Voronoi, _vegaDataflow.Transform);
const defaultExtent = [-1e5, -1e5, 1e5, 1e5];

prototype.transform = function (_, 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 = _d3Delaunay.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';
}
},{"vega-dataflow":"UC8n","vega-util":"dejJ","d3-delaunay":"MXym"}],"ur88":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "voronoi", {
  enumerable: true,
  get: function () {
    return _Voronoi.default;
  }
});

var _Voronoi = _interopRequireDefault(require("./src/Voronoi"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./src/Voronoi":"ttuI"}],"kMxc":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _vegaCanvas = require("vega-canvas");

/*
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,
    cw = 1 << 11 >> 5,
    ch = 1 << 11;

function _default() {
  var size = [256, 256],
      text,
      font,
      fontSize,
      fontStyle,
      fontWeight,
      rotate,
      padding,
      spiral = archimedeanSpiral,
      words = [],
      random = Math.random,
      cloud = {};

  cloud.layout = function () {
    var contextAndRatio = getContext((0, _vegaCanvas.canvas)()),
        board = zeroArray((size[0] >> 5) * size[1]),
        bounds = null,
        n = words.length,
        i = -1,
        tags = [],
        data = words.map(function (d) {
      return {
        text: text(d),
        font: font(d),
        style: fontStyle(d),
        weight: fontWeight(d),
        rotate: rotate(d),
        size: ~~fontSize(d),
        padding: padding(d),
        xoff: 0,
        yoff: 0,
        x1: 0,
        y1: 0,
        x0: 0,
        y0: 0,
        hasText: false,
        sprite: null,
        datum: d
      };
    }).sort(function (a, b) {
      return 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 = (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, (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 >= 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, (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) * (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
};
},{"vega-canvas":"ZLEK"}],"PDXn":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Wordcloud;

var _CloudLayout = _interopRequireDefault(require("./CloudLayout"));

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

var _vegaScale = require("vega-scale");

var _vegaStatistics = require("vega-statistics");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Output = ['x', 'y', 'font', 'fontSize', 'fontStyle', 'fontWeight', 'angle'];
var Params = ['text', 'font', 'rotate', 'fontSize', 'fontStyle', 'fontWeight'];

function Wordcloud(params) {
  _vegaDataflow.Transform.call(this, (0, _CloudLayout.default)(), 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": Output
  }]
};
var prototype = (0, _vegaUtil.inherits)(Wordcloud, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  if (_.size && !(_.size[0] && _.size[1])) {
    (0, _vegaUtil.error)('Wordcloud size dimensions must be non-zero.');
  }

  function modp(param) {
    var p = _[param];
    return (0, _vegaUtil.isFunction)(p) && pulse.modified(p.fields);
  }

  var mod = _.modified();

  if (!(mod || pulse.changed(pulse.ADD_REM) || Params.some(modp))) return;
  var data = pulse.materialize(pulse.SOURCE).source,
      layout = this.value,
      as = _.as || Output,
      fontSize = _.fontSize || 14,
      range;
  (0, _vegaUtil.isFunction)(fontSize) ? range = _.fontSizeRange : fontSize = (0, _vegaUtil.constant)(fontSize); // create font size scaling function as needed

  if (range) {
    var fsize = fontSize,
        sizeScale = (0, _vegaScale.scale)('sqrt')().domain((0, _vegaUtil.extent)(data, fsize)).range(range);

    fontSize = function (x) {
      return sizeScale(fsize(x));
    };
  }

  data.forEach(function (t) {
    t[as[0]] = NaN;
    t[as[1]] = NaN;
    t[as[3]] = 0;
  }); // configure layout

  var 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(_vegaStatistics.random).layout();
  var size = layout.size(),
      dx = size[0] >> 1,
      dy = size[1] >> 1,
      i = 0,
      n = words.length,
      w,
      t;

  for (; 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);
};
},{"./CloudLayout":"kMxc","vega-dataflow":"UC8n","vega-util":"dejJ","vega-scale":"VE6e","vega-statistics":"yUSi"}],"IWOG":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "wordcloud", {
  enumerable: true,
  get: function () {
    return _Wordcloud.default;
  }
});

var _Wordcloud = _interopRequireDefault(require("./src/Wordcloud"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./src/Wordcloud":"PDXn"}],"TK64":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.array8 = array8;
exports.array16 = array16;
exports.array32 = array32;

function array8(n) {
  return new Uint8Array(n);
}

function array16(n) {
  return new Uint16Array(n);
}

function array32(n) {
  return new Uint32Array(n);
}
},{}],"gQ2V":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Bitmaps;

var _arrays = require("./arrays");

/**
 * Maintains CrossFilter state.
 */
function Bitmaps() {
  var width = 8,
      data = [],
      seen = (0, _arrays.array32)(0),
      curr = array(0, width),
      prev = array(0, width);
  return {
    data: function () {
      return data;
    },
    seen: function () {
      return seen = lengthen(seen, data.length);
    },
    add: function (array) {
      for (var i = 0, j = data.length, n = array.length, t; i < n; ++i) {
        t = array[i];
        t._index = j++;
        data.push(t);
      }
    },
    remove: function (num, map) {
      // map: index -> boolean (true => remove)
      var n = data.length,
          copy = Array(n - num),
          reindex = data,
          // reuse old data array for index map
      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: function () {
      return data.length;
    },
    curr: function () {
      return curr;
    },
    prev: function () {
      return prev;
    },
    reset: function (k) {
      prev[k] = curr[k];
    },
    all: function () {
      return width < 0x101 ? 0xff : width < 0x10001 ? 0xffff : 0xffffffff;
    },
    set: function (k, one) {
      curr[k] |= one;
    },
    clear: function (k, one) {
      curr[k] &= ~one;
    },
    resize: function (n, m) {
      var k = curr.length;

      if (n > k || m > width) {
        width = Math.max(m, width);
        curr = array(n, width, curr);
        prev = 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 array(n, m, array) {
  var copy = (m < 0x101 ? _arrays.array8 : m < 0x10001 ? _arrays.array16 : _arrays.array32)(n);
  if (array) copy.set(array);
  return copy;
}
},{"./arrays":"TK64"}],"F2VQ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(index, i, query) {
  var bit = 1 << i;
  return {
    one: bit,
    zero: ~bit,
    range: query.slice(),
    bisect: index.bisect,
    index: index.index,
    size: index.size,
    onAdd: function (added, curr) {
      var dim = this,
          range = dim.bisect(dim.range, added.value),
          idx = added.index,
          lo = range[0],
          hi = range[1],
          n1 = idx.length,
          i;

      for (i = 0; i < lo; ++i) curr[idx[i]] |= bit;

      for (i = hi; i < n1; ++i) curr[idx[i]] |= bit;

      return dim;
    }
  };
}
},{}],"ktUN":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = SortedIndex;

var _arrays = require("./arrays");

var _d3Array = require("d3-array");

/**
 * Maintains a list of values, sorted by key.
 */
function SortedIndex() {
  var index = (0, _arrays.array32)(0),
      value = [],
      size = 0;

  function insert(key, data, base) {
    if (!data.length) return [];
    var n0 = size,
        n1 = data.length,
        addv = Array(n1),
        addi = (0, _arrays.array32)(n1),
        oldv,
        oldi,
        i;

    for (i = 0; i < n1; ++i) {
      addv[i] = key(data[i]);
      addi[i] = i;
    }

    addv = sort(addv, addi);

    if (n0) {
      oldv = value;
      oldi = index;
      value = Array(n0 + n1);
      index = (0, _arrays.array32)(n0 + n1);
      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
    var n = size,
        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 (var i = 0, n = size; i < n; ++i) {
      index[i] = map[index[i]];
    }
  }

  function bisect(range, array) {
    var n;

    if (array) {
      n = array.length;
    } else {
      array = value;
      n = size;
    }

    return [(0, _d3Array.bisectLeft)(array, range[0], 0, n), (0, _d3Array.bisectRight)(array, range[1], 0, n)];
  }

  return {
    insert: insert,
    remove: remove,
    bisect: bisect,
    reindex: reindex,
    index: function () {
      return index;
    },
    size: function () {
      return size;
    }
  };
}

function sort(values, index) {
  values.sort.call(index, function (a, b) {
    var x = values[a],
        y = values[b];
    return x < y ? -1 : x > y ? 1 : 0;
  });
  return (0, _d3Array.permute)(values, index);
}

function merge(base, value0, index0, n0, value1, index1, n1, value, index) {
  var 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;
  }
}
},{"./arrays":"TK64","d3-array":"Rpnd"}],"A4lS":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = CrossFilter;

var _Bitmaps = _interopRequireDefault(require("./Bitmaps"));

var _Dimension = _interopRequireDefault(require("./Dimension"));

var _SortedIndex = _interopRequireDefault(require("./SortedIndex"));

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * 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) {
  _vegaDataflow.Transform.call(this, (0, _Bitmaps.default)(), 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
    }
  }]
};
var prototype = (0, _vegaUtil.inherits)(CrossFilter, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  if (!this._dims) {
    return this.init(_, pulse);
  } else {
    var init = _.modified('fields') || _.fields.some(function (f) {
      return pulse.modified(f.fields);
    });

    return init ? this.reinit(_, pulse) : this.eval(_, pulse);
  }
};

prototype.init = function (_, pulse) {
  var fields = _.fields,
      query = _.query,
      indices = this._indices = {},
      dims = this._dims = [],
      m = query.length,
      i = 0,
      key,
      index; // instantiate indices and dimensions

  for (; i < m; ++i) {
    key = fields[i].fname;
    index = indices[key] || (indices[key] = (0, _SortedIndex.default)());
    dims.push((0, _Dimension.default)(index, i, query[i]));
  }

  return this.eval(_, pulse);
};

prototype.reinit = function (_, pulse) {
  var 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 = {},
      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 = (0, _SortedIndex.default)();
        adds[key] = add = index.insert(f, pulse.source, 0);
      }

      dims[i] = (0, _Dimension.default)(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;
};

prototype.eval = function (_, pulse) {
  var output = pulse.materialize().fork(),
      m = this._dims.length,
      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;
};

prototype.insert = function (_, pulse, output) {
  var tuples = pulse.add,
      bits = this.value,
      dims = this._dims,
      indices = this._indices,
      fields = _.fields,
      adds = {},
      out = output.add,
      k = bits.size(),
      n = k + tuples.length,
      m = dims.length,
      j,
      key,
      add; // resize bitmaps and add tuples as needed

  bits.resize(n, m);
  bits.add(tuples);
  var 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);
  }
};

prototype.modify = function (pulse, output) {
  var out = output.mod,
      bits = this.value,
      curr = bits.curr(),
      all = bits.all(),
      tuples = pulse.mod,
      i,
      n,
      k;

  for (i = 0, n = tuples.length; i < n; ++i) {
    k = tuples[i]._index;
    if (curr[k] !== all) out.push(k);
  }
};

prototype.remove = function (_, pulse, output) {
  var indices = this._indices,
      bits = this.value,
      curr = bits.curr(),
      prev = bits.prev(),
      all = bits.all(),
      map = {},
      out = output.rem,
      tuples = pulse.rem,
      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


prototype.reindex = function (pulse, num, map) {
  var indices = this._indices,
      bits = this.value;
  pulse.runAfter(function () {
    var indexMap = bits.remove(num, map);

    for (var key in indices) indices[key].reindex(indexMap);
  });
};

prototype.update = function (_, pulse, output) {
  var dims = this._dims,
      query = _.query,
      stamp = pulse.stamp,
      m = dims.length,
      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;
};

prototype.incrementAll = function (dim, query, stamp, out) {
  var 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,
      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();
};

prototype.incrementOne = function (dim, query, add, rem) {
  var 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,
      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();
};
},{"./Bitmaps":"gQ2V","./Dimension":"F2VQ","./SortedIndex":"ktUN","vega-dataflow":"UC8n","vega-util":"dejJ"}],"Ueah":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = ResolveFilter;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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) {
  _vegaDataflow.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."
  }]
};
var prototype = (0, _vegaUtil.inherits)(ResolveFilter, _vegaDataflow.Transform);

prototype.transform = function (_, pulse) {
  var 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;

  var output = pulse.fork(pulse.ALL),
      data = bitmap.data(),
      curr = bitmap.curr(),
      prev = bitmap.prev(),
      pass = function (k) {
    return !(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, function (k) {
      return (curr[k] & ignore) === mask ? data[k] : null;
    });
  } else {
    // multiple filters changed
    output.filter(output.ADD, function (k) {
      var c = curr[k] & ignore,
          f = !c && c ^ prev[k] & ignore;
      return f ? data[k] : null;
    });
    output.filter(output.REM, function (k) {
      var 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, function (t) {
    return pass(t._index);
  });
};
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"RH0r":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "crossfilter", {
  enumerable: true,
  get: function () {
    return _CrossFilter.default;
  }
});
Object.defineProperty(exports, "resolvefilter", {
  enumerable: true,
  get: function () {
    return _ResolveFilter.default;
  }
});

var _CrossFilter = _interopRequireDefault(require("./src/CrossFilter"));

var _ResolveFilter = _interopRequireDefault(require("./src/ResolveFilter"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./src/CrossFilter":"A4lS","./src/ResolveFilter":"Ueah"}],"aMtX":[function(require,module,exports) {
module.exports = {
  "_from": "vega@^5.8",
  "_id": "vega@5.8.1",
  "_inBundle": false,
  "_integrity": "sha512-+3FN66ROsZdjg5e8ktyoXfdhxsQSCcGgr8vVTbJydqqkt5Qqp9gTDA5j7qutBk0d5/i5rIzN89XYGLRvBXYU0A==",
  "_location": "/vega",
  "_phantomChildren": {},
  "_requested": {
    "type": "range",
    "registry": true,
    "raw": "vega@^5.8",
    "name": "vega",
    "escapedName": "vega",
    "rawSpec": "^5.8",
    "saveSpec": null,
    "fetchSpec": "^5.8"
  },
  "_requiredBy": [
    "/"
  ],
  "_resolved": "https://registry.npmjs.org/vega/-/vega-5.8.1.tgz",
  "_shasum": "86234c657958a2e229fbb1c47f82e9e07866ad18",
  "_spec": "vega@^5.8",
  "_where": "C:\\src\\SandDance-Master\\packages\\sanddance-app",
  "author": {
    "name": "UW Interactive Data Lab",
    "url": "http://idl.cs.washington.edu"
  },
  "bugs": {
    "url": "https://github.com/vega/vega/issues"
  },
  "bundleDependencies": false,
  "dependencies": {
    "vega-crossfilter": "4.0.1",
    "vega-dataflow": "5.4.1",
    "vega-encode": "4.5.0",
    "vega-event-selector": "2.0.1",
    "vega-expression": "2.6.2",
    "vega-force": "4.0.3",
    "vega-functions": "5.5.0",
    "vega-geo": "4.2.0",
    "vega-hierarchy": "4.0.3",
    "vega-loader": "4.1.3",
    "vega-parser": "5.11.0",
    "vega-projection": "1.3.0",
    "vega-regression": "1.0.2",
    "vega-runtime": "5.0.2",
    "vega-scale": "5.0.0",
    "vega-scenegraph": "4.4.1",
    "vega-statistics": "1.7.0",
    "vega-time": "1.0.0",
    "vega-transforms": "4.5.0",
    "vega-typings": "0.11.1",
    "vega-util": "1.12.0",
    "vega-view": "5.3.2",
    "vega-view-transforms": "4.5.0",
    "vega-voronoi": "4.1.1",
    "vega-wordcloud": "4.0.3"
  },
  "deprecated": false,
  "description": "The Vega visualization grammar.",
  "devDependencies": {
    "vega-schema": "*"
  },
  "gitHead": "b460f55b7bdf668e855ed2f00d9c88f4e836dcb9",
  "homepage": "https://github.com/vega/vega#readme",
  "jsdelivr": "build/vega.min.js",
  "keywords": [
    "vega",
    "visualization",
    "interaction",
    "dataflow",
    "library",
    "data",
    "d3"
  ],
  "license": "BSD-3-Clause",
  "main": "build/vega-node.js",
  "module": "index",
  "name": "vega",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/vega/vega.git"
  },
  "scripts": {
    "build": "yarn rollup && node rollup -e && node rollup -m",
    "postbuild": "terser build/vega.js -c -m -o build/vega.min.js && terser build/vega-core.js -c -m -o build/vega-core.min.js",
    "postpublish": "git push && git push --tags && ./schema-deploy.sh",
    "prebuild": "rimraf build && mkdirp build",
    "prepublishOnly": "yarn test && yarn build",
    "pretest": "yarn prebuild && yarn rollup",
    "rollup": "node rollup-node && node rollup && node schema-copy",
    "test": "TZ=America/Los_Angeles tape 'test/**/*-test.js' && eslint index.js test"
  },
  "types": "index.d.ts",
  "unpkg": "build/vega.min.js",
  "version": "5.8.1"
}
;
},{}],"NKpT":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _vegaUtil = require("vega-util");

var Default = 'default';

function _default(view) {
  var cursor = view._signals.cursor; // add cursor signal to dataflow, if needed

  if (!cursor) {
    view._signals.cursor = cursor = view.add({
      user: Default,
      item: null
    });
  } // evaluate cursor on each mousemove event


  view.on(view.events('view', 'mousemove'), cursor, function (_, event) {
    var value = cursor.value,
        user = value ? (0, _vegaUtil.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 (_) {
    var user = _.cursor,
        item = this.value;

    if (!(0, _vegaUtil.isString)(user)) {
      item = user.item;
      user = user.user;
    }

    setCursor(user && user !== Default ? user : item || user);
    return item;
  }, {
    cursor: cursor
  });
}

function setCursor(cursor) {
  // set cursor on document body
  // this ensures cursor applies even if dragging out of view
  if (typeof document !== 'undefined' && document.body) {
    document.body.style.cursor = cursor;
  }
}
},{"vega-util":"dejJ"}],"F0bw":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.dataref = dataref;
exports.data = data;
exports.change = change;
exports.insert = insert;
exports.remove = remove;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

function dataref(view, name) {
  var data = view._runtime.data;

  if (!(0, _vegaUtil.hasOwnProperty)(data, name)) {
    (0, _vegaUtil.error)('Unrecognized data set: ' + name);
  }

  return data[name];
}

function data(name, values) {
  return arguments.length < 2 ? dataref(this, name).values.value : change.call(this, name, (0, _vegaDataflow.changeset)().remove(_vegaUtil.truthy).insert(values));
}

function change(name, changes) {
  if (!(0, _vegaDataflow.isChangeSet)(changes)) {
    (0, _vegaUtil.error)('Second argument to changes must be a changeset.');
  }

  var dataset = dataref(this, name);
  dataset.modified = true;
  return this.pulse(dataset.input, changes);
}

function insert(name, _) {
  return change.call(this, name, (0, _vegaDataflow.changeset)().insert(_));
}

function remove(name, _) {
  return change.call(this, name, (0, _vegaDataflow.changeset)().remove(_));
}
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"DnBT":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.width = width;
exports.height = height;
exports.offset = offset;
exports.resizeRenderer = resizeRenderer;

function width(view) {
  var padding = view.padding();
  return Math.max(0, view._viewWidth + padding.left + padding.right);
}

function height(view) {
  var padding = view.padding();
  return Math.max(0, view._viewHeight + padding.top + padding.bottom);
}

function offset(view) {
  var padding = view.padding(),
      origin = view._origin;
  return [padding.left + origin[0], padding.top + origin[1]];
}

function resizeRenderer(view) {
  var origin = offset(view),
      w = width(view),
      h = height(view);

  view._renderer.background(view._background);

  view._renderer.resize(w, h, origin);

  view._handler.origin(origin);

  view._resizeListeners.forEach(function (handler) {
    try {
      handler(w, h);
    } catch (error) {
      view.error(error);
    }
  });
}
},{}],"ldGb":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _renderSize = require("./render-size");

var _vegaUtil = require("vega-util");

var _vegaScenegraph = require("vega-scenegraph");

/**
 * 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 _default(view, event, item) {
  var r = view._renderer,
      el = r && r.canvas(),
      p,
      e,
      translate;

  if (el) {
    translate = (0, _renderSize.offset)(view);
    e = event.changedTouches ? event.changedTouches[0] : event;
    p = (0, _vegaScenegraph.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) {
  var 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 ((0, _vegaUtil.isString)(item)) item = group(item);
    var 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: (0, _vegaUtil.constant)(view),
    item: (0, _vegaUtil.constant)(item || {}),
    group: group,
    xy: xy,
    x: function (item) {
      return xy(item)[0];
    },
    y: function (item) {
      return xy(item)[1];
    }
  };
}
},{"./render-size":"DnBT","vega-util":"dejJ","vega-scenegraph":"rKdC"}],"yLPS":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.initializeEventConfig = initializeEventConfig;
exports.events = events;

var _eventsExtend = _interopRequireDefault(require("./events-extend"));

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

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 = (0, _vegaUtil.extend)({
    defaults: {}
  }, config);

  const unpack = (obj, keys) => {
    keys.forEach(k => {
      if ((0, _vegaUtil.isArray)(obj[k])) obj[k] = (0, _vegaUtil.toSet)(obj[k]);
    });
  };

  unpack(events.defaults, ['prevent', 'allow']);
  unpack(events, ['view', 'window', 'selector']);
  return events;
}

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 || (0, _vegaUtil.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 events(source, type, filter) {
  var view = this,
      s = new _vegaDataflow.EventStream(filter),
      send = function (e, item) {
    view.runAsync(null, () => {
      if (source === VIEW && prevent(view, type)) {
        e.preventDefault();
      }

      s.receive((0, _eventsExtend.default)(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);
      }

      view._eventListeners.push({
        type: type,
        sources: sources,
        handler: send
      });
    }
  }

  return s;
}
},{"./events-extend":"ldGb","vega-dataflow":"UC8n","vega-util":"dejJ"}],"yKgy":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

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 _default(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;
}
},{}],"GIsK":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

/**
 * Finalize a View instance that is being removed.
 * Cancel any running timers.
 * Remove all external event listeners.
 * Remove any currently displayed tooltip.
 */
function _default() {
  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;
}
},{}],"UZ1A":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(tag, attr, text) {
  var el = document.createElement(tag);

  for (var key in attr) el.setAttribute(key, attr[key]);

  if (text != null) el.textContent = text;
  return el;
}
},{}],"YQmk":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _element = _interopRequireDefault(require("./element"));

var _vegaUtil = require("vega-util");

var _d3Array = require("d3-array");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var BindClass = 'vega-bind',
    NameClass = 'vega-bind-name',
    RadioClass = 'vega-bind-radio',
    OptionClass = 'vega-option-';
/**
 * 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 _default(view, el, binding) {
  if (!el) return;
  var param = binding.param,
      bind = binding.state;

  if (!bind) {
    bind = binding.state = {
      elements: null,
      active: false,
      set: null,
      update: function (value) {
        if (value !== view.signal(param.signal)) {
          view.runAsync(null, function () {
            bind.source = true;
            view.signal(param.signal, value);
          });
        }
      }
    };

    if (param.debounce) {
      bind.update = (0, _vegaUtil.debounce)(param.debounce, bind.update);
    }
  }

  generate(bind, el, param, view.signal(param.signal));

  if (!bind.active) {
    view.on(view._signals[param.signal], null, function () {
      bind.source ? bind.source = false : bind.set(view.signal(param.signal));
    });
    bind.active = true;
  }

  return bind;
}
/**
 * Generate an HTML input form element and bind it to a signal.
 */


function generate(bind, el, param, value) {
  var div = (0, _element.default)('div', {
    'class': BindClass
  });
  div.appendChild((0, _element.default)('span', {
    'class': NameClass
  }, param.name || param.signal));
  el.appendChild(div);
  var input = form;

  switch (param.input) {
    case 'checkbox':
      input = checkbox;
      break;

    case 'select':
      input = select;
      break;

    case 'radio':
      input = radio;
      break;

    case 'range':
      input = range;
      break;
  }

  input(bind, div, param, value);
}
/**
 * Generates an arbitrary input form element.
 * The input type is controlled via user-provided parameters.
 */


function form(bind, el, param, value) {
  var node = (0, _element.default)('input');

  for (var 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', function () {
    bind.update(node.value);
  });
  bind.elements = [node];

  bind.set = function (value) {
    node.value = value;
  };
}
/**
 * Generates a checkbox input element.
 */


function checkbox(bind, el, param, value) {
  var attr = {
    type: 'checkbox',
    name: param.signal
  };
  if (value) attr.checked = true;
  var node = (0, _element.default)('input', attr);
  el.appendChild(node);
  node.addEventListener('change', function () {
    bind.update(node.checked);
  });
  bind.elements = [node];

  bind.set = function (value) {
    node.checked = !!value || null;
  };
}
/**
 * Generates a selection list input element.
 */


function select(bind, el, param, value) {
  var node = (0, _element.default)('select', {
    name: param.signal
  });
  param.options.forEach(function (option) {
    var attr = {
      value: option
    };
    if (valuesEqual(option, value)) attr.selected = true;
    node.appendChild((0, _element.default)('option', attr, option + ''));
  });
  el.appendChild(node);
  node.addEventListener('change', function () {
    bind.update(param.options[node.selectedIndex]);
  });
  bind.elements = [node];

  bind.set = function (value) {
    for (var 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 radio(bind, el, param, value) {
  var group = (0, _element.default)('span', {
    'class': RadioClass
  });
  el.appendChild(group);
  bind.elements = param.options.map(function (option) {
    var id = OptionClass + param.signal + '-' + option;
    var attr = {
      id: id,
      type: 'radio',
      name: param.signal,
      value: option
    };
    if (valuesEqual(option, value)) attr.checked = true;
    var input = (0, _element.default)('input', attr);
    input.addEventListener('change', function () {
      bind.update(option);
    });
    group.appendChild(input);
    group.appendChild((0, _element.default)('label', {
      'for': id
    }, option + ''));
    return input;
  });

  bind.set = function (value) {
    var nodes = bind.elements,
        i = 0,
        n = nodes.length;

    for (; i < n; ++i) {
      if (valuesEqual(nodes[i].value, value)) nodes[i].checked = true;
    }
  };
}
/**
 * Generates a slider input element.
 */


function range(bind, el, param, value) {
  value = value !== undefined ? value : (+param.max + +param.min) / 2;
  var max = param.max != null ? param.max : Math.max(100, +value) || 100,
      min = param.min || Math.min(0, max, +value) || 0,
      step = param.step || (0, _d3Array.tickStep)(min, max, 100);
  var node = (0, _element.default)('input', {
    type: 'range',
    name: param.signal,
    min: min,
    max: max,
    step: step
  });
  node.value = value;
  var label = (0, _element.default)('label', {}, +value);
  el.appendChild(node);
  el.appendChild(label);

  function update() {
    label.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 = function (value) {
    node.value = value;
    label.textContent = value;
  };
}

function valuesEqual(a, b) {
  return a === b || a + '' === b + '';
}
},{"./element":"UZ1A","vega-util":"dejJ","d3-array":"Rpnd"}],"NrzC":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _renderSize = require("./render-size");

function _default(view, r, el, constructor, scaleFactor, opt) {
  r = r || new constructor(view.loader());
  return r.initialize(el, (0, _renderSize.width)(view), (0, _renderSize.height)(view), (0, _renderSize.offset)(view), scaleFactor, opt).background(view._background);
}
},{"./render-size":"DnBT"}],"Pywq":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(view, fn) {
  return !fn ? null : function () {
    try {
      fn.apply(this, arguments);
    } catch (error) {
      view.error(error);
    }
  };
}
},{}],"cxaI":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _renderSize = require("./render-size");

var _trap = _interopRequireDefault(require("./trap"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(view, prevHandler, el, constructor) {
  // instantiate scenegraph handler
  var handler = new constructor(view.loader(), (0, _trap.default)(view, view.tooltip())).scene(view.scenegraph().root).initialize(el, (0, _renderSize.offset)(view), view); // transfer event handlers

  if (prevHandler) {
    prevHandler.handlers().forEach(function (h) {
      handler.on(h.type, h.handler);
    });
  }

  return handler;
}
},{"./render-size":"DnBT","./trap":"Pywq"}],"n2uX":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _bind = _interopRequireDefault(require("./bind"));

var _element = _interopRequireDefault(require("./element"));

var _initializeRenderer = _interopRequireDefault(require("./initialize-renderer"));

var _initializeHandler = _interopRequireDefault(require("./initialize-handler"));

var _vegaScenegraph = require("vega-scenegraph");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(el, elBind) {
  var view = this,
      type = view._renderType,
      config = view._eventConfig.bind,
      module = (0, _vegaScenegraph.renderModule)(type),
      Handler,
      Renderer; // containing dom element

  el = view._el = el ? lookup(view, el) : null; // select appropriate renderer & handler

  if (!module) view.error('Unrecognized renderer type: ' + type);
  Handler = module.handler || _vegaScenegraph.CanvasHandler;
  Renderer = el ? module.renderer : module.headless; // initialize renderer and input handler

  view._renderer = !Renderer ? null : (0, _initializeRenderer.default)(view, view._renderer, el, Renderer);
  view._handler = (0, _initializeHandler.default)(view, view._handler, el, Handler);
  view._redraw = true; // initialize signal bindings

  if (el && config !== 'none') {
    elBind = elBind ? view._elBind = lookup(view, elBind) : el.appendChild((0, _element.default)('div', {
      'class': 'vega-bindings'
    }));

    view._bind.forEach(function (_) {
      if (_.param.element && config !== 'container') {
        _.element = lookup(view, _.param.element);
      }
    });

    view._bind.forEach(function (_) {
      (0, _bind.default)(view, _.element || elBind, _);
    });
  }

  return view;
}

function lookup(view, el) {
  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) {
    try {
      el.innerHTML = '';
    } catch (e) {
      el = null;
      view.error(e);
    }
  }

  return el;
}
},{"./bind":"YQmk","./element":"UZ1A","./initialize-renderer":"NrzC","./initialize-handler":"cxaI","vega-scenegraph":"rKdC"}],"i9Xy":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _initializeRenderer = _interopRequireDefault(require("./initialize-renderer"));

var _vegaScenegraph = require("vega-scenegraph");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * 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 _default(view, type, scaleFactor, opt) {
  const module = (0, _vegaScenegraph.renderModule)(type),
        ctr = module && module.headless;
  if (!ctr) (0, _vegaUtil.error)('Unrecognized renderer type: ' + type);
  await view.runAsync();
  return (0, _initializeRenderer.default)(view, null, null, ctr, scaleFactor, opt).renderAsync(view._scenegraph.root);
}
},{"./initialize-renderer":"NrzC","vega-scenegraph":"rKdC","vega-util":"dejJ"}],"q9KE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _renderHeadless = _interopRequireDefault(require("./render-headless"));

var _vegaScenegraph = require("vega-scenegraph");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * 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 _default(type, scaleFactor) {
  if (type !== _vegaScenegraph.RenderType.Canvas && type !== _vegaScenegraph.RenderType.SVG && type !== _vegaScenegraph.RenderType.PNG) {
    (0, _vegaUtil.error)('Unrecognized image type: ' + type);
  }

  const r = await (0, _renderHeadless.default)(this, type, scaleFactor);
  return type === _vegaScenegraph.RenderType.SVG ? toBlobURL(r.svg(), 'image/svg+xml') : r.canvas().toDataURL('image/png');
}

function toBlobURL(data, mime) {
  var blob = new Blob([data], {
    type: mime
  });
  return window.URL.createObjectURL(blob);
}
},{"./render-headless":"i9Xy","vega-scenegraph":"rKdC","vega-util":"dejJ"}],"f2sY":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _renderHeadless = _interopRequireDefault(require("./render-headless"));

var _vegaScenegraph = require("vega-scenegraph");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * 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 _default(scaleFactor, opt) {
  const r = await (0, _renderHeadless.default)(this, _vegaScenegraph.RenderType.Canvas, scaleFactor, opt);
  return r.canvas();
}
},{"./render-headless":"i9Xy","vega-scenegraph":"rKdC"}],"TZ4d":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _renderHeadless = _interopRequireDefault(require("./render-headless"));

var _vegaScenegraph = require("vega-scenegraph");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * 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 _default(scaleFactor) {
  const r = await (0, _renderHeadless.default)(this, _vegaScenegraph.RenderType.SVG, scaleFactor);
  return r.svg();
}
},{"./render-headless":"i9Xy","vega-scenegraph":"rKdC"}],"XKkZ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = ASTNode;
exports.UnaryExpression = exports.ObjectExpression = exports.MemberExpression = exports.LogicalExpression = exports.ConditionalExpression = exports.CallExpression = exports.BinaryExpression = exports.ArrayExpression = exports.Identifier = exports.Property = exports.Literal = exports.RawCode = void 0;
var RawCode = 'RawCode';
exports.RawCode = RawCode;
var Literal = 'Literal';
exports.Literal = Literal;
var Property = 'Property';
exports.Property = Property;
var Identifier = 'Identifier';
exports.Identifier = Identifier;
var ArrayExpression = 'ArrayExpression';
exports.ArrayExpression = ArrayExpression;
var BinaryExpression = 'BinaryExpression';
exports.BinaryExpression = BinaryExpression;
var CallExpression = 'CallExpression';
exports.CallExpression = CallExpression;
var ConditionalExpression = 'ConditionalExpression';
exports.ConditionalExpression = ConditionalExpression;
var LogicalExpression = 'LogicalExpression';
exports.LogicalExpression = LogicalExpression;
var MemberExpression = 'MemberExpression';
exports.MemberExpression = MemberExpression;
var ObjectExpression = 'ObjectExpression';
exports.ObjectExpression = ObjectExpression;
var UnaryExpression = 'UnaryExpression';
exports.UnaryExpression = UnaryExpression;

function ASTNode(type) {
  this.type = type;
}

ASTNode.prototype.visit = function (visitor) {
  var node = this,
      c,
      i,
      n;
  if (visitor(node)) return 1;

  for (c = children(node), i = 0, n = c.length; i < n; ++i) {
    if (c[i].visit(visitor)) return 1;
  }
};

function children(node) {
  switch (node.type) {
    case ArrayExpression:
      return node.elements;

    case BinaryExpression:
    case LogicalExpression:
      return [node.left, node.right];

    case CallExpression:
      var args = node.arguments.slice();
      args.unshift(node.callee);
      return args;

    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 Identifier:
    case Literal:
    case RawCode:
    default:
      return [];
  }
}
},{}],"rmm7":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _ast = _interopRequireDefault(require("./ast"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/*
  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, source, index, 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 || // $ (dollar) and _ (underscore)
  ch >= 0x41 && ch <= 0x5A || // A..Z
  ch >= 0x61 && ch <= 0x7A || // a..z
  ch === 0x5C || // \ (backslash)
  ch >= 0x80 && RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch));
}

function 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 && RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch));
} // 7.6.1.1 Keywords


var 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() {
  var ch;

  while (index < length) {
    ch = source.charCodeAt(index);

    if (isWhiteSpace(ch) || isLineTerminator(ch)) {
      ++index;
    } else {
      break;
    }
  }
}

function scanHexEscape(prefix) {
  var i,
      len,
      ch,
      code = 0;
  len = prefix === 'u' ? 4 : 2;

  for (i = 0; i < len; ++i) {
    if (index < length && isHexDigit(source[index])) {
      ch = source[index++];
      code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
    } else {
      throwError({}, MessageUnexpectedToken, ILLEGAL);
    }
  }

  return String.fromCharCode(code);
}

function scanUnicodeCodePointEscape() {
  var ch, code, cu1, cu2;
  ch = source[index];
  code = 0; // At least, one hex digit is required.

  if (ch === '}') {
    throwError({}, MessageUnexpectedToken, ILLEGAL);
  }

  while (index < length) {
    ch = source[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 = source.charCodeAt(index++);
  id = String.fromCharCode(ch); // '\u' (U+005C, U+0075) denotes an escaped character.

  if (ch === 0x5C) {
    if (source.charCodeAt(index) !== 0x75) {
      throwError({}, MessageUnexpectedToken, ILLEGAL);
    }

    ++index;
    ch = scanHexEscape('u');

    if (!ch || ch === '\\' || !isIdentifierStart(ch.charCodeAt(0))) {
      throwError({}, MessageUnexpectedToken, ILLEGAL);
    }

    id = ch;
  }

  while (index < length) {
    ch = source.charCodeAt(index);

    if (!isIdentifierPart(ch)) {
      break;
    }

    ++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 (source.charCodeAt(index) !== 0x75) {
        throwError({}, MessageUnexpectedToken, ILLEGAL);
      }

      ++index;
      ch = scanHexEscape('u');

      if (!ch || ch === '\\' || !isIdentifierPart(ch.charCodeAt(0))) {
        throwError({}, MessageUnexpectedToken, ILLEGAL);
      }

      id += ch;
    }
  }

  return id;
}

function getIdentifier() {
  var start, ch;
  start = index++;

  while (index < length) {
    ch = source.charCodeAt(index);

    if (ch === 0x5C) {
      // Blackslash (U+005C) marks Unicode escape sequence.
      index = start;
      return getEscapedIdentifier();
    }

    if (isIdentifierPart(ch)) {
      ++index;
    } else {
      break;
    }
  }

  return source.slice(start, index);
}

function scanIdentifier() {
  var start, id, type;
  start = index; // Backslash (U+005C) starts an escaped character.

  id = source.charCodeAt(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: index
  };
} // 7.7 Punctuators


function scanPunctuator() {
  var start = index,
      code = source.charCodeAt(index),
      code2,
      ch1 = source[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:
      // ~
      ++index;
      return {
        type: TokenPunctuator,
        value: String.fromCharCode(code),
        start: start,
        end: index
      };

    default:
      code2 = source.charCodeAt(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:
            // *
            index += 2;
            return {
              type: TokenPunctuator,
              value: String.fromCharCode(code) + String.fromCharCode(code2),
              start: start,
              end: index
            };

          case 0x21: // !

          case 0x3D:
            // =
            index += 2; // !== and ===

            if (source.charCodeAt(index) === 0x3D) {
              ++index;
            }

            return {
              type: TokenPunctuator,
              value: source.slice(start, index),
              start: start,
              end: index
            };
        }
      }

  } // 4-character punctuator: >>>=


  ch4 = source.substr(index, 4);

  if (ch4 === '>>>=') {
    index += 4;
    return {
      type: TokenPunctuator,
      value: ch4,
      start: start,
      end: index
    };
  } // 3-character punctuators: === !== >>> <<= >>=


  ch3 = ch4.substr(0, 3);

  if (ch3 === '>>>' || ch3 === '<<=' || ch3 === '>>=') {
    index += 3;
    return {
      type: TokenPunctuator,
      value: ch3,
      start: start,
      end: index
    };
  } // Other 2-character punctuators: ++ -- << >> && ||


  ch2 = ch3.substr(0, 2);

  if (ch1 === ch2[1] && '+-<>&|'.indexOf(ch1) >= 0 || ch2 === '=>') {
    index += 2;
    return {
      type: TokenPunctuator,
      value: ch2,
      start: start,
      end: index
    };
  } // 1-character punctuators: < > = ! + - * % & | ^ /


  if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) {
    ++index;
    return {
      type: TokenPunctuator,
      value: ch1,
      start: start,
      end: index
    };
  }

  throwError({}, MessageUnexpectedToken, ILLEGAL);
} // 7.8.3 Numeric Literals


function scanHexLiteral(start) {
  var number = '';

  while (index < length) {
    if (!isHexDigit(source[index])) {
      break;
    }

    number += source[index++];
  }

  if (number.length === 0) {
    throwError({}, MessageUnexpectedToken, ILLEGAL);
  }

  if (isIdentifierStart(source.charCodeAt(index))) {
    throwError({}, MessageUnexpectedToken, ILLEGAL);
  }

  return {
    type: TokenNumericLiteral,
    value: parseInt('0x' + number, 16),
    start: start,
    end: index
  };
}

function scanOctalLiteral(start) {
  var number = '0' + source[index++];

  while (index < length) {
    if (!isOctalDigit(source[index])) {
      break;
    }

    number += source[index++];
  }

  if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) {
    throwError({}, MessageUnexpectedToken, ILLEGAL);
  }

  return {
    type: TokenNumericLiteral,
    value: parseInt(number, 8),
    octal: true,
    start: start,
    end: index
  };
}

function scanNumericLiteral() {
  var number, start, ch;
  ch = source[index];
  assert(isDecimalDigit(ch.charCodeAt(0)) || ch === '.', 'Numeric literal must start with a decimal digit or a decimal point');
  start = index;
  number = '';

  if (ch !== '.') {
    number = source[index++];
    ch = source[index]; // Hex number starts with '0x'.
    // Octal number starts with '0'.

    if (number === '0') {
      if (ch === 'x' || ch === 'X') {
        ++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(source.charCodeAt(index))) {
      number += source[index++];
    }

    ch = source[index];
  }

  if (ch === '.') {
    number += source[index++];

    while (isDecimalDigit(source.charCodeAt(index))) {
      number += source[index++];
    }

    ch = source[index];
  }

  if (ch === 'e' || ch === 'E') {
    number += source[index++];
    ch = source[index];

    if (ch === '+' || ch === '-') {
      number += source[index++];
    }

    if (isDecimalDigit(source.charCodeAt(index))) {
      while (isDecimalDigit(source.charCodeAt(index))) {
        number += source[index++];
      }
    } else {
      throwError({}, MessageUnexpectedToken, ILLEGAL);
    }
  }

  if (isIdentifierStart(source.charCodeAt(index))) {
    throwError({}, MessageUnexpectedToken, ILLEGAL);
  }

  return {
    type: TokenNumericLiteral,
    value: parseFloat(number),
    start: start,
    end: index
  };
} // 7.8.4 String Literals


function scanStringLiteral() {
  var str = '',
      quote,
      start,
      ch,
      code,
      octal = false;
  quote = source[index];
  assert(quote === '\'' || quote === '"', 'String literal must starts with a quote');
  start = index;
  ++index;

  while (index < length) {
    ch = source[index++];

    if (ch === quote) {
      quote = '';
      break;
    } else if (ch === '\\') {
      ch = source[index++];

      if (!ch || !isLineTerminator(ch.charCodeAt(0))) {
        switch (ch) {
          case 'u':
          case 'x':
            if (source[index] === '{') {
              ++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 (index < length && isOctalDigit(source[index])) {
                octal = true;
                code = code * 8 + '01234567'.indexOf(source[index++]); // 3 digits are only allowed when string starts
                // with 0, 1, 2, 3

                if ('0123'.indexOf(ch) >= 0 && index < length && isOctalDigit(source[index])) {
                  code = code * 8 + '01234567'.indexOf(source[index++]);
                }
              }

              str += String.fromCharCode(code);
            } else {
              str += ch;
            }

            break;
        }
      } else {
        if (ch === '\r' && source[index] === '\n') {
          ++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: index
  };
}

function 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';
      }

      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 = source[index];
  assert(ch === '/', 'Regular expression literal must start with a slash');
  str = source[index++];
  classMarker = false;
  terminated = false;

  while (index < length) {
    ch = source[index++];
    str += ch;

    if (ch === '\\') {
      ch = source[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 (index < length) {
    ch = source[index];

    if (!isIdentifierPart(ch.charCodeAt(0))) {
      break;
    }

    ++index;

    if (ch === '\\' && index < 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 = 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: index
  };
}

function isIdentifierName(token) {
  return token.type === TokenIdentifier || token.type === TokenKeyword || token.type === TokenBooleanLiteral || token.type === TokenNullLiteral;
}

function advance() {
  var ch;
  skipComment();

  if (index >= length) {
    return {
      type: TokenEOF,
      start: index,
      end: index
    };
  }

  ch = source.charCodeAt(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(source.charCodeAt(index + 1))) {
      return scanNumericLiteral();
    }

    return scanPunctuator();
  }

  if (isDecimalDigit(ch)) {
    return scanNumericLiteral();
  }

  return scanPunctuator();
}

function lex() {
  var token;
  token = lookahead;
  index = token.end;
  lookahead = advance();
  index = token.end;
  return token;
}

function peek() {
  var pos;
  pos = index;
  lookahead = advance();
  index = pos;
}

function finishArrayExpression(elements) {
  var node = new _ast.default(SyntaxArrayExpression);
  node.elements = elements;
  return node;
}

function finishBinaryExpression(operator, left, right) {
  var node = new _ast.default(operator === '||' || operator === '&&' ? SyntaxLogicalExpression : SyntaxBinaryExpression);
  node.operator = operator;
  node.left = left;
  node.right = right;
  return node;
}

function finishCallExpression(callee, args) {
  var node = new _ast.default(SyntaxCallExpression);
  node.callee = callee;
  node.arguments = args;
  return node;
}

function finishConditionalExpression(test, consequent, alternate) {
  var node = new _ast.default(SyntaxConditionalExpression);
  node.test = test;
  node.consequent = consequent;
  node.alternate = alternate;
  return node;
}

function finishIdentifier(name) {
  var node = new _ast.default(SyntaxIdentifier);
  node.name = name;
  return node;
}

function finishLiteral(token) {
  var node = new _ast.default(SyntaxLiteral);
  node.value = token.value;
  node.raw = 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) {
  var node = new _ast.default(SyntaxMemberExpression);
  node.computed = accessor === '[';
  node.object = object;
  node.property = property;
  if (!node.computed) property.member = true;
  return node;
}

function finishObjectExpression(properties) {
  var node = new _ast.default(SyntaxObjectExpression);
  node.properties = properties;
  return node;
}

function finishProperty(kind, key, value) {
  var node = new _ast.default(SyntaxProperty);
  node.key = key;
  node.value = value;
  node.kind = kind;
  return node;
}

function finishUnaryExpression(operator, argument) {
  var node = new _ast.default(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, function (whole, index) {
    assert(index < args.length, 'Message reference must be in range');
    return args[index];
  });
  error = new Error(msg);
  error.index = 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) {
  var 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() {
  var elements = [];
  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() {
  var token;
  index = lookahead.start;
  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;
  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;
  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() {
  var expr;
  expect('(');
  expr = parseExpression();
  expect(')');
  return expr;
} // 11.1 Primary Expressions


var legalKeywords = {
  "if": 1,
  "this": 1
};

function parsePrimaryExpression() {
  var type, token, expr;

  if (match('(')) {
    return parseGroupExpression();
  }

  if (match('[')) {
    return parseArrayInitialiser();
  }

  if (match('{')) {
    return parseObjectInitialiser();
  }

  type = lookahead.type;
  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() {
  var args = [];
  expect('(');

  if (!match(')')) {
    while (index < length) {
      args.push(parseConditionalExpression());

      if (match(')')) {
        break;
      }

      expect(',');
    }
  }

  expect(')');
  return args;
}

function parseNonComputedProperty() {
  var token;
  index = lookahead.start;
  token = lex();

  if (!isIdentifierName(token)) {
    throwUnexpected(token);
  }

  return finishIdentifier(token.value);
}

function parseNonComputedMember() {
  expect('.');
  return parseNonComputedProperty();
}

function parseComputedMember() {
  var expr;
  expect('[');
  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() {
  var 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) {
  var 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;

    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 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() {
  var expr = parseConditionalExpression();

  if (match(',')) {
    throw new Error(DISABLED); // no sequence expressions
  }

  return expr;
}

function _default(code) {
  source = code;
  index = 0;
  length = source.length;
  lookahead = null;
  peek();
  var expr = parseExpression();

  if (lookahead.type !== TokenEOF) {
    throw new Error("Unexpect token after expression.");
  }

  return expr;
}
},{"./ast":"XKkZ"}],"K7Bh":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _default = {
  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'
};
exports.default = _default;
},{}],"UolI":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _vegaUtil = require("vega-util");

function _default(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 (args) {
      if (args.length < 3) (0, _vegaUtil.error)('Missing arguments to clamp function.');
      if (args.length > 3) (0, _vegaUtil.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 (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 (args) {
      if (args.length < 3) (0, _vegaUtil.error)('Missing arguments to if function.');
      if (args.length > 3) (0, _vegaUtil.error)('Too many arguments to if function.');
      var a = args.map(codegen);
      return '(' + a[0] + '?' + a[1] + ':' + a[2] + ')';
    }
  };
}
},{"vega-util":"dejJ"}],"q5xb":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constants = _interopRequireDefault(require("./constants"));

var _functions = _interopRequireDefault(require("./functions"));

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function stripQuotes(s) {
  var n = s && s.length - 1;
  return n && (s[0] === '"' && s[n] === '"' || s[0] === '\'' && s[n] === '\'') ? s.slice(1, -1) : s;
}

function _default(opt) {
  opt = opt || {};

  var whitelist = opt.whitelist ? (0, _vegaUtil.toSet)(opt.whitelist) : {},
      blacklist = opt.blacklist ? (0, _vegaUtil.toSet)(opt.blacklist) : {},
      constants = opt.constants || _constants.default,
      functions = (opt.functions || _functions.default)(visit),
      globalvar = opt.globalvar,
      fieldvar = opt.fieldvar,
      globals = {},
      fields = {},
      memberDepth = 0;

  var outputGlobal = (0, _vegaUtil.isFunction)(globalvar) ? globalvar : function (id) {
    return globalvar + '["' + id + '"]';
  };

  function visit(ast) {
    if ((0, _vegaUtil.isString)(ast)) return ast;
    var generator = Generators[ast.type];
    if (generator == null) (0, _vegaUtil.error)('Unsupported type: ' + ast.type);
    return generator(ast);
  }

  var Generators = {
    Literal: function (n) {
      return n.raw;
    },
    Identifier: function (n) {
      var id = n.name;

      if (memberDepth > 0) {
        return id;
      } else if ((0, _vegaUtil.hasOwnProperty)(blacklist, id)) {
        return (0, _vegaUtil.error)('Illegal identifier: ' + id);
      } else if ((0, _vegaUtil.hasOwnProperty)(constants, id)) {
        return constants[id];
      } else if ((0, _vegaUtil.hasOwnProperty)(whitelist, id)) {
        return id;
      } else {
        globals[id] = 1;
        return outputGlobal(id);
      }
    },
    MemberExpression: function (n) {
      var d = !n.computed;
      var o = visit(n.object);
      if (d) memberDepth += 1;
      var 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: function (n) {
      if (n.callee.type !== 'Identifier') {
        (0, _vegaUtil.error)('Illegal callee type: ' + n.callee.type);
      }

      var callee = n.callee.name;
      var args = n.arguments;
      var fn = (0, _vegaUtil.hasOwnProperty)(functions, callee) && functions[callee];
      if (!fn) (0, _vegaUtil.error)('Unrecognized function: ' + callee);
      return (0, _vegaUtil.isFunction)(fn) ? fn(args) : fn + '(' + args.map(visit).join(',') + ')';
    },
    ArrayExpression: function (n) {
      return '[' + n.elements.map(visit).join(',') + ']';
    },
    BinaryExpression: function (n) {
      return '(' + visit(n.left) + n.operator + visit(n.right) + ')';
    },
    UnaryExpression: function (n) {
      return '(' + n.operator + visit(n.argument) + ')';
    },
    ConditionalExpression: function (n) {
      return '(' + visit(n.test) + '?' + visit(n.consequent) + ':' + visit(n.alternate) + ')';
    },
    LogicalExpression: function (n) {
      return '(' + visit(n.left) + n.operator + visit(n.right) + ')';
    },
    ObjectExpression: function (n) {
      return '{' + n.properties.map(visit).join(',') + '}';
    },
    Property: function (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;
}
},{"./constants":"K7Bh","./functions":"UolI","vega-util":"dejJ"}],"rJuS":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "RawCode", {
  enumerable: true,
  get: function () {
    return _ast.RawCode;
  }
});
Object.defineProperty(exports, "Literal", {
  enumerable: true,
  get: function () {
    return _ast.Literal;
  }
});
Object.defineProperty(exports, "Property", {
  enumerable: true,
  get: function () {
    return _ast.Property;
  }
});
Object.defineProperty(exports, "Identifier", {
  enumerable: true,
  get: function () {
    return _ast.Identifier;
  }
});
Object.defineProperty(exports, "ArrayExpression", {
  enumerable: true,
  get: function () {
    return _ast.ArrayExpression;
  }
});
Object.defineProperty(exports, "BinaryExpression", {
  enumerable: true,
  get: function () {
    return _ast.BinaryExpression;
  }
});
Object.defineProperty(exports, "CallExpression", {
  enumerable: true,
  get: function () {
    return _ast.CallExpression;
  }
});
Object.defineProperty(exports, "ConditionalExpression", {
  enumerable: true,
  get: function () {
    return _ast.ConditionalExpression;
  }
});
Object.defineProperty(exports, "LogicalExpression", {
  enumerable: true,
  get: function () {
    return _ast.LogicalExpression;
  }
});
Object.defineProperty(exports, "MemberExpression", {
  enumerable: true,
  get: function () {
    return _ast.MemberExpression;
  }
});
Object.defineProperty(exports, "ObjectExpression", {
  enumerable: true,
  get: function () {
    return _ast.ObjectExpression;
  }
});
Object.defineProperty(exports, "UnaryExpression", {
  enumerable: true,
  get: function () {
    return _ast.UnaryExpression;
  }
});
Object.defineProperty(exports, "ASTNode", {
  enumerable: true,
  get: function () {
    return _ast.default;
  }
});
Object.defineProperty(exports, "parse", {
  enumerable: true,
  get: function () {
    return _parser.default;
  }
});
Object.defineProperty(exports, "codegen", {
  enumerable: true,
  get: function () {
    return _codegen.default;
  }
});
Object.defineProperty(exports, "functions", {
  enumerable: true,
  get: function () {
    return _functions.default;
  }
});
Object.defineProperty(exports, "constants", {
  enumerable: true,
  get: function () {
    return _constants.default;
  }
});

var _ast = _interopRequireWildcard(require("./src/ast"));

var _parser = _interopRequireDefault(require("./src/parser"));

var _codegen = _interopRequireDefault(require("./src/codegen"));

var _functions = _interopRequireDefault(require("./src/functions"));

var _constants = _interopRequireDefault(require("./src/constants"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
},{"./src/ast":"XKkZ","./src/parser":"rmm7","./src/codegen":"q5xb","./src/functions":"UolI","./src/constants":"K7Bh"}],"sHy0":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.And = exports.Or = exports.VlMulti = exports.Union = exports.Intersect = void 0;
const Intersect = 'intersect';
exports.Intersect = Intersect;
const Union = 'union';
exports.Union = Union;
const VlMulti = 'vlMulti';
exports.VlMulti = VlMulti;
const Or = 'or';
exports.Or = Or;
const And = 'and';
exports.And = And;
},{}],"zqGN":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.selectionTest = selectionTest;

var _constants = require("./constants");

var _vegaUtil = require("vega-util");

var 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 = _vegaUtil.field.getter || (0, _vegaUtil.field)(f.field);
    dval = f.getter(datum);
    if ((0, _vegaUtil.isDate)(dval)) dval = (0, _vegaUtil.toNumber)(dval);
    if ((0, _vegaUtil.isDate)(values[i])) values[i] = (0, _vegaUtil.toNumber)(values[i]);
    if ((0, _vegaUtil.isDate)(values[i][0])) values[i] = values[i].map(_vegaUtil.toNumber);

    if (f.type === TYPE_ENUM) {
      // Enumerated fields can either specify individual values (single/multi selections)
      // or an array of values (interval selections).
      if ((0, _vegaUtil.isArray)(values[i]) ? values[i].indexOf(dval) < 0 : dval !== values[i]) {
        return false;
      }
    } else {
      if (f.type === TYPE_RANGE_INC) {
        if (!(0, _vegaUtil.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 (!(0, _vegaUtil.inrange)(dval, values[i], true, false)) return false;
      } else if (f.type === TYPE_RANGE_EXC) {
        // 'R-E'/'R-LE' included for completeness.
        if (!(0, _vegaUtil.inrange)(dval, values[i], false, false)) return false;
      } else if (f.type === TYPE_RANGE_LE) {
        if (!(0, _vegaUtil.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 === _constants.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;
}
},{"./constants":"sHy0","vega-util":"dejJ"}],"rE2X":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.selectionResolve = selectionResolve;

var _constants = require("./constants");

var _vegaUtil = require("vega-util");

/**
 * 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).
 * @returns {object} An object of selected fields and values.
 */
function selectionResolve(name, op, isMulti) {
  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 = ops[type + '_union'];
      res[unit] = union(resUnit, (0, _vegaUtil.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((0, _vegaUtil.array)(values).reduce((obj, curr, j) => (obj[fields[j].field] = curr, obj), {}));
    }
  } // Then resolve fields across units as per the op.


  op = op || _constants.Union;
  Object.keys(resolved).forEach(function (field) {
    resolved[field] = Object.keys(resolved[field]).map(unit => resolved[field][unit]).reduce((acc, curr) => acc === undefined ? curr : ops[types[field] + '_' + op](acc, curr));
  });
  entries = Object.keys(multiRes);

  if (isMulti && entries.length) {
    resolved[_constants.VlMulti] = op === _constants.Union ? {
      [_constants.Or]: entries.reduce((acc, k) => (acc.push.apply(acc, multiRes[k]), acc), [])
    } : {
      [_constants.And]: entries.map(k => ({
        [_constants.Or]: multiRes[k]
      }))
    };
  }

  return resolved;
}

var 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(function (v) {
      return value.indexOf(v) >= 0;
    });
  },
  R_union: function (base, value) {
    var lo = (0, _vegaUtil.toNumber)(value[0]),
        hi = (0, _vegaUtil.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 = (0, _vegaUtil.toNumber)(value[0]),
        hi = (0, _vegaUtil.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;
  }
};
},{"./constants":"sHy0","vega-util":"dejJ"}],"CNBi":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.selectionVisitor = selectionVisitor;

var _constants = require("./constants");

var _vegaExpression = require("vega-expression");

var _vegaUtil = require("vega-util");

const DataPrefix = ':',
      IndexPrefix = '@';

function selectionVisitor(name, args, scope, params) {
  if (args[0].type !== _vegaExpression.Literal) (0, _vegaUtil.error)('First argument to selection functions must be a string literal.');
  const data = args[0].value,
        op = args.length >= 2 && (0, _vegaUtil.peek)(args).value,
        field = 'unit',
        indexName = IndexPrefix + field,
        dataName = DataPrefix + data; // eslint-disable-next-line no-prototype-builtins

  if (op === _constants.Intersect && !(0, _vegaUtil.hasOwnProperty)(params, indexName)) {
    params[indexName] = scope.getData(data).indataRef(scope, field);
  } // eslint-disable-next-line no-prototype-builtins


  if (!(0, _vegaUtil.hasOwnProperty)(params, dataName)) {
    params[dataName] = scope.getData(data).tuplesRef();
  }
}
},{"./constants":"sHy0","vega-expression":"rJuS","vega-util":"dejJ"}],"fsSi":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "selectionTest", {
  enumerable: true,
  get: function () {
    return _selectionTest.selectionTest;
  }
});
Object.defineProperty(exports, "selectionResolve", {
  enumerable: true,
  get: function () {
    return _selectionResolve.selectionResolve;
  }
});
Object.defineProperty(exports, "selectionVisitor", {
  enumerable: true,
  get: function () {
    return _selectionVisitor.selectionVisitor;
  }
});

var _selectionTest = require("./src/selectionTest");

var _selectionResolve = require("./src/selectionResolve");

var _selectionVisitor = require("./src/selectionVisitor");
},{"./src/selectionTest":"zqGN","./src/selectionResolve":"rE2X","./src/selectionVisitor":"CNBi"}],"ZP9R":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.luminance = luminance;
exports.contrast = contrast;

var _d3Color = require("d3-color");

// https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
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 = (0, _d3Color.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);
}
},{"d3-color":"x3do"}],"WAv9":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.data = data;
exports.indata = indata;
exports.setdata = setdata;

var _vegaUtil = require("vega-util");

function 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(_vegaUtil.truthy).insert(tuples));
  return 1;
}
},{"vega-util":"dejJ"}],"CjAK":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(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;
}
},{}],"ogOy":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.format = format;
exports.timeFormat = timeFormat;
exports.utcFormat = utcFormat;
exports.timeParse = timeParse;
exports.utcParse = utcParse;
exports.monthFormat = monthFormat;
exports.monthAbbrevFormat = monthAbbrevFormat;
exports.dayFormat = dayFormat;
exports.dayAbbrevFormat = dayAbbrevFormat;

var _vegaTime = require("vega-time");

var _d3Format = require("d3-format");

var _d3TimeFormat = require("d3-time-format");

const formatCache = {};

function formatter(type, method, specifier) {
  let k = type + ':' + specifier,
      e = formatCache[k];

  if (!e || e[0] !== method) {
    formatCache[k] = e = [method, method(specifier)];
  }

  return e[1];
}

function format(_, specifier) {
  return formatter('format', _d3Format.format, specifier)(_);
}

function timeFormat(_, specifier) {
  return formatter('timeFormat', _vegaTime.timeFormat, specifier)(_);
}

function utcFormat(_, specifier) {
  return formatter('utcFormat', _vegaTime.utcFormat, specifier)(_);
}

function timeParse(_, specifier) {
  return formatter('timeParse', _d3TimeFormat.timeParse, specifier)(_);
}

function utcParse(_, specifier) {
  return formatter('utcParse', _d3TimeFormat.utcParse, specifier)(_);
}

var dateObj = new Date(2000, 0, 1);

function time(month, day, specifier) {
  if (!Number.isInteger(month) || !Number.isInteger(day)) return '';
  dateObj.setYear(2000);
  dateObj.setMonth(month);
  dateObj.setDate(day);
  return timeFormat(dateObj, specifier);
}

function monthFormat(month) {
  return time(month, 1, '%B');
}

function monthAbbrevFormat(month) {
  return time(month, 1, '%b');
}

function dayFormat(day) {
  return time(0, 2 + day, '%A');
}

function dayAbbrevFormat(day) {
  return time(0, 2 + day, '%a');
}
},{"vega-time":"j8qo","d3-format":"SA6z","d3-time-format":"fort"}],"yJDC":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getScale = getScale;
exports.range = range;
exports.domain = domain;
exports.bandwidth = bandwidth;
exports.bandspace = bandspace;
exports.copy = copy;
exports.scale = scale;
exports.invert = invert;

var _vegaScale = require("vega-scale");

var _vegaUtil = require("vega-util");

function getScale(name, ctx) {
  let s;
  return (0, _vegaUtil.isFunction)(name) ? name : (0, _vegaUtil.isString)(name) ? (s = ctx.scales[name]) && s.value : undefined;
}

function range(name, group) {
  const s = getScale(name, (group || this).context);
  return s && s.range ? s.range() : [];
}

function domain(name, group) {
  const s = getScale(name, (group || this).context);
  return s ? s.domain() : [];
}

function bandwidth(name, group) {
  const s = getScale(name, (group || this).context);
  return s && s.bandwidth ? s.bandwidth() : 0;
}

function bandspace(count, paddingInner, paddingOuter) {
  return (0, _vegaScale.bandSpace)(count || 0, paddingInner || 0, paddingOuter || 0);
}

function copy(name, group) {
  const s = getScale(name, (group || this).context);
  return s ? s.copy() : undefined;
}

function scale(name, value, group) {
  const s = getScale(name, (group || this).context);
  return s && value !== undefined ? s(value) : undefined;
}

function invert(name, range, group) {
  const s = getScale(name, (group || this).context);
  return !s ? undefined : (0, _vegaUtil.isArray)(range) ? (s.invertRange || s.invert)(range) : (s.invert || s.invertExtent)(range);
}
},{"vega-scale":"VE6e","vega-util":"dejJ"}],"nCJ6":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.geoCentroid = exports.geoBounds = exports.geoArea = void 0;

var _scale = require("./scale");

var _d3Geo = require("d3-geo");

function geoMethod(methodName, globalMethod) {
  return function (projection, geojson, group) {
    if (projection) {
      // projection defined, use it
      const p = (0, _scale.getScale)(projection, (group || this).context);
      return p && p.path[methodName](geojson);
    } else {
      // projection undefined, use global method
      return globalMethod(geojson);
    }
  };
}

const geoArea = geoMethod('area', _d3Geo.geoArea);
exports.geoArea = geoArea;
const geoBounds = geoMethod('bounds', _d3Geo.geoBounds);
exports.geoBounds = geoBounds;
const geoCentroid = geoMethod('centroid', _d3Geo.geoCentroid);
exports.geoCentroid = geoCentroid;
},{"./scale":"yJDC","d3-geo":"YztC"}],"HFwA":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(item) {
  let group = this.context.group,
      value = false;
  if (group) while (item) {
    if (item === group) {
      value = true;
      break;
    }

    item = item.mark.group;
  }
  return value;
}
},{}],"Kt6b":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _vegaScenegraph = require("vega-scenegraph");

var _vegaUtil = require("vega-util");

function _default(b, opt, group) {
  if (!b) return [];
  const [u, v] = b,
        box = new _vegaScenegraph.Bounds().set(u[0], u[1], v[0], v[1]),
        scene = group || this.context.dataflow.scenegraph().root;
  return (0, _vegaScenegraph.intersect)(scene, box, filter(opt));
}

function filter(opt) {
  let p = null;

  if (opt) {
    const types = (0, _vegaUtil.array)(opt.marktype),
          names = (0, _vegaUtil.array)(opt.markname);

    p = _ => (!types.length || types.some(t => _.marktype === t)) && (!names.length || names.some(s => _.name === s));
  }

  return p;
}
},{"vega-scenegraph":"rKdC","vega-util":"dejJ"}],"cp7x":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.warn = warn;
exports.info = info;
exports.debug = debug;

function 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 log(this.context.dataflow, 'warn', arguments);
}

function info() {
  return log(this.context.dataflow, 'info', arguments);
}

function debug() {
  return log(this.context.dataflow, 'debug', arguments);
}
},{}],"boEf":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _vegaUtil = require("vega-util");

function _default() {
  var args = [].slice.call(arguments);
  args.unshift({});
  return _vegaUtil.extend.apply(null, args);
}
},{"vega-util":"dejJ"}],"ij63":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

function equal(a, b) {
  return a === b || a !== a && b !== b ? true : (0, _vegaUtil.isArray)(a) ? (0, _vegaUtil.isArray)(b) && a.length === b.length ? equalArray(a, b) : false : (0, _vegaUtil.isObject)(a) && (0, _vegaUtil.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 (let key in a) {
    if (!equal(a[key], b[key])) return false;
  }

  return true;
}

function removePredicate(props) {
  return _ => equalObject(props, _);
}

function _default(name, insert, remove, toggle, modify, values) {
  let df = this.context.dataflow,
      data = this.context.data[name],
      input = data.input,
      changes = data.changes,
      stamp = df.stamp(),
      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(function () {
      data.modified = true;
      df.pulse(input, changes).run();
    }, true, 1);
  }

  if (remove) {
    predicate = remove === true ? _vegaUtil.truthy : (0, _vegaUtil.isArray)(remove) || (0, _vegaDataflow.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;
}
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"Xs8n":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.pinchDistance = pinchDistance;
exports.pinchAngle = pinchAngle;

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);
}
},{}],"DICr":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _scale = require("./scale");

var _vegaScale = require("vega-scale");

var _vegaScenegraph = require("vega-scenegraph");

var _vegaUtil = require("vega-util");

function _default(scale, p0, p1, count, group) {
  scale = (0, _scale.getScale)(scale, (group || this).context);
  const gradient = (0, _vegaScenegraph.Gradient)(p0, p1);
  let stops = scale.domain(),
      min = stops[0],
      max = (0, _vegaUtil.peek)(stops),
      fraction = _vegaUtil.identity;

  if (!(max - min)) {
    // expand scale if domain has zero span, fix #1479
    scale = (scale.interpolator ? (0, _vegaScale.scale)('sequential')().interpolator(scale.interpolator()) : (0, _vegaScale.scale)('linear')().interpolate(scale.interpolate()).range(scale.range())).domain([min = 0, max = 1]);
  } else {
    fraction = (0, _vegaScale.scaleFraction)(scale, min, max);
  }

  if (scale.ticks) {
    stops = scale.ticks(+count || 15);
    if (min !== stops[0]) stops.unshift(min);
    if (max !== (0, _vegaUtil.peek)(stops)) stops.push(max);
  }

  stops.forEach(_ => gradient.stop(fraction(_), scale(_)));
  return gradient;
}
},{"./scale":"yJDC","vega-scale":"VE6e","vega-scenegraph":"rKdC","vega-util":"dejJ"}],"vAMt":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.geoShape = geoShape;
exports.pathShape = pathShape;

var _scale = require("./scale");

var _vegaScenegraph = require("vega-scenegraph");

function geoShape(projection, geojson, group) {
  const p = (0, _scale.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 ? (0, _vegaScenegraph.pathRender)(context, p = p || (0, _vegaScenegraph.pathParse)(path)) : path;
  };
}
},{"./scale":"yJDC","vega-scenegraph":"rKdC"}],"Ix36":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.treePath = treePath;
exports.treeAncestors = treeAncestors;

var _data = require("./data");

const EMPTY = {};

function datum(d) {
  return d.data;
}

function treeNodes(name, context) {
  const tree = _data.data.call(context, name);

  return tree.root && tree.root.lookup || EMPTY;
}

function treePath(name, source, target) {
  const nodes = treeNodes(name, this),
        s = nodes[source],
        t = nodes[target];
  return s && t ? s.path(t).map(datum) : undefined;
}

function treeAncestors(name, node) {
  const n = treeNodes(name, this)[node];
  return n ? n.ancestors().map(datum) : undefined;
}
},{"./data":"WAv9"}],"aUoC":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.screen = screen;
exports.windowSize = windowSize;
exports.containerSize = containerSize;

const _window = typeof window !== 'undefined' && window || null;

function screen() {
  return _window ? _window.screen : {};
}

function windowSize() {
  return _window ? [_window.innerWidth, _window.innerHeight] : [undefined, undefined];
}

function containerSize() {
  const view = this.context.dataflow,
        el = view.container && view.container();
  return el ? [el.clientWidth, el.clientHeight] : [undefined, undefined];
}
},{}],"lrXg":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.SignalPrefix = exports.ScalePrefix = exports.IndexPrefix = exports.DataPrefix = void 0;
const DataPrefix = ':';
exports.DataPrefix = DataPrefix;
const IndexPrefix = '@';
exports.IndexPrefix = IndexPrefix;
const ScalePrefix = '%';
exports.ScalePrefix = ScalePrefix;
const SignalPrefix = '$';
exports.SignalPrefix = SignalPrefix;
},{}],"OWOU":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.dataVisitor = dataVisitor;
exports.indataVisitor = indataVisitor;
exports.scaleVisitor = scaleVisitor;

var _prefix = require("./prefix");

var _vegaExpression = require("vega-expression");

var _vegaUtil = require("vega-util");

function dataVisitor(name, args, scope, params) {
  if (args[0].type !== _vegaExpression.Literal) {
    (0, _vegaUtil.error)('First argument to data functions must be a string literal.');
  }

  const data = args[0].value,
        dataName = _prefix.DataPrefix + data;

  if (!(0, _vegaUtil.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 !== _vegaExpression.Literal) (0, _vegaUtil.error)('First argument to indata must be a string literal.');
  if (args[1].type !== _vegaExpression.Literal) (0, _vegaUtil.error)('Second argument to indata must be a string literal.');
  const data = args[0].value,
        field = args[1].value,
        indexName = _prefix.IndexPrefix + field;

  if (!(0, _vegaUtil.hasOwnProperty)(indexName, params)) {
    params[indexName] = scope.getData(data).indataRef(scope, field);
  }
}

function scaleVisitor(name, args, scope, params) {
  if (args[0].type === _vegaExpression.Literal) {
    // add scale dependency
    addScaleDependency(scope, params, args[0].value);
  } else if (args[0].type === _vegaExpression.Identifier) {
    // indirect scale lookup; add all scales as parameters
    for (name in scope.scales) {
      addScaleDependency(scope, params, name);
    }
  }
}

function addScaleDependency(scope, params, name) {
  const scaleName = _prefix.ScalePrefix + name;

  if (!(0, _vegaUtil.hasOwnProperty)(params, scaleName)) {
    try {
      params[scaleName] = scope.scaleRef(name);
    } catch (err) {// TODO: error handling? warning?
    }
  }
}
},{"./prefix":"lrXg","vega-expression":"rJuS","vega-util":"dejJ"}],"MT6a":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.expressionFunction = expressionFunction;
exports.codeGenerator = exports.codegenParams = exports.functionContext = void 0;

var _vegaExpression = require("vega-expression");

var _vegaDataflow = require("vega-dataflow");

var _vegaSelections = require("vega-selections");

var _vegaStatistics = require("vega-statistics");

var _vegaTime = require("vega-time");

var _vegaUtil = require("vega-util");

var _d3Array = require("d3-array");

var _d3Color = require("d3-color");

var _luminance = require("./luminance");

var _data = require("./data");

var _encode = _interopRequireDefault(require("./encode"));

var _format = require("./format");

var _geo = require("./geo");

var _inscope = _interopRequireDefault(require("./inscope"));

var _intersect = _interopRequireDefault(require("./intersect"));

var _log = require("./log");

var _merge = _interopRequireDefault(require("./merge"));

var _modify = _interopRequireDefault(require("./modify"));

var _pinch = require("./pinch");

var _scale = require("./scale");

var _scaleGradient = _interopRequireDefault(require("./scale-gradient"));

var _shape = require("./shape");

var _tree = require("./tree");

var _window = require("./window");

var _visitors = require("./visitors");

var _prefix = require("./prefix");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Expression function context object
const functionContext = {
  random: function () {
    return (0, _vegaStatistics.random)();
  },
  // override default
  cumulativeNormal: _vegaStatistics.cumulativeNormal,
  cumulativeLogNormal: _vegaStatistics.cumulativeLogNormal,
  cumulativeUniform: _vegaStatistics.cumulativeUniform,
  densityNormal: _vegaStatistics.densityNormal,
  densityLogNormal: _vegaStatistics.densityLogNormal,
  densityUniform: _vegaStatistics.densityUniform,
  quantileNormal: _vegaStatistics.quantileNormal,
  quantileLogNormal: _vegaStatistics.quantileLogNormal,
  quantileUniform: _vegaStatistics.quantileUniform,
  sampleNormal: _vegaStatistics.sampleNormal,
  sampleLogNormal: _vegaStatistics.sampleLogNormal,
  sampleUniform: _vegaStatistics.sampleUniform,
  isArray: _vegaUtil.isArray,
  isBoolean: _vegaUtil.isBoolean,
  isDate: _vegaUtil.isDate,
  isDefined: function (_) {
    return _ !== undefined;
  },
  isNumber: _vegaUtil.isNumber,
  isObject: _vegaUtil.isObject,
  isRegExp: _vegaUtil.isRegExp,
  isString: _vegaUtil.isString,
  isTuple: _vegaDataflow.isTuple,
  isValid: function (_) {
    return _ != null && _ === _;
  },
  toBoolean: _vegaUtil.toBoolean,
  toDate: _vegaUtil.toDate,
  toNumber: _vegaUtil.toNumber,
  toString: _vegaUtil.toString,
  flush: _vegaUtil.flush,
  lerp: _vegaUtil.lerp,
  merge: _merge.default,
  pad: _vegaUtil.pad,
  peek: _vegaUtil.peek,
  span: _vegaUtil.span,
  inrange: _vegaUtil.inrange,
  truncate: _vegaUtil.truncate,
  rgb: _d3Color.rgb,
  lab: _d3Color.lab,
  hcl: _d3Color.hcl,
  hsl: _d3Color.hsl,
  luminance: _luminance.luminance,
  contrast: _luminance.contrast,
  sequence: _d3Array.range,
  format: _format.format,
  utcFormat: _format.utcFormat,
  utcParse: _format.utcParse,
  utcOffset: _vegaTime.utcOffset,
  utcSequence: _vegaTime.utcSequence,
  timeFormat: _format.timeFormat,
  timeParse: _format.timeParse,
  timeOffset: _vegaTime.timeOffset,
  timeSequence: _vegaTime.timeSequence,
  timeUnitSpecifier: _vegaTime.timeUnitSpecifier,
  monthFormat: _format.monthFormat,
  monthAbbrevFormat: _format.monthAbbrevFormat,
  dayFormat: _format.dayFormat,
  dayAbbrevFormat: _format.dayAbbrevFormat,
  quarter: _vegaUtil.quarter,
  utcquarter: _vegaUtil.utcquarter,
  warn: _log.warn,
  info: _log.info,
  debug: _log.debug,
  extent: _vegaUtil.extent,
  inScope: _inscope.default,
  intersect: _intersect.default,
  clampRange: _vegaUtil.clampRange,
  pinchDistance: _pinch.pinchDistance,
  pinchAngle: _pinch.pinchAngle,
  screen: _window.screen,
  containerSize: _window.containerSize,
  windowSize: _window.windowSize,
  bandspace: _scale.bandspace,
  setdata: _data.setdata,
  pathShape: _shape.pathShape,
  panLinear: _vegaUtil.panLinear,
  panLog: _vegaUtil.panLog,
  panPow: _vegaUtil.panPow,
  panSymlog: _vegaUtil.panSymlog,
  zoomLinear: _vegaUtil.zoomLinear,
  zoomLog: _vegaUtil.zoomLog,
  zoomPow: _vegaUtil.zoomPow,
  zoomSymlog: _vegaUtil.zoomSymlog,
  encode: _encode.default,
  modify: _modify.default
};
exports.functionContext = functionContext;
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
// Build expression function registry

function buildFunctions(codegen) {
  const fn = (0, _vegaExpression.functions)(codegen);
  eventFunctions.forEach(name => fn[name] = eventPrefix + name);

  for (let name in functionContext) {
    fn[name] = thisPrefix + name;
  }

  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', _scale.bandwidth, _visitors.scaleVisitor);
expressionFunction('copy', _scale.copy, _visitors.scaleVisitor);
expressionFunction('domain', _scale.domain, _visitors.scaleVisitor);
expressionFunction('range', _scale.range, _visitors.scaleVisitor);
expressionFunction('invert', _scale.invert, _visitors.scaleVisitor);
expressionFunction('scale', _scale.scale, _visitors.scaleVisitor);
expressionFunction('gradient', _scaleGradient.default, _visitors.scaleVisitor);
expressionFunction('geoArea', _geo.geoArea, _visitors.scaleVisitor);
expressionFunction('geoBounds', _geo.geoBounds, _visitors.scaleVisitor);
expressionFunction('geoCentroid', _geo.geoCentroid, _visitors.scaleVisitor);
expressionFunction('geoShape', _shape.geoShape, _visitors.scaleVisitor);
expressionFunction('indata', _data.indata, _visitors.indataVisitor);
expressionFunction('data', _data.data, _visitors.dataVisitor);
expressionFunction('treePath', _tree.treePath, _visitors.dataVisitor);
expressionFunction('treeAncestors', _tree.treeAncestors, _visitors.dataVisitor); // register Vega-Lite selection functions

expressionFunction('vlSelectionTest', _vegaSelections.selectionTest, _vegaSelections.selectionVisitor);
expressionFunction('vlSelectionResolve', _vegaSelections.selectionResolve, _vegaSelections.selectionVisitor); // Export code generator and parameters

const codegenParams = {
  blacklist: ['_'],
  whitelist: ['datum', 'event', 'item'],
  fieldvar: 'datum',
  globalvar: function (id) {
    return '_[' + (0, _vegaUtil.stringValue)(_prefix.SignalPrefix + id) + ']';
  },
  functions: buildFunctions,
  constants: _vegaExpression.constants,
  visitors: astVisitors
};
exports.codegenParams = codegenParams;
var codeGenerator = (0, _vegaExpression.codegen)(codegenParams);
exports.codeGenerator = codeGenerator;
},{"vega-expression":"rJuS","vega-dataflow":"UC8n","vega-selections":"fsSi","vega-statistics":"yUSi","vega-time":"j8qo","vega-util":"dejJ","d3-array":"Rpnd","d3-color":"x3do","./luminance":"ZP9R","./data":"WAv9","./encode":"CjAK","./format":"ogOy","./geo":"nCJ6","./inscope":"HFwA","./intersect":"Kt6b","./log":"cp7x","./merge":"boEf","./modify":"ij63","./pinch":"Xs8n","./scale":"yJDC","./scale-gradient":"DICr","./shape":"vAMt","./tree":"Ix36","./window":"aUoC","./visitors":"OWOU","./prefix":"lrXg"}],"JYcc":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "codegenParams", {
  enumerable: true,
  get: function () {
    return _codegen.codegenParams;
  }
});
Object.defineProperty(exports, "codeGenerator", {
  enumerable: true,
  get: function () {
    return _codegen.codeGenerator;
  }
});
Object.defineProperty(exports, "expressionFunction", {
  enumerable: true,
  get: function () {
    return _codegen.expressionFunction;
  }
});
Object.defineProperty(exports, "functionContext", {
  enumerable: true,
  get: function () {
    return _codegen.functionContext;
  }
});
Object.defineProperty(exports, "data", {
  enumerable: true,
  get: function () {
    return _data.data;
  }
});
Object.defineProperty(exports, "indata", {
  enumerable: true,
  get: function () {
    return _data.indata;
  }
});
Object.defineProperty(exports, "setdata", {
  enumerable: true,
  get: function () {
    return _data.setdata;
  }
});
Object.defineProperty(exports, "encode", {
  enumerable: true,
  get: function () {
    return _encode.default;
  }
});
Object.defineProperty(exports, "format", {
  enumerable: true,
  get: function () {
    return _format.format;
  }
});
Object.defineProperty(exports, "utcFormat", {
  enumerable: true,
  get: function () {
    return _format.utcFormat;
  }
});
Object.defineProperty(exports, "timeFormat", {
  enumerable: true,
  get: function () {
    return _format.timeFormat;
  }
});
Object.defineProperty(exports, "utcParse", {
  enumerable: true,
  get: function () {
    return _format.utcParse;
  }
});
Object.defineProperty(exports, "timeParse", {
  enumerable: true,
  get: function () {
    return _format.timeParse;
  }
});
Object.defineProperty(exports, "monthFormat", {
  enumerable: true,
  get: function () {
    return _format.monthFormat;
  }
});
Object.defineProperty(exports, "monthAbbrevFormat", {
  enumerable: true,
  get: function () {
    return _format.monthAbbrevFormat;
  }
});
Object.defineProperty(exports, "dayFormat", {
  enumerable: true,
  get: function () {
    return _format.dayFormat;
  }
});
Object.defineProperty(exports, "dayAbbrevFormat", {
  enumerable: true,
  get: function () {
    return _format.dayAbbrevFormat;
  }
});
Object.defineProperty(exports, "geoArea", {
  enumerable: true,
  get: function () {
    return _geo.geoArea;
  }
});
Object.defineProperty(exports, "geoBounds", {
  enumerable: true,
  get: function () {
    return _geo.geoBounds;
  }
});
Object.defineProperty(exports, "geoCentroid", {
  enumerable: true,
  get: function () {
    return _geo.geoCentroid;
  }
});
Object.defineProperty(exports, "inScope", {
  enumerable: true,
  get: function () {
    return _inscope.default;
  }
});
Object.defineProperty(exports, "warn", {
  enumerable: true,
  get: function () {
    return _log.warn;
  }
});
Object.defineProperty(exports, "info", {
  enumerable: true,
  get: function () {
    return _log.info;
  }
});
Object.defineProperty(exports, "debug", {
  enumerable: true,
  get: function () {
    return _log.debug;
  }
});
Object.defineProperty(exports, "luminance", {
  enumerable: true,
  get: function () {
    return _luminance.luminance;
  }
});
Object.defineProperty(exports, "contrast", {
  enumerable: true,
  get: function () {
    return _luminance.contrast;
  }
});
Object.defineProperty(exports, "merge", {
  enumerable: true,
  get: function () {
    return _merge.default;
  }
});
Object.defineProperty(exports, "modify", {
  enumerable: true,
  get: function () {
    return _modify.default;
  }
});
Object.defineProperty(exports, "pinchDistance", {
  enumerable: true,
  get: function () {
    return _pinch.pinchDistance;
  }
});
Object.defineProperty(exports, "pinchAngle", {
  enumerable: true,
  get: function () {
    return _pinch.pinchAngle;
  }
});
Object.defineProperty(exports, "DataPrefix", {
  enumerable: true,
  get: function () {
    return _prefix.DataPrefix;
  }
});
Object.defineProperty(exports, "IndexPrefix", {
  enumerable: true,
  get: function () {
    return _prefix.IndexPrefix;
  }
});
Object.defineProperty(exports, "ScalePrefix", {
  enumerable: true,
  get: function () {
    return _prefix.ScalePrefix;
  }
});
Object.defineProperty(exports, "SignalPrefix", {
  enumerable: true,
  get: function () {
    return _prefix.SignalPrefix;
  }
});
Object.defineProperty(exports, "range", {
  enumerable: true,
  get: function () {
    return _scale.range;
  }
});
Object.defineProperty(exports, "domain", {
  enumerable: true,
  get: function () {
    return _scale.domain;
  }
});
Object.defineProperty(exports, "bandwidth", {
  enumerable: true,
  get: function () {
    return _scale.bandwidth;
  }
});
Object.defineProperty(exports, "bandspace", {
  enumerable: true,
  get: function () {
    return _scale.bandspace;
  }
});
Object.defineProperty(exports, "copy", {
  enumerable: true,
  get: function () {
    return _scale.copy;
  }
});
Object.defineProperty(exports, "scale", {
  enumerable: true,
  get: function () {
    return _scale.scale;
  }
});
Object.defineProperty(exports, "invert", {
  enumerable: true,
  get: function () {
    return _scale.invert;
  }
});
Object.defineProperty(exports, "scaleGradient", {
  enumerable: true,
  get: function () {
    return _scaleGradient.default;
  }
});
Object.defineProperty(exports, "geoShape", {
  enumerable: true,
  get: function () {
    return _shape.geoShape;
  }
});
Object.defineProperty(exports, "pathShape", {
  enumerable: true,
  get: function () {
    return _shape.pathShape;
  }
});
Object.defineProperty(exports, "treePath", {
  enumerable: true,
  get: function () {
    return _tree.treePath;
  }
});
Object.defineProperty(exports, "treeAncestors", {
  enumerable: true,
  get: function () {
    return _tree.treeAncestors;
  }
});
Object.defineProperty(exports, "containerSize", {
  enumerable: true,
  get: function () {
    return _window.containerSize;
  }
});
Object.defineProperty(exports, "screen", {
  enumerable: true,
  get: function () {
    return _window.screen;
  }
});
Object.defineProperty(exports, "windowSize", {
  enumerable: true,
  get: function () {
    return _window.windowSize;
  }
});
Object.defineProperty(exports, "dataVisitor", {
  enumerable: true,
  get: function () {
    return _visitors.dataVisitor;
  }
});
Object.defineProperty(exports, "indataVisitor", {
  enumerable: true,
  get: function () {
    return _visitors.indataVisitor;
  }
});
Object.defineProperty(exports, "scaleVisitor", {
  enumerable: true,
  get: function () {
    return _visitors.scaleVisitor;
  }
});
Object.defineProperty(exports, "formatLocale", {
  enumerable: true,
  get: function () {
    return _d3Format.formatDefaultLocale;
  }
});
Object.defineProperty(exports, "timeFormatLocale", {
  enumerable: true,
  get: function () {
    return _d3TimeFormat.timeFormatDefaultLocale;
  }
});

var _codegen = require("./src/codegen");

var _data = require("./src/data");

var _encode = _interopRequireDefault(require("./src/encode"));

var _format = require("./src/format");

var _geo = require("./src/geo");

var _inscope = _interopRequireDefault(require("./src/inscope"));

var _log = require("./src/log");

var _luminance = require("./src/luminance");

var _merge = _interopRequireDefault(require("./src/merge"));

var _modify = _interopRequireDefault(require("./src/modify"));

var _pinch = require("./src/pinch");

var _prefix = require("./src/prefix.js");

var _scale = require("./src/scale");

var _scaleGradient = _interopRequireDefault(require("./src/scale-gradient"));

var _shape = require("./src/shape");

var _tree = require("./src/tree");

var _window = require("./src/window");

var _visitors = require("./src/visitors");

var _d3Format = require("d3-format");

var _d3TimeFormat = require("d3-time-format");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./src/codegen":"MT6a","./src/data":"WAv9","./src/encode":"CjAK","./src/format":"ogOy","./src/geo":"nCJ6","./src/inscope":"HFwA","./src/log":"cp7x","./src/luminance":"ZP9R","./src/merge":"boEf","./src/modify":"ij63","./src/pinch":"Xs8n","./src/prefix.js":"lrXg","./src/scale":"yJDC","./src/scale-gradient":"DICr","./src/shape":"vAMt","./src/tree":"Ix36","./src/window":"aUoC","./src/visitors":"OWOU","d3-format":"SA6z","d3-time-format":"fort"}],"qj1B":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = expression;
exports.operatorExpression = operatorExpression;
exports.parameterExpression = parameterExpression;
exports.eventExpression = eventExpression;
exports.handlerExpression = handlerExpression;
exports.encodeExpression = encodeExpression;

/**
 * Parse an expression given the argument signature and body code.
 */
function expression(args, code, ctx) {
  // wrap code in return statement if expression does not terminate
  if (code[code.length - 1] !== ';') {
    code = 'return(' + code + ');';
  }

  var fn = Function.apply(null, args.concat(code));
  return ctx && ctx.functions ? fn.bind(ctx.functions) : fn;
}
/**
 * Parse an expression used to update an operator value.
 */


function operatorExpression(code, ctx) {
  return expression(['_'], code, ctx);
}
/**
 * Parse an expression provided as an operator parameter value.
 */


function parameterExpression(code, ctx) {
  return expression(['datum', '_'], code, ctx);
}
/**
 * Parse an expression applied to an event stream.
 */


function eventExpression(code, ctx) {
  return expression(['event'], code, ctx);
}
/**
 * Parse an expression used to handle an event-driven operator update.
 */


function handlerExpression(code, ctx) {
  return expression(['_', 'event'], code, ctx);
}
/**
 * Parse an expression that performs visual encoding.
 */


function encodeExpression(code, ctx) {
  return expression(['item', '_'], code, ctx);
}
},{}],"uY2i":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = parseParameters;

var _dataflow = _interopRequireDefault(require("./dataflow"));

var _expression = require("./expression");

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * Parse a set of operator parameters.
 */
function parseParameters(spec, ctx, params) {
  params = params || {};
  var key, value;

  for (key in spec) {
    value = spec[key];
    params[key] = (0, _vegaUtil.isArray)(value) ? value.map(function (v) {
      return parseParameter(v, ctx, params);
    }) : parseParameter(value, ctx, params);
  }

  return params;
}
/**
 * Parse a single parameter.
 */


function parseParameter(spec, ctx, params) {
  if (!spec || !(0, _vegaUtil.isObject)(spec)) return spec;

  for (var i = 0, n = PARSERS.length, p; i < n; ++i) {
    p = PARSERS[i];

    if ((0, _vegaUtil.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: getField
}, {
  key: '$encode',
  parse: getEncode
}, {
  key: '$compare',
  parse: getCompare
}, {
  key: '$context',
  parse: getContext
}, {
  key: '$subflow',
  parse: getSubflow
}, {
  key: '$tupleid',
  parse: getTupleId
}];
/**
 * Resolve an operator reference.
 */

function getOperator(_, ctx) {
  return ctx.get(_.$ref) || (0, _vegaUtil.error)('Operator not defined: ' + _.$ref);
}
/**
 * Resolve an expression reference.
 */


function getExpression(_, ctx, params) {
  if (_.$params) {
    // parse expression parameters
    parseParameters(_.$params, ctx, params);
  }

  var k = 'e:' + _.$expr + '_' + _.$name;
  return ctx.fn[k] || (ctx.fn[k] = (0, _vegaUtil.accessor)((0, _expression.parameterExpression)(_.$expr, ctx), _.$fields, _.$name));
}
/**
 * Resolve a key accessor reference.
 */


function getKey(_, ctx) {
  var k = 'k:' + _.$key + '_' + !!_.$flat;
  return ctx.fn[k] || (ctx.fn[k] = (0, _vegaUtil.key)(_.$key, _.$flat));
}
/**
 * Resolve a field accessor reference.
 */


function getField(_, ctx) {
  if (!_.$field) return null;
  var k = 'f:' + _.$field + '_' + _.$name;
  return ctx.fn[k] || (ctx.fn[k] = (0, _vegaUtil.field)(_.$field, _.$name));
}
/**
 * Resolve a comparator function reference.
 */


function getCompare(_, ctx) {
  var k = 'c:' + _.$compare + '_' + _.$order,
      c = (0, _vegaUtil.array)(_.$compare).map(function (_) {
    return _ && _.$tupleid ? _vegaDataflow.tupleid : _;
  });
  return ctx.fn[k] || (ctx.fn[k] = (0, _vegaUtil.compare)(c, _.$order));
}
/**
 * Resolve an encode operator reference.
 */


function getEncode(_, ctx) {
  var spec = _.$encode,
      encode = {},
      name,
      enc;

  for (name in spec) {
    enc = spec[name];
    encode[name] = (0, _vegaUtil.accessor)((0, _expression.encodeExpression)(enc.$expr, ctx), enc.$fields);
    encode[name].output = enc.$output;
  }

  return encode;
}
/**
 * Resolve a context reference.
 */


function getContext(_, ctx) {
  return ctx;
}
/**
 * Resolve a recursive subflow specification.
 */


function getSubflow(_, ctx) {
  var spec = _.$subflow;
  return function (dataflow, key, parent) {
    var subctx = (0, _dataflow.default)(spec, ctx.fork()),
        op = subctx.get(spec.operators[0].id),
        p = subctx.signals.parent;
    if (p) p.set(parent);
    return op;
  };
}
/**
 * Resolve a tuple id reference.
 */


function getTupleId() {
  return _vegaDataflow.tupleid;
}
},{"./dataflow":"Fun1","./expression":"qj1B","vega-dataflow":"UC8n","vega-util":"dejJ"}],"Q2Zy":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.canonicalType = canonicalType;
exports.isOperator = isOperator;
exports.isCollect = isCollect;

function canonicalType(type) {
  return (type + '').toLowerCase();
}

function isOperator(type) {
  return canonicalType(type) === 'operator';
}

function isCollect(type) {
  return canonicalType(type) === 'collect';
}
},{}],"I7F6":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.parseOperatorParameters = parseOperatorParameters;

var _expression = require("./expression");

var _parameters = _interopRequireDefault(require("./parameters"));

var _util = require("./util");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * Parse a dataflow operator.
 */
function _default(spec, ctx) {
  if ((0, _util.isOperator)(spec.type) || !spec.type) {
    ctx.operator(spec, spec.update ? (0, _expression.operatorExpression)(spec.update, ctx) : null);
  } else {
    ctx.transform(spec, spec.type);
  }
}
/**
 * Parse and assign operator parameters.
 */


function parseOperatorParameters(spec, ctx) {
  if (spec.params) {
    var op = ctx.get(spec.id);
    if (!op) (0, _vegaUtil.error)('Invalid operator id: ' + spec.id);
    ctx.dataflow.connect(op, op.parameters((0, _parameters.default)(spec.params, ctx), spec.react, spec.initonly));
  }
}
},{"./expression":"qj1B","./parameters":"uY2i","./util":"Q2Zy","vega-util":"dejJ"}],"aVl4":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _expression = require("./expression");

var _vegaUtil = require("vega-util");

/**
 * Parse an event stream specification.
 */
function _default(spec, ctx) {
  var filter = spec.filter != null ? (0, _expression.eventExpression)(spec.filter, ctx) : 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.bind(ctx));
    stream = args[0].merge.apply(args[0], args.slice(1));
  }

  if (spec.between) {
    args = spec.between.map(ctx.get.bind(ctx));
    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) {
    (0, _vegaUtil.error)('Invalid stream definition: ' + JSON.stringify(spec));
  }

  if (spec.consume) stream.consume(true);
  ctx.stream(spec, stream);
}
},{"./expression":"qj1B","vega-util":"dejJ"}],"Q0c3":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _expression = require("./expression");

var _parameters = _interopRequireDefault(require("./parameters"));

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * Parse an event-driven operator update.
 */
function _default(spec, ctx) {
  var srcid = (0, _vegaUtil.isObject)(srcid = spec.source) ? srcid.$ref : srcid,
      source = ctx.get(srcid),
      target = null,
      update = spec.update,
      params = undefined;
  if (!source) (0, _vegaUtil.error)('Source not defined: ' + spec.source);

  if (spec.target && spec.target.$expr) {
    target = (0, _expression.eventExpression)(spec.target.$expr, ctx);
  } else {
    target = ctx.get(spec.target);
  }

  if (update && update.$expr) {
    if (update.$params) {
      params = (0, _parameters.default)(update.$params, ctx);
    }

    update = (0, _expression.handlerExpression)(update.$expr, ctx);
  }

  ctx.update(spec, source, target, update, params);
}
},{"./expression":"qj1B","./parameters":"uY2i","vega-util":"dejJ"}],"Fun1":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _operator = _interopRequireWildcard(require("./operator"));

var _stream = _interopRequireDefault(require("./stream"));

var _update = _interopRequireDefault(require("./update"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * Parse a serialized dataflow specification.
 */
function _default(spec, ctx) {
  var operators = spec.operators || []; // parse background

  if (spec.background) {
    ctx.background = spec.background;
  } // parse event configuration


  if (spec.eventConfig) {
    ctx.eventConfig = spec.eventConfig;
  } // parse operators


  operators.forEach(function (entry) {
    (0, _operator.default)(entry, ctx);
  }); // parse operator parameters

  operators.forEach(function (entry) {
    (0, _operator.parseOperatorParameters)(entry, ctx);
  }); // parse streams

  (spec.streams || []).forEach(function (entry) {
    (0, _stream.default)(entry, ctx);
  }); // parse updates

  (spec.updates || []).forEach(function (entry) {
    (0, _update.default)(entry, ctx);
  });
  return ctx.resolve();
}
},{"./operator":"I7F6","./stream":"aVl4","./update":"Q0c3"}],"dVCq":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getState = getState;
exports.setState = setState;

var _vegaUtil = require("vega-util");

var SKIP = {
  skip: true
};

function getState(options) {
  var ctx = this,
      state = {};

  if (options.signals) {
    var signals = state.signals = {};
    Object.keys(ctx.signals).forEach(function (key) {
      var 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(function (key) {
      var 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(function (ctx) {
      return ctx.getState(options);
    });
  }

  return state;
}

function setState(state) {
  var ctx = this,
      df = ctx.dataflow,
      data = state.data,
      signals = state.signals;
  Object.keys(signals || {}).forEach(function (key) {
    df.update(ctx.signals[key], signals[key], SKIP);
  });
  Object.keys(data || {}).forEach(function (key) {
    df.pulse(ctx.data[key].input, df.changeset().remove(_vegaUtil.truthy).insert(data[key]));
  });
  (state.subcontext || []).forEach(function (substate, i) {
    var subctx = ctx.subcontext[i];
    if (subctx) subctx.setState(substate);
  });
}
},{"vega-util":"dejJ"}],"osQT":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _state = require("./state");

var _util = require("./util");

/**
 * 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 _default(df, transforms, functions) {
  return new Context(df, transforms, functions);
}

function Context(df, transforms, functions) {
  this.dataflow = df;
  this.transforms = transforms;
  this.events = df.events.bind(df);
  this.signals = {};
  this.scales = {};
  this.nodes = {};
  this.data = {};
  this.fn = {};

  if (functions) {
    this.functions = Object.create(functions);
    this.functions.context = this;
  }
}

function ContextFork(ctx) {
  this.dataflow = ctx.dataflow;
  this.transforms = ctx.transforms;
  this.functions = ctx.functions;
  this.events = ctx.events;
  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 = ContextFork.prototype = {
  fork: function () {
    var ctx = new ContextFork(this);
    (this.subcontext || (this.subcontext = [])).push(ctx);
    return ctx;
  },
  get: function (id) {
    return this.nodes[id];
  },
  set: function (id, node) {
    return this.nodes[id] = node;
  },
  add: function (spec, op) {
    var ctx = this,
        df = ctx.dataflow,
        data;
    ctx.set(spec.id, op);

    if ((0, _util.isCollect)(spec.type) && (data = spec.value)) {
      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) {
      var p = ctx.get(spec.parent.$ref);

      if (p) {
        df.connect(p, [op]);
        op.targets().add(p);
      } else {
        (ctx.unresolved = ctx.unresolved || []).push(function () {
          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 (var name in spec.data) {
        data = ctx.data[name] || (ctx.data[name] = {});
        spec.data[name].forEach(function (role) {
          data[role] = op;
        });
      }
    }
  },
  resolve: function () {
    (this.unresolved || []).forEach(function (fn) {
      fn();
    });
    delete this.unresolved;
    return this;
  },
  operator: function (spec, update) {
    this.add(spec, this.dataflow.add(spec.value, update));
  },
  transform: function (spec, type) {
    this.add(spec, this.dataflow.add(this.transforms[(0, _util.canonicalType)(type)]));
  },
  stream: function (spec, stream) {
    this.set(spec.id, stream);
  },
  update: function (spec, stream, target, update, params) {
    this.dataflow.on(stream, target, update, params, spec.options);
  },
  getState: _state.getState,
  setState: _state.setState
};
},{"./state":"dVCq","./util":"Q2Zy"}],"SS7m":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "parse", {
  enumerable: true,
  get: function () {
    return _dataflow.default;
  }
});
Object.defineProperty(exports, "context", {
  enumerable: true,
  get: function () {
    return _context.default;
  }
});
Object.defineProperty(exports, "expression", {
  enumerable: true,
  get: function () {
    return _expression.default;
  }
});

var _dataflow = _interopRequireDefault(require("./src/dataflow"));

var _context = _interopRequireDefault(require("./src/context"));

var _expression = _interopRequireDefault(require("./src/expression"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./src/dataflow":"Fun1","./src/context":"osQT","./src/expression":"qj1B"}],"n1O2":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _vegaDataflow = require("vega-dataflow");

var _vegaFunctions = require("vega-functions");

var _vegaRuntime = require("vega-runtime");

function _default(view, spec, functions) {
  var fn = functions || _vegaFunctions.functionContext;
  return (0, _vegaRuntime.parse)(spec, (0, _vegaRuntime.context)(view, _vegaDataflow.transforms, fn));
}
},{"vega-dataflow":"UC8n","vega-functions":"JYcc","vega-runtime":"SS7m"}],"jKDr":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.scale = scale;

var _vegaUtil = require("vega-util");

function scale(name) {
  var scales = this._runtime.scales;

  if (!(0, _vegaUtil.hasOwnProperty)(scales, name)) {
    (0, _vegaUtil.error)('Unrecognized scale or projection: ' + name);
  }

  return scales[name].value;
}
},{"vega-util":"dejJ"}],"D0Fn":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.viewWidth = viewWidth;
exports.viewHeight = viewHeight;
exports.initializeResize = initializeResize;
exports.resizeView = resizeView;
var Width = 'width',
    Height = 'height',
    Padding = 'padding',
    Skip = {
  skip: true
};

function viewWidth(view, width) {
  var a = view.autosize(),
      p = view.padding();
  return width - (a && a.contains === Padding ? p.left + p.right : 0);
}

function viewHeight(view, height) {
  var a = view.autosize(),
      p = view.padding();
  return height - (a && a.contains === Padding ? p.top + p.bottom : 0);
}

function initializeResize(view) {
  var s = view._signals,
      w = s[Width],
      h = s[Height],
      p = s[Padding];

  function resetSize() {
    view._autosize = view._resize = 1;
  } // respond to width signal


  view._resizeWidth = view.add(null, function (_) {
    view._width = _.size;
    view._viewWidth = viewWidth(view, _.size);
    resetSize();
  }, {
    size: w
  }); // respond to height signal

  view._resizeHeight = view.add(null, function (_) {
    view._height = _.size;
    view._viewHeight = viewHeight(view, _.size);
    resetSize();
  }, {
    size: h
  }); // respond to padding signal

  var 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(function (view) {
    var 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, 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, 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);
}
},{}],"Ajym":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getState = getState;
exports.setState = setState;

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

/**
 * 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 getState(options) {
  return this._runtime.getState(options || {
    data: dataTest,
    signals: signalTest,
    recurse: true
  });
}

function dataTest(name, data) {
  return data.modified && (0, _vegaUtil.isArray)(data.input.value) && name.indexOf('_:vega:_');
}

function signalTest(name, op) {
  return !(name === 'parent' || op instanceof _vegaDataflow.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 setState(state) {
  this.runAsync(null, v => {
    v._trigger = false;

    v._runtime.setState(state);
  }, v => {
    v._trigger = true;
  });
  return this;
}
},{"vega-dataflow":"UC8n","vega-util":"dejJ"}],"AeNt":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _d3Timer = require("d3-timer");

function _default(callback, delay) {
  function tick(elapsed) {
    callback({
      timestamp: Date.now(),
      elapsed: elapsed
    });
  }

  this._timers.push((0, _d3Timer.interval)(tick, delay));
}
},{"d3-timer":"yaK5"}],"xvEw":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _vegaUtil = require("vega-util");

function _default(handler, event, item, value) {
  var el = handler.element();
  if (el) el.setAttribute('title', formatTooltip(value));
}

function formatTooltip(value) {
  return value == null ? '' : (0, _vegaUtil.isArray)(value) ? formatArray(value) : (0, _vegaUtil.isObject)(value) && !(0, _vegaUtil.isDate)(value) ? formatObject(value) : value + '';
}

function formatObject(obj) {
  return Object.keys(obj).map(function (key) {
    var v = obj[key];
    return key + ': ' + ((0, _vegaUtil.isArray)(v) ? formatArray(v) : formatValue(v));
  }).join('\n');
}

function formatArray(value) {
  return '[' + value.map(formatValue).join(', ') + ']';
}

function formatValue(value) {
  return (0, _vegaUtil.isArray)(value) ? '[\u2026]' : (0, _vegaUtil.isObject)(value) && !(0, _vegaUtil.isDate)(value) ? '{\u2026}' : value;
}
},{"vega-util":"dejJ"}],"r17T":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = View;

var _cursor = _interopRequireDefault(require("./cursor"));

var _data = require("./data");

var _events = require("./events");

var _hover = _interopRequireDefault(require("./hover"));

var _finalize = _interopRequireDefault(require("./finalize"));

var _initialize = _interopRequireDefault(require("./initialize"));

var _renderToImageUrl = _interopRequireDefault(require("./render-to-image-url"));

var _renderToCanvas = _interopRequireDefault(require("./render-to-canvas"));

var _renderToSvg = _interopRequireDefault(require("./render-to-svg"));

var _renderSize = require("./render-size");

var _runtime = _interopRequireDefault(require("./runtime"));

var _scale = require("./scale");

var _size = require("./size");

var _state = require("./state");

var _timer = _interopRequireDefault(require("./timer"));

var _tooltip = _interopRequireDefault(require("./tooltip"));

var _trap = _interopRequireDefault(require("./trap"));

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

var _vegaScenegraph = require("vega-scenegraph");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * 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 peformed upon dataflow runs.
 * @constructor
 * @param {object} spec - The Vega dataflow runtime specification.
 */
function View(spec, options) {
  var view = this;
  options = options || {};

  _vegaDataflow.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);
  view._el = null;
  view._elBind = null;
  view._renderType = options.renderer || _vegaScenegraph.RenderType.Canvas;
  view._scenegraph = new _vegaScenegraph.Scenegraph();
  var root = view._scenegraph.root; // initialize renderer, handler and event management

  view._renderer = null;
  view._tooltip = options.tooltip || _tooltip.default, view._redraw = true;
  view._handler = new _vegaScenegraph.CanvasHandler().scene(root);
  view._preventDefault = false;
  view._timers = [];
  view._eventListeners = [];
  view._resizeListeners = []; // initialize event configuration

  view._eventConfig = (0, _events.initializeEventConfig)(spec.eventConfig); // initialize dataflow graph

  var ctx = (0, _runtime.default)(view, spec, options.functions);
  view._runtime = ctx;
  view._signals = ctx.signals;
  view._bind = (spec.bindings || []).map(function (_) {
    return {
      state: null,
      param: (0, _vegaUtil.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 background color

  view._background = options.background || ctx.background || null; // initialize view size

  view._width = view.width();
  view._height = view.height();
  view._viewWidth = (0, _size.viewWidth)(view, view._width);
  view._viewHeight = (0, _size.viewHeight)(view, view._height);
  view._origin = [0, 0];
  view._resize = 0;
  view._autosize = 1;
  (0, _size.initializeResize)(view); // initialize cursor

  (0, _cursor.default)(view); // 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);
}

var prototype = (0, _vegaUtil.inherits)(View, _vegaDataflow.Dataflow); // -- DATAFLOW / RENDERING ----

prototype.evaluate = async function (encode, prerun, postrun) {
  // evaluate dataflow and prerun
  await _vegaDataflow.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;
          (0, _renderSize.resizeRenderer)(this);
        }

        await this._renderer.renderAsync(this._scenegraph.root);
      }

      this._redraw = false;
    } catch (e) {
      this.error(e);
    }
  } // evaluate postrun


  if (postrun) (0, _vegaDataflow.asyncCallback)(this, postrun);
  return this;
};

prototype.dirty = function (item) {
  this._redraw = true;
  this._renderer && this._renderer.dirty(item);
}; // -- GET / SET ----


prototype.container = function () {
  return this._el;
};

prototype.scenegraph = function () {
  return this._scenegraph;
};

prototype.origin = function () {
  return this._origin.slice();
};

function lookupSignal(view, name) {
  return (0, _vegaUtil.hasOwnProperty)(view._signals, name) ? view._signals[name] : (0, _vegaUtil.error)('Unrecognized signal name: ' + (0, _vegaUtil.stringValue)(name));
}

prototype.signal = function (name, value, options) {
  var op = lookupSignal(this, name);
  return arguments.length === 1 ? op.value : this.update(op, value, options);
};

prototype.background = function (_) {
  if (arguments.length) {
    this._background = _;
    this._resize = 1;
    return this;
  } else {
    return this._background;
  }
};

prototype.width = function (_) {
  return arguments.length ? this.signal('width', _) : this.signal('width');
};

prototype.height = function (_) {
  return arguments.length ? this.signal('height', _) : this.signal('height');
};

prototype.padding = function (_) {
  return arguments.length ? this.signal('padding', _) : this.signal('padding');
};

prototype.autosize = function (_) {
  return arguments.length ? this.signal('autosize', _) : this.signal('autosize');
};

prototype.renderer = function (type) {
  if (!arguments.length) return this._renderType;
  if (!(0, _vegaScenegraph.renderModule)(type)) (0, _vegaUtil.error)('Unrecognized renderer type: ' + type);

  if (type !== this._renderType) {
    this._renderType = type;

    this._resetRenderer();
  }

  return this;
};

prototype.tooltip = function (handler) {
  if (!arguments.length) return this._tooltip;

  if (handler !== this._tooltip) {
    this._tooltip = handler;

    this._resetRenderer();
  }

  return this;
};

prototype.loader = function (loader) {
  if (!arguments.length) return this._loader;

  if (loader !== this._loader) {
    _vegaDataflow.Dataflow.prototype.loader.call(this, loader);

    this._resetRenderer();
  }

  return this;
};

prototype.resize = function () {
  // set flag to perform autosize
  this._autosize = 1; // touch autosize signal to ensure top-level ViewLayout runs

  return this.touch(lookupSignal(this, 'autosize'));
};

prototype._resetRenderer = function () {
  if (this._renderer) {
    this._renderer = null;
    this.initialize(this._el, this._elBind);
  }
}; // -- SIZING ----


prototype._resizeView = _size.resizeView; // -- EVENT HANDLING ----

prototype.addEventListener = function (type, handler, options) {
  var callback = handler;

  if (!(options && options.trap === false)) {
    // wrap callback in error handler
    callback = (0, _trap.default)(this, handler);
    callback.raw = handler;
  }

  this._handler.on(type, callback);

  return this;
};

prototype.removeEventListener = function (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;
};

prototype.addResizeListener = function (handler) {
  var 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;
};

prototype.removeResizeListener = function (handler) {
  var l = this._resizeListeners,
      i = l.indexOf(handler);

  if (i >= 0) {
    l.splice(i, 1);
  }

  return this;
};

function findOperatorHandler(op, handler) {
  var t = op._targets || [],
      h = t.filter(function (op) {
    var u = op._update;
    return u && u.handler === handler;
  });
  return h.length ? h[0] : null;
}

function addOperatorListener(view, name, op, handler) {
  var h = findOperatorHandler(op, handler);

  if (!h) {
    h = (0, _trap.default)(this, function () {
      handler(name, op.value);
    });
    h.handler = handler;
    view.on(op, null, h);
  }

  return view;
}

function removeOperatorListener(view, op, handler) {
  var h = findOperatorHandler(op, handler);
  if (h) op._targets.remove(h);
  return view;
}

prototype.addSignalListener = function (name, handler) {
  return addOperatorListener(this, name, lookupSignal(this, name), handler);
};

prototype.removeSignalListener = function (name, handler) {
  return removeOperatorListener(this, lookupSignal(this, name), handler);
};

prototype.addDataListener = function (name, handler) {
  return addOperatorListener(this, name, (0, _data.dataref)(this, name).values, handler);
};

prototype.removeDataListener = function (name, handler) {
  return removeOperatorListener(this, (0, _data.dataref)(this, name).values, handler);
};

prototype.preventDefault = function (_) {
  if (arguments.length) {
    this._preventDefault = _;
    return this;
  } else {
    return this._preventDefault;
  }
};

prototype.timer = _timer.default;
prototype.events = _events.events;
prototype.finalize = _finalize.default;
prototype.hover = _hover.default; // -- DATA ----

prototype.data = _data.data;
prototype.change = _data.change;
prototype.insert = _data.insert;
prototype.remove = _data.remove; // -- SCALES --

prototype.scale = _scale.scale; // -- INITIALIZATION ----

prototype.initialize = _initialize.default; // -- HEADLESS RENDERING ----

prototype.toImageURL = _renderToImageUrl.default;
prototype.toCanvas = _renderToCanvas.default;
prototype.toSVG = _renderToSvg.default; // -- SAVE / RESTORE STATE ----

prototype.getState = _state.getState;
prototype.setState = _state.setState;
},{"./cursor":"NKpT","./data":"F0bw","./events":"yLPS","./hover":"yKgy","./finalize":"GIsK","./initialize":"n2uX","./render-to-image-url":"q9KE","./render-to-canvas":"f2sY","./render-to-svg":"TZ4d","./render-size":"DnBT","./runtime":"n1O2","./scale":"jKDr","./size":"D0Fn","./state":"Ajym","./timer":"AeNt","./tooltip":"xvEw","./trap":"Pywq","vega-dataflow":"UC8n","vega-util":"dejJ","vega-scenegraph":"rKdC"}],"YCdH":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "View", {
  enumerable: true,
  get: function () {
    return _View.default;
  }
});

var _View = _interopRequireDefault(require("./src/View"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./src/View":"r17T"}],"rRM3":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _vegaUtil = require("vega-util");

function _default(spec, config) {
  spec = spec || config.autosize;
  return (0, _vegaUtil.isObject)(spec) ? spec : {
    type: spec || 'pad'
  };
}
},{"vega-util":"dejJ"}],"IU3H":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _vegaUtil = require("vega-util");

function _default(spec, config) {
  spec = spec || config.padding;
  return (0, _vegaUtil.isObject)(spec) ? {
    top: number(spec.top),
    bottom: number(spec.bottom),
    left: number(spec.left),
    right: number(spec.right)
  } : paddingObject(number(spec));
}

function number(_) {
  return +_ || 0;
}

function paddingObject(_) {
  return {
    top: _,
    bottom: _,
    left: _,
    right: _
  };
}
},{"vega-util":"dejJ"}],"W0Pp":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _vegaUtil = require("vega-util");

var OUTER = 'outer',
    OUTER_INVALID = ['value', 'update', 'init', 'react', 'bind'];

function outerError(prefix, name) {
  (0, _vegaUtil.error)(prefix + ' for "outer" push: ' + (0, _vegaUtil.stringValue)(name));
}

function _default(signal, scope) {
  var 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(function (prop) {
      if (signal[prop] !== undefined) outerError('Invalid property ', prop);
    });
  } else {
    // define a new signal in the current scope
    var op = scope.addSignal(name, signal.value);
    if (signal.react === false) op.react = false;
    if (signal.bind) scope.addBinding(name, signal.bind);
  }
}
},{"vega-util":"dejJ"}],"ixc4":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _vegaExpression = require("vega-expression");

var _vegaFunctions = require("vega-functions");

var _vegaUtil = require("vega-util");

function _default(expr, scope, preamble) {
  var params = {},
      ast,
      gen; // parse the expression to an abstract syntax tree (ast)

  try {
    expr = (0, _vegaUtil.isString)(expr) ? expr : (0, _vegaUtil.stringValue)(expr) + '';
    ast = (0, _vegaExpression.parse)(expr);
  } catch (err) {
    (0, _vegaUtil.error)('Expression parse error: ' + expr);
  } // analyze ast function calls for dependencies


  ast.visit(function visitor(node) {
    if (node.type !== _vegaExpression.CallExpression) return;
    var name = node.callee.name,
        visit = _vegaFunctions.codegenParams.visitors[name];
    if (visit) visit(name, node.arguments, scope, params);
  }); // perform code generation

  gen = (0, _vegaFunctions.codeGenerator)(ast); // collect signal dependencies

  gen.globals.forEach(function (name) {
    var signalName = _vegaFunctions.SignalPrefix + name;

    if (!(0, _vegaUtil.hasOwnProperty)(params, signalName) && scope.getSignal(name)) {
      params[signalName] = scope.signalRef(name);
    }
  }); // return generated expression code and dependencies

  return {
    $expr: preamble ? preamble + 'return(' + gen.code + ');' : gen.code,
    $fields: gen.fields,
    $params: params
  };
}
},{"vega-expression":"rJuS","vega-functions":"JYcc","vega-util":"dejJ"}],"eOYX":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Entry = Entry;
exports.entry = entry;
exports.operator = operator;
exports.ref = ref;
exports.fieldRef = fieldRef;
exports.compareRef = compareRef;
exports.keyRef = keyRef;
exports.sortKey = sortKey;
exports.aggrField = aggrField;
exports.isSignal = isSignal;
exports.isExpr = isExpr;
exports.hasSignal = hasSignal;
exports.value = value;
exports.deref = deref;
exports.View = exports.Scope = exports.Descending = exports.Ascending = exports.keyFieldRef = exports.tupleidRef = void 0;

var _vegaUtil = require("vega-util");

function Entry(type, value, params, parent) {
  this.id = -1;
  this.type = type;
  this.value = value;
  this.params = params;
  if (parent) this.parent = parent;
}

function entry(type, value, params, parent) {
  return new Entry(type, value, params, parent);
}

function operator(value, params) {
  return entry('operator', value, params);
} // -----


function ref(op) {
  var 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;
}

var tupleidRef = {
  $tupleid: 1,
  toString: function () {
    return ':_tupleid_:';
  }
};
exports.tupleidRef = tupleidRef;

function fieldRef(field, name) {
  return name ? {
    $field: field,
    $name: name
  } : {
    $field: field
  };
}

var keyFieldRef = fieldRef('key');
exports.keyFieldRef = keyFieldRef;

function compareRef(fields, orders) {
  return {
    $compare: fields,
    $order: orders
  };
}

function keyRef(fields, flat) {
  var ref = {
    $key: fields
  };
  if (flat) ref.$flat = true;
  return ref;
} // -----


var Ascending = 'ascending';
exports.Ascending = Ascending;
var Descending = 'descending';
exports.Descending = Descending;

function sortKey(sort) {
  return !(0, _vegaUtil.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 || '');
} // -----


var Scope = 'scope';
exports.Scope = Scope;
var View = 'view';
exports.View = View;

function isSignal(_) {
  return _ && _.signal;
}

function isExpr(_) {
  return _ && _.expr;
}

function hasSignal(_) {
  if (isSignal(_)) return true;
  if ((0, _vegaUtil.isObject)(_)) for (var key in _) {
    if (hasSignal(_[key])) return true;
  }
  return false;
}

function value(specValue, defaultValue) {
  return specValue != null ? specValue : defaultValue;
}

function deref(v) {
  return v && v.signal || v;
}
},{"vega-util":"dejJ"}],"Yym5":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = parseStream;

var _expression = _interopRequireDefault(require("./expression"));

var _util = require("../util");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Timer = 'timer';

function parseStream(stream, scope) {
  var method = stream.merge ? mergeStream : stream.stream ? nestedStream : stream.type ? eventStream : (0, _vegaUtil.error)('Invalid stream specification: ' + (0, _vegaUtil.stringValue)(stream));
  return method(stream, scope);
}

function eventSource(source) {
  return source === _util.Scope ? _util.View : source || _util.View;
}

function mergeStream(stream, scope) {
  var list = stream.merge.map(s => parseStream(s, scope)),
      entry = streamParameters({
    merge: list
  }, stream, scope);
  return scope.addStream(entry).id;
}

function nestedStream(stream, scope) {
  var id = parseStream(stream.stream, scope),
      entry = streamParameters({
    stream: id
  }, stream, scope);
  return scope.addStream(entry).id;
}

function eventStream(stream, scope) {
  var id, entry;

  if (stream.type === Timer) {
    id = scope.event(Timer, stream.throttle);
    stream = {
      between: stream.between,
      filter: stream.filter
    };
  } else {
    id = scope.event(eventSource(stream.source), stream.type);
  }

  entry = streamParameters({
    stream: id
  }, stream, scope);
  return Object.keys(entry).length === 1 ? id : scope.addStream(entry).id;
}

function streamParameters(entry, stream, scope) {
  var param = stream.between;

  if (param) {
    if (param.length !== 2) {
      (0, _vegaUtil.error)('Stream "between" parameter must have 2 entries: ' + (0, _vegaUtil.stringValue)(stream));
    }

    entry.between = [parseStream(param[0], scope), 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 === _util.Scope) {
    // add filter to limit events from sub-scope only
    param.push('inScope(event.item)');
  }

  if (param.length) {
    entry.filter = (0, _expression.default)('(' + param.join(')&&(') + ')').$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) {
  var item = 'event.item';
  return item + (type && type !== '*' ? '&&' + item + '.mark.marktype===\'' + type + '\'' : '') + (role ? '&&' + item + '.mark.role===\'' + role + '\'' : '') + (name ? '&&' + item + '.mark.name===\'' + name + '\'' : '');
}
},{"./expression":"ixc4","../util":"eOYX","vega-util":"dejJ"}],"uLGE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

/**
 * Parse an event selector string.
 * Returns an array of event stream definitions.
 */
function _default(selector, source, marks) {
  DEFAULT_SOURCE = source || VIEW;
  MARKS = marks || DEFAULT_MARKS;
  return parseMerge(selector.trim()).map(parseSelector);
}

var VIEW = 'view',
    LBRACK = '[',
    RBRACK = ']',
    LBRACE = '{',
    RBRACE = '}',
    COLON = ':',
    COMMA = ',',
    NAME = '@',
    GT = '>',
    ILLEGAL = /[[\]{}]/,
    DEFAULT_SOURCE,
    MARKS,
    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
};

function isMarkType(type) {
  return MARKS[type];
}

function find(s, i, endChar, pushChar, popChar) {
  var count = 0,
      n = s.length,
      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) {
  var output = [],
      start = 0,
      n = s.length,
      i = 0;

  while (i < n) {
    i = 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) : parseStream(s);
}

function parseBetween(s) {
  var n = s.length,
      i = 1,
      b,
      stream;
  i = 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);
  stream = parseSelector(s.slice(1).trim());

  if (stream.between) {
    return {
      between: b,
      stream: stream
    };
  } else {
    stream.between = b;
  }

  return stream;
}

function parseStream(s) {
  var stream = {
    source: DEFAULT_SOURCE
  },
      source = [],
      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 = find(s, i, COLON);

  if (j < n) {
    source.push(s.substring(start, j).trim());
    start = i = ++j;
  } // extract remaining part of stream selector


  i = 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 = 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) || 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) {
  var a = s.split(COMMA);
  if (!s.length || a.length > 2) throw s;
  return a.map(function (_) {
    var x = +_;
    if (x !== x) throw s;
    return x;
  });
}
},{}],"ymtz":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "selector", {
  enumerable: true,
  get: function () {
    return _eventSelector.default;
  }
});

var _eventSelector = _interopRequireDefault(require("./src/event-selector"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./src/event-selector":"uLGE"}],"tdvl":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _expression = _interopRequireDefault(require("./expression"));

var _stream = _interopRequireDefault(require("./stream"));

var _util = require("../util");

var _vegaEventSelector = require("vega-event-selector");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var preamble = 'var datum=event.item&&event.item.datum;';

function _default(spec, scope, target) {
  var events = spec.events,
      update = spec.update,
      encode = spec.encode,
      sources = [],
      entry = {
    target: target
  };

  if (!events) {
    (0, _vegaUtil.error)('Signal update missing events specification.');
  } // interpret as an event selector string


  if ((0, _vegaUtil.isString)(events)) {
    events = (0, _vegaEventSelector.selector)(events, scope.isSubscope() ? _util.Scope : _util.View);
  } // separate event streams from signal updates


  events = (0, _vegaUtil.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) (0, _vegaUtil.error)('Signal encode and update are mutually exclusive.');
    update = 'encode(item(),' + (0, _vegaUtil.stringValue)(encode) + ')';
  } // resolve update value


  entry.update = (0, _vegaUtil.isString)(update) ? (0, _expression.default)(update, scope, preamble) : update.expr != null ? (0, _expression.default)(update.expr, scope, preamble) : update.value != null ? update.value : update.signal != null ? {
    $expr: '_.value',
    $params: {
      value: scope.signalRef(update.signal)
    }
  } : (0, _vegaUtil.error)('Invalid signal update specification.');

  if (spec.force) {
    entry.options = {
      force: true
    };
  }

  sources.forEach(function (source) {
    scope.addUpdate((0, _vegaUtil.extend)(streamSource(source, scope), entry));
  });
}

function streamSource(stream, scope) {
  return {
    source: stream.signal ? scope.signalRef(stream.signal) : stream.scale ? scope.scaleRef(stream.scale) : (0, _stream.default)(stream, scope)
  };
}

function mergeSources(sources) {
  return {
    signal: '[' + sources.map(s => s.scale ? 'scale("' + s.scale + '")' : s.signal) + ']'
  };
}
},{"./expression":"ixc4","./stream":"Yym5","../util":"eOYX","vega-event-selector":"ymtz","vega-util":"dejJ"}],"uclE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _expression = _interopRequireDefault(require("./expression"));

var _update = _interopRequireDefault(require("./update"));

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(signal, scope) {
  var op = scope.getSignal(signal.name),
      expr = signal.update;

  if (signal.init) {
    if (expr) {
      (0, _vegaUtil.error)('Signals can not include both init and update expressions.');
    } else {
      expr = signal.init;
      op.initonly = true;
    }
  }

  if (expr) {
    expr = (0, _expression.default)(expr, scope);
    op.update = expr.$expr;
    op.params = expr.$params;
  }

  if (signal.on) {
    signal.on.forEach(function (_) {
      (0, _update.default)(_, scope, op.id);
    });
  }
}
},{"./expression":"ixc4","./update":"tdvl","vega-util":"dejJ"}],"rsu0":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Values = exports.ViewLayout = exports.SortItems = exports.Sieve = exports.Scale = exports.Render = exports.Relay = exports.Proxy = exports.Projection = exports.PreFacet = exports.Params = exports.Overlap = exports.MultiValues = exports.MultiExtent = exports.Mark = exports.Load = exports.LegendEntries = exports.Key = exports.Field = exports.Facet = exports.Extent = exports.Expression = exports.Encode = exports.DataJoin = exports.Compare = exports.Collect = exports.Bound = exports.AxisTicks = exports.Aggregate = void 0;

var _util = require("./util");

function transform(name) {
  return function (params, value, parent) {
    return (0, _util.entry)(name, value, params || undefined, parent);
  };
}

var Aggregate = transform('aggregate');
exports.Aggregate = Aggregate;
var AxisTicks = transform('axisticks');
exports.AxisTicks = AxisTicks;
var Bound = transform('bound');
exports.Bound = Bound;
var Collect = transform('collect');
exports.Collect = Collect;
var Compare = transform('compare');
exports.Compare = Compare;
var DataJoin = transform('datajoin');
exports.DataJoin = DataJoin;
var Encode = transform('encode');
exports.Encode = Encode;
var Expression = transform('expression');
exports.Expression = Expression;
var Extent = transform('extent');
exports.Extent = Extent;
var Facet = transform('facet');
exports.Facet = Facet;
var Field = transform('field');
exports.Field = Field;
var Key = transform('key');
exports.Key = Key;
var LegendEntries = transform('legendentries');
exports.LegendEntries = LegendEntries;
var Load = transform('load');
exports.Load = Load;
var Mark = transform('mark');
exports.Mark = Mark;
var MultiExtent = transform('multiextent');
exports.MultiExtent = MultiExtent;
var MultiValues = transform('multivalues');
exports.MultiValues = MultiValues;
var Overlap = transform('overlap');
exports.Overlap = Overlap;
var Params = transform('params');
exports.Params = Params;
var PreFacet = transform('prefacet');
exports.PreFacet = PreFacet;
var Projection = transform('projection');
exports.Projection = Projection;
var Proxy = transform('proxy');
exports.Proxy = Proxy;
var Relay = transform('relay');
exports.Relay = Relay;
var Render = transform('render');
exports.Render = Render;
var Scale = transform('scale');
exports.Scale = Scale;
var Sieve = transform('sieve');
exports.Sieve = Sieve;
var SortItems = transform('sortitems');
exports.SortItems = SortItems;
var ViewLayout = transform('viewlayout');
exports.ViewLayout = ViewLayout;
var Values = transform('values');
exports.Values = Values;
},{"./util":"eOYX"}],"BBsO":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.initScale = initScale;
exports.parseScale = parseScale;

var _util = require("../util");

var _transforms = require("../transforms");

var _vegaScale = require("vega-scale");

var _vegaUtil = require("vega-util");

var FIELD_REF_ID = 0;
var MULTIDOMAIN_SORT_OPS = {
  min: 'min',
  max: 'max',
  count: 'sum'
};

function initScale(spec, scope) {
  var type = spec.type || 'linear';

  if (!(0, _vegaScale.isValidScaleType)(type)) {
    (0, _vegaUtil.error)('Unrecognized scale type: ' + (0, _vegaUtil.stringValue)(type));
  }

  scope.addScale(spec.name, {
    type: type,
    domain: undefined
  });
}

function parseScale(spec, scope) {
  var params = scope.getScale(spec.name).params,
      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 ((0, _vegaUtil.hasOwnProperty)(params, key) || key === 'name') continue;
    params[key] = parseLiteral(spec[key], scope);
  }
}

function parseLiteral(v, scope) {
  return !(0, _vegaUtil.isObject)(v) ? v : v.signal ? scope.signalRef(v.signal) : (0, _vegaUtil.error)('Unsupported object: ' + (0, _vegaUtil.stringValue)(v));
}

function parseArray(v, scope) {
  return v.signal ? scope.signalRef(v.signal) : v.map(v => parseLiteral(v, scope));
}

function dataLookupError(name) {
  (0, _vegaUtil.error)('Can not find data set: ' + (0, _vegaUtil.stringValue)(name));
} // -- SCALE DOMAIN ----


function parseScaleDomain(domain, spec, scope) {
  if (!domain) {
    if (spec.domainMin != null || spec.domainMax != null) {
      (0, _vegaUtil.error)('No scale domain defined for domainMin/domainMax to override.');
    }

    return; // default domain
  }

  return domain.signal ? scope.signalRef(domain.signal) : ((0, _vegaUtil.isArray)(domain) ? explicitDomain : domain.fields ? multipleDomain : singularDomain)(domain, spec, scope);
}

function explicitDomain(domain, spec, scope) {
  return domain.map(function (v) {
    return parseLiteral(v, scope);
  });
}

function singularDomain(domain, spec, scope) {
  var data = scope.getData(domain.data);
  if (!data) dataLookupError(domain.data);
  return (0, _vegaScale.isDiscrete)(spec.type) ? data.valuesRef(scope, domain.field, parseSort(domain.sort, false)) : (0, _vegaScale.isQuantile)(spec.type) ? data.domainRef(scope, domain.field) : data.extentRef(scope, domain.field);
}

function multipleDomain(domain, spec, scope) {
  var data = domain.data,
      fields = domain.fields.reduce(function (dom, d) {
    d = (0, _vegaUtil.isString)(d) ? {
      data: data,
      field: d
    } : (0, _vegaUtil.isArray)(d) || d.signal ? fieldRef(d, scope) : d;
    dom.push(d);
    return dom;
  }, []);
  return ((0, _vegaScale.isDiscrete)(spec.type) ? ordinalMultipleDomain : (0, _vegaScale.isQuantile)(spec.type) ? quantileMultipleDomain : numericMultipleDomain)(domain, scope, fields);
}

function fieldRef(data, scope) {
  var name = '_:vega:_' + FIELD_REF_ID++,
      coll = (0, _transforms.Collect)({});

  if ((0, _vegaUtil.isArray)(data)) {
    coll.value = {
      $ingest: data
    };
  } else if (data.signal) {
    var code = 'setdata(' + (0, _vegaUtil.stringValue)(name) + ',' + data.signal + ')';
    coll.params.input = scope.signalRef(code);
  }

  scope.addDataPipeline(name, [coll, (0, _transforms.Sieve)({})]);
  return {
    data: name,
    field: 'data'
  };
}

function ordinalMultipleDomain(domain, scope, fields) {
  var sort = parseSort(domain.sort, true),
      counts,
      p,
      a,
      c,
      v; // get value counts for each domain field

  counts = fields.map(function (f) {
    var data = scope.getData(f.data);
    if (!data) dataLookupError(f.data);
    return data.countsRef(scope, f.field, sort);
  }); // aggregate the results from each domain field

  p = {
    groupby: _util.keyFieldRef,
    pulse: counts
  };

  if (sort) {
    a = sort.op || 'count';
    v = sort.field ? (0, _util.aggrField)(a, sort.field) : 'count';
    p.ops = [MULTIDOMAIN_SORT_OPS[a]];
    p.fields = [scope.fieldRef(v)];
    p.as = [v];
  }

  a = scope.add((0, _transforms.Aggregate)(p)); // collect aggregate output

  c = scope.add((0, _transforms.Collect)({
    pulse: (0, _util.ref)(a)
  })); // extract values for combined domain

  v = scope.add((0, _transforms.Values)({
    field: _util.keyFieldRef,
    sort: scope.sortRef(sort),
    pulse: (0, _util.ref)(c)
  }));
  return (0, _util.ref)(v);
}

function parseSort(sort, multidomain) {
  if (sort) {
    if (!sort.field && !sort.op) {
      if ((0, _vegaUtil.isObject)(sort)) sort.field = 'key';else sort = {
        field: 'key'
      };
    } else if (!sort.field && sort.op !== 'count') {
      (0, _vegaUtil.error)('No field provided for sort aggregate op: ' + sort.op);
    } else if (multidomain && sort.field) {
      if (sort.op && !MULTIDOMAIN_SORT_OPS[sort.op]) {
        (0, _vegaUtil.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
  var values = fields.map(function (f) {
    var data = scope.getData(f.data);
    if (!data) dataLookupError(f.data);
    return data.domainRef(scope, f.field);
  }); // combine value arrays

  return (0, _util.ref)(scope.add((0, _transforms.MultiValues)({
    values: values
  })));
}

function numericMultipleDomain(domain, scope, fields) {
  // get extents for each domain field
  var extents = fields.map(function (f) {
    var data = scope.getData(f.data);
    if (!data) dataLookupError(f.data);
    return data.extentRef(scope, f.field);
  }); // combine extents

  return (0, _util.ref)(scope.add((0, _transforms.MultiExtent)({
    extents: extents
  })));
} // -- SCALE BINS -----


function parseScaleBins(v, scope) {
  return v.signal || (0, _vegaUtil.isArray)(v) ? parseArray(v, scope) : scope.objectProperty(v);
} // -- SCALE NICE -----


function parseScaleNice(nice) {
  return (0, _vegaUtil.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) {
  var range = spec.range,
      config = scope.config.range;

  if (range.signal) {
    return scope.signalRef(range.signal);
  } else if ((0, _vegaUtil.isString)(range)) {
    if (config && (0, _vegaUtil.hasOwnProperty)(config, range)) {
      spec = (0, _vegaUtil.extend)({}, spec, {
        range: config[range]
      });
      return parseScaleRange(spec, scope, params);
    } else if (range === 'width') {
      range = [0, {
        signal: 'width'
      }];
    } else if (range === 'height') {
      range = (0, _vegaScale.isDiscrete)(spec.type) ? [0, {
        signal: 'height'
      }] : [{
        signal: 'height'
      }, 0];
    } else {
      (0, _vegaUtil.error)('Unrecognized scale range value: ' + (0, _vegaUtil.stringValue)(range));
    }
  } else if (range.scheme) {
    params.scheme = (0, _vegaUtil.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 ((0, _vegaScale.isDiscrete)(spec.type) && !(0, _vegaUtil.isArray)(range)) {
    return parseScaleDomain(range, spec, scope);
  } else if (!(0, _vegaUtil.isArray)(range)) {
    (0, _vegaUtil.error)('Unsupported range type: ' + (0, _vegaUtil.stringValue)(range));
  }

  return range.map(v => ((0, _vegaUtil.isArray)(v) ? parseArray : parseLiteral)(v, scope));
}
},{"../util":"eOYX","../transforms":"rsu0","vega-scale":"VE6e","vega-util":"dejJ"}],"C3DW":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _vegaUtil = require("vega-util");

function _default(proj, scope) {
  var config = scope.config.projection || {},
      params = {};

  for (var name in proj) {
    if (name === 'name') continue;
    params[name] = parseParameter(proj[name], name, scope);
  } // apply projection defaults from config


  for (name in config) {
    if (params[name] == null) {
      params[name] = parseParameter(config[name], name, scope);
    }
  }

  scope.addProjection(proj.name, params);
}

function parseParameter(_, name, scope) {
  return (0, _vegaUtil.isArray)(_) ? _.map(function (_) {
    return parseParameter(_, name, scope);
  }) : !(0, _vegaUtil.isObject)(_) ? _ : _.signal ? scope.signalRef(_.signal) : name === 'fit' ? _ : (0, _vegaUtil.error)('Unsupported parameter object: ' + (0, _vegaUtil.stringValue)(_));
}
},{"vega-util":"dejJ"}],"Bky9":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.one = exports.zero = exports.Skip = exports.LegendScales = exports.Discrete = exports.Gradient = exports.Symbols = exports.GroupSubtitleStyle = exports.GroupTitleStyle = exports.GuideTitleStyle = exports.GuideLabelStyle = exports.Value = exports.Size = exports.Perc2 = exports.Perc = exports.Offset = exports.Label = exports.Index = exports.End = exports.Middle = exports.Start = exports.Vertical = exports.Center = exports.Bottom = exports.Right = exports.Left = exports.Top = void 0;
const Top = 'top';
exports.Top = Top;
const Left = 'left';
exports.Left = Left;
const Right = 'right';
exports.Right = Right;
const Bottom = 'bottom';
exports.Bottom = Bottom;
const Center = 'center';
exports.Center = Center;
const Vertical = 'vertical';
exports.Vertical = Vertical;
const Start = 'start';
exports.Start = Start;
const Middle = 'middle';
exports.Middle = Middle;
const End = 'end';
exports.End = End;
const Index = 'index';
exports.Index = Index;
const Label = 'label';
exports.Label = Label;
const Offset = 'offset';
exports.Offset = Offset;
const Perc = 'perc';
exports.Perc = Perc;
const Perc2 = 'perc2';
exports.Perc2 = Perc2;
const Size = 'size';
exports.Size = Size;
const Value = 'value';
exports.Value = Value;
const GuideLabelStyle = 'guide-label';
exports.GuideLabelStyle = GuideLabelStyle;
const GuideTitleStyle = 'guide-title';
exports.GuideTitleStyle = GuideTitleStyle;
const GroupTitleStyle = 'group-title';
exports.GroupTitleStyle = GroupTitleStyle;
const GroupSubtitleStyle = 'group-subtitle';
exports.GroupSubtitleStyle = GroupSubtitleStyle;
const Symbols = 'symbol';
exports.Symbols = Symbols;
const Gradient = 'gradient';
exports.Gradient = Gradient;
const Discrete = 'discrete'; // Encoding channels supported by legends
// In priority order of 'canonical' scale

exports.Discrete = Discrete;
const LegendScales = ['size', 'shape', 'fill', 'stroke', 'strokeWidth', 'strokeDash', 'opacity'];
exports.LegendScales = LegendScales;
const Skip = {
  name: 1,
  style: 1,
  interactive: 1
};
exports.Skip = Skip;
const zero = {
  value: 0
};
exports.zero = zero;
const one = {
  value: 1
};
exports.one = one;
},{}],"FegD":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _vegaUtil = require("vega-util");

var Skip = (0, _vegaUtil.toSet)(['rule']),
    Swap = (0, _vegaUtil.toSet)(['group', 'image', 'rect']);

function _default(encode, marktype) {
  var 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;
}
},{"vega-util":"dejJ"}],"UDp0":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _entry = _interopRequireDefault(require("./entry"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(enc, scope, params, fields) {
  function color(type, x, y, z) {
    var a = (0, _entry.default)(null, x, scope, params, fields),
        b = (0, _entry.default)(null, y, scope, params, fields),
        c = (0, _entry.default)(null, z, scope, params, fields);
    return 'this.' + type + '(' + [a, b, c].join(',') + ').toString()';
  }

  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;
}
},{"./entry":"TSri"}],"GfmA":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _expression = _interopRequireDefault(require("../expression"));

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(code, scope, params, fields) {
  var expr = (0, _expression.default)(code, scope);
  expr.$fields.forEach(function (name) {
    fields[name] = 1;
  });
  (0, _vegaUtil.extend)(params, expr.$params);
  return expr.$expr;
}
},{"../expression":"ixc4","vega-util":"dejJ"}],"uiF9":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _expression = _interopRequireDefault(require("./expression"));

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(ref, scope, params, fields) {
  return resolve((0, _vegaUtil.isObject)(ref) ? ref : {
    datum: ref
  }, scope, params, fields);
}

function resolve(ref, scope, params, fields) {
  var object, level, field;

  if (ref.signal) {
    object = 'datum';
    field = (0, _expression.default)(ref.signal, scope, params, fields);
  } 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 {
    (0, _vegaUtil.error)('Invalid field reference: ' + (0, _vegaUtil.stringValue)(ref));
  }

  if (!ref.signal) {
    if ((0, _vegaUtil.isString)(field)) {
      fields[field] = 1; // TODO review field tracking?

      field = (0, _vegaUtil.splitAccessPath)(field).map(_vegaUtil.stringValue).join('][');
    } else {
      field = resolve(field, scope, params, fields);
    }
  }

  return object + '[' + field + ']';
}
},{"./expression":"GfmA","vega-util":"dejJ"}],"bpmg":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _entry = _interopRequireDefault(require("./entry"));

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(property, scope, params, fields) {
  return (0, _vegaUtil.isObject)(property) ? '(' + (0, _entry.default)(null, property, scope, params, fields) + ')' : property;
}
},{"./entry":"TSri","vega-util":"dejJ"}],"QTKh":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.getScale = getScale;

var _expression = _interopRequireDefault(require("./expression"));

var _field = _interopRequireDefault(require("./field"));

var _property = _interopRequireDefault(require("./property"));

var _vegaFunctions = require("vega-functions");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(enc, value, scope, params, fields) {
  var scale = getScale(enc.scale, scope, params, fields),
      interp,
      func,
      flag;

  if (enc.range != null) {
    // pull value from scale range
    interp = +enc.range;
    func = scale + '.range()';
    value = interp === 0 ? func + '[0]' : '($=' + func + ',' + (interp === 1 ? '$[$.length-1]' : '$[0]+' + interp + '*($[$.length-1]-$[0])') + ')';
  } else {
    // run value through scale and/or pull scale bandwidth
    if (value !== undefined) value = scale + '(' + value + ')';

    if (enc.band && (flag = hasBandwidth(enc.scale, scope))) {
      func = scale + '.bandwidth';

      if (enc.band.signal) {
        interp = func + '()*' + (0, _property.default)(enc.band, scope, params, fields);
      } else {
        interp = +enc.band;
        interp = func + '()' + (interp === 1 ? '' : '*' + interp);
      } // if we don't know the scale type, check for bandwidth


      if (flag < 0) interp = '(' + func + '?' + interp + ':0)';
      value = (value ? value + '+' : '') + interp;

      if (enc.extra) {
        // include logic to handle extraneous elements
        value = '(datum.extra?' + scale + '(datum.extra.value):' + value + ')';
      }
    }

    if (value == null) value = '0';
  }

  return value;
}

function hasBandwidth(name, scope) {
  if (!(0, _vegaUtil.isString)(name)) return -1;
  var type = scope.scaleType(name);
  return type === 'band' || type === 'point' ? 1 : 0;
}

function getScale(name, scope, params, fields) {
  var scaleName;

  if ((0, _vegaUtil.isString)(name)) {
    // direct scale lookup; add scale as parameter
    scaleName = _vegaFunctions.ScalePrefix + name;

    if (!(0, _vegaUtil.hasOwnProperty)(params, scaleName)) {
      params[scaleName] = scope.scaleRef(name);
    }

    scaleName = (0, _vegaUtil.stringValue)(scaleName);
  } else {
    // indirect scale lookup; add all scales as parameters
    for (scaleName in scope.scales) {
      params[_vegaFunctions.ScalePrefix + scaleName] = scope.scaleRef(scaleName);
    }

    scaleName = (0, _vegaUtil.stringValue)(_vegaFunctions.ScalePrefix) + '+' + (name.signal ? '(' + (0, _expression.default)(name.signal, scope, params, fields) + ')' : (0, _field.default)(name, scope, params, fields));
  }

  return '_[' + scaleName + ']';
}
},{"./expression":"GfmA","./field":"uiF9","./property":"bpmg","vega-functions":"JYcc","vega-util":"dejJ"}],"tdIS":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _scale = require("./scale");

var _vegaUtil = require("vega-util");

function _default(enc, scope, params, fields) {
  return 'this.gradient(' + (0, _scale.getScale)(enc.gradient, scope, params, fields) + ',' + (0, _vegaUtil.stringValue)(enc.start) + ',' + (0, _vegaUtil.stringValue)(enc.stop) + ',' + (0, _vegaUtil.stringValue)(enc.count) + ')';
}
},{"./scale":"QTKh","vega-util":"dejJ"}],"TSri":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _color = _interopRequireDefault(require("./color"));

var _field = _interopRequireDefault(require("./field"));

var _scale = _interopRequireDefault(require("./scale"));

var _gradient = _interopRequireDefault(require("./gradient"));

var _property = _interopRequireDefault(require("./property"));

var _expression = _interopRequireDefault(require("./expression"));

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(channel, enc, scope, params, fields) {
  if (enc.gradient != null) {
    return (0, _gradient.default)(enc, scope, params, fields);
  }

  var value = enc.signal ? (0, _expression.default)(enc.signal, scope, params, fields) : enc.color ? (0, _color.default)(enc.color, scope, params, fields) : enc.field != null ? (0, _field.default)(enc.field, scope, params, fields) : enc.value !== undefined ? (0, _vegaUtil.stringValue)(enc.value) : undefined;

  if (enc.scale != null) {
    value = (0, _scale.default)(enc, value, scope, params, fields);
  }

  if (value === undefined) {
    value = null;
  }

  if (enc.exponent != null) {
    value = 'Math.pow(' + value + ',' + (0, _property.default)(enc.exponent, scope, params, fields) + ')';
  }

  if (enc.mult != null) {
    value += '*' + (0, _property.default)(enc.mult, scope, params, fields);
  }

  if (enc.offset != null) {
    value += '+' + (0, _property.default)(enc.offset, scope, params, fields);
  }

  if (enc.round) {
    value = 'Math.round(' + value + ')';
  }

  return value;
}
},{"./color":"UDp0","./field":"uiF9","./scale":"QTKh","./gradient":"tdIS","./property":"bpmg","./expression":"GfmA","vega-util":"dejJ"}],"cSxt":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _vegaUtil = require("vega-util");

function _default(obj, key, value) {
  const o = obj + '[' + (0, _vegaUtil.stringValue)(key) + ']';
  return `$=${value};if(${o}!==$)${o}=$,m=1;`;
}
},{"vega-util":"dejJ"}],"uA9l":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _entry = _interopRequireDefault(require("./entry"));

var _set = _interopRequireDefault(require("./set"));

var _expression = _interopRequireDefault(require("./expression"));

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(channel, rules, scope, params, fields) {
  var code = '';
  rules.forEach(function (rule) {
    var value = (0, _entry.default)(channel, rule, scope, params, fields);
    code += rule.test ? (0, _expression.default)(rule.test, scope, params, fields) + '?' + value + ':' : value;
  }); // if no else clause, terminate with null (vega/vega#1366)

  if ((0, _vegaUtil.peek)(code) === ':') {
    code += 'null';
  }

  return (0, _set.default)('o', channel, code);
}
},{"./entry":"TSri","./set":"cSxt","./expression":"GfmA","vega-util":"dejJ"}],"B71a":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = parseEncode;

var _adjustSpatial = _interopRequireDefault(require("./encode/adjust-spatial"));

var _entry = _interopRequireDefault(require("./encode/entry"));

var _rule = _interopRequireDefault(require("./encode/rule"));

var _set = _interopRequireDefault(require("./encode/set"));

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function parseEncode(encode, marktype, params, scope) {
  var fields = {},
      code = 'var o=item,datum=o.datum,m=0,$;',
      channel,
      enc,
      value;

  for (channel in encode) {
    enc = encode[channel];

    if ((0, _vegaUtil.isArray)(enc)) {
      // rule
      code += (0, _rule.default)(channel, enc, scope, params, fields);
    } else {
      value = (0, _entry.default)(channel, enc, scope, params, fields);
      code += (0, _set.default)('o', channel, value);
    }
  }

  code += (0, _adjustSpatial.default)(encode, marktype);
  code += 'return m;';
  return {
    $expr: code,
    $fields: Object.keys(fields),
    $output: Object.keys(encode)
  };
}
},{"./encode/adjust-spatial":"FegD","./encode/entry":"TSri","./encode/rule":"uA9l","./encode/set":"cSxt","vega-util":"dejJ"}],"ZEgH":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.TitleSubtitleRole = exports.TitleTextRole = exports.TitleRole = exports.LegendTitleRole = exports.LegendSymbolRole = exports.LegendLabelRole = exports.LegendGradientRole = exports.LegendEntryRole = exports.LegendBandRole = exports.LegendRole = exports.AxisTitleRole = exports.AxisTickRole = exports.AxisLabelRole = exports.AxisGridRole = exports.AxisDomainRole = exports.AxisRole = exports.ScopeRole = exports.FrameRole = exports.MarkRole = void 0;
var MarkRole = 'mark';
exports.MarkRole = MarkRole;
var FrameRole = 'frame';
exports.FrameRole = FrameRole;
var ScopeRole = 'scope';
exports.ScopeRole = ScopeRole;
var AxisRole = 'axis';
exports.AxisRole = AxisRole;
var AxisDomainRole = 'axis-domain';
exports.AxisDomainRole = AxisDomainRole;
var AxisGridRole = 'axis-grid';
exports.AxisGridRole = AxisGridRole;
var AxisLabelRole = 'axis-label';
exports.AxisLabelRole = AxisLabelRole;
var AxisTickRole = 'axis-tick';
exports.AxisTickRole = AxisTickRole;
var AxisTitleRole = 'axis-title';
exports.AxisTitleRole = AxisTitleRole;
var LegendRole = 'legend';
exports.LegendRole = LegendRole;
var LegendBandRole = 'legend-band';
exports.LegendBandRole = LegendBandRole;
var LegendEntryRole = 'legend-entry';
exports.LegendEntryRole = LegendEntryRole;
var LegendGradientRole = 'legend-gradient';
exports.LegendGradientRole = LegendGradientRole;
var LegendLabelRole = 'legend-label';
exports.LegendLabelRole = LegendLabelRole;
var LegendSymbolRole = 'legend-symbol';
exports.LegendSymbolRole = LegendSymbolRole;
var LegendTitleRole = 'legend-title';
exports.LegendTitleRole = LegendTitleRole;
var TitleRole = 'title';
exports.TitleRole = TitleRole;
var TitleTextRole = 'title-text';
exports.TitleTextRole = TitleTextRole;
var TitleSubtitleRole = 'title-subtitle';
exports.TitleSubtitleRole = TitleSubtitleRole;
},{}],"scev":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.encoder = encoder;
exports.addEncode = addEncode;
exports.addEncoders = addEncoders;
exports.extendEncode = extendEncode;
exports.encoders = encoders;
exports.has = has;

var _encode = _interopRequireDefault(require("../encode"));

var _roles = require("../marks/roles");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function encoder(_) {
  return (0, _vegaUtil.isObject)(_) && !(0, _vegaUtil.isArray)(_) ? (0, _vegaUtil.extend)({}, _) : {
    value: _
  };
}

function addEncode(object, name, value, set) {
  if (value != null) {
    if ((0, _vegaUtil.isObject)(value) && !(0, _vegaUtil.isArray)(value)) {
      object.update[name] = value;
    } else {
      object[set || 'enter'][name] = {
        value: value
      };
    }

    return 1;
  } else {
    return 0;
  }
}

function addEncoders(object, enter, update) {
  for (let name in enter) {
    addEncode(object, name, enter[name]);
  }

  for (let name in update) {
    addEncode(object, name, update[name], 'update');
  }
}

function extendEncode(encode, extra, skip) {
  for (var name in extra) {
    if (skip && (0, _vegaUtil.hasOwnProperty)(skip, name)) continue;
    encode[name] = (0, _vegaUtil.extend)(encode[name] || {}, extra[name]);
  }

  return encode;
}

function encoders(encode, type, role, style, scope, params) {
  var enc, key;
  params = params || {};
  params.encoders = {
    $encode: enc = {}
  };
  encode = applyDefaults(encode, type, role, style, scope.config);

  for (key in encode) {
    enc[key] = (0, _encode.default)(encode[key], type, params, scope);
  }

  return params;
}

function applyDefaults(encode, type, role, style, config) {
  var defaults = {},
      enter = {},
      update,
      key,
      skip,
      props; // ignore legend and axis

  if (role == 'legend' || String(role).indexOf('axis') === 0) {
    role = null;
  } // resolve mark config


  props = role === _roles.FrameRole ? config.group : role === _roles.MarkRole ? (0, _vegaUtil.extend)({}, config.mark, config[type]) : null;

  for (key in props) {
    // do not apply defaults if relevant fields are defined
    skip = has(key, encode) || (key === 'fill' || key === 'stroke') && (has('fill', encode) || has('stroke', encode));
    if (!skip) applyDefault(defaults, key, props[key]);
  } // resolve styles, apply with increasing precedence


  (0, _vegaUtil.array)(style).forEach(function (name) {
    var props = config.style && config.style[name];

    for (var key in props) {
      if (!has(key, encode)) {
        applyDefault(defaults, key, props[key]);
      }
    }
  });
  encode = (0, _vegaUtil.extend)({}, encode); // defensive copy

  for (key in defaults) {
    props = defaults[key];

    if (props.signal) {
      (update = update || {})[key] = props;
    } else {
      enter[key] = props;
    }
  }

  encode.enter = (0, _vegaUtil.extend)(enter, encode.enter);
  if (update) encode.update = (0, _vegaUtil.extend)(update, encode.update);
  return encode;
}

function applyDefault(defaults, key, value) {
  defaults[key] = value && value.signal ? {
    signal: value.signal
  } : {
    value: value
  };
}

function has(key, encode) {
  return encode && (encode.enter && encode.enter[key] || encode.update && encode.update[key]);
}
},{"../encode":"B71a","../marks/roles":"ZEgH","vega-util":"dejJ"}],"nJSB":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constants = require("./constants");

var _encodeUtil = require("../encode/encode-util");

function _default(type, role, style, key, dataRef, encode, extras) {
  return {
    type: type,
    name: extras ? extras.name : undefined,
    role: role,
    style: extras && extras.style || style,
    key: key,
    from: dataRef,
    interactive: !!(extras && extras.interactive),
    encode: (0, _encodeUtil.extendEncode)(encode, extras, _constants.Skip)
  };
}
},{"./constants":"Bky9","../encode/encode-util":"scev"}],"enGB":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.lookup = lookup;
exports.getEncoding = getEncoding;
exports.getStyle = getStyle;
exports.anchorExpr = anchorExpr;
exports.tickBand = tickBand;
exports.alignExpr = void 0;

var _constants = require("./constants");

var _util = require("../../util");

var _vegaUtil = require("vega-util");

function lookup(spec, config) {
  const _ = (name, dflt) => (0, _util.value)(spec[name], (0, _util.value)(config[name], dflt));

  _.isVertical = s => _constants.Vertical === (0, _util.value)(spec.direction, config.direction || (s ? config.symbolDirection : config.gradientDirection));

  _.gradientLength = () => (0, _util.value)(spec.gradientLength, config.gradientLength || config.gradientWidth);

  _.gradientThickness = () => (0, _util.value)(spec.gradientThickness, config.gradientThickness || config.gradientHeight);

  _.entryColumns = () => (0, _util.value)(spec.columns, (0, _util.value)(config.columns, +_.isVertical(true)));

  return _;
}

function getEncoding(name, encode) {
  var 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) {
  var s = scope.config.style[style];
  return s && s[name];
}

function anchorExpr(s, e, m) {
  return `item.anchor === "${_constants.Start}" ? ${s} : item.anchor === "${_constants.End}" ? ${e} : ${m}`;
}

const alignExpr = anchorExpr((0, _vegaUtil.stringValue)(_constants.Left), (0, _vegaUtil.stringValue)(_constants.Right), (0, _vegaUtil.stringValue)(_constants.Center));
exports.alignExpr = alignExpr;

function tickBand(_) {
  let v = _('tickBand'),
      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'?true:false`
    };

    if (!(0, _vegaUtil.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
  };
}
},{"./constants":"Bky9","../../util":"eOYX","vega-util":"dejJ"}],"tWO1":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.TextMark = exports.SymbolMark = exports.RuleMark = exports.RectMark = exports.GroupMark = void 0;
var GroupMark = 'group';
exports.GroupMark = GroupMark;
var RectMark = 'rect';
exports.RectMark = RectMark;
var RuleMark = 'rule';
exports.RuleMark = RuleMark;
var SymbolMark = 'symbol';
exports.SymbolMark = SymbolMark;
var TextMark = 'text';
exports.TextMark = TextMark;
},{}],"eF2V":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constants = require("./constants");

var _guideMark = _interopRequireDefault(require("./guide-mark"));

var _guideUtil = require("./guide-util");

var _marktypes = require("../marks/marktypes");

var _roles = require("../marks/roles");

var _encodeUtil = require("../encode/encode-util");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(spec, scale, config, userEncode) {
  var _ = (0, _guideUtil.lookup)(spec, config),
      vertical = _.isVertical(),
      thickness = _.gradientThickness(),
      length = _.gradientLength(),
      encode,
      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;
  }

  encode = {
    enter: enter = {
      opacity: _constants.zero,
      x: _constants.zero,
      y: _constants.zero,
      width: (0, _encodeUtil.encoder)(width),
      height: (0, _encodeUtil.encoder)(height)
    },
    update: (0, _vegaUtil.extend)({}, enter, {
      opacity: _constants.one,
      fill: {
        gradient: scale,
        start: start,
        stop: stop
      }
    }),
    exit: {
      opacity: _constants.zero
    }
  };
  (0, _encodeUtil.addEncoders)(encode, {
    stroke: _('gradientStrokeColor'),
    strokeWidth: _('gradientStrokeWidth')
  }, {
    // update
    opacity: _('gradientOpacity')
  });
  return (0, _guideMark.default)(_marktypes.RectMark, _roles.LegendGradientRole, null, undefined, undefined, encode, userEncode);
}
},{"./constants":"Bky9","./guide-mark":"nJSB","./guide-util":"enGB","../marks/marktypes":"tWO1","../marks/roles":"ZEgH","../encode/encode-util":"scev","vega-util":"dejJ"}],"v968":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constants = require("./constants");

var _guideMark = _interopRequireDefault(require("./guide-mark"));

var _guideUtil = require("./guide-util");

var _marktypes = require("../marks/marktypes");

var _roles = require("../marks/roles");

var _encodeUtil = require("../encode/encode-util");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(spec, scale, config, userEncode, dataRef) {
  var _ = (0, _guideUtil.lookup)(spec, config),
      vertical = _.isVertical(),
      thickness = _.gradientThickness(),
      length = _.gradientLength(),
      encode,
      enter,
      u,
      v,
      uu,
      vv,
      adjust = '';

  vertical ? (u = 'y', uu = 'y2', v = 'x', vv = 'width', adjust = '1-') : (u = 'x', uu = 'x2', v = 'y', vv = 'height');
  enter = {
    opacity: _constants.zero,
    fill: {
      scale: scale,
      field: _constants.Value
    }
  };
  enter[u] = {
    signal: adjust + 'datum.' + _constants.Perc,
    mult: length
  };
  enter[v] = _constants.zero;
  enter[uu] = {
    signal: adjust + 'datum.' + _constants.Perc2,
    mult: length
  };
  enter[vv] = (0, _encodeUtil.encoder)(thickness);
  encode = {
    enter: enter,
    update: (0, _vegaUtil.extend)({}, enter, {
      opacity: _constants.one
    }),
    exit: {
      opacity: _constants.zero
    }
  };
  (0, _encodeUtil.addEncoders)(encode, {
    stroke: _('gradientStrokeColor'),
    strokeWidth: _('gradientStrokeWidth')
  }, {
    // update
    opacity: _('gradientOpacity')
  });
  return (0, _guideMark.default)(_marktypes.RectMark, _roles.LegendBandRole, null, _constants.Value, dataRef, encode, userEncode);
}
},{"./constants":"Bky9","./guide-mark":"nJSB","./guide-util":"enGB","../marks/marktypes":"tWO1","../marks/roles":"ZEgH","../encode/encode-util":"scev","vega-util":"dejJ"}],"u4OQ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constants = require("./constants");

var _guideMark = _interopRequireDefault(require("./guide-mark"));

var _guideUtil = require("./guide-util");

var _marktypes = require("../marks/marktypes");

var _roles = require("../marks/roles");

var _encodeUtil = require("../encode/encode-util");

var _util = require("../../util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

const alignExpr = `datum.${_constants.Perc}<=0?"${_constants.Left}":datum.${_constants.Perc}>=1?"${_constants.Right}":"${_constants.Center}"`,
      baselineExpr = `datum.${_constants.Perc}<=0?"${_constants.Bottom}":datum.${_constants.Perc}>=1?"${_constants.Top}":"${_constants.Middle}"`;

function _default(spec, config, userEncode, dataRef) {
  var _ = (0, _guideUtil.lookup)(spec, config),
      vertical = _.isVertical(),
      thickness = (0, _encodeUtil.encoder)(_.gradientThickness()),
      length = _.gradientLength(),
      overlap = _('labelOverlap'),
      separation = _('labelSeparation'),
      encode,
      enter,
      update,
      u,
      v,
      adjust = '';

  encode = {
    enter: enter = {
      opacity: _constants.zero
    },
    update: update = {
      opacity: _constants.one,
      text: {
        field: _constants.Label
      }
    },
    exit: {
      opacity: _constants.zero
    }
  };
  (0, _encodeUtil.addEncoders)(encode, {
    fill: _('labelColor'),
    fillOpacity: _('labelOpacity'),
    font: _('labelFont'),
    fontSize: _('labelFontSize'),
    fontStyle: _('labelFontStyle'),
    fontWeight: _('labelFontWeight'),
    limit: (0, _util.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.' + _constants.Perc,
    mult: length
  };
  enter[v] = update[v] = thickness;
  thickness.offset = (0, _util.value)(spec.labelOffset, config.gradientLabelOffset) || 0;
  spec = (0, _guideMark.default)(_marktypes.TextMark, _roles.LegendLabelRole, _constants.GuideLabelStyle, _constants.Value, dataRef, encode, userEncode);

  if (overlap) {
    spec.overlap = {
      separation: separation,
      method: overlap,
      order: 'datum.' + _constants.Index
    };
  }

  return spec;
}
},{"./constants":"Bky9","./guide-mark":"nJSB","./guide-util":"enGB","../marks/marktypes":"tWO1","../marks/roles":"ZEgH","../encode/encode-util":"scev","../../util":"eOYX"}],"lVnG":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _marktypes = require("../marks/marktypes");

function _default(role, style, name, dataRef, interactive, encode, marks, layout) {
  return {
    type: _marktypes.GroupMark,
    name: name,
    role: role,
    style: style,
    from: dataRef,
    interactive: interactive || false,
    encode: encode,
    marks: marks,
    layout: layout
  };
}
},{"../marks/marktypes":"tWO1"}],"s35U":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.legendSymbolLayout = legendSymbolLayout;

var _constants = require("./constants");

var _guideGroup = _interopRequireDefault(require("./guide-group"));

var _guideMark = _interopRequireDefault(require("./guide-mark"));

var _guideUtil = require("./guide-util");

var _marktypes = require("../marks/marktypes");

var _roles = require("../marks/roles");

var _encodeUtil = require("../encode/encode-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// userEncode is top-level, includes entries, symbols, labels
function _default(spec, config, userEncode, dataRef, columns) {
  var _ = (0, _guideUtil.lookup)(spec, config),
      entries = userEncode.entries,
      interactive = !!(entries && entries.interactive),
      name = entries ? entries.name : undefined,
      height = _('clipHeight'),
      symbolOffset = _('symbolOffset'),
      valueRef = {
    data: 'value'
  },
      encode = {},
      xSignal = `${columns} ? datum.${_constants.Offset} : datum.${_constants.Size}`,
      yEncode = height ? (0, _encodeUtil.encoder)(height) : {
    field: _constants.Size
  },
      index = `datum.${_constants.Index}`,
      ncols = `max(1, ${columns})`,
      enter,
      update,
      labelOffset,
      symbols,
      labels,
      nrows,
      sort;

  yEncode.mult = 0.5; // -- LEGEND SYMBOLS --

  encode = {
    enter: enter = {
      opacity: _constants.zero,
      x: {
        signal: xSignal,
        mult: 0.5,
        offset: symbolOffset
      },
      y: yEncode
    },
    update: update = {
      opacity: _constants.one,
      x: enter.x,
      y: enter.y
    },
    exit: {
      opacity: _constants.zero
    }
  };
  var baseFill = null,
      baseStroke = null;

  if (!spec.fill) {
    baseFill = config.symbolBaseFillColor;
    baseStroke = config.symbolBaseStrokeColor;
  }

  (0, _encodeUtil.addEncoders)(encode, {
    fill: _('symbolFillColor', baseFill),
    shape: _('symbolType'),
    size: _('symbolSize'),
    stroke: _('symbolStrokeColor', baseStroke),
    strokeDash: _('symbolDash'),
    strokeDashOffset: _('symbolDashOffset'),
    strokeWidth: _('symbolStrokeWidth')
  }, {
    // update
    opacity: _('symbolOpacity')
  });

  _constants.LegendScales.forEach(function (scale) {
    if (spec[scale]) {
      update[scale] = enter[scale] = {
        scale: spec[scale],
        field: _constants.Value
      };
    }
  });

  symbols = (0, _guideMark.default)(_marktypes.SymbolMark, _roles.LegendSymbolRole, null, _constants.Value, valueRef, encode, userEncode.symbols);
  if (height) symbols.clip = true; // -- LEGEND LABELS --

  labelOffset = (0, _encodeUtil.encoder)(symbolOffset);
  labelOffset.offset = _('labelOffset');
  encode = {
    enter: enter = {
      opacity: _constants.zero,
      x: {
        signal: xSignal,
        offset: labelOffset
      },
      y: yEncode
    },
    update: update = {
      opacity: _constants.one,
      text: {
        field: _constants.Label
      },
      x: enter.x,
      y: enter.y
    },
    exit: {
      opacity: _constants.zero
    }
  };
  (0, _encodeUtil.addEncoders)(encode, {
    align: _('labelAlign'),
    baseline: _('labelBaseline'),
    fill: _('labelColor'),
    fillOpacity: _('labelOpacity'),
    font: _('labelFont'),
    fontSize: _('labelFontSize'),
    fontStyle: _('labelFontStyle'),
    fontWeight: _('labelFontWeight'),
    limit: _('labelLimit')
  });
  labels = (0, _guideMark.default)(_marktypes.TextMark, _roles.LegendLabelRole, _constants.GuideLabelStyle, _constants.Value, valueRef, encode, userEncode.labels); // -- LEGEND ENTRY GROUPS --

  encode = {
    enter: {
      noBound: {
        value: !height
      },
      // ignore width/height in bounds calc
      width: _constants.zero,
      height: height ? (0, _encodeUtil.encoder)(height) : _constants.zero,
      opacity: _constants.zero
    },
    exit: {
      opacity: _constants.zero
    },
    update: update = {
      opacity: _constants.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: _constants.Index
    }
  };
  spec = (0, _guideGroup.default)(_roles.ScopeRole, null, name, dataRef, interactive, (0, _encodeUtil.extendEncode)(encode, entries, _constants.Skip), [symbols, labels]);
  spec.sort = sort;
  return spec;
}

function legendSymbolLayout(spec, config) {
  const _ = (0, _guideUtil.lookup)(spec, config); // layout parameters for legend entries


  return {
    align: _('gridAlign'),
    columns: _.entryColumns(),
    center: {
      row: true,
      column: false
    },
    padding: {
      row: _('rowPadding'),
      column: _('columnPadding')
    }
  };
}
},{"./constants":"Bky9","./guide-group":"lVnG","./guide-mark":"nJSB","./guide-util":"enGB","../marks/marktypes":"tWO1","../marks/roles":"ZEgH","../encode/encode-util":"scev"}],"qVoi":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constants = require("./constants");

var _guideMark = _interopRequireDefault(require("./guide-mark"));

var _guideUtil = require("./guide-util");

var _marktypes = require("../marks/marktypes");

var _roles = require("../marks/roles");

var _encodeUtil = require("../encode/encode-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// expression logic for align, anchor, angle, and baseline calculation
const isL = 'item.orient === "left"',
      isR = 'item.orient === "right"',
      isLR = `(${isL} || ${isR})`,
      isVG = `datum.vgrad && ${isLR}`,
      baseline = (0, _guideUtil.anchorExpr)('"top"', '"bottom"', '"middle"'),
      alignFlip = (0, _guideUtil.anchorExpr)('"right"', '"left"', '"center"'),
      exprAlign = `datum.vgrad && ${isR} ? (${alignFlip}) : (${isLR} && !(datum.vgrad && ${isL})) ? "left" : ${_guideUtil.alignExpr}`,
      exprAnchor = `item._anchor || (${isLR} ? "middle" : "start")`,
      exprAngle = `${isVG} ? (${isL} ? -90 : 90) : 0`,
      exprBaseline = `${isLR} ? (datum.vgrad ? (${isR} ? "bottom" : "top") : ${baseline}) : "top"`;

function _default(spec, config, userEncode, dataRef) {
  var _ = (0, _guideUtil.lookup)(spec, config),
      encode;

  encode = {
    enter: {
      opacity: _constants.zero
    },
    update: {
      opacity: _constants.one,
      x: {
        field: {
          group: 'padding'
        }
      },
      y: {
        field: {
          group: 'padding'
        }
      }
    },
    exit: {
      opacity: _constants.zero
    }
  };
  (0, _encodeUtil.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 (0, _guideMark.default)(_marktypes.TextMark, _roles.LegendTitleRole, _constants.GuideTitleStyle, null, dataRef, encode, userEncode);
}
},{"./constants":"Bky9","./guide-mark":"nJSB","./guide-util":"enGB","../marks/marktypes":"tWO1","../marks/roles":"ZEgH","../encode/encode-util":"scev"}],"bpBF":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _vegaUtil = require("vega-util");

function _default(clip, scope) {
  var expr;

  if ((0, _vegaUtil.isObject)(clip)) {
    if (clip.signal) {
      expr = clip.signal;
    } else if (clip.path) {
      expr = 'pathShape(' + param(clip.path) + ')';
    } else if (clip.sphere) {
      expr = 'geoShape(' + param(clip.sphere) + ', {type: "Sphere"})';
    }
  }

  return expr ? scope.signalRef(expr) : !!clip;
}

function param(value) {
  return (0, _vegaUtil.isObject)(value) && value.signal ? value.signal : (0, _vegaUtil.stringValue)(value);
}
},{"vega-util":"dejJ"}],"s3bn":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _marktypes = require("./marktypes");

var _roles = require("./roles");

function _default(spec) {
  var role = spec.role || '';
  return !role.indexOf('axis') || !role.indexOf('legend') || !role.indexOf('title') ? role : spec.type === _marktypes.GroupMark ? _roles.ScopeRole : role || _roles.MarkRole;
}
},{"./marktypes":"tWO1","./roles":"ZEgH"}],"Exzc":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _role = _interopRequireDefault(require("./role"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(spec) {
  return {
    marktype: spec.type,
    name: spec.name || undefined,
    role: spec.role || (0, _role.default)(spec),
    zindex: +spec.zindex || undefined
  };
}
},{"./role":"s3bn"}],"OBj2":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

function _default(spec, scope) {
  return spec && spec.signal ? scope.signalRef(spec.signal) : spec === false ? false : true;
}
},{}],"MNxB":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.outerExpr = outerExpr;
exports.outerField = outerField;
exports.isData = isData;
exports.isExpr = isExpr;
exports.isField = isField;
exports.isCompare = isCompare;

var _expression = _interopRequireDefault(require("./expression"));

var _util = require("../util");

var _transforms = require("../transforms");

var _vegaDataflow = require("vega-dataflow");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * Parse a data transform specification.
 */
function _default(spec, scope) {
  var def = (0, _vegaDataflow.definition)(spec.type);
  if (!def) (0, _vegaUtil.error)('Unrecognized transform type: ' + (0, _vegaUtil.stringValue)(spec.type));
  var t = (0, _util.entry)(def.type.toLowerCase(), null, 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 parseParameters(def, spec, scope) {
  var params = {},
      pdef,
      i,
      n;

  for (i = 0, n = def.params.length; i < n; ++i) {
    pdef = def.params[i];
    params[pdef.name] = parseParameter(pdef, spec, scope);
  }

  return params;
}
/**
 * Parse a data transform parameter.
 */


function parseParameter(def, spec, scope) {
  var type = def.type,
      value = spec[def.name];

  if (type === 'index') {
    return parseIndexParameter(def, spec, scope);
  } else if (value === undefined) {
    if (def.required) {
      (0, _vegaUtil.error)('Missing required ' + (0, _vegaUtil.stringValue)(spec.type) + ' parameter: ' + (0, _vegaUtil.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 && !(0, _util.isSignal)(value) ? value.map(function (v) {
    return parameterValue(def, v, scope);
  }) : parameterValue(def, value, scope);
}
/**
 * Parse a single parameter value.
 */


function parameterValue(def, value, scope) {
  var type = def.type;

  if ((0, _util.isSignal)(value)) {
    return isExpr(type) ? (0, _vegaUtil.error)('Expression references can not be signals.') : isField(type) ? scope.fieldRef(value) : isCompare(type) ? scope.compareRef(value) : scope.signalRef(value.signal);
  } else {
    var expr = def.expr || isField(type);
    return expr && outerExpr(value) ? scope.exprRef(value.expr, value.as) : expr && outerField(value) ? (0, _util.fieldRef)(value.field, value.as) : isExpr(type) ? (0, _expression.default)(value, scope) : isData(type) ? (0, _util.ref)(scope.getData(value).values) : isField(type) ? (0, _util.fieldRef)(value) : isCompare(type) ? scope.compareRef(value) : value;
  }
}
/**
 * Parse parameter for accessing an index of another data set.
 */


function parseIndexParameter(def, spec, scope) {
  if (!(0, _vegaUtil.isString)(spec.from)) {
    (0, _vegaUtil.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) {
  var value = spec[def.name];

  if (def.array) {
    if (!(0, _vegaUtil.isArray)(value)) {
      // signals not allowed!
      (0, _vegaUtil.error)('Expected an array of sub-parameters. Instead: ' + (0, _vegaUtil.stringValue)(value));
    }

    return value.map(function (v) {
      return parseSubParameter(def, v, scope);
    });
  } else {
    return parseSubParameter(def, value, scope);
  }
}
/**
 * Parse a sub-parameter object.
 */


function parseSubParameter(def, value, scope) {
  var params, pdef, k, i, n; // loop over defs to find matching key

  for (i = 0, n = def.params.length; i < n; ++i) {
    pdef = def.params[i];

    for (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) (0, _vegaUtil.error)('Unsupported parameter: ' + (0, _vegaUtil.stringValue)(value)); // parse params, create Params transform, return ref

  params = (0, _vegaUtil.extend)(parseParameters(pdef, value, scope), pdef.key);
  return (0, _util.ref)(scope.add((0, _transforms.Params)(params)));
} // -- Utilities -----


function outerExpr(_) {
  return _ && _.expr;
}

function outerField(_) {
  return _ && _.field;
}

function isData(_) {
  return _ === 'data';
}

function isExpr(_) {
  return _ === 'expr';
}

function isField(_) {
  return _ === 'field';
}

function isCompare(_) {
  return _ === 'compare';
}
},{"./expression":"ixc4","../util":"eOYX","../transforms":"rsu0","vega-dataflow":"UC8n","vega-util":"dejJ"}],"i1RA":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
exports.getDataRef = getDataRef;

var _transform = _interopRequireDefault(require("../transform"));

var _util = require("../../util");

var _transforms = require("../../transforms");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(from, group, scope) {
  var facet, key, op, dataRef, parent; // if no source data, generate singleton datum

  if (!from) {
    dataRef = (0, _util.ref)(scope.add((0, _transforms.Collect)(null, [{}])));
  } // if faceted, process facet specification
  else if (facet = from.facet) {
      if (!group) (0, _vegaUtil.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 = (0, _transform.default)((0, _vegaUtil.extend)({
            type: 'aggregate',
            groupby: (0, _vegaUtil.array)(facet.groupby)
          }, facet.aggregate), scope);
          op.params.key = scope.keyRef(facet.groupby);
          op.params.pulse = getDataRef(facet, scope);
          dataRef = parent = (0, _util.ref)(scope.add(op));
        } else {
          parent = (0, _util.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 : (0, _util.ref)(scope.getData(from.data).output);
}
},{"../transform":"MNxB","../../util":"eOYX","../../transforms":"rsu0","vega-util":"dejJ"}],"gNLj":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = DataScope;

var _util = require("./util");

var _transforms = require("./transforms");

var _vegaUtil = require("vega-util");

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) {
  var n = entries.length,
      i = 1,
      input = entries[0],
      values = entries[n - 1],
      output = entries[n - 2],
      aggr = null;

  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 = (0, _util.ref)(entries[i - 1]);
    scope.add(entries[i]);
    if (entries[i].type === 'aggregate') aggr = entries[i];
  }

  return new DataScope(scope, input, output, values, aggr);
};

var prototype = DataScope.prototype;

prototype.countsRef = function (scope, field, sort) {
  var ds = this,
      cache = ds.counts || (ds.counts = {}),
      k = fieldKey(field),
      v,
      a,
      p;

  if (k != null) {
    scope = ds.scope;
    v = cache[k];
  }

  if (!v) {
    p = {
      groupby: scope.fieldRef(field, 'key'),
      pulse: (0, _util.ref)(ds.output)
    };
    if (sort && sort.field) addSortField(scope, p, sort);
    a = scope.add((0, _transforms.Aggregate)(p));
    v = scope.add((0, _transforms.Collect)({
      pulse: (0, _util.ref)(a)
    }));
    v = {
      agg: a,
      ref: (0, _util.ref)(v)
    };
    if (k != null) cache[k] = v;
  } else if (sort && sort.field) {
    addSortField(scope, v.agg.params, sort);
  }

  return v.ref;
};

function fieldKey(field) {
  return (0, _vegaUtil.isString)(field) ? field : null;
}

function addSortField(scope, p, sort) {
  var as = (0, _util.aggrField)(sort.op, sort.field),
      s;

  if (p.ops) {
    for (var 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 cache(scope, ds, name, optype, field, counts, index) {
  var cache = ds[name] || (ds[name] = {}),
      sort = (0, _util.sortKey)(counts),
      k = fieldKey(field),
      v,
      op;

  if (k != null) {
    scope = ds.scope;
    k = k + (sort ? '|' + sort : '');
    v = cache[k];
  }

  if (!v) {
    var params = counts ? {
      field: _util.keyFieldRef,
      pulse: ds.countsRef(scope, field, counts)
    } : {
      field: scope.fieldRef(field),
      pulse: (0, _util.ref)(ds.output)
    };
    if (sort) params.sort = scope.sortRef(counts);
    op = scope.add((0, _util.entry)(optype, undefined, params));
    if (index) ds.index[field] = op;
    v = (0, _util.ref)(op);
    if (k != null) cache[k] = v;
  }

  return v;
}

prototype.tuplesRef = function () {
  return (0, _util.ref)(this.values);
};

prototype.extentRef = function (scope, field) {
  return cache(scope, this, 'extent', 'extent', field, false);
};

prototype.domainRef = function (scope, field) {
  return cache(scope, this, 'domain', 'values', field, false);
};

prototype.valuesRef = function (scope, field, sort) {
  return cache(scope, this, 'vals', 'values', field, sort || true);
};

prototype.lookupRef = function (scope, field) {
  return cache(scope, this, 'lookup', 'tupleindex', field, false);
};

prototype.indataRef = function (scope, field) {
  return cache(scope, this, 'indata', 'tupleindex', field, true, true);
};
},{"./util":"eOYX","./transforms":"rsu0","vega-util":"dejJ"}],"uVhO":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _data = require("./data");

var _spec = _interopRequireDefault(require("../spec"));

var _DataScope = _interopRequireDefault(require("../../DataScope"));

var _util = require("../../util");

var _transforms = require("../../transforms");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(spec, scope, group) {
  var facet = spec.from.facet,
      name = facet.name,
      data = (0, _data.getDataRef)(facet, scope),
      subscope,
      source,
      values,
      op;

  if (!facet.name) {
    (0, _vegaUtil.error)('Facet must have a name: ' + (0, _vegaUtil.stringValue)(facet));
  }

  if (!facet.data) {
    (0, _vegaUtil.error)('Facet must reference a data set: ' + (0, _vegaUtil.stringValue)(facet));
  }

  if (facet.field) {
    op = scope.add((0, _transforms.PreFacet)({
      field: scope.fieldRef(facet.field),
      pulse: data
    }));
  } else if (facet.groupby) {
    op = scope.add((0, _transforms.Facet)({
      key: scope.keyRef(facet.groupby),
      group: (0, _util.ref)(scope.proxy(group.parent)),
      pulse: data
    }));
  } else {
    (0, _vegaUtil.error)('Facet must specify groupby or field: ' + (0, _vegaUtil.stringValue)(facet));
  } // initialize facet subscope


  subscope = scope.fork();
  source = subscope.add((0, _transforms.Collect)());
  values = subscope.add((0, _transforms.Sieve)({
    pulse: (0, _util.ref)(source)
  }));
  subscope.addData(name, new _DataScope.default(subscope, source, source, values));
  subscope.addSignal('parent', null); // parse faceted subflow

  op.params.subflow = {
    $subflow: (0, _spec.default)(spec, subscope).toRuntime()
  };
}
},{"./data":"i1RA","../spec":"kjTu","../../DataScope":"gNLj","../../util":"eOYX","../../transforms":"rsu0","vega-util":"dejJ"}],"hSMu":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _spec = _interopRequireDefault(require("../spec"));

var _transforms = require("../../transforms");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(spec, scope, input) {
  var op = scope.add((0, _transforms.PreFacet)({
    pulse: input.pulse
  })),
      subscope = scope.fork();
  subscope.add((0, _transforms.Sieve)());
  subscope.addSignal('parent', null); // parse group mark subflow

  op.params.subflow = {
    $subflow: (0, _spec.default)(spec, subscope).toRuntime()
  };
}
},{"../spec":"kjTu","../../transforms":"rsu0"}],"LoBK":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _expression = _interopRequireDefault(require("./expression"));

var _util = require("../util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(spec, scope, name) {
  var remove = spec.remove,
      insert = spec.insert,
      toggle = spec.toggle,
      modify = spec.modify,
      values = spec.values,
      op = scope.add((0, _util.operator)()),
      update,
      expr;
  update = 'if(' + spec.trigger + ',modify("' + name + '",' + [insert, remove, toggle, modify, values].map(function (_) {
    return _ == null ? 'null' : _;
  }).join(',') + '),0)';
  expr = (0, _expression.default)(update, scope);
  op.update = expr.$expr;
  op.params = expr.$params;
}
},{"./expression":"ixc4","../util":"eOYX"}],"eBdu":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _clip = _interopRequireDefault(require("./marks/clip"));

var _definition = _interopRequireDefault(require("./marks/definition"));

var _interactive = _interopRequireDefault(require("./marks/interactive"));

var _data = _interopRequireDefault(require("./marks/data"));

var _facet = _interopRequireDefault(require("./marks/facet"));

var _subflow = _interopRequireDefault(require("./marks/subflow"));

var _role = _interopRequireDefault(require("./marks/role"));

var _marktypes = require("./marks/marktypes");

var _roles = require("./marks/roles");

var _encodeUtil = require("./encode/encode-util");

var _transform = _interopRequireDefault(require("./transform"));

var _trigger = _interopRequireDefault(require("./trigger"));

var _spec = _interopRequireDefault(require("./spec"));

var _DataScope = _interopRequireDefault(require("../DataScope"));

var _util = require("../util");

var _vegaUtil = require("vega-util");

var _transforms = require("../transforms");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(spec, scope) {
  var role = (0, _role.default)(spec),
      group = spec.type === _marktypes.GroupMark,
      facet = spec.from && spec.from.facet,
      layout = spec.layout || role === _roles.ScopeRole || role === _roles.FrameRole,
      nested = role === _roles.MarkRole || layout || facet,
      overlap = spec.overlap,
      ops,
      op,
      input,
      store,
      enc,
      bound,
      render,
      sieve,
      name,
      joinRef,
      markRef,
      encodeRef,
      layoutRef,
      boundRef; // resolve input data

  input = (0, _data.default)(spec.from, group, scope); // data join to map tuples to visual items

  op = scope.add((0, _transforms.DataJoin)({
    key: input.key || (spec.key ? (0, _util.fieldRef)(spec.key) : undefined),
    pulse: input.pulse,
    clean: !group
  }));
  joinRef = (0, _util.ref)(op); // collect visual items

  op = store = scope.add((0, _transforms.Collect)({
    pulse: joinRef
  })); // connect visual items to scenegraph

  op = scope.add((0, _transforms.Mark)({
    markdef: (0, _definition.default)(spec),
    interactive: (0, _interactive.default)(spec.interactive, scope),
    clip: (0, _clip.default)(spec.clip, scope),
    context: {
      $context: true
    },
    groups: scope.lookup(),
    parent: scope.signals.parent ? scope.signalRef('parent') : null,
    index: scope.markpath(),
    pulse: (0, _util.ref)(op)
  }));
  markRef = (0, _util.ref)(op); // add visual encoders

  op = enc = scope.add((0, _transforms.Encode)((0, _encodeUtil.encoders)(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(function (_) {
      const tx = (0, _transform.default)(_, scope),
            md = tx.metadata;

      if (md.generates || md.changes) {
        (0, _vegaUtil.error)('Mark transforms should not generate new data.');
      }

      if (!md.nomod) enc.params.mod = true; // update encode mod handling

      tx.params.pulse = (0, _util.ref)(op);
      scope.add(op = tx);
    });
  } // if item sort specified, perform post-encoding


  if (spec.sort) {
    op = scope.add((0, _transforms.SortItems)({
      sort: scope.compareRef(spec.sort),
      pulse: (0, _util.ref)(op)
    }));
  }

  encodeRef = (0, _util.ref)(op); // add view layout operator if needed

  if (facet || layout) {
    layout = scope.add((0, _transforms.ViewLayout)({
      layout: scope.objectProperty(spec.layout),
      legends: scope.legends,
      mark: markRef,
      pulse: encodeRef
    }));
    layoutRef = (0, _util.ref)(layout);
  } // compute bounding boxes


  bound = scope.add((0, _transforms.Bound)({
    mark: markRef,
    pulse: layoutRef || encodeRef
  }));
  boundRef = (0, _util.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 ? (0, _facet.default)(spec, scope, input) // explicit facet
    : nested ? (0, _subflow.default)(spec, scope, input) // standard mark group
    : (0, _spec.default)(spec, scope); // 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


  render = scope.add((0, _transforms.Render)({
    pulse: boundRef
  }));
  sieve = scope.add((0, _transforms.Sieve)({
    pulse: (0, _util.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.default(scope, store, render, sieve));
    if (spec.on) spec.on.forEach(function (on) {
      if (on.insert || on.remove || on.toggle) {
        (0, _vegaUtil.error)('Marks only support modify triggers.');
      }

      (0, _trigger.default)(on, scope, name);
    });
  }
}

function parseOverlap(overlap, source, scope) {
  var method = overlap.method,
      bound = overlap.bound,
      sep = overlap.separation,
      tol;
  var params = {
    separation: (0, _util.isSignal)(sep) ? scope.signalRef(sep.signal) : sep,
    method: (0, _util.isSignal)(method) ? scope.signalRef(method.signal) : method,
    pulse: source
  };

  if (overlap.order) {
    params.sort = scope.compareRef({
      field: overlap.order
    });
  }

  if (bound) {
    tol = bound.tolerance;
    params.boundTolerance = (0, _util.isSignal)(tol) ? scope.signalRef(tol.signal) : +tol;
    params.boundScale = scope.scaleRef(bound.scale);
    params.boundOrient = bound.orient;
  }

  return (0, _util.ref)(scope.add((0, _transforms.Overlap)(params)));
}
},{"./marks/clip":"bpBF","./marks/definition":"Exzc","./marks/interactive":"OBj2","./marks/data":"i1RA","./marks/facet":"uVhO","./marks/subflow":"hSMu","./marks/role":"s3bn","./marks/marktypes":"tWO1","./marks/roles":"ZEgH","./encode/encode-util":"scev","./transform":"MNxB","./trigger":"LoBK","./spec":"kjTu","../DataScope":"gNLj","../util":"eOYX","vega-util":"dejJ","../transforms":"rsu0"}],"CE8V":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constants = require("./guides/constants");

var _legendGradient = _interopRequireDefault(require("./guides/legend-gradient"));

var _legendGradientDiscrete = _interopRequireDefault(require("./guides/legend-gradient-discrete"));

var _legendGradientLabels = _interopRequireDefault(require("./guides/legend-gradient-labels"));

var _legendSymbolGroups = _interopRequireWildcard(require("./guides/legend-symbol-groups"));

var _legendTitle = _interopRequireDefault(require("./guides/legend-title"));

var _guideGroup = _interopRequireDefault(require("./guides/guide-group"));

var _guideUtil = require("./guides/guide-util");

var _expression = _interopRequireDefault(require("./expression"));

var _mark = _interopRequireDefault(require("./mark"));

var _roles = require("./marks/roles");

var _encodeUtil = require("./encode/encode-util");

var _util = require("../util");

var _transforms = require("../transforms");

var _vegaScale = require("vega-scale");

var _vegaUtil = require("vega-util");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(spec, scope) {
  var config = scope.config.legend,
      encode = spec.encode || {},
      legendEncode = encode.legend || {},
      name = legendEncode.name || undefined,
      interactive = legendEncode.interactive,
      style = legendEncode.style,
      _ = (0, _guideUtil.lookup)(spec, config),
      entryEncode,
      entryLayout,
      params,
      children,
      type,
      datum,
      dataRef,
      entryRef,
      group; // resolve 'canonical' scale name


  var scale = _constants.LegendScales.reduce(function (a, b) {
    return a || spec[b];
  }, 0);

  if (!scale) (0, _vegaUtil.error)('Missing valid scale for legend.'); // resolve legend type (symbol, gradient, or discrete gradient)

  type = legendType(spec, scope.scaleType(scale)); // single-element data source for legend group

  datum = {
    title: spec.title != null,
    type: type,
    vgrad: type !== 'symbol' && _.isVertical()
  };
  dataRef = (0, _util.ref)(scope.add((0, _transforms.Collect)(null, [datum]))); // encoding properties for legend group

  legendEncode = (0, _encodeUtil.extendEncode)(buildLegendEncode(_, config), legendEncode, _constants.Skip); // encoding properties for legend entry sub-group

  entryEncode = {
    enter: {
      x: {
        value: 0
      },
      y: {
        value: 0
      }
    }
  }; // data source for legend values

  entryRef = (0, _util.ref)(scope.add((0, _transforms.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 === _constants.Gradient) {
    children = [(0, _legendGradient.default)(spec, scale, config, encode.gradient), (0, _legendGradientLabels.default)(spec, config, encode.labels, entryRef)]; // adjust default tick count based on the gradient length

    params.count = params.count || scope.signalRef(`max(2,2*floor((${(0, _util.deref)(_.gradientLength())})/100))`);
  } // discrete gradient legend
  else if (type === _constants.Discrete) {
      children = [(0, _legendGradientDiscrete.default)(spec, scale, config, encode.gradient, entryRef), (0, _legendGradientLabels.default)(spec, config, encode.labels, entryRef)];
    } // symbol legend
    else {
        // determine legend symbol group layout
        entryLayout = (0, _legendSymbolGroups.legendSymbolLayout)(spec, config);
        children = [(0, _legendSymbolGroups.default)(spec, config, encode, entryRef, (0, _util.deref)(entryLayout.columns))]; // pass symbol size information to legend entry generator

        params.size = sizeExpression(spec, scope, children[0].marks);
      } // generate legend marks


  children = [(0, _guideGroup.default)(_roles.LegendEntryRole, null, null, dataRef, interactive, entryEncode, children, entryLayout)]; // include legend title if defined

  if (datum.title) {
    children.push((0, _legendTitle.default)(spec, config, encode.title, dataRef));
  } // build legend specification


  group = (0, _guideGroup.default)(_roles.LegendRole, style, name, dataRef, interactive, legendEncode, children);
  if (spec.zindex) group.zindex = spec.zindex; // parse legend specification

  return (0, _mark.default)(group, scope);
}

function legendType(spec, scaleType) {
  var type = spec.type || _constants.Symbols;

  if (!spec.type && scaleCount(spec) === 1 && (spec.fill || spec.stroke)) {
    type = (0, _vegaScale.isContinuous)(scaleType) ? _constants.Gradient : (0, _vegaScale.isDiscretizing)(scaleType) ? _constants.Discrete : _constants.Symbols;
  }

  return type !== _constants.Gradient ? type : (0, _vegaScale.isDiscretizing)(scaleType) ? _constants.Discrete : _constants.Gradient;
}

function scaleCount(spec) {
  return _constants.LegendScales.reduce(function (count, type) {
    return count + (spec[type] ? 1 : 0);
  }, 0);
}

function buildLegendEncode(_, config) {
  var encode = {
    enter: {},
    update: {}
  };
  (0, _encodeUtil.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')
  });
  return encode;
}

function sizeExpression(spec, scope, marks) {
  var size = (0, _util.deref)(getChannel('size', spec, marks)),
      strokeWidth = (0, _util.deref)(getChannel('strokeWidth', spec, marks)),
      fontSize = (0, _util.deref)(getFontSize(marks[1].encode, scope, _constants.GuideLabelStyle));
  return (0, _expression.default)(`max(ceil(sqrt(${size})+${strokeWidth}),${fontSize})`, scope);
}

function getChannel(name, spec, marks) {
  return spec[name] ? `scale("${spec[name]}",datum)` : (0, _guideUtil.getEncoding)(name, marks[0].encode);
}

function getFontSize(encode, scope, style) {
  return (0, _guideUtil.getEncoding)('fontSize', encode) || (0, _guideUtil.getStyle)('fontSize', scope, style);
}
},{"./guides/constants":"Bky9","./guides/legend-gradient":"eF2V","./guides/legend-gradient-discrete":"v968","./guides/legend-gradient-labels":"u4OQ","./guides/legend-symbol-groups":"s35U","./guides/legend-title":"qVoi","./guides/guide-group":"lVnG","./guides/guide-util":"enGB","./expression":"ixc4","./mark":"eBdu","./marks/roles":"ZEgH","./encode/encode-util":"scev","../util":"eOYX","../transforms":"rsu0","vega-scale":"VE6e","vega-util":"dejJ"}],"gzmo":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constants = require("./guides/constants");

var _guideGroup = _interopRequireDefault(require("./guides/guide-group"));

var _guideMark = _interopRequireDefault(require("./guides/guide-mark"));

var _guideUtil = require("./guides/guide-util");

var _mark = _interopRequireDefault(require("./mark"));

var _marktypes = require("./marks/marktypes");

var _roles = require("./marks/roles");

var _encodeUtil = require("./encode/encode-util");

var _util = require("../util");

var _transforms = require("../transforms");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

const angleExpr = `item.orient==="${_constants.Left}"?-90:item.orient==="${_constants.Right}"?90:0`;

function _default(spec, scope) {
  spec = (0, _vegaUtil.isString)(spec) ? {
    text: spec
  } : spec;

  var _ = (0, _guideUtil.lookup)(spec, scope.config.title),
      encode = spec.encode || {},
      userEncode = encode.group || {},
      name = userEncode.name || undefined,
      interactive = userEncode.interactive,
      style = userEncode.style,
      children = [],
      dataRef,
      group; // single-element data source for group title


  dataRef = (0, _util.ref)(scope.add((0, _transforms.Collect)(null, [{}]))); // include title text

  children.push(buildTitle(spec, _, titleEncode(spec), dataRef)); // include subtitle text

  if (spec.subtitle) {
    children.push(buildSubTitle(spec, _, encode.subtitle, dataRef));
  } // build title specification


  group = (0, _guideGroup.default)(_roles.TitleRole, style, name, dataRef, interactive, groupEncode(_, userEncode), children);
  if (spec.zindex) group.zindex = spec.zindex; // parse title specification

  return (0, _mark.default)(group, 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 || (0, _vegaUtil.extend)({
    name: spec.name,
    interactive: spec.interactive,
    style: spec.style
  }, encode);
}

function groupEncode(_, userEncode) {
  var encode = {
    enter: {},
    update: {}
  };
  (0, _encodeUtil.addEncoders)(encode, {
    orient: _('orient'),
    anchor: _('anchor'),
    align: {
      signal: _guideUtil.alignExpr
    },
    angle: {
      signal: angleExpr
    },
    limit: _('limit'),
    frame: _('frame'),
    offset: _('offset') || 0,
    padding: _('subtitlePadding')
  });
  return (0, _encodeUtil.extendEncode)(encode, userEncode, _constants.Skip);
}

function buildTitle(spec, _, userEncode, dataRef) {
  var zero = {
    value: 0
  },
      text = spec.text,
      encode = {
    enter: {
      opacity: zero
    },
    update: {
      opacity: {
        value: 1
      }
    },
    exit: {
      opacity: zero
    }
  };
  (0, _encodeUtil.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 (0, _guideMark.default)(_marktypes.TextMark, _roles.TitleTextRole, _constants.GroupTitleStyle, null, dataRef, encode, userEncode);
}

function buildSubTitle(spec, _, userEncode, dataRef) {
  var zero = {
    value: 0
  },
      text = spec.subtitle,
      encode = {
    enter: {
      opacity: zero
    },
    update: {
      opacity: {
        value: 1
      }
    },
    exit: {
      opacity: zero
    }
  };
  (0, _encodeUtil.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 (0, _guideMark.default)(_marktypes.TextMark, _roles.TitleSubtitleRole, _constants.GroupSubtitleStyle, null, dataRef, encode, userEncode);
}
},{"./guides/constants":"Bky9","./guides/guide-group":"lVnG","./guides/guide-mark":"nJSB","./guides/guide-util":"enGB","./mark":"eBdu","./marks/marktypes":"tWO1","./marks/roles":"ZEgH","./encode/encode-util":"scev","../util":"eOYX","../transforms":"rsu0","vega-util":"dejJ"}],"YErn":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = parseData;

var _transform = _interopRequireDefault(require("./transform"));

var _trigger = _interopRequireDefault(require("./trigger"));

var _util = require("../util");

var _transforms = require("../transforms");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function parseData(data, scope) {
  var transforms = [];

  if (data.transform) {
    data.transform.forEach(function (tx) {
      transforms.push((0, _transform.default)(tx, scope));
    });
  }

  if (data.on) {
    data.on.forEach(function (on) {
      (0, _trigger.default)(on, scope, data.name);
    });
  }

  scope.addDataPipeline(data.name, analyze(data, scope, transforms));
}
/**
 * Analyze a data pipeline, add needed operators.
 */


function analyze(data, scope, ops) {
  var output = [],
      source = null,
      modify = false,
      generate = false,
      upstream,
      i,
      n,
      t,
      m;

  if (data.values) {
    // hard-wired input data set
    if ((0, _util.hasSignal)(data.values) || (0, _util.hasSignal)(data.format)) {
      // if either values 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 ((0, _util.hasSignal)(data.url) || (0, _util.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 = (0, _vegaUtil.array)(data.source).map(function (d) {
      return (0, _util.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] = (0, _transforms.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((0, _transforms.Sieve)({}));
  return output;
}

function collect(values) {
  var s = (0, _transforms.Collect)({}, values);
  s.metadata = {
    source: true
  };
  return s;
}

function load(scope, data) {
  return (0, _transforms.Load)({
    url: data.url ? scope.property(data.url) : undefined,
    values: data.values ? scope.property(data.values) : undefined,
    format: scope.objectProperty(data.format)
  });
}
},{"./transform":"MNxB","./trigger":"LoBK","../util":"eOYX","../transforms":"rsu0","vega-util":"dejJ"}],"adUN":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constants = require("./constants");

var _vegaUtil = require("vega-util");

function _default(spec, scope) {
  var config = scope.config,
      orient = spec.orient,
      xy = orient === _constants.Top || orient === _constants.Bottom ? config.axisX : config.axisY,
      or = config['axis' + orient[0].toUpperCase() + orient.slice(1)],
      band = scope.scaleType(spec.scale) === 'band' && config.axisBand;
  return xy || or || band ? (0, _vegaUtil.extend)({}, config.axis, xy, or, band) : config.axis;
}
},{"./constants":"Bky9","vega-util":"dejJ"}],"p7JW":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constants = require("./constants");

var _guideMark = _interopRequireDefault(require("./guide-mark"));

var _guideUtil = require("./guide-util");

var _marktypes = require("../marks/marktypes");

var _roles = require("../marks/roles");

var _encodeUtil = require("../encode/encode-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(spec, config, userEncode, dataRef) {
  var _ = (0, _guideUtil.lookup)(spec, config),
      orient = spec.orient,
      encode,
      enter,
      update,
      u,
      u2,
      v;

  encode = {
    enter: enter = {
      opacity: _constants.zero
    },
    update: update = {
      opacity: _constants.one
    },
    exit: {
      opacity: _constants.zero
    }
  };
  (0, _encodeUtil.addEncoders)(encode, {
    stroke: _('domainColor'),
    strokeDash: _('domainDash'),
    strokeDashOffset: _('domainDashOffset'),
    strokeWidth: _('domainWidth'),
    strokeOpacity: _('domainOpacity')
  });

  if (orient === _constants.Top || orient === _constants.Bottom) {
    u = 'x';
    v = 'y';
  } else {
    u = 'y';
    v = 'x';
  }

  u2 = u + '2';
  enter[v] = _constants.zero;
  update[u] = enter[u] = position(spec, 0);
  update[u2] = enter[u2] = position(spec, 1);
  return (0, _guideMark.default)(_marktypes.RuleMark, _roles.AxisDomainRole, null, null, dataRef, encode, userEncode);
}

function position(spec, pos) {
  return {
    scale: spec.scale,
    range: pos
  };
}
},{"./constants":"Bky9","./guide-mark":"nJSB","./guide-util":"enGB","../marks/marktypes":"tWO1","../marks/roles":"ZEgH","../encode/encode-util":"scev"}],"mYS5":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constants = require("./constants");

var _guideMark = _interopRequireDefault(require("./guide-mark"));

var _guideUtil = require("./guide-util");

var _marktypes = require("../marks/marktypes");

var _roles = require("../marks/roles");

var _encodeUtil = require("../encode/encode-util");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(spec, config, userEncode, dataRef, band) {
  var _ = (0, _guideUtil.lookup)(spec, config),
      orient = spec.orient,
      vscale = spec.gridScale,
      sign = orient === _constants.Left || orient === _constants.Top ? 1 : -1,
      offset = offsetValue(spec.offset, sign),
      encode,
      enter,
      exit,
      update,
      tickPos,
      u,
      v,
      v2,
      s;

  encode = {
    enter: enter = {
      opacity: _constants.zero
    },
    update: update = {
      opacity: _constants.one
    },
    exit: exit = {
      opacity: _constants.zero
    }
  };
  (0, _encodeUtil.addEncoders)(encode, {
    stroke: _('gridColor'),
    strokeDash: _('gridDash'),
    strokeDashOffset: _('gridDashOffset'),
    strokeOpacity: _('gridOpacity'),
    strokeWidth: _('gridWidth')
  });
  tickPos = {
    scale: spec.scale,
    field: _constants.Value,
    band: band.band,
    extra: band.extra,
    offset: band.offset,
    round: _('tickRound')
  };

  if (orient === _constants.Top || orient === _constants.Bottom) {
    u = 'x';
    v = 'y';
    s = 'height';
  } else {
    u = 'y';
    v = 'x';
    s = 'width';
  }

  v2 = v + '2';
  update[u] = enter[u] = exit[u] = tickPos;

  if (vscale) {
    update[v] = enter[v] = {
      scale: vscale,
      range: 0,
      mult: sign,
      offset: offset
    };
    update[v2] = enter[v2] = {
      scale: vscale,
      range: 1,
      mult: sign,
      offset: offset
    };
  } else {
    update[v] = enter[v] = {
      value: 0,
      offset: offset
    };
    update[v2] = enter[v2] = {
      signal: s,
      mult: sign,
      offset: offset
    };
  }

  return (0, _guideMark.default)(_marktypes.RuleMark, _roles.AxisGridRole, null, _constants.Value, dataRef, encode, userEncode);
}

function offsetValue(offset, sign) {
  if (sign === 1) {// do nothing!
  } else if (!(0, _vegaUtil.isObject)(offset)) {
    offset = sign * (offset || 0);
  } else {
    var entry = offset = (0, _vegaUtil.extend)({}, offset);

    while (entry.mult != null) {
      if (!(0, _vegaUtil.isObject)(entry.mult)) {
        entry.mult *= sign;
        return offset;
      } else {
        entry = entry.mult = (0, _vegaUtil.extend)({}, entry.mult);
      }
    }

    entry.mult = sign;
  }

  return offset;
}
},{"./constants":"Bky9","./guide-mark":"nJSB","./guide-util":"enGB","../marks/marktypes":"tWO1","../marks/roles":"ZEgH","../encode/encode-util":"scev","vega-util":"dejJ"}],"y00D":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constants = require("./constants");

var _guideMark = _interopRequireDefault(require("./guide-mark"));

var _guideUtil = require("./guide-util");

var _marktypes = require("../marks/marktypes");

var _roles = require("../marks/roles");

var _encodeUtil = require("../encode/encode-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(spec, config, userEncode, dataRef, size, band) {
  var _ = (0, _guideUtil.lookup)(spec, config),
      orient = spec.orient,
      sign = orient === _constants.Left || orient === _constants.Top ? -1 : 1,
      encode,
      enter,
      exit,
      update,
      tickSize,
      tickPos;

  encode = {
    enter: enter = {
      opacity: _constants.zero
    },
    update: update = {
      opacity: _constants.one
    },
    exit: exit = {
      opacity: _constants.zero
    }
  };
  (0, _encodeUtil.addEncoders)(encode, {
    stroke: _('tickColor'),
    strokeDash: _('tickDash'),
    strokeDashOffset: _('tickDashOffset'),
    strokeOpacity: _('tickOpacity'),
    strokeWidth: _('tickWidth')
  });
  tickSize = (0, _encodeUtil.encoder)(size);
  tickSize.mult = sign;
  tickPos = {
    scale: spec.scale,
    field: _constants.Value,
    band: band.band,
    extra: band.extra,
    offset: band.offset,
    round: _('tickRound')
  };

  if (orient === _constants.Top || orient === _constants.Bottom) {
    update.y = enter.y = _constants.zero;
    update.y2 = enter.y2 = tickSize;
    update.x = enter.x = exit.x = tickPos;
  } else {
    update.x = enter.x = _constants.zero;
    update.x2 = enter.x2 = tickSize;
    update.y = enter.y = exit.y = tickPos;
  }

  return (0, _guideMark.default)(_marktypes.RuleMark, _roles.AxisTickRole, null, _constants.Value, dataRef, encode, userEncode);
}
},{"./constants":"Bky9","./guide-mark":"nJSB","./guide-util":"enGB","../marks/marktypes":"tWO1","../marks/roles":"ZEgH","../encode/encode-util":"scev"}],"s4ix":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constants = require("./constants");

var _guideMark = _interopRequireDefault(require("./guide-mark"));

var _guideUtil = require("./guide-util");

var _marktypes = require("../marks/marktypes");

var _roles = require("../marks/roles");

var _encodeUtil = require("../encode/encode-util");

var _util = require("../../util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function flushExpr(scale, threshold, a, b, c) {
  return {
    signal: 'flush(range("' + scale + '"), ' + 'scale("' + scale + '", datum.value), ' + threshold + ',' + a + ',' + b + ',' + c + ')'
  };
}

function _default(spec, config, userEncode, dataRef, size, band) {
  var _ = (0, _guideUtil.lookup)(spec, config),
      orient = spec.orient,
      sign = orient === _constants.Left || orient === _constants.Top ? -1 : 1,
      isXAxis = orient === _constants.Top || orient === _constants.Bottom,
      scale = spec.scale,
      flush = (0, _util.deref)(_('labelFlush')),
      flushOffset = (0, _util.deref)(_('labelFlushOffset')),
      flushOn = flush === 0 || !!flush,
      labelAlign = _('labelAlign'),
      labelBaseline = _('labelBaseline'),
      encode,
      enter,
      tickSize,
      tickPos,
      align,
      baseline,
      offset,
      bound,
      overlap,
      separation;

  tickSize = (0, _encodeUtil.encoder)(size);
  tickSize.mult = sign;
  tickSize.offset = (0, _encodeUtil.encoder)(_('labelPadding') || 0);
  tickSize.offset.mult = sign;
  tickPos = {
    scale: scale,
    field: _constants.Value,
    band: 0.5,
    offset: band.offset
  };

  if (isXAxis) {
    align = labelAlign || (flushOn ? flushExpr(scale, flush, '"left"', '"right"', '"center"') : 'center');
    baseline = labelBaseline || (orient === _constants.Top ? 'bottom' : 'top');
    offset = !labelAlign;
  } else {
    align = labelAlign || (orient === _constants.Right ? 'left' : 'right');
    baseline = labelBaseline || (flushOn ? flushExpr(scale, flush, '"top"', '"bottom"', '"middle"') : 'middle');
    offset = !labelBaseline;
  }

  offset = offset && flushOn && flushOffset ? flushExpr(scale, flush, '-(' + flushOffset + ')', flushOffset, 0) : null;
  encode = {
    enter: enter = {
      opacity: _constants.zero,
      x: isXAxis ? tickPos : tickSize,
      y: isXAxis ? tickSize : tickPos
    },
    update: {
      opacity: _constants.one,
      text: {
        field: _constants.Label
      },
      x: enter.x,
      y: enter.y
    },
    exit: {
      opacity: _constants.zero,
      x: enter.x,
      y: enter.y
    }
  };
  (0, _encodeUtil.addEncoders)(encode, {
    [isXAxis ? 'dx' : 'dy']: offset,
    align: align,
    baseline: baseline,
    angle: _('labelAngle'),
    fill: _('labelColor'),
    fillOpacity: _('labelOpacity'),
    font: _('labelFont'),
    fontSize: _('labelFontSize'),
    fontWeight: _('labelFontWeight'),
    fontStyle: _('labelFontStyle'),
    limit: _('labelLimit')
  });
  bound = _('labelBound');
  overlap = _('labelOverlap');
  separation = _('labelSeparation');
  spec = (0, _guideMark.default)(_marktypes.TextMark, _roles.AxisLabelRole, _constants.GuideLabelStyle, _constants.Value, dataRef, encode, userEncode); // if overlap method or bound defined, request label overlap removal

  if (overlap || bound) {
    spec.overlap = {
      separation: separation,
      method: overlap,
      order: 'datum.index',
      bound: bound ? {
        scale: scale,
        orient: orient,
        tolerance: bound
      } : null
    };
  }

  return spec;
}
},{"./constants":"Bky9","./guide-mark":"nJSB","./guide-util":"enGB","../marks/marktypes":"tWO1","../marks/roles":"ZEgH","../encode/encode-util":"scev","../../util":"eOYX"}],"zv96":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _constants = require("./constants");

var _guideMark = _interopRequireDefault(require("./guide-mark"));

var _guideUtil = require("./guide-util");

var _encodeUtil = require("../encode/encode-util");

var _marktypes = require("../marks/marktypes");

var _roles = require("../marks/roles");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(spec, config, userEncode, dataRef) {
  var _ = (0, _guideUtil.lookup)(spec, config),
      orient = spec.orient,
      sign = orient === _constants.Left || orient === _constants.Top ? -1 : 1,
      horizontal = orient === _constants.Top || orient === _constants.Bottom,
      encode,
      enter,
      update,
      titlePos;

  encode = {
    enter: enter = {
      opacity: _constants.zero,
      anchor: (0, _encodeUtil.encoder)(_('titleAnchor')),
      align: {
        signal: _guideUtil.alignExpr
      }
    },
    update: update = (0, _vegaUtil.extend)({}, enter, {
      opacity: _constants.one,
      text: (0, _encodeUtil.encoder)(spec.title)
    }),
    exit: {
      opacity: _constants.zero
    }
  };
  titlePos = {
    signal: `lerp(range("${spec.scale}"), ${(0, _guideUtil.anchorExpr)(0, 1, 0.5)})`
  };

  if (horizontal) {
    update.x = titlePos;
    enter.angle = {
      value: 0
    };
    enter.baseline = {
      value: orient === _constants.Top ? 'bottom' : 'top'
    };
  } else {
    update.y = titlePos;
    enter.angle = {
      value: sign * 90
    };
    enter.baseline = {
      value: 'bottom'
    };
  }

  (0, _encodeUtil.addEncoders)(encode, {
    angle: _('titleAngle'),
    baseline: _('titleBaseline'),
    fill: _('titleColor'),
    fillOpacity: _('titleOpacity'),
    font: _('titleFont'),
    fontSize: _('titleFontSize'),
    fontStyle: _('titleFontStyle'),
    fontWeight: _('titleFontWeight'),
    limit: _('titleLimit'),
    lineHeight: _('titleLineHeight')
  }, {
    // require update
    align: _('titleAlign')
  });
  !(0, _encodeUtil.addEncode)(encode, 'x', _('titleX'), 'update') && !horizontal && !(0, _encodeUtil.has)('x', userEncode) && (encode.enter.auto = {
    value: true
  });
  !(0, _encodeUtil.addEncode)(encode, 'y', _('titleY'), 'update') && horizontal && !(0, _encodeUtil.has)('y', userEncode) && (encode.enter.auto = {
    value: true
  });
  return (0, _guideMark.default)(_marktypes.TextMark, _roles.AxisTitleRole, _constants.GuideTitleStyle, null, dataRef, encode, userEncode);
}
},{"./constants":"Bky9","./guide-mark":"nJSB","./guide-util":"enGB","../encode/encode-util":"scev","../marks/marktypes":"tWO1","../marks/roles":"ZEgH","vega-util":"dejJ"}],"LFcI":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _axisConfig = _interopRequireDefault(require("./guides/axis-config"));

var _axisDomain = _interopRequireDefault(require("./guides/axis-domain"));

var _axisGrid = _interopRequireDefault(require("./guides/axis-grid"));

var _axisTicks = _interopRequireDefault(require("./guides/axis-ticks"));

var _axisLabels = _interopRequireDefault(require("./guides/axis-labels"));

var _axisTitle = _interopRequireDefault(require("./guides/axis-title"));

var _guideGroup = _interopRequireDefault(require("./guides/guide-group"));

var _guideUtil = require("./guides/guide-util");

var _roles = require("./marks/roles");

var _mark = _interopRequireDefault(require("./mark"));

var _encodeUtil = require("./encode/encode-util");

var _constants = require("./guides/constants");

var _util = require("../util");

var _transforms = require("../transforms");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(spec, scope) {
  var config = (0, _axisConfig.default)(spec, scope),
      encode = spec.encode || {},
      axisEncode = encode.axis || {},
      name = axisEncode.name || undefined,
      interactive = axisEncode.interactive,
      style = axisEncode.style,
      _ = (0, _guideUtil.lookup)(spec, config),
      band = (0, _guideUtil.tickBand)(_),
      datum,
      dataRef,
      ticksRef,
      size,
      group,
      children; // single-element data source for axis group


  datum = {
    orient: spec.orient,
    ticks: !!_('ticks'),
    labels: !!_('labels'),
    grid: !!_('grid'),
    domain: !!_('domain'),
    title: spec.title != null,
    translate: _('translate')
  };
  dataRef = (0, _util.ref)(scope.add((0, _transforms.Collect)({}, [datum]))); // encoding properties for axis group item

  axisEncode = (0, _encodeUtil.extendEncode)({
    update: {
      offset: (0, _encodeUtil.encoder)(_('offset') || 0),
      position: (0, _encodeUtil.encoder)((0, _util.value)(spec.position, 0)),
      titlePadding: (0, _encodeUtil.encoder)(_('titlePadding')),
      minExtent: (0, _encodeUtil.encoder)(_('minExtent')),
      maxExtent: (0, _encodeUtil.encoder)(_('maxExtent')),
      range: {
        signal: `abs(span(range("${spec.scale}")))`
      }
    }
  }, encode.axis, _constants.Skip); // data source for axis ticks

  ticksRef = (0, _util.ref)(scope.add((0, _transforms.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

  children = []; // include axis gridlines if requested

  if (datum.grid) {
    children.push((0, _axisGrid.default)(spec, config, encode.grid, ticksRef, band));
  } // include axis ticks if requested


  if (datum.ticks) {
    size = _('tickSize');
    children.push((0, _axisTicks.default)(spec, config, encode.ticks, ticksRef, size, band));
  } // include axis labels if requested


  if (datum.labels) {
    size = datum.ticks ? size : 0;
    children.push((0, _axisLabels.default)(spec, config, encode.labels, ticksRef, size, band));
  } // include axis domain path if requested


  if (datum.domain) {
    children.push((0, _axisDomain.default)(spec, config, encode.domain, dataRef));
  } // include axis title if defined


  if (datum.title) {
    children.push((0, _axisTitle.default)(spec, config, encode.title, dataRef));
  } // build axis specification


  group = (0, _guideGroup.default)(_roles.AxisRole, style, name, dataRef, interactive, axisEncode, children);
  if (spec.zindex) group.zindex = spec.zindex; // parse axis specification

  return (0, _mark.default)(group, scope);
}
},{"./guides/axis-config":"adUN","./guides/axis-domain":"p7JW","./guides/axis-grid":"mYS5","./guides/axis-ticks":"y00D","./guides/axis-labels":"s4ix","./guides/axis-title":"zv96","./guides/guide-group":"lVnG","./guides/guide-util":"enGB","./marks/roles":"ZEgH","./mark":"eBdu","./encode/encode-util":"scev","./guides/constants":"Bky9","../util":"eOYX","../transforms":"rsu0"}],"kjTu":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _signalUpdates = _interopRequireDefault(require("./signal-updates"));

var _scale = require("./scale");

var _projection = _interopRequireDefault(require("./projection"));

var _legend = _interopRequireDefault(require("./legend"));

var _signal = _interopRequireDefault(require("./signal"));

var _title = _interopRequireDefault(require("./title"));

var _data = _interopRequireDefault(require("./data"));

var _mark = _interopRequireDefault(require("./mark"));

var _axis = _interopRequireDefault(require("./axis"));

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(spec, scope, preprocessed) {
  var signals = (0, _vegaUtil.array)(spec.signals),
      scales = (0, _vegaUtil.array)(spec.scales); // parse signal definitions, if not already preprocessed

  if (!preprocessed) signals.forEach(_ => (0, _signal.default)(_, scope)); // parse cartographic projection definitions

  (0, _vegaUtil.array)(spec.projections).forEach(_ => (0, _projection.default)(_, scope)); // initialize scale references

  scales.forEach(_ => (0, _scale.initScale)(_, scope)); // parse data sources

  (0, _vegaUtil.array)(spec.data).forEach(_ => (0, _data.default)(_, scope)); // parse scale definitions

  scales.forEach(_ => (0, _scale.parseScale)(_, scope)); // parse signal updates

  (preprocessed || signals).forEach(_ => (0, _signalUpdates.default)(_, scope)); // parse axis definitions

  (0, _vegaUtil.array)(spec.axes).forEach(_ => (0, _axis.default)(_, scope)); // parse mark definitions

  (0, _vegaUtil.array)(spec.marks).forEach(_ => (0, _mark.default)(_, scope)); // parse legend definitions

  (0, _vegaUtil.array)(spec.legends).forEach(_ => (0, _legend.default)(_, scope)); // parse title, if defined

  if (spec.title) (0, _title.default)(spec.title, scope); // parse collected lambda (anonymous) expressions

  scope.parseLambdas();
  return scope;
}
},{"./signal-updates":"uclE","./scale":"BBsO","./projection":"C3DW","./legend":"CE8V","./signal":"W0Pp","./title":"gzmo","./data":"YErn","./mark":"eBdu","./axis":"LFcI","vega-util":"dejJ"}],"M6x2":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = parseView;

var _autosize = _interopRequireDefault(require("./autosize"));

var _padding = _interopRequireDefault(require("./padding"));

var _signal = _interopRequireDefault(require("./signal"));

var _spec = _interopRequireDefault(require("./spec"));

var _encodeUtil = require("./encode/encode-util");

var _marktypes = require("./marks/marktypes");

var _roles = require("./marks/roles");

var _util = require("../util");

var _DataScope = _interopRequireDefault(require("../DataScope"));

var _transforms = require("../transforms");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var defined = (0, _vegaUtil.toSet)(['width', 'height', 'padding', 'autosize']);

function parseView(spec, scope) {
  var config = scope.config,
      op,
      input,
      encode,
      parent,
      root,
      signals;
  scope.background = spec.background || config.background;
  scope.eventConfig = config.events;
  root = (0, _util.ref)(scope.root = scope.add((0, _util.operator)()));
  scope.addSignal('width', spec.width || 0);
  scope.addSignal('height', spec.height || 0);
  scope.addSignal('padding', (0, _padding.default)(spec.padding, config));
  scope.addSignal('autosize', (0, _autosize.default)(spec.autosize, config));
  scope.legends = scope.objectProperty(config.legend && config.legend.layout); // parse signal definitions, including config entries

  signals = addSignals(scope, spec.signals, config.signals); // Store root group item

  input = scope.add((0, _transforms.Collect)()); // Encode root group item

  encode = (0, _encodeUtil.extendEncode)({
    enter: {
      x: {
        value: 0
      },
      y: {
        value: 0
      }
    },
    update: {
      width: {
        signal: 'width'
      },
      height: {
        signal: 'height'
      }
    }
  }, spec.encode);
  encode = scope.add((0, _transforms.Encode)((0, _encodeUtil.encoders)(encode, _marktypes.GroupMark, _roles.FrameRole, spec.style, scope, {
    pulse: (0, _util.ref)(input)
  }))); // Perform view layout

  parent = scope.add((0, _transforms.ViewLayout)({
    layout: scope.objectProperty(spec.layout),
    legends: scope.legends,
    autosize: scope.signalRef('autosize'),
    mark: root,
    pulse: (0, _util.ref)(encode)
  }));
  scope.operators.pop(); // Parse remainder of specification

  scope.pushState((0, _util.ref)(encode), (0, _util.ref)(parent), null);
  (0, _spec.default)(spec, scope, signals);
  scope.operators.push(parent); // Bound / render / sieve root item

  op = scope.add((0, _transforms.Bound)({
    mark: root,
    pulse: (0, _util.ref)(parent)
  }));
  op = scope.add((0, _transforms.Render)({
    pulse: (0, _util.ref)(op)
  }));
  op = scope.add((0, _transforms.Sieve)({
    pulse: (0, _util.ref)(op)
  })); // Track metadata for root item

  scope.addData('root', new _DataScope.default(scope, input, input, op));
  return scope;
}

function addSignals(scope, signals, config) {
  // signals defined in the spec take priority
  (0, _vegaUtil.array)(signals).forEach(_ => {
    if (!defined[_.name]) (0, _signal.default)(_, scope);
  });
  if (!config) return signals;
  const out = (0, _vegaUtil.array)(signals).slice(); // add config signals if not already defined

  (0, _vegaUtil.array)(config).forEach(_ => {
    if (!scope.hasOwnSignal(_.name)) {
      (0, _signal.default)(_, scope);
      out.push(_);
    }
  });
  return out;
}
},{"./autosize":"rRM3","./padding":"IU3H","./signal":"W0Pp","./spec":"kjTu","./encode/encode-util":"scev","./marks/marktypes":"tWO1","./marks/roles":"ZEgH","../util":"eOYX","../DataScope":"gNLj","../transforms":"rsu0","vega-util":"dejJ"}],"Yrqr":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Scope;

var _DataScope = _interopRequireDefault(require("./DataScope"));

var _util = require("./util");

var _expression = _interopRequireDefault(require("./parsers/expression"));

var _transforms = require("./transforms");

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function Scope(config) {
  this.config = config;
  this.bindings = [];
  this.field = {};
  this.signals = {};
  this.lambdas = {};
  this.scales = {};
  this.events = {};
  this.data = {};
  this.streams = [];
  this.updates = [];
  this.operators = [];
  this.background = null;
  this.eventConfig = 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.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;
}

var prototype = Scope.prototype = Subscope.prototype; // ----

prototype.fork = function () {
  return new Subscope(this);
};

prototype.isSubscope = function () {
  return this._subid > 0;
};

prototype.toRuntime = function () {
  this.finish();
  return {
    background: this.background,
    operators: this.operators,
    streams: this.streams,
    updates: this.updates,
    bindings: this.bindings,
    eventConfig: this.eventConfig
  };
};

prototype.id = function () {
  return (this._subid ? this._subid + ':' : 0) + this._id++;
};

prototype.add = function (op) {
  this.operators.push(op);
  op.id = this.id(); // if pre-registration references exist, resolve them now

  if (op.refs) {
    op.refs.forEach(function (ref) {
      ref.$ref = op.id;
    });
    op.refs = null;
  }

  return op;
};

prototype.proxy = function (op) {
  var vref = op instanceof _util.Entry ? (0, _util.ref)(op) : op;
  return this.add((0, _transforms.Proxy)({
    value: vref
  }));
};

prototype.addStream = function (stream) {
  this.streams.push(stream);
  stream.id = this.id();
  return stream;
};

prototype.addUpdate = function (update) {
  this.updates.push(update);
  return update;
}; // Apply metadata


prototype.finish = function () {
  var 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) {
    var 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 (var field in ds.index) {
      annotate(ds.index[field], name, 'index:' + field);
    }
  }

  return this;
}; // ----


prototype.pushState = function (encode, parent, lookup) {
  this._encode.push((0, _util.ref)(this.add((0, _transforms.Sieve)({
    pulse: encode
  }))));

  this._parent.push(parent);

  this._lookup.push(lookup ? (0, _util.ref)(this.proxy(lookup)) : null);

  this._markpath.push(-1);
};

prototype.popState = function () {
  this._encode.pop();

  this._parent.pop();

  this._lookup.pop();

  this._markpath.pop();
};

prototype.parent = function () {
  return (0, _vegaUtil.peek)(this._parent);
};

prototype.encode = function () {
  return (0, _vegaUtil.peek)(this._encode);
};

prototype.lookup = function () {
  return (0, _vegaUtil.peek)(this._lookup);
};

prototype.markpath = function () {
  var p = this._markpath;
  return ++p[p.length - 1];
}; // ----


prototype.fieldRef = function (field, name) {
  if ((0, _vegaUtil.isString)(field)) return (0, _util.fieldRef)(field, name);

  if (!field.signal) {
    (0, _vegaUtil.error)('Unsupported field reference: ' + (0, _vegaUtil.stringValue)(field));
  }

  var s = field.signal,
      f = this.field[s],
      params;

  if (!f) {
    params = {
      name: this.signalRef(s)
    };
    if (name) params.as = name;
    this.field[s] = f = (0, _util.ref)(this.add((0, _transforms.Field)(params)));
  }

  return f;
};

prototype.compareRef = function (cmp) {
  function check(_) {
    if ((0, _util.isSignal)(_)) {
      signal = true;
      return scope.signalRef(_.signal);
    } else if ((0, _util.isExpr)(_)) {
      signal = true;
      return scope.exprRef(_.expr);
    } else {
      return _;
    }
  }

  var scope = this,
      signal = false,
      fields = (0, _vegaUtil.array)(cmp.field).map(check),
      orders = (0, _vegaUtil.array)(cmp.order).map(check);
  return signal ? (0, _util.ref)(this.add((0, _transforms.Compare)({
    fields: fields,
    orders: orders
  }))) : (0, _util.compareRef)(fields, orders);
};

prototype.keyRef = function (fields, flat) {
  function check(_) {
    if ((0, _util.isSignal)(_)) {
      signal = true;
      return (0, _util.ref)(sig[_.signal]);
    } else {
      return _;
    }
  }

  var sig = this.signals,
      signal = false;
  fields = (0, _vegaUtil.array)(fields).map(check);
  return signal ? (0, _util.ref)(this.add((0, _transforms.Key)({
    fields: fields,
    flat: flat
  }))) : (0, _util.keyRef)(fields, flat);
};

prototype.sortRef = function (sort) {
  if (!sort) return sort; // including id ensures stable sorting

  var a = (0, _util.aggrField)(sort.op, sort.field),
      o = sort.order || _util.Ascending;
  return o.signal ? (0, _util.ref)(this.add((0, _transforms.Compare)({
    fields: a,
    orders: this.signalRef(o.signal)
  }))) : (0, _util.compareRef)(a, o);
}; // ----


prototype.event = function (source, type) {
  var key = source + ':' + type;

  if (!this.events[key]) {
    var id = this.id();
    this.streams.push({
      id: id,
      source: source,
      type: type
    });
    this.events[key] = id;
  }

  return this.events[key];
}; // ----


prototype.hasOwnSignal = function (name) {
  return (0, _vegaUtil.hasOwnProperty)(this.signals, name);
};

prototype.addSignal = function (name, value) {
  if (this.hasOwnSignal(name)) {
    (0, _vegaUtil.error)('Duplicate signal name: ' + (0, _vegaUtil.stringValue)(name));
  }

  var op = value instanceof _util.Entry ? value : this.add((0, _util.operator)(value));
  return this.signals[name] = op;
};

prototype.getSignal = function (name) {
  if (!this.signals[name]) {
    (0, _vegaUtil.error)('Unrecognized signal name: ' + (0, _vegaUtil.stringValue)(name));
  }

  return this.signals[name];
};

prototype.signalRef = function (s) {
  if (this.signals[s]) {
    return (0, _util.ref)(this.signals[s]);
  } else if (!(0, _vegaUtil.hasOwnProperty)(this.lambdas, s)) {
    this.lambdas[s] = this.add((0, _util.operator)(null));
  }

  return (0, _util.ref)(this.lambdas[s]);
};

prototype.parseLambdas = function () {
  var code = Object.keys(this.lambdas);

  for (var i = 0, n = code.length; i < n; ++i) {
    var s = code[i],
        e = (0, _expression.default)(s, this),
        op = this.lambdas[s];
    op.params = e.$params;
    op.update = e.$expr;
  }
};

prototype.property = function (spec) {
  return spec && spec.signal ? this.signalRef(spec.signal) : spec;
};

prototype.objectProperty = function (spec) {
  return !spec || !(0, _vegaUtil.isObject)(spec) ? spec : this.signalRef(spec.signal || propertyLambda(spec));
};

function propertyLambda(spec) {
  return ((0, _vegaUtil.isArray)(spec) ? arrayLambda : objectLambda)(spec);
}

function arrayLambda(array) {
  var code = '[',
      i = 0,
      n = array.length,
      value;

  for (; i < n; ++i) {
    value = array[i];
    code += (i > 0 ? ',' : '') + ((0, _vegaUtil.isObject)(value) ? value.signal || propertyLambda(value) : (0, _vegaUtil.stringValue)(value));
  }

  return code + ']';
}

function objectLambda(obj) {
  var code = '{',
      i = 0,
      key,
      value;

  for (key in obj) {
    value = obj[key];
    code += (++i > 1 ? ',' : '') + (0, _vegaUtil.stringValue)(key) + ':' + ((0, _vegaUtil.isObject)(value) ? value.signal || propertyLambda(value) : (0, _vegaUtil.stringValue)(value));
  }

  return code + '}';
}

prototype.exprRef = function (code, name) {
  var params = {
    expr: (0, _expression.default)(code, this)
  };
  if (name) params.expr.$name = name;
  return (0, _util.ref)(this.add((0, _transforms.Expression)(params)));
};

prototype.addBinding = function (name, bind) {
  if (!this.bindings) {
    (0, _vegaUtil.error)('Nested signals do not support binding: ' + (0, _vegaUtil.stringValue)(name));
  }

  this.bindings.push((0, _vegaUtil.extend)({
    signal: name
  }, bind));
}; // ----


prototype.addScaleProj = function (name, transform) {
  if ((0, _vegaUtil.hasOwnProperty)(this.scales, name)) {
    (0, _vegaUtil.error)('Duplicate scale or projection name: ' + (0, _vegaUtil.stringValue)(name));
  }

  this.scales[name] = this.add(transform);
};

prototype.addScale = function (name, params) {
  this.addScaleProj(name, (0, _transforms.Scale)(params));
};

prototype.addProjection = function (name, params) {
  this.addScaleProj(name, (0, _transforms.Projection)(params));
};

prototype.getScale = function (name) {
  if (!this.scales[name]) {
    (0, _vegaUtil.error)('Unrecognized scale name: ' + (0, _vegaUtil.stringValue)(name));
  }

  return this.scales[name];
};

prototype.projectionRef = prototype.scaleRef = function (name) {
  return (0, _util.ref)(this.getScale(name));
};

prototype.projectionType = prototype.scaleType = function (name) {
  return this.getScale(name).params.type;
}; // ----


prototype.addData = function (name, dataScope) {
  if ((0, _vegaUtil.hasOwnProperty)(this.data, name)) {
    (0, _vegaUtil.error)('Duplicate data set name: ' + (0, _vegaUtil.stringValue)(name));
  }

  return this.data[name] = dataScope;
};

prototype.getData = function (name) {
  if (!this.data[name]) {
    (0, _vegaUtil.error)('Undefined data set name: ' + (0, _vegaUtil.stringValue)(name));
  }

  return this.data[name];
};

prototype.addDataPipeline = function (name, entries) {
  if ((0, _vegaUtil.hasOwnProperty)(this.data, name)) {
    (0, _vegaUtil.error)('Duplicate data set name: ' + (0, _vegaUtil.stringValue)(name));
  }

  return this.addData(name, _DataScope.default.fromEntries(this, entries));
};
},{"./DataScope":"gNLj","./util":"eOYX","./parsers/expression":"ixc4","./transforms":"rsu0","vega-util":"dejJ"}],"JJvU":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
var defaultFont = 'sans-serif',
    defaultSymbolSize = 30,
    defaultStrokeWidth = 2,
    defaultColor = '#4c78a8',
    black = '#000',
    gray = '#888',
    lightGray = '#ddd';
/**
 * 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 _default() {
  return {
    // 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
    },
    // 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,
      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']
    }
  };
}
},{}],"aKyH":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _view = _interopRequireDefault(require("./parsers/view"));

var _Scope = _interopRequireDefault(require("./Scope"));

var _config = _interopRequireDefault(require("./config"));

var _vegaUtil = require("vega-util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _default(spec, config) {
  if (!(0, _vegaUtil.isObject)(spec)) {
    (0, _vegaUtil.error)('Input Vega specification must be an object.');
  }

  config = (0, _vegaUtil.mergeConfig)((0, _config.default)(), config, spec.config);
  return (0, _view.default)(spec, new _Scope.default(config)).toRuntime();
}
},{"./parsers/view":"M6x2","./Scope":"Yrqr","./config":"JJvU","vega-util":"dejJ"}],"mRX2":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "parse", {
  enumerable: true,
  get: function () {
    return _parse.default;
  }
});
Object.defineProperty(exports, "config", {
  enumerable: true,
  get: function () {
    return _config.default;
  }
});
Object.defineProperty(exports, "signal", {
  enumerable: true,
  get: function () {
    return _signal.default;
  }
});
Object.defineProperty(exports, "signalUpdates", {
  enumerable: true,
  get: function () {
    return _signalUpdates.default;
  }
});
Object.defineProperty(exports, "stream", {
  enumerable: true,
  get: function () {
    return _stream.default;
  }
});
Object.defineProperty(exports, "MarkRole", {
  enumerable: true,
  get: function () {
    return _roles.MarkRole;
  }
});
Object.defineProperty(exports, "FrameRole", {
  enumerable: true,
  get: function () {
    return _roles.FrameRole;
  }
});
Object.defineProperty(exports, "ScopeRole", {
  enumerable: true,
  get: function () {
    return _roles.ScopeRole;
  }
});
Object.defineProperty(exports, "AxisRole", {
  enumerable: true,
  get: function () {
    return _roles.AxisRole;
  }
});
Object.defineProperty(exports, "AxisDomainRole", {
  enumerable: true,
  get: function () {
    return _roles.AxisDomainRole;
  }
});
Object.defineProperty(exports, "AxisGridRole", {
  enumerable: true,
  get: function () {
    return _roles.AxisGridRole;
  }
});
Object.defineProperty(exports, "AxisLabelRole", {
  enumerable: true,
  get: function () {
    return _roles.AxisLabelRole;
  }
});
Object.defineProperty(exports, "AxisTickRole", {
  enumerable: true,
  get: function () {
    return _roles.AxisTickRole;
  }
});
Object.defineProperty(exports, "AxisTitleRole", {
  enumerable: true,
  get: function () {
    return _roles.AxisTitleRole;
  }
});
Object.defineProperty(exports, "LegendRole", {
  enumerable: true,
  get: function () {
    return _roles.LegendRole;
  }
});
Object.defineProperty(exports, "LegendEntryRole", {
  enumerable: true,
  get: function () {
    return _roles.LegendEntryRole;
  }
});
Object.defineProperty(exports, "LegendLabelRole", {
  enumerable: true,
  get: function () {
    return _roles.LegendLabelRole;
  }
});
Object.defineProperty(exports, "LegendSymbolRole", {
  enumerable: true,
  get: function () {
    return _roles.LegendSymbolRole;
  }
});
Object.defineProperty(exports, "LegendTitleRole", {
  enumerable: true,
  get: function () {
    return _roles.LegendTitleRole;
  }
});
Object.defineProperty(exports, "Scope", {
  enumerable: true,
  get: function () {
    return _Scope.default;
  }
});
Object.defineProperty(exports, "DataScope", {
  enumerable: true,
  get: function () {
    return _DataScope.default;
  }
});

var _parse = _interopRequireDefault(require("./src/parse"));

var _config = _interopRequireDefault(require("./src/config"));

var _signal = _interopRequireDefault(require("./src/parsers/signal"));

var _signalUpdates = _interopRequireDefault(require("./src/parsers/signal-updates"));

var _stream = _interopRequireDefault(require("./src/parsers/stream"));

var _roles = require("./src/parsers/marks/roles");

var _Scope = _interopRequireDefault(require("./src/Scope"));

var _DataScope = _interopRequireDefault(require("./src/DataScope"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
},{"./src/parse":"aKyH","./src/config":"JJvU","./src/parsers/signal":"W0Pp","./src/parsers/signal-updates":"uclE","./src/parsers/stream":"Yym5","./src/parsers/marks/roles":"ZEgH","./src/Scope":"Yrqr","./src/DataScope":"gNLj"}],"VKat":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
var _exportNames = {
  Dataflow: true,
  EventStream: true,
  Parameters: true,
  Pulse: true,
  MultiPulse: true,
  Operator: true,
  Transform: true,
  changeset: true,
  ingest: true,
  isTuple: true,
  definition: true,
  transform: true,
  transforms: true,
  tupleid: true,
  version: true,
  scale: true,
  scheme: true,
  interpolate: true,
  interpolateColors: true,
  interpolateRange: true,
  quantizeInterpolator: true,
  projection: true,
  View: true,
  expressionFunction: true,
  formatLocale: true,
  timeFormatLocale: true,
  parse: true,
  runtime: true,
  runtimeContext: true
};
Object.defineProperty(exports, "Dataflow", {
  enumerable: true,
  get: function () {
    return _vegaDataflow.Dataflow;
  }
});
Object.defineProperty(exports, "EventStream", {
  enumerable: true,
  get: function () {
    return _vegaDataflow.EventStream;
  }
});
Object.defineProperty(exports, "Parameters", {
  enumerable: true,
  get: function () {
    return _vegaDataflow.Parameters;
  }
});
Object.defineProperty(exports, "Pulse", {
  enumerable: true,
  get: function () {
    return _vegaDataflow.Pulse;
  }
});
Object.defineProperty(exports, "MultiPulse", {
  enumerable: true,
  get: function () {
    return _vegaDataflow.MultiPulse;
  }
});
Object.defineProperty(exports, "Operator", {
  enumerable: true,
  get: function () {
    return _vegaDataflow.Operator;
  }
});
Object.defineProperty(exports, "Transform", {
  enumerable: true,
  get: function () {
    return _vegaDataflow.Transform;
  }
});
Object.defineProperty(exports, "changeset", {
  enumerable: true,
  get: function () {
    return _vegaDataflow.changeset;
  }
});
Object.defineProperty(exports, "ingest", {
  enumerable: true,
  get: function () {
    return _vegaDataflow.ingest;
  }
});
Object.defineProperty(exports, "isTuple", {
  enumerable: true,
  get: function () {
    return _vegaDataflow.isTuple;
  }
});
Object.defineProperty(exports, "definition", {
  enumerable: true,
  get: function () {
    return _vegaDataflow.definition;
  }
});
Object.defineProperty(exports, "transform", {
  enumerable: true,
  get: function () {
    return _vegaDataflow.transform;
  }
});
Object.defineProperty(exports, "transforms", {
  enumerable: true,
  get: function () {
    return _vegaDataflow.transforms;
  }
});
Object.defineProperty(exports, "tupleid", {
  enumerable: true,
  get: function () {
    return _vegaDataflow.tupleid;
  }
});
Object.defineProperty(exports, "version", {
  enumerable: true,
  get: function () {
    return _package.version;
  }
});
Object.defineProperty(exports, "scale", {
  enumerable: true,
  get: function () {
    return _vegaScale.scale;
  }
});
Object.defineProperty(exports, "scheme", {
  enumerable: true,
  get: function () {
    return _vegaScale.scheme;
  }
});
Object.defineProperty(exports, "interpolate", {
  enumerable: true,
  get: function () {
    return _vegaScale.interpolate;
  }
});
Object.defineProperty(exports, "interpolateColors", {
  enumerable: true,
  get: function () {
    return _vegaScale.interpolateColors;
  }
});
Object.defineProperty(exports, "interpolateRange", {
  enumerable: true,
  get: function () {
    return _vegaScale.interpolateRange;
  }
});
Object.defineProperty(exports, "quantizeInterpolator", {
  enumerable: true,
  get: function () {
    return _vegaScale.quantizeInterpolator;
  }
});
Object.defineProperty(exports, "projection", {
  enumerable: true,
  get: function () {
    return _vegaProjection.projection;
  }
});
Object.defineProperty(exports, "View", {
  enumerable: true,
  get: function () {
    return _vegaView.View;
  }
});
Object.defineProperty(exports, "expressionFunction", {
  enumerable: true,
  get: function () {
    return _vegaFunctions.expressionFunction;
  }
});
Object.defineProperty(exports, "formatLocale", {
  enumerable: true,
  get: function () {
    return _vegaFunctions.formatLocale;
  }
});
Object.defineProperty(exports, "timeFormatLocale", {
  enumerable: true,
  get: function () {
    return _vegaFunctions.timeFormatLocale;
  }
});
Object.defineProperty(exports, "parse", {
  enumerable: true,
  get: function () {
    return _vegaParser.parse;
  }
});
Object.defineProperty(exports, "runtime", {
  enumerable: true,
  get: function () {
    return _vegaRuntime.parse;
  }
});
Object.defineProperty(exports, "runtimeContext", {
  enumerable: true,
  get: function () {
    return _vegaRuntime.context;
  }
});

var _vegaUtil = require("vega-util");

Object.keys(_vegaUtil).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _vegaUtil[key];
    }
  });
});

var _vegaDataflow = require("vega-dataflow");

var tx = _interopRequireWildcard(require("vega-transforms"));

var vtx = _interopRequireWildcard(require("vega-view-transforms"));

var encode = _interopRequireWildcard(require("vega-encode"));

var geo = _interopRequireWildcard(require("vega-geo"));

var force = _interopRequireWildcard(require("vega-force"));

var tree = _interopRequireWildcard(require("vega-hierarchy"));

var reg = _interopRequireWildcard(require("vega-regression"));

var voronoi = _interopRequireWildcard(require("vega-voronoi"));

var wordcloud = _interopRequireWildcard(require("vega-wordcloud"));

var xf = _interopRequireWildcard(require("vega-crossfilter"));

var _package = require("./package.json");

var _vegaStatistics = require("vega-statistics");

Object.keys(_vegaStatistics).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _vegaStatistics[key];
    }
  });
});

var _vegaTime = require("vega-time");

Object.keys(_vegaTime).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _vegaTime[key];
    }
  });
});

var _vegaLoader = require("vega-loader");

Object.keys(_vegaLoader).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _vegaLoader[key];
    }
  });
});

var _vegaScenegraph = require("vega-scenegraph");

Object.keys(_vegaScenegraph).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _vegaScenegraph[key];
    }
  });
});

var _vegaScale = require("vega-scale");

var _vegaProjection = require("vega-projection");

var _vegaView = require("vega-view");

var _vegaFunctions = require("vega-functions");

var _vegaParser = require("vega-parser");

var _vegaRuntime = require("vega-runtime");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// -- Transforms -----
(0, _vegaUtil.extend)(_vegaDataflow.transforms, tx, vtx, encode, geo, force, tree, reg, voronoi, wordcloud, xf); // -- Exports -----
},{"vega-util":"dejJ","vega-dataflow":"UC8n","vega-transforms":"fCtd","vega-view-transforms":"JYoF","vega-encode":"m51Y","vega-geo":"mZS8","vega-force":"fXAp","vega-hierarchy":"cflr","vega-regression":"RK92","vega-voronoi":"ur88","vega-wordcloud":"IWOG","vega-crossfilter":"RH0r","./package.json":"aMtX","vega-statistics":"yUSi","vega-time":"j8qo","vega-loader":"wGnx","vega-scenegraph":"rKdC","vega-scale":"VE6e","vega-projection":"FdWH","vega-view":"YCdH","vega-functions":"JYcc","vega-parser":"mRX2","vega-runtime":"SS7m"}],"xgwM":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.__extends = __extends;
exports.__rest = __rest;
exports.__decorate = __decorate;
exports.__param = __param;
exports.__metadata = __metadata;
exports.__awaiter = __awaiter;
exports.__generator = __generator;
exports.__exportStar = __exportStar;
exports.__values = __values;
exports.__read = __read;
exports.__spread = __spread;
exports.__spreadArrays = __spreadArrays;
exports.__await = __await;
exports.__asyncGenerator = __asyncGenerator;
exports.__asyncDelegator = __asyncDelegator;
exports.__asyncValues = __asyncValues;
exports.__makeTemplateObject = __makeTemplateObject;
exports.__importStar = __importStar;
exports.__importDefault = __importDefault;
exports.__assign = void 0;

/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0

THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.

See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */

/* 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 __extends(d, b) {
  extendStatics(d, b);

  function __() {
    this.constructor = d;
  }

  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}

var __assign = function () {
  exports.__assign = __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);
};

exports.__assign = __assign;

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) {
  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) : new P(function (resolve) {
        resolve(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 m = typeof Symbol === "function" && o[Symbol.iterator],
      i = 0;
  if (m) return m.call(o);
  return {
    next: function () {
      if (o && i >= o.length) o = void 0;
      return {
        value: o && o[i++],
        done: !o
      };
    }
  };
}

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
  };
}
},{}],"l8wQ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.setVersion = setVersion;
// A packages cache that makes sure that we don't inject the same packageName twice in the same bundle -
// this cache is local to the module closure inside this bundle
var packagesCache = {};

function setVersion(packageName, packageVersion) {
  if (typeof window !== 'undefined') {
    // tslint:disable-next-line:no-any
    var packages = window.__packages__ = window.__packages__ || {}; // We allow either the global packages or local packages caches to invalidate so testing can just clear the global to set this state

    if (!packages[packageName] || !packagesCache[packageName]) {
      packagesCache[packageName] = packageVersion;
      var versions = packages[packageName] = packages[packageName] || [];
      versions.push(packageVersion);
    }
  }
}
},{}],"c7t6":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "setVersion", {
  enumerable: true,
  get: function () {
    return _setVersion.setVersion;
  }
});

var _setVersion = require("./setVersion");

(0, _setVersion.setVersion)('@uifabric/set-version', '6.0.0');
},{"./setVersion":"l8wQ"}],"xNUS":[function(require,module,exports) {
"use strict";

var _setVersion = require("@uifabric/set-version");

// office-ui-fabric-react@6.204.3
// Do not modify this file, the file is generated as part of publish. The checked in version is a placeholder only.
(0, _setVersion.setVersion)('office-ui-fabric-react', '6.204.3');
},{"@uifabric/set-version":"c7t6"}],"tKHx":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.setSSR = setSSR;
exports._isSSR = void 0;
var _isSSR = false;
/**
 * Helper to set ssr mode to simulate no window object returned from getWindow helper.
 *
 * @public
 */

exports._isSSR = _isSSR;

function setSSR(isEnabled) {
  exports._isSSR = _isSSR = isEnabled;
}
},{}],"mtGO":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getWindow = getWindow;

var _setSSR = require("./setSSR");

var _window = undefined; // Note: Accessing "window" in IE11 is somewhat expensive, and calling "typeof window"
// hits a memory leak, whereas aliasing it and calling "typeof _window" does not.
// Caching the window value at the file scope lets us minimize the impact.

try {
  _window = window;
} catch (e) {}
/* no-op */

/**
 * Helper to get the window object. The helper will make sure to use a cached variable
 * of "window", to avoid overhead and memory leaks in IE11. Note that in popup scenarios the
 * window object won't match the "global" window object, and for these scenarios, you should
 * pass in an element hosted within the popup.
 *
 * @public
 */


function getWindow(rootElement) {
  if (_setSSR._isSSR || typeof _window === 'undefined') {
    return undefined;
  } else {
    var el = rootElement;
    return el && el.ownerDocument && el.ownerDocument.defaultView ? el.ownerDocument.defaultView : _window;
  }
}
},{"./setSSR":"tKHx"}],"JzaE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Async = void 0;

var _getWindow = require("./dom/getWindow");

/**
 * Bugs often appear in async code when stuff gets disposed, but async operations don't get canceled.
 * This Async helper class solves these issues by tying async code to the lifetime of a disposable object.
 *
 * Usage: Anything class extending from BaseModel can access this helper via this.async. Otherwise create a
 * new instance of the class and remember to call dispose() during your code's dispose handler.
 *
 * @public
 */
var Async =
/** @class */
function () {
  // tslint:disable-next-line:no-any
  function Async(parent, onError) {
    this._timeoutIds = null;
    this._immediateIds = null;
    this._intervalIds = null;
    this._animationFrameIds = null;
    this._isDisposed = false;
    this._parent = parent || null;
    this._onErrorHandler = onError;

    this._noop = function () {
      /* do nothing */
    };
  }
  /**
   * Dispose function, clears all async operations.
   */


  Async.prototype.dispose = function () {
    var id;
    this._isDisposed = true;
    this._parent = null; // Clear timeouts.

    if (this._timeoutIds) {
      for (id in this._timeoutIds) {
        if (this._timeoutIds.hasOwnProperty(id)) {
          this.clearTimeout(parseInt(id, 10));
        }
      }

      this._timeoutIds = null;
    } // Clear immediates.


    if (this._immediateIds) {
      for (id in this._immediateIds) {
        if (this._immediateIds.hasOwnProperty(id)) {
          this.clearImmediate(parseInt(id, 10));
        }
      }

      this._immediateIds = null;
    } // Clear intervals.


    if (this._intervalIds) {
      for (id in this._intervalIds) {
        if (this._intervalIds.hasOwnProperty(id)) {
          this.clearInterval(parseInt(id, 10));
        }
      }

      this._intervalIds = null;
    } // Clear animation frames.


    if (this._animationFrameIds) {
      for (id in this._animationFrameIds) {
        if (this._animationFrameIds.hasOwnProperty(id)) {
          this.cancelAnimationFrame(parseInt(id, 10));
        }
      }

      this._animationFrameIds = null;
    }
  };
  /**
   * SetTimeout override, which will auto cancel the timeout during dispose.
   * @param callback - Callback to execute.
   * @param duration - Duration in milliseconds.
   * @returns The setTimeout id.
   */


  Async.prototype.setTimeout = function (callback, duration) {
    var _this = this;

    var timeoutId = 0;

    if (!this._isDisposed) {
      if (!this._timeoutIds) {
        this._timeoutIds = {};
      }
      /* tslint:disable:ban-native-functions */


      timeoutId = setTimeout(function () {
        // Time to execute the timeout, enqueue it as a foreground task to be executed.
        try {
          // Now delete the record and call the callback.
          if (_this._timeoutIds) {
            delete _this._timeoutIds[timeoutId];
          }

          callback.apply(_this._parent);
        } catch (e) {
          if (_this._onErrorHandler) {
            _this._onErrorHandler(e);
          }
        }
      }, duration);
      /* tslint:enable:ban-native-functions */

      this._timeoutIds[timeoutId] = true;
    }

    return timeoutId;
  };
  /**
   * Clears the timeout.
   * @param id - Id to cancel.
   */


  Async.prototype.clearTimeout = function (id) {
    if (this._timeoutIds && this._timeoutIds[id]) {
      /* tslint:disable:ban-native-functions */
      clearTimeout(id);
      delete this._timeoutIds[id];
      /* tslint:enable:ban-native-functions */
    }
  };
  /**
   * SetImmediate override, which will auto cancel the immediate during dispose.
   * @param callback - Callback to execute.
   * @param targetElement - Optional target element to use for identifying the correct window.
   * @returns The setTimeout id.
   */


  Async.prototype.setImmediate = function (callback, targetElement) {
    var _this = this;

    var immediateId = 0;
    var win = (0, _getWindow.getWindow)(targetElement);

    if (!this._isDisposed) {
      if (!this._immediateIds) {
        this._immediateIds = {};
      }
      /* tslint:disable:ban-native-functions */


      var setImmediateCallback = function () {
        // Time to execute the timeout, enqueue it as a foreground task to be executed.
        try {
          // Now delete the record and call the callback.
          if (_this._immediateIds) {
            delete _this._immediateIds[immediateId];
          }

          callback.apply(_this._parent);
        } catch (e) {
          _this._logError(e);
        }
      };

      immediateId = win.setTimeout(setImmediateCallback, 0);
      /* tslint:enable:ban-native-functions */

      this._immediateIds[immediateId] = true;
    }

    return immediateId;
  };
  /**
   * Clears the immediate.
   * @param id - Id to cancel.
   * @param targetElement - Optional target element to use for identifying the correct window.
   */


  Async.prototype.clearImmediate = function (id, targetElement) {
    var win = (0, _getWindow.getWindow)(targetElement);

    if (this._immediateIds && this._immediateIds[id]) {
      /* tslint:disable:ban-native-functions */
      win.clearTimeout(id);
      delete this._immediateIds[id];
      /* tslint:enable:ban-native-functions */
    }
  };
  /**
   * SetInterval override, which will auto cancel the timeout during dispose.
   * @param callback - Callback to execute.
   * @param duration - Duration in milliseconds.
   * @returns The setTimeout id.
   */


  Async.prototype.setInterval = function (callback, duration) {
    var _this = this;

    var intervalId = 0;

    if (!this._isDisposed) {
      if (!this._intervalIds) {
        this._intervalIds = {};
      }
      /* tslint:disable:ban-native-functions */


      intervalId = setInterval(function () {
        // Time to execute the interval callback, enqueue it as a foreground task to be executed.
        try {
          callback.apply(_this._parent);
        } catch (e) {
          _this._logError(e);
        }
      }, duration);
      /* tslint:enable:ban-native-functions */

      this._intervalIds[intervalId] = true;
    }

    return intervalId;
  };
  /**
   * Clears the interval.
   * @param id - Id to cancel.
   */


  Async.prototype.clearInterval = function (id) {
    if (this._intervalIds && this._intervalIds[id]) {
      /* tslint:disable:ban-native-functions */
      clearInterval(id);
      delete this._intervalIds[id];
      /* tslint:enable:ban-native-functions */
    }
  };
  /**
   * Creates a function that, when executed, will only call the func function at most once per
   * every wait milliseconds. Provide an options object to indicate that func should be invoked
   * on the leading and/or trailing edge of the wait timeout. Subsequent calls to the throttled
   * function will return the result of the last func call.
   *
   * Note: If leading and trailing options are true func will be called on the trailing edge of
   * the timeout only if the the throttled function is invoked more than once during the wait timeout.
   *
   * @param func - The function to throttle.
   * @param wait - The number of milliseconds to throttle executions to. Defaults to 0.
   * @param options - The options object.
   * @returns The new throttled function.
   */


  Async.prototype.throttle = function (func, wait, options) {
    var _this = this;

    if (this._isDisposed) {
      return this._noop;
    }

    var waitMS = wait || 0;
    var leading = true;
    var trailing = true;
    var lastExecuteTime = 0;
    var lastResult; // tslint:disable-next-line:no-any

    var lastArgs;
    var timeoutId = null;

    if (options && typeof options.leading === 'boolean') {
      leading = options.leading;
    }

    if (options && typeof options.trailing === 'boolean') {
      trailing = options.trailing;
    }

    var callback = function (userCall) {
      var now = new Date().getTime();
      var delta = now - lastExecuteTime;
      var waitLength = leading ? waitMS - delta : waitMS;

      if (delta >= waitMS && (!userCall || leading)) {
        lastExecuteTime = now;

        if (timeoutId) {
          _this.clearTimeout(timeoutId);

          timeoutId = null;
        }

        lastResult = func.apply(_this._parent, lastArgs);
      } else if (timeoutId === null && trailing) {
        timeoutId = _this.setTimeout(callback, waitLength);
      }

      return lastResult;
    }; // tslint:disable-next-line:no-any


    var resultFunction = function () {
      var args = [];

      for (var _i = 0; _i < arguments.length; _i++) {
        args[_i] = arguments[_i];
      }

      lastArgs = args;
      return callback(true);
    };

    return resultFunction;
  };
  /**
   * Creates a function that will delay the execution of func until after wait milliseconds have
   * elapsed since the last time it was invoked. Provide an options object to indicate that func
   * should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent calls
   * to the debounced function will return the result of the last func call.
   *
   * Note: If leading and trailing options are true func will be called on the trailing edge of
   * the timeout only if the the debounced function is invoked more than once during the wait
   * timeout.
   *
   * @param func - The function to debounce.
   * @param wait - The number of milliseconds to delay.
   * @param options - The options object.
   * @returns The new debounced function.
   */


  Async.prototype.debounce = function (func, wait, options) {
    var _this = this;

    if (this._isDisposed) {
      var noOpFunction = function () {
        /** Do nothing */
      };

      noOpFunction.cancel = function () {
        return;
      };
      /* tslint:disable:no-any */


      noOpFunction.flush = function () {
        return null;
      };
      /* tslint:enable:no-any */


      noOpFunction.pending = function () {
        return false;
      };

      return noOpFunction;
    }

    var waitMS = wait || 0;
    var leading = false;
    var trailing = true;
    var maxWait = null;
    var lastCallTime = 0;
    var lastExecuteTime = new Date().getTime();
    var lastResult; // tslint:disable-next-line:no-any

    var lastArgs;
    var timeoutId = null;

    if (options && typeof options.leading === 'boolean') {
      leading = options.leading;
    }

    if (options && typeof options.trailing === 'boolean') {
      trailing = options.trailing;
    }

    if (options && typeof options.maxWait === 'number' && !isNaN(options.maxWait)) {
      maxWait = options.maxWait;
    }

    var markExecuted = function (time) {
      if (timeoutId) {
        _this.clearTimeout(timeoutId);

        timeoutId = null;
      }

      lastExecuteTime = time;
    };

    var invokeFunction = function (time) {
      markExecuted(time);
      lastResult = func.apply(_this._parent, lastArgs);
    };

    var callback = function (userCall) {
      var now = new Date().getTime();
      var executeImmediately = false;

      if (userCall) {
        if (leading && now - lastCallTime >= waitMS) {
          executeImmediately = true;
        }

        lastCallTime = now;
      }

      var delta = now - lastCallTime;
      var waitLength = waitMS - delta;
      var maxWaitDelta = now - lastExecuteTime;
      var maxWaitExpired = false;

      if (maxWait !== null) {
        // maxWait only matters when there is a pending callback
        if (maxWaitDelta >= maxWait && timeoutId) {
          maxWaitExpired = true;
        } else {
          waitLength = Math.min(waitLength, maxWait - maxWaitDelta);
        }
      }

      if (delta >= waitMS || maxWaitExpired || executeImmediately) {
        invokeFunction(now);
      } else if ((timeoutId === null || !userCall) && trailing) {
        timeoutId = _this.setTimeout(callback, waitLength);
      }

      return lastResult;
    };

    var pending = function () {
      return !!timeoutId;
    };

    var cancel = function () {
      if (pending()) {
        // Mark the debounced function as having executed
        markExecuted(new Date().getTime());
      }
    };

    var flush = function () {
      if (pending()) {
        invokeFunction(new Date().getTime());
      }

      return lastResult;
    }; // tslint:disable-next-line:no-any


    var resultFunction = function () {
      var args = [];

      for (var _i = 0; _i < arguments.length; _i++) {
        args[_i] = arguments[_i];
      }

      lastArgs = args;
      return callback(true);
    };

    resultFunction.cancel = cancel;
    resultFunction.flush = flush;
    resultFunction.pending = pending;
    return resultFunction;
  };

  Async.prototype.requestAnimationFrame = function (callback, targetElement) {
    var _this = this;

    var animationFrameId = 0;
    var win = (0, _getWindow.getWindow)(targetElement);

    if (!this._isDisposed) {
      if (!this._animationFrameIds) {
        this._animationFrameIds = {};
      }
      /* tslint:disable:ban-native-functions */


      var animationFrameCallback = function () {
        try {
          // Now delete the record and call the callback.
          if (_this._animationFrameIds) {
            delete _this._animationFrameIds[animationFrameId];
          }

          callback.apply(_this._parent);
        } catch (e) {
          _this._logError(e);
        }
      };

      animationFrameId = win.requestAnimationFrame ? win.requestAnimationFrame(animationFrameCallback) : win.setTimeout(animationFrameCallback, 0);
      /* tslint:enable:ban-native-functions */

      this._animationFrameIds[animationFrameId] = true;
    }

    return animationFrameId;
  };

  Async.prototype.cancelAnimationFrame = function (id, targetElement) {
    var win = (0, _getWindow.getWindow)(targetElement);

    if (this._animationFrameIds && this._animationFrameIds[id]) {
      /* tslint:disable:ban-native-functions */
      win.cancelAnimationFrame ? win.cancelAnimationFrame(id) : win.clearTimeout(id);
      /* tslint:enable:ban-native-functions */

      delete this._animationFrameIds[id];
    }
  }; // tslint:disable-next-line:no-any


  Async.prototype._logError = function (e) {
    if (this._onErrorHandler) {
      this._onErrorHandler(e);
    }
  };

  return Async;
}();

exports.Async = Async;
},{"./dom/getWindow":"mtGO"}],"pqqa":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Stylesheet = exports.InjectionMode = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var InjectionMode = {
  /**
   * Avoids style injection, use getRules() to read the styles.
   */
  none: 0,

  /**
   * Inserts rules using the insertRule api.
   */
  insertNode: 1,

  /**
   * Appends rules using appendChild.
   */
  appendChild: 2
};
exports.InjectionMode = InjectionMode;
var STYLESHEET_SETTING = '__stylesheet__'; // tslint:disable-next-line:no-any

var _global = {}; // Grab window.

try {
  _global = window;
} catch (_a) {
  /* leave as blank object */
}

var _stylesheet;
/**
 * Represents the state of styles registered in the page. Abstracts
 * the surface for adding styles to the stylesheet, exposes helpers
 * for reading the styles registered in server rendered scenarios.
 *
 * @public
 */


var Stylesheet =
/** @class */
function () {
  function Stylesheet(config) {
    this._rules = [];
    this._preservedRules = [];
    this._rulesToInsert = [];
    this._counter = 0;
    this._keyToClassName = {};
    this._onResetCallbacks = []; // tslint:disable-next-line:no-any

    this._classNameToArgs = {};
    this._config = tslib_1.__assign({
      injectionMode: InjectionMode.insertNode,
      defaultPrefix: 'css',
      namespace: undefined,
      cspSettings: undefined
    }, config);
  }
  /**
   * Gets the singleton instance.
   */


  Stylesheet.getInstance = function () {
    // tslint:disable-next-line:no-any
    _stylesheet = _global[STYLESHEET_SETTING];

    if (!_stylesheet || _stylesheet._lastStyleElement && _stylesheet._lastStyleElement.ownerDocument !== document) {
      // tslint:disable-next-line:no-string-literal
      var fabricConfig = _global && _global['FabricConfig'] || {};
      _stylesheet = _global[STYLESHEET_SETTING] = new Stylesheet(fabricConfig.mergeStyles);
    }

    return _stylesheet;
  };
  /**
   * Configures the stylesheet.
   */


  Stylesheet.prototype.setConfig = function (config) {
    this._config = tslib_1.__assign({}, this._config, config);
  };
  /**
   * Configures a reset callback.
   *
   * @param callback - A callback which will be called when the Stylesheet is reset.
   */


  Stylesheet.prototype.onReset = function (callback) {
    this._onResetCallbacks.push(callback);
  };
  /**
   * Generates a unique classname.
   *
   * @param displayName - Optional value to use as a prefix.
   */


  Stylesheet.prototype.getClassName = function (displayName) {
    var namespace = this._config.namespace;
    var prefix = displayName || this._config.defaultPrefix;
    return "" + (namespace ? namespace + '-' : '') + prefix + "-" + this._counter++;
  };
  /**
   * Used internally to cache information about a class which was
   * registered with the stylesheet.
   */


  Stylesheet.prototype.cacheClassName = function (className, key, args, rules) {
    this._keyToClassName[key] = className;
    this._classNameToArgs[className] = {
      args: args,
      rules: rules
    };
  };
  /**
   * Gets the appropriate classname given a key which was previously
   * registered using cacheClassName.
   */


  Stylesheet.prototype.classNameFromKey = function (key) {
    return this._keyToClassName[key];
  };
  /**
   * Gets the arguments associated with a given classname which was
   * previously registered using cacheClassName.
   */


  Stylesheet.prototype.argsFromClassName = function (className) {
    var entry = this._classNameToArgs[className];
    return entry && entry.args;
  };
  /**
   * Gets the arguments associated with a given classname which was
   * previously registered using cacheClassName.
   */


  Stylesheet.prototype.insertedRulesFromClassName = function (className) {
    var entry = this._classNameToArgs[className];
    return entry && entry.rules;
  };
  /**
   * Inserts a css rule into the stylesheet.
   * @param preserve - Preserves the rule beyond a reset boundary.
   */


  Stylesheet.prototype.insertRule = function (rule, preserve) {
    var injectionMode = this._config.injectionMode;
    var element = injectionMode !== InjectionMode.none ? this._getStyleElement() : undefined;

    if (preserve) {
      this._preservedRules.push(rule);
    }

    if (element) {
      switch (this._config.injectionMode) {
        case InjectionMode.insertNode:
          var sheet = element.sheet;

          try {
            sheet.insertRule(rule, sheet.cssRules.length);
          } catch (e) {// The browser will throw exceptions on unsupported rules (such as a moz prefix in webkit.)
            // We need to swallow the exceptions for this scenario, otherwise we'd need to filter
            // which could be slower and bulkier.
          }

          break;

        case InjectionMode.appendChild:
          element.appendChild(document.createTextNode(rule));
          break;
      }
    } else {
      this._rules.push(rule);
    }

    if (this._config.onInsertRule) {
      this._config.onInsertRule(rule);
    }
  };
  /**
   * Gets all rules registered with the stylesheet; only valid when
   * using InsertionMode.none.
   */


  Stylesheet.prototype.getRules = function (includePreservedRules) {
    return (includePreservedRules ? this._preservedRules.join('') : '') + this._rules.join('') + this._rulesToInsert.join('');
  };
  /**
   * Resets the internal state of the stylesheet. Only used in server
   * rendered scenarios where we're using InsertionMode.none.
   */


  Stylesheet.prototype.reset = function () {
    this._rules = [];
    this._rulesToInsert = [];
    this._counter = 0;
    this._classNameToArgs = {};
    this._keyToClassName = {};

    this._onResetCallbacks.forEach(function (callback) {
      return callback();
    });
  }; // Forces the regeneration of incoming styles without totally resetting the stylesheet.


  Stylesheet.prototype.resetKeys = function () {
    this._keyToClassName = {};
  };

  Stylesheet.prototype._getStyleElement = function () {
    var _this = this;

    if (!this._styleElement && typeof document !== 'undefined') {
      this._styleElement = this._createStyleElement(); // Reset the style element on the next frame.

      window.requestAnimationFrame(function () {
        _this._styleElement = undefined;
      });
    }

    return this._styleElement;
  };

  Stylesheet.prototype._createStyleElement = function () {
    var styleElement = document.createElement('style');
    styleElement.setAttribute('data-merge-styles', 'true');
    styleElement.type = 'text/css';
    var cspSettings = this._config.cspSettings;

    if (cspSettings) {
      if (cspSettings.nonce) {
        styleElement.setAttribute('nonce', cspSettings.nonce);
      }
    }

    if (this._lastStyleElement && this._lastStyleElement.nextElementSibling) {
      document.head.insertBefore(styleElement, this._lastStyleElement.nextElementSibling);
    } else {
      document.head.appendChild(styleElement);
    }

    this._lastStyleElement = styleElement;
    return styleElement;
  };

  return Stylesheet;
}();

exports.Stylesheet = Stylesheet;
},{"tslib":"xgwM"}],"FqEZ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.kebabRules = kebabRules;
var rules = {
  MozOsxFontSmoothing: '-moz-osx-font-smoothing',
  MsHighContrastAdjust: '-ms-high-contrast-adjust',
  WebkitFontSmoothing: '-webkit-font-smoothing',
  WebkitOverflowScrolling: '-webkit-overflow-scrolling',
  WebkitTapHighlightColor: '-webkit-tap-highlight-color',
  alignContent: 'align-content',
  alignItems: 'align-items',
  alignSelf: 'align-self',
  animation: 'animation',
  animationDelay: 'animation-delay',
  animationDirection: 'animation-direction',
  animationDuration: 'animation-duration',
  animationFillMode: 'animation-fill-mode',
  animationIterationCount: 'animation-iteration-count',
  animationName: 'animation-name',
  animationTimingFunction: 'animation-timing-function',
  background: 'background',
  backgroundClip: 'background-clip',
  backgroundColor: 'background-color',
  backgroundImage: 'background-image',
  backgroundPosition: 'background-position',
  border: 'border',
  borderBottom: 'border-bottom',
  borderBottomColor: 'border-bottom-color',
  borderBottomStyle: 'border-bottom-style',
  borderBottomWidth: 'border-bottom-width',
  borderCollapse: 'border-collapse',
  borderColor: 'border-color',
  borderLeft: 'border-left',
  borderRadius: 'border-radius',
  borderRight: 'border-right',
  borderStyle: 'border-style',
  borderTop: 'border-top',
  borderTopColor: 'border-top-color',
  borderTopLeftRadius: 'border-top-left-radius',
  borderTopRightRadius: 'border-top-right-radius',
  borderTopStyle: 'border-top-style',
  borderTopWidth: 'border-top-width',
  borderWidth: 'border-width',
  bordercolor: 'bordercolor',
  bottom: 'bottom',
  boxShadow: 'box-shadow',
  boxSizing: 'box-sizing',
  clear: 'clear',
  color: 'color',
  content: 'content',
  cursor: 'cursor',
  display: 'display',
  fill: 'fill',
  flex: 'flex',
  flexBasis: 'flex-basis',
  flexDirection: 'flex-direction',
  flexGrow: 'flex-grow',
  flexShrink: 'flex-shrink',
  flexWrap: 'flex-wrap',
  float: 'float',
  font: 'font',
  fontFamily: 'font-family',
  fontSize: 'font-size',
  fontStyle: 'font-style',
  fontWeight: 'font-weight',
  height: 'height',
  justifyContent: 'justify-content',
  left: 'left',
  lineHeight: 'line-height',
  listStyle: 'list-style',
  listStyleType: 'list-style-type',
  marginBottom: 'margin-bottom',
  marginLeft: 'margin-left',
  marginRight: 'margin-right',
  marginTop: 'margin-top',
  maxHeight: 'max-height',
  maxWidth: 'max-width',
  minHeight: 'min-height',
  minWidth: 'min-width',
  mozOsxFontSmoothing: 'moz-osx-font-smoothing',
  objectFit: 'object-fit',
  opacity: 'opacity',
  order: 'order',
  outline: 'outline',
  outlineColor: 'outline-color',
  outlineOffset: 'outline-offset',
  overflow: 'overflow',
  overflowWrap: 'overflow-wrap',
  overflowX: 'overflow-x',
  overflowY: 'overflow-y',
  paddingBottom: 'padding-bottom',
  paddingLeft: 'padding-left',
  paddingRight: 'padding-right',
  paddingTop: 'padding-top',
  perspective: 'perspective',
  pointerEvents: 'pointer-events',
  position: 'position',
  resize: 'resize',
  right: 'right',
  speak: 'speak',
  src: 'src',
  tableLayout: 'table-layout',
  textAlign: 'text-align',
  textDecoration: 'text-decoration',
  textOverflow: 'text-overflow',
  textTransform: 'text-transform',
  top: 'top',
  transform: 'transform',
  transformOrigin: 'transform-origin',
  transition: 'transition',
  transitionDelay: 'transition-delay',
  transitionDuration: 'transition-duration',
  transitionProperty: 'transition-property',
  transitionTimingFunction: 'transition-timing-function',
  userSelect: 'user-select',
  verticalAlign: 'vertical-align',
  visibility: 'visibility',
  webkitFontSmoothing: 'webkit-font-smoothing',
  whiteSpace: 'white-space',
  width: 'width',
  wordBreak: 'word-break',
  wordWrap: 'word-wrap',
  zIndex: 'z-index'
};

function kebabRules(rulePairs, index) {
  var rule = rulePairs[index];
  rulePairs[index] = rules[rule] = rules[rule] || rule.replace(/([A-Z])/g, '-$1').toLowerCase();
}
},{}],"ZbLz":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getVendorSettings = getVendorSettings;
exports.setVendorSettings = setVendorSettings;

var _vendorSettings;

function getVendorSettings() {
  if (!_vendorSettings) {
    var doc = typeof document !== 'undefined' ? document : undefined;
    var nav = typeof navigator !== 'undefined' ? navigator : undefined;
    var userAgent = nav ? nav.userAgent.toLowerCase() : undefined;

    if (!doc) {
      _vendorSettings = {
        isWebkit: true,
        isMoz: true,
        isOpera: true,
        isMs: true
      };
    } else {
      _vendorSettings = {
        isWebkit: !!(doc && 'WebkitAppearance' in doc.documentElement.style),
        isMoz: !!(userAgent && userAgent.indexOf('firefox') > -1),
        isOpera: !!(userAgent && userAgent.indexOf('opera') > -1),
        isMs: !!(nav && (/rv:11.0/i.test(nav.userAgent) || /Edge\/\d./i.test(navigator.userAgent)))
      };
    }
  }

  return _vendorSettings;
}
/**
 * Sets the vendor settings for prefixing and vendor specific operations.
 */


function setVendorSettings(vendorSettings) {
  _vendorSettings = vendorSettings;
}
},{}],"JRbX":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.prefixRules = prefixRules;

var _getVendorSettings = require("../getVendorSettings");

var autoPrefixNames = {
  'user-select': 1
};

function prefixRules(rulePairs, index) {
  var vendorSettings = (0, _getVendorSettings.getVendorSettings)();
  var name = rulePairs[index];

  if (autoPrefixNames[name]) {
    var value = rulePairs[index + 1];

    if (autoPrefixNames[name]) {
      if (vendorSettings.isWebkit) {
        rulePairs.push('-webkit-' + name, value);
      }

      if (vendorSettings.isMoz) {
        rulePairs.push('-moz-' + name, value);
      }

      if (vendorSettings.isMs) {
        rulePairs.push('-ms-' + name, value);
      }

      if (vendorSettings.isOpera) {
        rulePairs.push('-o-' + name, value);
      }
    }
  }
}
},{"../getVendorSettings":"ZbLz"}],"jgCc":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.provideUnits = provideUnits;
var NON_PIXEL_NUMBER_PROPS = ['column-count', 'font-weight', 'flex-basis', 'flex', 'flex-grow', 'flex-shrink', 'fill-opacity', 'opacity', 'order', 'z-index', 'zoom'];

function provideUnits(rulePairs, index) {
  var name = rulePairs[index];
  var value = rulePairs[index + 1];

  if (typeof value === 'number') {
    var unit = NON_PIXEL_NUMBER_PROPS.indexOf(name) === -1 ? 'px' : '';
    rulePairs[index + 1] = "" + value + unit;
  }
}
},{}],"wg5F":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.setRTL = setRTL;
exports.getRTL = getRTL;
exports.rtlifyRules = rtlifyRules;

var _Stylesheet = require("../Stylesheet");

var LEFT = 'left';
var RIGHT = 'right';
var NO_FLIP = '@noflip';
var NAME_REPLACEMENTS = (_a = {}, _a[LEFT] = RIGHT, _a[RIGHT] = LEFT, _a);
var VALUE_REPLACEMENTS = {
  'w-resize': 'e-resize',
  'sw-resize': 'se-resize',
  'nw-resize': 'ne-resize'
};

var _rtl = getRTL();
/**
 * Sets the current RTL value.
 */


function setRTL(isRTL) {
  if (_rtl !== isRTL) {
    _Stylesheet.Stylesheet.getInstance().resetKeys();

    _rtl = isRTL;
  }
}
/**
 * Gets the current RTL value.
 */


function getRTL() {
  if (_rtl === undefined) {
    _rtl = typeof document !== 'undefined' && !!document.documentElement && document.documentElement.getAttribute('dir') === 'rtl';
  }

  return _rtl;
}
/**
 * RTLifies the rulePair in the array at the current index. This mutates the array for performance
 * reasons.
 */


function rtlifyRules(rulePairs, index) {
  if (getRTL()) {
    var name_1 = rulePairs[index];

    if (!name_1) {
      return;
    }

    var value = rulePairs[index + 1];

    if (typeof value === 'string' && value.indexOf(NO_FLIP) >= 0) {
      rulePairs[index + 1] = value.replace(/\s*(?:\/\*\s*)?\@noflip\b(?:\s*\*\/)?\s*?/g, '');
    } else if (name_1.indexOf(LEFT) >= 0) {
      rulePairs[index] = name_1.replace(LEFT, RIGHT);
    } else if (name_1.indexOf(RIGHT) >= 0) {
      rulePairs[index] = name_1.replace(RIGHT, LEFT);
    } else if (String(value).indexOf(LEFT) >= 0) {
      rulePairs[index + 1] = value.replace(LEFT, RIGHT);
    } else if (String(value).indexOf(RIGHT) >= 0) {
      rulePairs[index + 1] = value.replace(RIGHT, LEFT);
    } else if (NAME_REPLACEMENTS[name_1]) {
      rulePairs[index] = NAME_REPLACEMENTS[name_1];
    } else if (VALUE_REPLACEMENTS[value]) {
      rulePairs[index + 1] = VALUE_REPLACEMENTS[value];
    } else {
      switch (name_1) {
        case 'margin':
        case 'padding':
          rulePairs[index + 1] = flipQuad(value);
          break;

        case 'box-shadow':
          rulePairs[index + 1] = negateNum(value, 0);
          break;
      }
    }
  }
}
/**
 * Given a string value in a space delimited format (e.g. "1 2 3 4"), negates a particular value.
 */


function negateNum(value, partIndex) {
  var parts = value.split(' ');
  var numberVal = parseInt(parts[partIndex], 10);
  parts[0] = parts[0].replace(String(numberVal), String(numberVal * -1));
  return parts.join(' ');
}
/**
 * Given a string quad, flips the left and right values.
 */


function flipQuad(value) {
  if (typeof value === 'string') {
    var parts = value.split(' ');

    if (parts.length === 4) {
      return parts[0] + " " + parts[3] + " " + parts[2] + " " + parts[1];
    }
  }

  return value;
}

var _a;
},{"../Stylesheet":"pqqa"}],"WE02":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.serializeRuleEntries = serializeRuleEntries;
exports.styleToRegistration = styleToRegistration;
exports.applyRegistration = applyRegistration;
exports.styleToClassName = styleToClassName;

var _Stylesheet = require("./Stylesheet");

var _kebabRules = require("./transforms/kebabRules");

var _prefixRules = require("./transforms/prefixRules");

var _provideUnits = require("./transforms/provideUnits");

var _rtlifyRules = require("./transforms/rtlifyRules");

var DISPLAY_NAME = 'displayName';

function getDisplayName(rules) {
  var rootStyle = rules && rules['&'];
  return rootStyle ? rootStyle.displayName : undefined;
}

var globalSelectorRegExp = /\:global\((.+?)\)/g;
/**
 * Finds comma separated selectors in a :global() e.g. ":global(.class1, .class2, .class3)"
 * and wraps them each in their own global ":global(.class1), :global(.class2), :global(.class3)"
 *
 * @param selectorWithGlobals The selector to process
 * @returns The updated selector
 */

function expandCommaSeparatedGlobals(selectorWithGlobals) {
  // We the selector does not have a :global() we can shortcut
  if (!globalSelectorRegExp.test(selectorWithGlobals)) {
    return selectorWithGlobals;
  }

  var replacementInfo = [];
  var findGlobal = /\:global\((.+?)\)/g;
  var match = null; // Create a result list for global selectors so we can replace them.

  while (match = findGlobal.exec(selectorWithGlobals)) {
    // Only if the found selector is a comma separated list we'll process it.
    if (match[1].indexOf(',') > -1) {
      replacementInfo.push([match.index, match.index + match[0].length, // Wrap each of the found selectors in :global()
      match[1].split(',').map(function (v) {
        return ":global(" + v.trim() + ")";
      }).join(', ')]);
    }
  } // Replace the found selectors with their wrapped variants in reverse order


  return replacementInfo.reverse().reduce(function (selector, _a) {
    var matchIndex = _a[0],
        matchEndIndex = _a[1],
        replacement = _a[2];
    var prefix = selector.slice(0, matchIndex);
    var suffix = selector.slice(matchEndIndex);
    return prefix + replacement + suffix;
  }, selectorWithGlobals);
}

function expandSelector(newSelector, currentSelector) {
  if (newSelector.indexOf(':global(') >= 0) {
    return newSelector.replace(globalSelectorRegExp, '$1');
  } else if (newSelector.indexOf(':') === 0) {
    return currentSelector + newSelector;
  } else if (newSelector.indexOf('&') < 0) {
    return currentSelector + ' ' + newSelector;
  }

  return newSelector;
}

function extractRules(args, rules, currentSelector) {
  if (rules === void 0) {
    rules = {
      __order: []
    };
  }

  if (currentSelector === void 0) {
    currentSelector = '&';
  }

  var stylesheet = _Stylesheet.Stylesheet.getInstance();

  var currentRules = rules[currentSelector];

  if (!currentRules) {
    currentRules = {};
    rules[currentSelector] = currentRules;

    rules.__order.push(currentSelector);
  }

  for (var _i = 0, args_1 = args; _i < args_1.length; _i++) {
    var arg = args_1[_i]; // If the arg is a string, we need to look up the class map and merge.

    if (typeof arg === 'string') {
      var expandedRules = stylesheet.argsFromClassName(arg);

      if (expandedRules) {
        extractRules(expandedRules, rules, currentSelector);
      } // Else if the arg is an array, we need to recurse in.

    } else if (Array.isArray(arg)) {
      extractRules(arg, rules, currentSelector);
    } else {
      // tslint:disable-next-line:no-any
      for (var prop in arg) {
        if (prop === 'selectors') {
          // tslint:disable-next-line:no-any
          var selectors = arg.selectors;

          for (var newSelector in selectors) {
            if (selectors.hasOwnProperty(newSelector)) {
              var selectorValue = selectors[newSelector];

              if (newSelector.indexOf('@') === 0) {
                newSelector = newSelector + '{' + currentSelector;
                extractRules([selectorValue], rules, newSelector);
              } else if (newSelector.indexOf(',') > -1) {
                var commaSeparatedSelectors = expandCommaSeparatedGlobals(newSelector).split(/,/g).map(function (s) {
                  return s.trim();
                });
                extractRules([selectorValue], rules, commaSeparatedSelectors.map(function (commaSeparatedSelector) {
                  return expandSelector(commaSeparatedSelector, currentSelector);
                }).join(', '));
              } else {
                extractRules([selectorValue], rules, expandSelector(newSelector, currentSelector));
              }
            }
          }
        } else {
          if (arg[prop] !== undefined) {
            // Else, add the rule to the currentSelector.
            if (prop === 'margin' || prop === 'padding') {
              // tslint:disable-next-line:no-any
              expandQuads(currentRules, prop, arg[prop]);
            } else {
              // tslint:disable-next-line:no-any
              currentRules[prop] = arg[prop];
            }
          }
        }
      }
    }
  }

  return rules;
}

function expandQuads(currentRules, name, value) {
  var parts = typeof value === 'string' ? value.split(' ') : [value];
  currentRules[name + 'Top'] = parts[0];
  currentRules[name + 'Right'] = parts[1] || parts[0];
  currentRules[name + 'Bottom'] = parts[2] || parts[0];
  currentRules[name + 'Left'] = parts[3] || parts[1] || parts[0];
}

function getKeyForRules(rules) {
  var serialized = [];
  var hasProps = false;

  for (var _i = 0, _a = rules.__order; _i < _a.length; _i++) {
    var selector = _a[_i];
    serialized.push(selector);
    var rulesForSelector = rules[selector];

    for (var propName in rulesForSelector) {
      if (rulesForSelector.hasOwnProperty(propName) && rulesForSelector[propName] !== undefined) {
        hasProps = true;
        serialized.push(propName, rulesForSelector[propName]);
      }
    }
  }

  return hasProps ? serialized.join('') : undefined;
}

function serializeRuleEntries(ruleEntries) {
  if (!ruleEntries) {
    return '';
  }

  var allEntries = [];

  for (var entry in ruleEntries) {
    if (ruleEntries.hasOwnProperty(entry) && entry !== DISPLAY_NAME && ruleEntries[entry] !== undefined) {
      allEntries.push(entry, ruleEntries[entry]);
    }
  } // Apply transforms.


  for (var i = 0; i < allEntries.length; i += 2) {
    (0, _kebabRules.kebabRules)(allEntries, i);
    (0, _provideUnits.provideUnits)(allEntries, i);
    (0, _rtlifyRules.rtlifyRules)(allEntries, i);
    (0, _prefixRules.prefixRules)(allEntries, i);
  } // Apply punctuation.


  for (var i = 1; i < allEntries.length; i += 4) {
    allEntries.splice(i, 1, ':', allEntries[i], ';');
  }

  return allEntries.join('');
}

function styleToRegistration() {
  var args = [];

  for (var _i = 0; _i < arguments.length; _i++) {
    args[_i] = arguments[_i];
  }

  var rules = extractRules(args);
  var key = getKeyForRules(rules);

  if (key) {
    var stylesheet = _Stylesheet.Stylesheet.getInstance();

    var registration = {
      className: stylesheet.classNameFromKey(key),
      key: key,
      args: args
    };

    if (!registration.className) {
      registration.className = stylesheet.getClassName(getDisplayName(rules));
      var rulesToInsert = [];

      for (var _a = 0, _b = rules.__order; _a < _b.length; _a++) {
        var selector = _b[_a];
        rulesToInsert.push(selector, serializeRuleEntries(rules[selector]));
      }

      registration.rulesToInsert = rulesToInsert;
    }

    return registration;
  }
}

function applyRegistration(registration, classMap) {
  var stylesheet = _Stylesheet.Stylesheet.getInstance();

  var className = registration.className,
      key = registration.key,
      args = registration.args,
      rulesToInsert = registration.rulesToInsert;

  if (rulesToInsert) {
    // rulesToInsert is an ordered array of selector/rule pairs.
    for (var i = 0; i < rulesToInsert.length; i += 2) {
      var rules = rulesToInsert[i + 1];

      if (rules) {
        var selector = rulesToInsert[i]; // Fix selector using map.

        selector = selector.replace(/(&)|\$([\w-]+)\b/g, function (match, amp, cn) {
          if (amp) {
            return '.' + registration.className;
          } else if (cn) {
            return '.' + (classMap && classMap[cn] || cn);
          }

          return '';
        }); // Insert. Note if a media query, we must close the query with a final bracket.

        var processedRule = selector + "{" + rules + "}" + (selector.indexOf('@') === 0 ? '}' : '');
        stylesheet.insertRule(processedRule);
      }
    }

    stylesheet.cacheClassName(className, key, args, rulesToInsert);
  }
}

function styleToClassName() {
  var args = [];

  for (var _i = 0; _i < arguments.length; _i++) {
    args[_i] = arguments[_i];
  }

  var registration = styleToRegistration.apply(void 0, args);

  if (registration) {
    applyRegistration(registration);
    return registration.className;
  }

  return '';
}
},{"./Stylesheet":"pqqa","./transforms/kebabRules":"FqEZ","./transforms/prefixRules":"JRbX","./transforms/provideUnits":"jgCc","./transforms/rtlifyRules":"wg5F"}],"mbxw":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.extractStyleParts = extractStyleParts;

var _Stylesheet = require("./Stylesheet");

/**
 * Separates the classes and style objects. Any classes that are pre-registered
 * args are auto expanded into objects.
 */
function extractStyleParts() {
  var args = [];

  for (var _i = 0; _i < arguments.length; _i++) {
    args[_i] = arguments[_i];
  }

  var classes = [];
  var objects = [];

  var stylesheet = _Stylesheet.Stylesheet.getInstance();

  function _processArgs(argsList) {
    for (var _i = 0, argsList_1 = argsList; _i < argsList_1.length; _i++) {
      var arg = argsList_1[_i];

      if (arg) {
        if (typeof arg === 'string') {
          if (arg.indexOf(' ') >= 0) {
            _processArgs(arg.split(' '));
          } else {
            var translatedArgs = stylesheet.argsFromClassName(arg);

            if (translatedArgs) {
              _processArgs(translatedArgs);
            } else {
              // Avoid adding the same class twice.
              if (classes.indexOf(arg) === -1) {
                classes.push(arg);
              }
            }
          }
        } else if (Array.isArray(arg)) {
          _processArgs(arg);
        } else if (typeof arg === 'object') {
          objects.push(arg);
        }
      }
    }
  }

  _processArgs(args);

  return {
    classes: classes,
    objects: objects
  };
}
},{"./Stylesheet":"pqqa"}],"J77Q":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.mergeStyles = mergeStyles;

var _styleToClassName = require("./styleToClassName");

var _extractStyleParts = require("./extractStyleParts");

/**
 * Concatination helper, which can merge class names together. Skips over falsey values.
 *
 * @public
 */
function mergeStyles() {
  var args = [];

  for (var _i = 0; _i < arguments.length; _i++) {
    args[_i] = arguments[_i];
  }

  var _a = (0, _extractStyleParts.extractStyleParts)(args),
      classes = _a.classes,
      objects = _a.objects;

  if (objects.length) {
    classes.push((0, _styleToClassName.styleToClassName)(objects));
  }

  return classes.join(' ');
}
},{"./styleToClassName":"WE02","./extractStyleParts":"mbxw"}],"cQbE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.concatStyleSets = concatStyleSets;

/**
 * Combine a set of styles together (but does not register css classes).
 * @param styleSets - One or more stylesets to be merged (each param can also be falsy).
 */
function concatStyleSets() {
  var styleSets = [];

  for (var _i = 0; _i < arguments.length; _i++) {
    styleSets[_i] = arguments[_i];
  }

  if (styleSets && styleSets.length === 1 && styleSets[0] && !styleSets[0].subComponentStyles) {
    return styleSets[0];
  }

  var mergedSet = {}; // We process sub component styles in two phases. First we collect them, then we combine them into 1 style function.

  var workingSubcomponentStyles = {};

  for (var _a = 0, styleSets_1 = styleSets; _a < styleSets_1.length; _a++) {
    var currentSet = styleSets_1[_a];

    if (currentSet) {
      for (var prop in currentSet) {
        if (currentSet.hasOwnProperty(prop)) {
          if (prop === 'subComponentStyles' && currentSet.subComponentStyles !== undefined) {
            // subcomponent styles - style functions or objects
            var currentComponentStyles = currentSet.subComponentStyles;

            for (var subCompProp in currentComponentStyles) {
              if (currentComponentStyles.hasOwnProperty(subCompProp)) {
                if (workingSubcomponentStyles.hasOwnProperty(subCompProp)) {
                  workingSubcomponentStyles[subCompProp].push(currentComponentStyles[subCompProp]);
                } else {
                  workingSubcomponentStyles[subCompProp] = [currentComponentStyles[subCompProp]];
                }
              }
            }

            continue;
          } // the as any casts below is a workaround for ts 2.8.
          // todo: remove cast to any in ts 2.9.


          var mergedValue = mergedSet[prop];
          var currentValue = currentSet[prop];

          if (mergedValue === undefined) {
            mergedSet[prop] = currentValue;
          } else {
            mergedSet[prop] = (Array.isArray(mergedValue) ? mergedValue : [mergedValue]).concat(Array.isArray(currentValue) ? currentValue : [currentValue]);
          }
        }
      }
    }
  }

  if (Object.keys(workingSubcomponentStyles).length > 0) {
    mergedSet.subComponentStyles = {};
    var mergedSubStyles = mergedSet.subComponentStyles;

    var _loop_1 = function (subCompProp) {
      if (workingSubcomponentStyles.hasOwnProperty(subCompProp)) {
        var workingSet_1 = workingSubcomponentStyles[subCompProp];

        mergedSubStyles[subCompProp] = function (styleProps) {
          return concatStyleSets.apply(void 0, workingSet_1.map(function (styleFunctionOrObject) {
            return typeof styleFunctionOrObject === 'function' ? styleFunctionOrObject(styleProps) : styleFunctionOrObject;
          }));
        };
      }
    }; // now we process the subcomponent styles if there are any


    for (var subCompProp in workingSubcomponentStyles) {
      _loop_1(subCompProp);
    }
  }

  return mergedSet;
}
},{}],"uft5":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.mergeStyleSets = mergeStyleSets;

var _extractStyleParts = require("./extractStyleParts");

var _concatStyleSets = require("./concatStyleSets");

var _styleToClassName = require("./styleToClassName");

/**
 * Takes in one or more style set objects, each consisting of a set of areas,
 * each which will produce a class name. Using this is analogous to calling
 * `mergeStyles` for each property in the object, but ensures we maintain the
 * set ordering when multiple style sets are merged.
 *
 * @param styleSets - One or more style sets to be merged.
 */
function mergeStyleSets() {
  var styleSets = [];

  for (var _i = 0; _i < arguments.length; _i++) {
    styleSets[_i] = arguments[_i];
  } // tslint:disable-next-line:no-any


  var classNameSet = {
    subComponentStyles: {}
  };
  var classMap = {};
  var styleSet = styleSets[0];

  if (!styleSet && styleSets.length <= 1) {
    return {
      subComponentStyles: {}
    };
  }

  var concatenatedStyleSet = // we have guarded against falsey values just above.
  styleSet;
  concatenatedStyleSet = _concatStyleSets.concatStyleSets.apply(void 0, styleSets);
  var registrations = [];

  for (var styleSetArea in concatenatedStyleSet) {
    if (concatenatedStyleSet.hasOwnProperty(styleSetArea)) {
      if (styleSetArea === 'subComponentStyles') {
        classNameSet.subComponentStyles = concatenatedStyleSet.subComponentStyles || {};
        continue;
      }

      var styles = concatenatedStyleSet[styleSetArea];

      var _a = (0, _extractStyleParts.extractStyleParts)(styles),
          classes = _a.classes,
          objects = _a.objects;

      var registration = (0, _styleToClassName.styleToRegistration)({
        displayName: styleSetArea
      }, objects);
      registrations.push(registration);

      if (registration) {
        classMap[styleSetArea] = registration.className; // as any cast not needed in ts >=2.9

        classNameSet[styleSetArea] = classes.concat([registration.className]).join(' ');
      }
    }
  }

  for (var _b = 0, registrations_1 = registrations; _b < registrations_1.length; _b++) {
    var registration = registrations_1[_b];

    if (registration) {
      (0, _styleToClassName.applyRegistration)(registration, classMap);
    }
  }

  return classNameSet;
}
},{"./extractStyleParts":"mbxw","./concatStyleSets":"cQbE","./styleToClassName":"WE02"}],"x2Op":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.fontFace = fontFace;

var _Stylesheet = require("./Stylesheet");

var _styleToClassName = require("./styleToClassName");

/**
 * Registers a font face.
 * @public
 */
function fontFace(font) {
  _Stylesheet.Stylesheet.getInstance().insertRule("@font-face{" + (0, _styleToClassName.serializeRuleEntries)(font) + "}", true);
}
},{"./Stylesheet":"pqqa","./styleToClassName":"WE02"}],"AYJv":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.keyframes = keyframes;

var _Stylesheet = require("./Stylesheet");

var _styleToClassName = require("./styleToClassName");

/**
 * Registers keyframe definitions.
 *
 * @public
 */
function keyframes(timeline) {
  var stylesheet = _Stylesheet.Stylesheet.getInstance();

  var name = stylesheet.getClassName();
  var rulesArray = [];

  for (var prop in timeline) {
    if (timeline.hasOwnProperty(prop)) {
      rulesArray.push(prop, '{', (0, _styleToClassName.serializeRuleEntries)(timeline[prop]), '}');
    }
  }

  var rules = rulesArray.join('');
  stylesheet.insertRule("@keyframes " + name + "{" + rules + "}", true);
  stylesheet.cacheClassName(name, rules, [], ['keyframes', rules]);
  return name;
}
},{"./Stylesheet":"pqqa","./styleToClassName":"WE02"}],"WYAA":[function(require,module,exports) {
"use strict";

var _setVersion = require("@uifabric/set-version");

// @uifabric/merge-styles@6.19.3
// Do not modify this file, the file is generated as part of publish. The checked in version is a placeholder only.
(0, _setVersion.setVersion)('@uifabric/merge-styles', '6.19.3');
},{"@uifabric/set-version":"c7t6"}],"w5wT":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "mergeStyles", {
  enumerable: true,
  get: function () {
    return _mergeStyles.mergeStyles;
  }
});
Object.defineProperty(exports, "mergeStyleSets", {
  enumerable: true,
  get: function () {
    return _mergeStyleSets.mergeStyleSets;
  }
});
Object.defineProperty(exports, "concatStyleSets", {
  enumerable: true,
  get: function () {
    return _concatStyleSets.concatStyleSets;
  }
});
Object.defineProperty(exports, "fontFace", {
  enumerable: true,
  get: function () {
    return _fontFace.fontFace;
  }
});
Object.defineProperty(exports, "keyframes", {
  enumerable: true,
  get: function () {
    return _keyframes.keyframes;
  }
});
Object.defineProperty(exports, "InjectionMode", {
  enumerable: true,
  get: function () {
    return _Stylesheet.InjectionMode;
  }
});
Object.defineProperty(exports, "Stylesheet", {
  enumerable: true,
  get: function () {
    return _Stylesheet.Stylesheet;
  }
});
Object.defineProperty(exports, "setRTL", {
  enumerable: true,
  get: function () {
    return _rtlifyRules.setRTL;
  }
});

var _mergeStyles = require("./mergeStyles");

var _mergeStyleSets = require("./mergeStyleSets");

var _concatStyleSets = require("./concatStyleSets");

var _fontFace = require("./fontFace");

var _keyframes = require("./keyframes");

var _Stylesheet = require("./Stylesheet");

var _rtlifyRules = require("./transforms/rtlifyRules");

require("./version");
},{"./mergeStyles":"J77Q","./mergeStyleSets":"uft5","./concatStyleSets":"cQbE","./fontFace":"x2Op","./keyframes":"AYJv","./Stylesheet":"pqqa","./transforms/rtlifyRules":"wg5F","./version":"WYAA"}],"j10K":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.shallowCompare = shallowCompare;
exports.assign = assign;
exports.filteredAssign = filteredAssign;
exports.getId = getId;
exports.resetIds = resetIds;
exports.mapEnumByName = mapEnumByName;
exports.values = values;

var _mergeStyles = require("@uifabric/merge-styles");

var _getWindow = require("./dom/getWindow");

// Initialize global window id.
var CURRENT_ID_PROPERTY = '__currentId__';
var DEFAULT_ID_STRING = 'id__'; // tslint:disable-next-line:no-any

var _global = (0, _getWindow.getWindow)() || {};

if (_global[CURRENT_ID_PROPERTY] === undefined) {
  _global[CURRENT_ID_PROPERTY] = 0;
} // tslint:disable-next-line:no-any


function checkProperties(a, b) {
  for (var propName in a) {
    if (a.hasOwnProperty(propName)) {
      if (!b.hasOwnProperty(propName) || b[propName] !== a[propName]) {
        return false;
      }
    }
  }

  return true;
}
/**
 * Compares a to b and b to a.
 *
 * @public
 */


function shallowCompare(a, b) {
  return checkProperties(a, b) && checkProperties(b, a);
}
/**
 * Makes a resulting merge of a bunch of objects. Pass in the target object followed by 1 or more
 * objects as arguments and they will be merged sequentially into the target. Note that this will
 * shallow merge; it will not create new cloned values for target members.
 *
 * @public
 * @param target - Target object to merge following object arguments into.
 * @param args - One or more objects that will be mixed into the target in the order they are provided.
 * @returns Resulting merged target.
 */
// tslint:disable-next-line:no-any


function assign(target) {
  var args = [];

  for (var _i = 1; _i < arguments.length; _i++) {
    args[_i - 1] = arguments[_i];
  }

  return filteredAssign.apply(this, [null, target].concat(args));
}
/**
 * Makes a resulting merge of a bunch of objects, but allows a filter function to be passed in to filter
 * the resulting merges. This allows for scenarios where you want to merge "everything except that one thing"
 * or "properties that start with data-". Note that this will shallow merge; it will not create new cloned
 * values for target members.
 *
 * @public
 * @param isAllowed - Callback to determine if the given propName is allowed in the result.
 * @param target - Target object to merge following object arguments into.
 * @param args - One or more objects that will be mixed into the target in the order they are provided.
 * @returns Resulting merged target.
 */
// tslint:disable-next-line:no-any


function filteredAssign(isAllowed, target) {
  var args = [];

  for (var _i = 2; _i < arguments.length; _i++) {
    args[_i - 2] = arguments[_i];
  }

  target = target || {};

  for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {
    var sourceObject = args_1[_a];

    if (sourceObject) {
      for (var propName in sourceObject) {
        if (sourceObject.hasOwnProperty(propName) && (!isAllowed || isAllowed(propName))) {
          target[propName] = sourceObject[propName];
        }
      }
    }
  }

  return target;
} // Configure ids to reset on stylesheet resets.


var stylesheet = _mergeStyles.Stylesheet.getInstance();

if (stylesheet && stylesheet.onReset) {
  stylesheet.onReset(resetIds);
}
/**
 * Generates a unique id in the global scope (this spans across duplicate copies of the same library.)
 *
 * @public
 */


function getId(prefix) {
  var index = _global[CURRENT_ID_PROPERTY]++;
  return (prefix || DEFAULT_ID_STRING) + index;
}
/**
 * Resets id counter to an (optional) number.
 *
 * @public
 */


function resetIds(counter) {
  if (counter === void 0) {
    counter = 0;
  }

  _global[CURRENT_ID_PROPERTY] = counter;
}
/* Takes an enum and iterates over each value of the enum (as a string), running the callback on each, returning a mapped array.
 * The callback takes as a first parameter the string that represents the name of the entry, and the second parameter is the
 * value of that entry, which is the value you'd normally use when using the enum (usually a number).
 * */


function mapEnumByName( // tslint:disable-next-line:no-any
theEnum, callback) {
  // map<any> to satisfy compiler since it doesn't realize we strip out undefineds in the .filter() call
  return Object.keys(theEnum).map(function (p) {
    // map on each property name as a string
    if (String(Number(p)) !== p) {
      // if the property is not just a number (because enums in TypeScript will map both ways)
      return callback(p, theEnum[p]);
    }
  }).filter(function (v) {
    return !!v;
  }); // only return elements with values
}
/**
 * Get all values in an object dictionary
 *
 * @param obj - The dictionary to get values for
 */
// tslint:disable-next-line:no-any


function values(obj) {
  return Object.keys(obj).reduce(function (arr, key) {
    arr.push(obj[key]);
    return arr;
  }, []);
}
},{"@uifabric/merge-styles":"w5wT","./dom/getWindow":"mtGO"}],"n8h2":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.EventGroup = void 0;

var _object = require("./object");

/* tslint:disable:no-string-literal */

/** An instance of EventGroup allows anything with a handle to it to trigger events on it.
 *  If the target is an HTMLElement, the event will be attached to the element and can be
 *  triggered as usual (like clicking for onclick).
 *  The event can be triggered by calling EventGroup.raise() here. If the target is an
 *  HTMLElement, the event gets raised and is handled by the browser. Otherwise, it gets
 *  handled here in EventGroup, and the handler is called in the context of the parent
 *  (which is passed in in the constructor).
 *
 * @public
 * {@docCategory EventGroup}
 */
var EventGroup =
/** @class */
function () {
  /** parent: the context in which events attached to non-HTMLElements are called */
  // tslint:disable-next-line:no-any
  function EventGroup(parent) {
    this._id = EventGroup._uniqueId++;
    this._parent = parent;
    this._eventRecords = [];
  }
  /** For IE8, bubbleEvent is ignored here and must be dealt with by the handler.
   *  Events raised here by default have bubbling set to false and cancelable set to true.
   *  This applies also to built-in events being raised manually here on HTMLElements,
   *  which may lead to unexpected behavior if it differs from the defaults.
   *
   */


  EventGroup.raise = function ( // tslint:disable-next-line:no-any
  target, eventName, // tslint:disable-next-line:no-any
  eventArgs, bubbleEvent) {
    var retVal;

    if (EventGroup._isElement(target)) {
      if (typeof document !== 'undefined' && document.createEvent) {
        var ev = document.createEvent('HTMLEvents');
        ev.initEvent(eventName, bubbleEvent || false, true);
        (0, _object.assign)(ev, eventArgs);
        retVal = target.dispatchEvent(ev); // tslint:disable-next-line:no-any
      } else if (typeof document !== 'undefined' && document['createEventObject']) {
        // IE8
        // tslint:disable-next-line:no-any
        var evObj = document['createEventObject'](eventArgs); // cannot set cancelBubble on evObj, fireEvent will overwrite it

        target.fireEvent('on' + eventName, evObj);
      }
    } else {
      while (target && retVal !== false) {
        var events = target.__events__;
        var eventRecords = events ? events[eventName] : null;

        if (eventRecords) {
          for (var id in eventRecords) {
            if (eventRecords.hasOwnProperty(id)) {
              var eventRecordList = eventRecords[id];

              for (var listIndex = 0; retVal !== false && listIndex < eventRecordList.length; listIndex++) {
                var record = eventRecordList[listIndex];

                if (record.objectCallback) {
                  retVal = record.objectCallback.call(record.parent, eventArgs);
                }
              }
            }
          }
        } // If the target has a parent, bubble the event up.


        target = bubbleEvent ? target.parent : null;
      }
    }

    return retVal;
  }; // tslint:disable-next-line:no-any


  EventGroup.isObserved = function (target, eventName) {
    var events = target && target.__events__;
    return !!events && !!events[eventName];
  };
  /** Check to see if the target has declared support of the given event. */
  // tslint:disable-next-line:no-any


  EventGroup.isDeclared = function (target, eventName) {
    var declaredEvents = target && target.__declaredEvents;
    return !!declaredEvents && !!declaredEvents[eventName];
  }; // tslint:disable-next-line:no-any


  EventGroup.stopPropagation = function (event) {
    if (event.stopPropagation) {
      event.stopPropagation();
    } else {
      // IE8
      event.cancelBubble = true;
    }
  };

  EventGroup._isElement = function (target) {
    return !!target && (!!target.addEventListener || typeof HTMLElement !== 'undefined' && target instanceof HTMLElement);
  };

  EventGroup.prototype.dispose = function () {
    if (!this._isDisposed) {
      this._isDisposed = true;
      this.off();
      this._parent = null;
    }
  };
  /** On the target, attach a set of events, where the events object is a name to function mapping. */
  // tslint:disable-next-line:no-any


  EventGroup.prototype.onAll = function (target, events, useCapture) {
    for (var eventName in events) {
      if (events.hasOwnProperty(eventName)) {
        this.on(target, eventName, events[eventName], useCapture);
      }
    }
  };
  /** On the target, attach an event whose handler will be called in the context of the parent
   * of this instance of EventGroup.
   */
  // tslint:disable-next-line:no-any


  EventGroup.prototype.on = function (target, eventName, callback, options) {
    var _this = this;

    if (eventName.indexOf(',') > -1) {
      var events = eventName.split(/[ ,]+/);

      for (var i = 0; i < events.length; i++) {
        this.on(target, events[i], callback, options);
      }
    } else {
      var parent_1 = this._parent;
      var eventRecord = {
        target: target,
        eventName: eventName,
        parent: parent_1,
        callback: callback,
        options: options
      }; // Initialize and wire up the record on the target, so that it can call the callback if the event fires.

      var events = target.__events__ = target.__events__ || {};
      events[eventName] = events[eventName] || {
        count: 0
      };
      events[eventName][this._id] = events[eventName][this._id] || [];

      events[eventName][this._id].push(eventRecord);

      events[eventName].count++;

      if (EventGroup._isElement(target)) {
        // tslint:disable-next-line:no-any
        var processElementEvent = function () {
          var args = [];

          for (var _i = 0; _i < arguments.length; _i++) {
            args[_i] = arguments[_i];
          }

          if (_this._isDisposed) {
            return;
          }

          var result;

          try {
            result = callback.apply(parent_1, args);

            if (result === false && args[0]) {
              var e = args[0];

              if (e.preventDefault) {
                e.preventDefault();
              }

              if (e.stopPropagation) {
                e.stopPropagation();
              }

              e.cancelBubble = true;
            }
          } catch (e) {
            /* ErrorHelper.log(e); */
          }

          return result;
        };

        eventRecord.elementCallback = processElementEvent;

        if (target.addEventListener) {
          /* tslint:disable:ban-native-functions */
          target.addEventListener(eventName, processElementEvent, options);
          /* tslint:enable:ban-native-functions */
        } else if (target.attachEvent) {
          // IE8
          target.attachEvent('on' + eventName, processElementEvent);
        }
      } else {
        // tslint:disable-next-line:no-any
        var processObjectEvent = function () {
          var args = [];

          for (var _i = 0; _i < arguments.length; _i++) {
            args[_i] = arguments[_i];
          }

          if (_this._isDisposed) {
            return;
          }

          return callback.apply(parent_1, args);
        };

        eventRecord.objectCallback = processObjectEvent;
      } // Remember the record locally, so that it can be removed.


      this._eventRecords.push(eventRecord);
    }
  }; // tslint:disable-next-line:no-any


  EventGroup.prototype.off = function (target, eventName, callback, options) {
    for (var i = 0; i < this._eventRecords.length; i++) {
      var eventRecord = this._eventRecords[i];

      if ((!target || target === eventRecord.target) && (!eventName || eventName === eventRecord.eventName) && (!callback || callback === eventRecord.callback) && (typeof options !== 'boolean' || options === eventRecord.options)) {
        var events = eventRecord.target.__events__;
        var targetArrayLookup = events[eventRecord.eventName];
        var targetArray = targetArrayLookup ? targetArrayLookup[this._id] : null; // We may have already target's entries, so check for null.

        if (targetArray) {
          if (targetArray.length === 1 || !callback) {
            targetArrayLookup.count -= targetArray.length;
            delete events[eventRecord.eventName][this._id];
          } else {
            targetArrayLookup.count--;
            targetArray.splice(targetArray.indexOf(eventRecord), 1);
          }

          if (!targetArrayLookup.count) {
            delete events[eventRecord.eventName];
          }
        }

        if (eventRecord.elementCallback) {
          if (eventRecord.target.removeEventListener) {
            eventRecord.target.removeEventListener(eventRecord.eventName, eventRecord.elementCallback, eventRecord.options);
          } else if (eventRecord.target.detachEvent) {
            // IE8
            eventRecord.target.detachEvent('on' + eventRecord.eventName, eventRecord.elementCallback);
          }
        }

        this._eventRecords.splice(i--, 1);
      }
    }
  };
  /** Trigger the given event in the context of this instance of EventGroup. */
  // tslint:disable-next-line:no-any


  EventGroup.prototype.raise = function (eventName, eventArgs, bubbleEvent) {
    return EventGroup.raise(this._parent, eventName, eventArgs, bubbleEvent);
  };
  /** Declare an event as being supported by this instance of EventGroup. */


  EventGroup.prototype.declare = function (event) {
    var declaredEvents = this._parent.__declaredEvents = this._parent.__declaredEvents || {};

    if (typeof event === 'string') {
      declaredEvents[event] = true;
    } else {
      for (var i = 0; i < event.length; i++) {
        declaredEvents[event[i]] = true;
      }
    }
  }; // tslint:disable-next-line:no-inferrable-types


  EventGroup._uniqueId = 0;
  return EventGroup;
}();

exports.EventGroup = EventGroup;
},{"./object":"j10K"}],"NngM":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getDocument = getDocument;

var _setSSR = require("./setSSR");

/**
 * Helper to get the document object. Note that in popup window cases, document
 * might be the wrong document, which is why we look at ownerDocument for the
 * truth. Also note that the SSR flag is used to test ssr scenarios even if
 * document is defined (from JSDOM for example.)
 *
 * @public
 */
function getDocument(rootElement) {
  if (_setSSR._isSSR || typeof document === 'undefined') {
    return undefined;
  } else {
    var el = rootElement;
    return el && el.ownerDocument ? el.ownerDocument : document;
  }
}
},{"./setSSR":"tKHx"}],"oLlr":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.disableBodyScroll = disableBodyScroll;
exports.enableBodyScroll = enableBodyScroll;
exports.getScrollbarWidth = getScrollbarWidth;
exports.findScrollableParent = findScrollableParent;
exports.allowScrollOnElement = exports.DATA_IS_SCROLLABLE_ATTRIBUTE = void 0;

var _getDocument = require("./dom/getDocument");

var _mergeStyles = require("@uifabric/merge-styles");

var _getWindow = require("./dom/getWindow");

var _scrollbarWidth;

var _bodyScrollDisabledCount = 0;
var DisabledScrollClassName = (0, _mergeStyles.mergeStyles)({
  overflow: 'hidden !important'
});
/**
 * Placing this attribute on scrollable divs optimizes detection to know
 * if the div is scrollable or not (given we can avoid expensive operations
 * like getComputedStyle.)
 *
 * @public
 */

var DATA_IS_SCROLLABLE_ATTRIBUTE = 'data-is-scrollable';
exports.DATA_IS_SCROLLABLE_ATTRIBUTE = DATA_IS_SCROLLABLE_ATTRIBUTE;

var _makeElementScrollAllower = function () {
  var _previousClientY = 0;
  var _element = null; // remember the clientY for future calls of _preventOverscrolling

  var _saveClientY = function (event) {
    if (event.targetTouches.length === 1) {
      _previousClientY = event.targetTouches[0].clientY;
    }
  }; // prevent the body from scrolling when the user attempts
  // to scroll past the top or bottom of the element


  var _preventOverscrolling = function (event) {
    // only respond to a single-finger touch
    if (event.targetTouches.length !== 1) {
      return;
    } // prevent the body touchmove handler from firing
    // so that scrolling is allowed within the element


    event.stopPropagation();

    if (!_element) {
      return;
    }

    var clientY = event.targetTouches[0].clientY - _previousClientY;
    var scrollableParent = findScrollableParent(event.target);

    if (scrollableParent) {
      _element = scrollableParent;
    } // if the element is scrolled to the top,
    // prevent the user from scrolling up


    if (_element.scrollTop === 0 && clientY > 0) {
      event.preventDefault();
    } // if the element is scrolled to the bottom,
    // prevent the user from scrolling down


    if (_element.scrollHeight - _element.scrollTop <= _element.clientHeight && clientY < 0) {
      event.preventDefault();
    }
  };

  return function (element, events) {
    if (!element) {
      return;
    }

    events.on(element, 'touchstart', _saveClientY, {
      passive: false
    });
    events.on(element, 'touchmove', _preventOverscrolling, {
      passive: false
    });
    _element = element;
  };
};
/**
 * Allows the user to scroll within a element,
 * while preventing the user from scrolling the body
 */


var allowScrollOnElement = _makeElementScrollAllower();

exports.allowScrollOnElement = allowScrollOnElement;

var _disableIosBodyScroll = function (event) {
  event.preventDefault();
};
/**
 * Disables the body scrolling.
 *
 * @public
 */


function disableBodyScroll() {
  var doc = (0, _getDocument.getDocument)();

  if (doc && doc.body && !_bodyScrollDisabledCount) {
    doc.body.classList.add(DisabledScrollClassName);
    doc.body.addEventListener('touchmove', _disableIosBodyScroll, {
      passive: false,
      capture: false
    });
  }

  _bodyScrollDisabledCount++;
}
/**
 * Enables the body scrolling.
 *
 * @public
 */


function enableBodyScroll() {
  if (_bodyScrollDisabledCount > 0) {
    var doc = (0, _getDocument.getDocument)();

    if (doc && doc.body && _bodyScrollDisabledCount === 1) {
      doc.body.classList.remove(DisabledScrollClassName);
      doc.body.removeEventListener('touchmove', _disableIosBodyScroll);
    }

    _bodyScrollDisabledCount--;
  }
}
/**
 * Calculates the width of a scrollbar for the browser/os.
 *
 * @public
 */


function getScrollbarWidth() {
  if (_scrollbarWidth === undefined) {
    var scrollDiv = document.createElement('div');
    scrollDiv.style.setProperty('width', '100px');
    scrollDiv.style.setProperty('height', '100px');
    scrollDiv.style.setProperty('overflow', 'scroll');
    scrollDiv.style.setProperty('position', 'absolute');
    scrollDiv.style.setProperty('top', '-9999px');
    document.body.appendChild(scrollDiv); // Get the scrollbar width

    _scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; // Delete the DIV

    document.body.removeChild(scrollDiv);
  }

  return _scrollbarWidth;
}
/**
 * Traverses up the DOM for the element with the data-is-scrollable=true attribute, or returns
 * document.body.
 *
 * @public
 */


function findScrollableParent(startingElement) {
  var el = startingElement;
  var doc = (0, _getDocument.getDocument)(startingElement); // First do a quick scan for the scrollable attribute.

  while (el && el !== doc.body) {
    if (el.getAttribute(DATA_IS_SCROLLABLE_ATTRIBUTE) === 'true') {
      return el;
    }

    el = el.parentElement;
  } // If we haven't found it, the use the slower method: compute styles to evaluate if overflow is set.


  el = startingElement;

  while (el && el !== doc.body) {
    if (el.getAttribute(DATA_IS_SCROLLABLE_ATTRIBUTE) !== 'false') {
      var computedStyles = getComputedStyle(el);
      var overflowY = computedStyles ? computedStyles.getPropertyValue('overflow-y') : '';

      if (overflowY && (overflowY === 'scroll' || overflowY === 'auto')) {
        return el;
      }
    }

    el = el.parentElement;
  } // Fall back to window scroll.


  if (!el || el === doc.body) {
    // tslint:disable-next-line:no-any
    el = (0, _getWindow.getWindow)(startingElement);
  }

  return el;
}
},{"./dom/getDocument":"NngM","@uifabric/merge-styles":"w5wT","./dom/getWindow":"mtGO"}],"D9tF":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getRect = getRect;

/**
 * Helper to get bounding client rect. Passing in window will get the window size.
 *
 * @public
 */
function getRect(element) {
  var rect;

  if (element) {
    if (element === window) {
      rect = {
        left: 0,
        top: 0,
        width: window.innerWidth,
        height: window.innerHeight,
        right: window.innerWidth,
        bottom: window.innerHeight
      };
    } else if (element.getBoundingClientRect) {
      rect = element.getBoundingClientRect();
    }
  }

  return rect;
}
},{}],"mD02":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.AutoScroll = void 0;

var _EventGroup = require("./EventGroup");

var _scroll = require("./scroll");

var _getRect = require("./dom/getRect");

var SCROLL_ITERATION_DELAY = 16;
var SCROLL_GUTTER_HEIGHT = 100;
var MAX_SCROLL_VELOCITY = 15;
/**
 * AutoScroll simply hooks up mouse events given a parent element, and scrolls the container
 * up/down depending on how close the mouse is to the top/bottom of the container.
 *
 * Once you don't want autoscroll any more, just dispose the helper and it will unhook events.
 *
 * @public
 * {@docCategory AutoScroll}
 */

var AutoScroll =
/** @class */
function () {
  function AutoScroll(element) {
    this._events = new _EventGroup.EventGroup(this);
    this._scrollableParent = (0, _scroll.findScrollableParent)(element);
    this._incrementScroll = this._incrementScroll.bind(this);
    this._scrollRect = (0, _getRect.getRect)(this._scrollableParent); // tslint:disable-next-line:no-any

    if (this._scrollableParent === window) {
      this._scrollableParent = document.body;
    }

    if (this._scrollableParent) {
      this._events.on(window, 'mousemove', this._onMouseMove, true);

      this._events.on(window, 'touchmove', this._onTouchMove, true);
    }
  }

  AutoScroll.prototype.dispose = function () {
    this._events.dispose();

    this._stopScroll();
  };

  AutoScroll.prototype._onMouseMove = function (ev) {
    this._computeScrollVelocity(ev.clientY);
  };

  AutoScroll.prototype._onTouchMove = function (ev) {
    if (ev.touches.length > 0) {
      this._computeScrollVelocity(ev.touches[0].clientY);
    }
  };

  AutoScroll.prototype._computeScrollVelocity = function (clientY) {
    if (!this._scrollRect) {
      return;
    }

    var scrollRectTop = this._scrollRect.top;
    var scrollClientBottom = scrollRectTop + this._scrollRect.height - SCROLL_GUTTER_HEIGHT;

    if (clientY < scrollRectTop + SCROLL_GUTTER_HEIGHT) {
      this._scrollVelocity = Math.max(-MAX_SCROLL_VELOCITY, -MAX_SCROLL_VELOCITY * ((SCROLL_GUTTER_HEIGHT - (clientY - scrollRectTop)) / SCROLL_GUTTER_HEIGHT));
    } else if (clientY > scrollClientBottom) {
      this._scrollVelocity = Math.min(MAX_SCROLL_VELOCITY, MAX_SCROLL_VELOCITY * ((clientY - scrollClientBottom) / SCROLL_GUTTER_HEIGHT));
    } else {
      this._scrollVelocity = 0;
    }

    if (this._scrollVelocity) {
      this._startScroll();
    } else {
      this._stopScroll();
    }
  };

  AutoScroll.prototype._startScroll = function () {
    if (!this._timeoutId) {
      this._incrementScroll();
    }
  };

  AutoScroll.prototype._incrementScroll = function () {
    if (this._scrollableParent) {
      this._scrollableParent.scrollTop += Math.round(this._scrollVelocity);
    }

    this._timeoutId = setTimeout(this._incrementScroll, SCROLL_ITERATION_DELAY);
  };

  AutoScroll.prototype._stopScroll = function () {
    if (this._timeoutId) {
      clearTimeout(this._timeoutId);
      delete this._timeoutId;
    }
  };

  return AutoScroll;
}();

exports.AutoScroll = AutoScroll;
},{"./EventGroup":"n8h2","./scroll":"oLlr","./dom/getRect":"D9tF"}],"aOi7":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.warn = warn;
exports.setWarningCallback = setWarningCallback;
var _warningCallback = undefined;
/**
 * Sends a warning to console, if the api is present.
 *
 * @public
 * @param message - Warning message.
 */

function warn(message) {
  if (_warningCallback && "production" !== 'production') {
    _warningCallback(message);
  } else if (console && console.warn) {
    console.warn(message);
  }
}
/**
 * Configures the warning callback. Passing in undefined will reset it to use the default
 * console.warn function.
 *
 * @public
 * @param warningCallback - Callback to override the generated warnings.
 */


function setWarningCallback(warningCallback) {
  _warningCallback = warningCallback;
}
},{}],"U3x3":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.warnConditionallyRequiredProps = warnConditionallyRequiredProps;

var _warn = require("./warn");

/**
 * Warns when props are required if a condition is met.
 *
 * @public
 * @param componentName - The name of the component being used.
 * @param props - The props passed into the component.
 * @param requiredProps - The name of the props that are required when the condition is met.
 * @param conditionalPropName - The name of the prop that the condition is based on.
 * @param condition - Whether the condition is met.
 */
function warnConditionallyRequiredProps(componentName, props, requiredProps, conditionalPropName, condition) {
  if (condition === true && "production" !== 'production') {
    for (var _i = 0, requiredProps_1 = requiredProps; _i < requiredProps_1.length; _i++) {
      var requiredPropName = requiredProps_1[_i];

      if (!(requiredPropName in props)) {
        (0, _warn.warn)(componentName + " property '" + requiredPropName + "' is required when '" + conditionalPropName + "' is used.'");
      }
    }
  }
}
},{"./warn":"aOi7"}],"yHHK":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.warnMutuallyExclusive = warnMutuallyExclusive;

var _warn = require("./warn");

/**
 * Warns when two props which are mutually exclusive are both being used.
 *
 * @public
 * @param componentName - The name of the component being used.
 * @param props - The props passed into the component.
 * @param exclusiveMap - A map where the key is a parameter, and the value is the other parameter.
 */
function warnMutuallyExclusive(componentName, props, exclusiveMap) {
  if ("production" !== 'production') {
    for (var propName in exclusiveMap) {
      if (props && props[propName] !== undefined) {
        var propInExclusiveMapValue = exclusiveMap[propName];

        if (propInExclusiveMapValue && props[propInExclusiveMapValue] !== undefined) {
          (0, _warn.warn)(componentName + " property '" + propName + "' is mutually exclusive with '" + exclusiveMap[propName] + "'. Use one or the other.");
        }
      }
    }
  }
}
},{"./warn":"aOi7"}],"eQmD":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.warnDeprecations = warnDeprecations;

var _warn = require("./warn");

/**
 * Warns when a deprecated props are being used.
 *
 * @public
 * @param componentName - The name of the component being used.
 * @param props - The props passed into the component.
 * @param deprecationMap - The map of deprecations, where key is the prop name and the value is
 * either null or a replacement prop name.
 */
function warnDeprecations(componentName, props, deprecationMap) {
  if ("production" !== 'production') {
    for (var propName in deprecationMap) {
      if (props && propName in props) {
        var deprecationMessage = componentName + " property '" + propName + "' was used but has been deprecated.";
        var replacementPropName = deprecationMap[propName];

        if (replacementPropName) {
          deprecationMessage += " Use '" + replacementPropName + "' instead.";
        }

        (0, _warn.warn)(deprecationMessage);
      }
    }
  }
}
},{"./warn":"aOi7"}],"YHig":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.KeyCodes = void 0;

/**
 * Simulated enum for keycodes. These will get inlined by uglify when used much like an enum
 *
 * @public
 * {@docCategory KeyCodes}
 */
var KeyCodes = {
  backspace: 8,
  tab: 9,
  enter: 13,
  shift: 16,
  ctrl: 17,
  alt: 18,
  pauseBreak: 19,
  capslock: 20,
  escape: 27,
  space: 32,
  pageUp: 33,
  pageDown: 34,
  end: 35,
  home: 36,
  left: 37,
  up: 38,
  right: 39,
  down: 40,
  insert: 45,
  del: 46,
  zero: 48,
  one: 49,
  two: 50,
  three: 51,
  four: 52,
  five: 53,
  six: 54,
  seven: 55,
  eight: 56,
  nine: 57,
  a: 65,
  b: 66,
  c: 67,
  d: 68,
  e: 69,
  f: 70,
  g: 71,
  h: 72,
  i: 73,
  j: 74,
  k: 75,
  l: 76,
  m: 77,
  n: 78,
  o: 79,
  p: 80,
  q: 81,
  r: 82,
  s: 83,
  t: 84,
  u: 85,
  v: 86,
  w: 87,
  x: 88,
  y: 89,
  z: 90,
  leftWindow: 91,
  rightWindow: 92,
  select: 93,
  zero_numpad: 96,
  one_numpad: 97,
  two_numpad: 98,
  three_numpad: 99,
  four_numpad: 100,
  five_numpad: 101,
  six_numpad: 102,
  seven_numpad: 103,
  eight_numpad: 104,
  nine_numpad: 105,
  multiply: 106,
  add: 107,
  subtract: 109,
  decimalPoint: 110,
  divide: 111,
  f1: 112,
  f2: 113,
  f3: 114,
  f4: 115,
  f5: 116,
  f6: 117,
  f7: 118,
  f8: 119,
  f9: 120,
  f10: 121,
  f11: 122,
  f12: 123,
  numlock: 144,
  scrollLock: 145,
  semicolon: 186,
  equalSign: 187,
  comma: 188,
  dash: 189,
  period: 190,
  forwardSlash: 191,
  graveAccent: 192,
  openBracket: 219,
  backSlash: 220,
  closeBracket: 221,
  singleQuote: 222
};
exports.KeyCodes = KeyCodes;
},{}],"JDbk":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.isDirectionalKeyCode = isDirectionalKeyCode;
exports.addDirectionalKeyCode = addDirectionalKeyCode;

var _KeyCodes = require("./KeyCodes");

var DirectionalKeyCodes = (_a = {}, _a[_KeyCodes.KeyCodes.up] = 1, _a[_KeyCodes.KeyCodes.down] = 1, _a[_KeyCodes.KeyCodes.left] = 1, _a[_KeyCodes.KeyCodes.right] = 1, _a[_KeyCodes.KeyCodes.home] = 1, _a[_KeyCodes.KeyCodes.end] = 1, _a[_KeyCodes.KeyCodes.tab] = 1, _a[_KeyCodes.KeyCodes.pageUp] = 1, _a[_KeyCodes.KeyCodes.pageDown] = 1, _a);
/**
 * Returns true if the keycode is a directional keyboard key.
 */

function isDirectionalKeyCode(which) {
  return !!DirectionalKeyCodes[which];
}
/**
 * Adds a keycode to the list of keys that, when pressed, should cause the focus outlines to be visible.
 * This can be used to add global shortcut keys that directionally move from section to section within
 * an app or between focus trap zones.
 */


function addDirectionalKeyCode(which) {
  DirectionalKeyCodes[which] = 1;
}

var _a;
},{"./KeyCodes":"YHig"}],"Si1v":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.initializeFocusRects = initializeFocusRects;
exports.IsFocusVisibleClassName = void 0;

var _getWindow = require("./dom/getWindow");

var _keyboard = require("./keyboard");

var IsFocusVisibleClassName = 'ms-Fabric--isFocusVisible';
/**
 * Initializes the logic which:
 *
 * 1. Subscribes keydown and mousedown events. (It will only do it once per window,
 *    so it's safe to call this method multiple times.)
 * 2. When the user presses directional keyboard keys, adds the 'ms-Fabric--isFocusVisible' classname
 *    to the document body.
 * 3. When the user clicks a mouse button, we remove the classname if it exists.
 *
 * This logic allows components on the page to conditionally render focus treatments only
 * if the global classname exists, which simplifies logic overall.
 *
 * @param window - the window used to add the event listeners
 */

exports.IsFocusVisibleClassName = IsFocusVisibleClassName;

function initializeFocusRects(window) {
  var win = window || (0, _getWindow.getWindow)();

  if (win && !win.__hasInitializeFocusRects__) {
    win.__hasInitializeFocusRects__ = true;
    win.addEventListener('mousedown', _onMouseDown, true);
    win.addEventListener('keydown', _onKeyDown, true);
  }
}

function _onMouseDown(ev) {
  var win = (0, _getWindow.getWindow)(ev.target);

  if (win) {
    var classList = win.document.body.classList;

    if (classList.contains(IsFocusVisibleClassName)) {
      classList.remove(IsFocusVisibleClassName);
    }
  }
}

function _onKeyDown(ev) {
  var win = (0, _getWindow.getWindow)(ev.target);

  if (win) {
    var classList = win.document.body.classList;

    if ((0, _keyboard.isDirectionalKeyCode)(ev.which) && !classList.contains(IsFocusVisibleClassName)) {
      classList.add(IsFocusVisibleClassName);
    }
  }
}
},{"./dom/getWindow":"mtGO","./keyboard":"JDbk"}],"q2Dk":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.initializeDir = initializeDir;

var _getWindow = require("./dom/getWindow");

function initializeDir(win) {
  var w = win || (0, _getWindow.getWindow)();

  if (w && !w.__hasInitializedDir__) {
    w.__hasInitializedDir__ = true; // Ensure that the documentElement has a 'dir' attribute.

    var documentElement = w.document.documentElement;

    if (!documentElement.hasAttribute('dir')) {
      documentElement.setAttribute('dir', 'ltr');
    }
  }
}
},{"./dom/getWindow":"mtGO"}],"EfJk":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.nullRender = nullRender;
exports.BaseComponent = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Async = require("./Async");

var _EventGroup = require("./EventGroup");

var _warnConditionallyRequiredProps = require("./warn/warnConditionallyRequiredProps");

var _warnMutuallyExclusive = require("./warn/warnMutuallyExclusive");

var _warnDeprecations = require("./warn/warnDeprecations");

var _initializeFocusRects = require("./initializeFocusRects");

var _initializeDir = require("./initializeDir");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * BaseComponent class, which provides basic helpers for all components.
 *
 * @public
 * {@docCategory BaseComponent}
 */
var BaseComponent =
/** @class */
function (_super) {
  tslib_1.__extends(BaseComponent, _super); // tslint:enable:variable-name

  /**
   * BaseComponent constructor
   * @param props - The props for the component.
   * @param context - The context for the component.
   */
  // tslint:disable-next-line:no-any


  function BaseComponent(props, context) {
    var _this = _super.call(this, props, context) || this; // Ensure basic assumptions about the environment.


    (0, _initializeFocusRects.initializeFocusRects)();
    (0, _initializeDir.initializeDir)();

    _makeAllSafe(_this, BaseComponent.prototype, ['componentDidMount', 'shouldComponentUpdate', 'getSnapshotBeforeUpdate', 'render', 'componentDidUpdate', 'componentWillUnmount']);

    return _this;
  }
  /**
   * When the component receives props, make sure the componentRef is updated.
   */


  BaseComponent.prototype.componentDidUpdate = function (prevProps, prevState) {
    this._updateComponentRef(prevProps, this.props);
  };
  /**
   * When the component has mounted, update the componentRef.
   */


  BaseComponent.prototype.componentDidMount = function () {
    this._setComponentRef(this.props.componentRef, this);
  };
  /**
   * If we have disposables, dispose them automatically on unmount.
   */


  BaseComponent.prototype.componentWillUnmount = function () {
    this._setComponentRef(this.props.componentRef, null);

    if (this.__disposables) {
      for (var i = 0, len = this._disposables.length; i < len; i++) {
        var disposable = this.__disposables[i];

        if (disposable.dispose) {
          disposable.dispose();
        }
      }

      this.__disposables = null;
    }
  };

  Object.defineProperty(BaseComponent.prototype, "className", {
    /**
     * Gets the object's class name.
     */
    get: function () {
      if (!this.__className) {
        var funcNameRegex = /function (.{1,})\(/;
        var results = funcNameRegex.exec(this.constructor.toString());
        this.__className = results && results.length > 1 ? results[1] : '';
      }

      return this.__className;
    },
    enumerable: true,
    configurable: true
  });
  Object.defineProperty(BaseComponent.prototype, "_disposables", {
    /**
     * Allows subclasses to push things to this._disposables to be auto disposed.
     */
    get: function () {
      if (!this.__disposables) {
        this.__disposables = [];
      }

      return this.__disposables;
    },
    enumerable: true,
    configurable: true
  });
  Object.defineProperty(BaseComponent.prototype, "_async", {
    /**
     * Gets the async instance associated with the component, created on demand. The async instance gives
     * subclasses a way to execute setTimeout/setInterval async calls safely, where the callbacks
     * will be cleared/ignored automatically after unmounting. The helpers within the async object also
     * preserve the this pointer so that you don't need to "bind" the callbacks.
     */
    get: function () {
      if (!this.__async) {
        this.__async = new _Async.Async(this);

        this._disposables.push(this.__async);
      }

      return this.__async;
    },
    enumerable: true,
    configurable: true
  });
  Object.defineProperty(BaseComponent.prototype, "_events", {
    /**
     * Gets the event group instance assocaited with the component, created on demand. The event instance
     * provides on/off methods for listening to DOM (or regular javascript object) events. The event callbacks
     * will be automatically disconnected after unmounting. The helpers within the events object also
     * preserve the this reference so that you don't need to "bind" the callbacks.
     */
    get: function () {
      if (!this.__events) {
        this.__events = new _EventGroup.EventGroup(this);

        this._disposables.push(this.__events);
      }

      return this.__events;
    },
    enumerable: true,
    configurable: true
  });
  /**
   * Helper to return a memoized ref resolver function.
   * @param refName - Name of the member to assign the ref to.
   * @returns A function instance keyed from the given refname.
   * @deprecated Use `createRef` from React.createRef.
   */

  BaseComponent.prototype._resolveRef = function (refName) {
    var _this = this;

    if (!this.__resolves) {
      this.__resolves = {};
    }

    if (!this.__resolves[refName]) {
      // tslint:disable-next-line:no-any
      this.__resolves[refName] = function (ref) {
        // tslint:disable-next-line:no-any
        return _this[refName] = ref;
      };
    }

    return this.__resolves[refName];
  };
  /**
   * Updates the componentRef (by calling it with "this" when necessary.)
   */


  BaseComponent.prototype._updateComponentRef = function (currentProps, newProps) {
    if (newProps === void 0) {
      newProps = {};
    } // currentProps *should* always be defined, but verify that just in case a subclass is manually
    // calling a lifecycle method with no parameters (which has happened) or other odd usage.


    if (currentProps && newProps && currentProps.componentRef !== newProps.componentRef) {
      this._setComponentRef(currentProps.componentRef, null);

      this._setComponentRef(newProps.componentRef, this);
    }
  };
  /**
   * Warns when a deprecated props are being used.
   *
   * @param deprecationMap - The map of deprecations, where key is the prop name and the value is
   * either null or a replacement prop name.
   */


  BaseComponent.prototype._warnDeprecations = function (deprecationMap) {
    (0, _warnDeprecations.warnDeprecations)(this.className, this.props, deprecationMap);
  };
  /**
   * Warns when props which are mutually exclusive with each other are both used.
   *
   * @param mutuallyExclusiveMap - The map of mutually exclusive props.
   */


  BaseComponent.prototype._warnMutuallyExclusive = function (mutuallyExclusiveMap) {
    (0, _warnMutuallyExclusive.warnMutuallyExclusive)(this.className, this.props, mutuallyExclusiveMap);
  };
  /**
   * Warns when props are required if a condition is met.
   *
   * @param requiredProps - The name of the props that are required when the condition is met.
   * @param conditionalPropName - The name of the prop that the condition is based on.
   * @param condition - Whether the condition is met.
   */


  BaseComponent.prototype._warnConditionallyRequiredProps = function (requiredProps, conditionalPropName, condition) {
    (0, _warnConditionallyRequiredProps.warnConditionallyRequiredProps)(this.className, this.props, requiredProps, conditionalPropName, condition);
  };

  BaseComponent.prototype._setComponentRef = function (ref, value) {
    if (!this._skipComponentRefResolution && ref) {
      if (typeof ref === 'function') {
        ref(value);
      }

      if (typeof ref === 'object') {
        // tslint:disable:no-any
        ref.current = value;
      }
    }
  };

  return BaseComponent;
}(React.Component);

exports.BaseComponent = BaseComponent;

/**
 * Helper to override a given method with a wrapper method that can try/catch the original, but also
 * ensures that the BaseComponent's methods are called before the subclass's. This ensures that
 * componentWillUnmount in the base is called and that things in the _disposables array are disposed.
 */
function _makeAllSafe(obj, prototype, methodNames) {
  for (var i = 0, len = methodNames.length; i < len; i++) {
    _makeSafe(obj, prototype, methodNames[i]);
  }
}

function _makeSafe(obj, prototype, methodName) {
  // tslint:disable:no-any
  var classMethod = obj[methodName];
  var prototypeMethod = prototype[methodName]; // tslint:enable:no-any

  if (classMethod || prototypeMethod) {
    // tslint:disable-next-line:no-any
    obj[methodName] = function () {
      var retVal;

      if (prototypeMethod) {
        retVal = prototypeMethod.apply(this, arguments);
      }

      if (classMethod !== prototypeMethod) {
        retVal = classMethod.apply(this, arguments);
      }

      return retVal;
    };
  }
}
/**
 * Simple constant function for returning null, used to render empty templates in JSX.
 *
 * @public
 */


function nullRender() {
  return null;
}
},{"tslib":"xgwM","react":"mpTF","./Async":"JzaE","./EventGroup":"n8h2","./warn/warnConditionallyRequiredProps":"U3x3","./warn/warnMutuallyExclusive":"yHHK","./warn/warnDeprecations":"eQmD","./initializeFocusRects":"Si1v","./initializeDir":"q2Dk"}],"oo6l":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.provideContext = provideContext;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * @deprecated This function uses the legacy context API, which is deprecated and should not be
 * used in new code. Please migrate to the new context API. https://reactjs.org/docs/context.html
 */
function provideContext(contextTypes, mapPropsToContext) {
  var Provider =
  /** @class */
  function (_super) {
    tslib_1.__extends(Provider, _super);

    function Provider() {
      return _super !== null && _super.apply(this, arguments) || this;
    }

    Provider.prototype.getChildContext = function () {
      return mapPropsToContext(this.props);
    };

    Provider.prototype.render = function () {
      return React.Children.only(this.props.children);
    };

    Provider.childContextTypes = contextTypes;
    return Provider;
  }(React.Component);

  return Provider;
}
},{"tslib":"xgwM","react":"mpTF"}],"F1fh":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.DelayedRender = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * Utility component for delaying the render of a child component after a given delay. This component
 * requires a single child component; don't pass in many components. Wrap multiple components in a DIV
 * if necessary.
 *
 * @public
 * {@docCategory DelayedRender}
 */
var DelayedRender =
/** @class */
function (_super) {
  tslib_1.__extends(DelayedRender, _super);

  function DelayedRender(props) {
    var _this = _super.call(this, props) || this;

    _this.state = {
      isRendered: false
    };
    return _this;
  }

  DelayedRender.prototype.componentDidMount = function () {
    var _this = this;

    var delay = this.props.delay;
    this._timeoutId = setTimeout(function () {
      _this.setState({
        isRendered: true
      });
    }, delay);
  };

  DelayedRender.prototype.componentWillUnmount = function () {
    if (this._timeoutId) {
      clearTimeout(this._timeoutId);
    }
  };

  DelayedRender.prototype.render = function () {
    return this.state.isRendered ? React.Children.only(this.props.children) : null;
  };

  DelayedRender.defaultProps = {
    delay: 0
  };
  return DelayedRender;
}(React.Component);

exports.DelayedRender = DelayedRender;
},{"tslib":"xgwM","react":"mpTF"}],"j9Va":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.FabricPerformance = void 0;

var now = function () {
  return typeof performance !== 'undefined' && !!performance.now ? performance.now() : Date.now();
};

var RESET_INTERVAL = 3 * 60 * 1000; // auto reset every 3 minutes

/**
 * Performance helper class for measuring things.
 *
 * @public
 * {@docCategory FabricPerformance}
 */

var FabricPerformance =
/** @class */
function () {
  function FabricPerformance() {}
  /**
   * Measures execution time of the given syncronous function. If the same logic is executed multiple times,
   * each individual measurement will be collected as well the overall numbers.
   * @param name - The name of this measurement
   * @param func - The logic to be measured for execution time
   */


  FabricPerformance.measure = function (name, func) {
    if (FabricPerformance._timeoutId) {
      FabricPerformance.setPeriodicReset();
    }

    var start = now();
    func();
    var end = now();
    var measurement = FabricPerformance.summary[name] || {
      totalDuration: 0,
      count: 0,
      all: []
    };
    var duration = end - start;
    measurement.totalDuration += duration;
    measurement.count++;
    measurement.all.push({
      duration: duration,
      timeStamp: end
    });
    FabricPerformance.summary[name] = measurement;
  };

  FabricPerformance.reset = function () {
    FabricPerformance.summary = {};
    clearTimeout(FabricPerformance._timeoutId);
    FabricPerformance._timeoutId = NaN;
  };

  FabricPerformance.setPeriodicReset = function () {
    FabricPerformance._timeoutId = setTimeout(function () {
      return FabricPerformance.reset();
    }, RESET_INTERVAL);
  };

  FabricPerformance.summary = {};
  return FabricPerformance;
}();

exports.FabricPerformance = FabricPerformance;
},{}],"hmlX":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.GlobalSettings = void 0;

var _getWindow = require("./dom/getWindow");

/**
 * Storing global state in local module variables has issues when more than one copy
 * if the module gets loaded on the page (due to a bundling error or simply by consuming
 * a prebundled script.)
 *
 * This file contains helpers to deal with the getting and setting local state, and allows
 * callers to get called back when it mutates.
 */
// tslint:disable:no-any
var GLOBAL_SETTINGS_PROP_NAME = '__globalSettings__';
var CALLBACK_STATE_PROP_NAME = '__callbacks__';
var _counter = 0;
/**
 * Global settings helper, which stores settings in the global (window) namespace.
 * If window is not provided, it will store settings in module scope. Provides a
 * way to observe changes as well when their values change.
 *
 * @public
 * {@docCategory GlobalSettings}
 */

var GlobalSettings =
/** @class */
function () {
  function GlobalSettings() {}

  GlobalSettings.getValue = function (key, defaultValue) {
    var globalSettings = _getGlobalSettings();

    if (globalSettings[key] === undefined) {
      globalSettings[key] = typeof defaultValue === 'function' ? defaultValue() : defaultValue;
    }

    return globalSettings[key];
  };

  GlobalSettings.setValue = function (key, value) {
    var globalSettings = _getGlobalSettings();

    var callbacks = globalSettings[CALLBACK_STATE_PROP_NAME];
    var oldValue = globalSettings[key];

    if (value !== oldValue) {
      globalSettings[key] = value;
      var changeDescription = {
        oldValue: oldValue,
        value: value,
        key: key
      };

      for (var id in callbacks) {
        if (callbacks.hasOwnProperty(id)) {
          callbacks[id](changeDescription);
        }
      }
    }

    return value;
  };

  GlobalSettings.addChangeListener = function (cb) {
    // Note: we use generated ids on the callbacks to create a map of the callbacks, which optimizes removal.
    // (It's faster to delete a key than it is to look up the index of an object and splice an array.)
    var id = cb.__id__;

    var callbacks = _getCallbacks();

    if (!id) {
      id = cb.__id__ = String(_counter++);
    }

    callbacks[id] = cb;
  };

  GlobalSettings.removeChangeListener = function (cb) {
    var callbacks = _getCallbacks();

    delete callbacks[cb.__id__];
  };

  return GlobalSettings;
}();

exports.GlobalSettings = GlobalSettings;

function _getGlobalSettings() {
  var win = (0, _getWindow.getWindow)();
  var globalObj = win || {};

  if (!globalObj[GLOBAL_SETTINGS_PROP_NAME]) {
    globalObj[GLOBAL_SETTINGS_PROP_NAME] = (_a = {}, _a[CALLBACK_STATE_PROP_NAME] = {}, _a);
  }

  return globalObj[GLOBAL_SETTINGS_PROP_NAME];

  var _a;
}

function _getCallbacks() {
  var globalSettings = _getGlobalSettings();

  return globalSettings[CALLBACK_STATE_PROP_NAME];
}
},{"./dom/getWindow":"mtGO"}],"MdWq":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Rectangle = void 0;

/**
 * Rectangle helper class.
 *
 * @public
 * {@docCategory Rectangle}
 */
var Rectangle =
/** @class */
function () {
  function Rectangle(left, right, top, bottom) {
    if (left === void 0) {
      left = 0;
    }

    if (right === void 0) {
      right = 0;
    }

    if (top === void 0) {
      top = 0;
    }

    if (bottom === void 0) {
      bottom = 0;
    }

    this.top = top;
    this.bottom = bottom;
    this.left = left;
    this.right = right;
  }

  Object.defineProperty(Rectangle.prototype, "width", {
    /**
     * Calculated automatically by subtracting the right from left
     */
    get: function () {
      return this.right - this.left;
    },
    enumerable: true,
    configurable: true
  });
  Object.defineProperty(Rectangle.prototype, "height", {
    /**
     * Calculated automatically by subtracting the bottom from top.
     */
    get: function () {
      return this.bottom - this.top;
    },
    enumerable: true,
    configurable: true
  });
  /**
   * Tests if another rect is approximately equal to this rect (within 4 decimal places.)
   */

  Rectangle.prototype.equals = function (rect) {
    // I'm fixing it to 4 decimal places because it allows enough precision and will handle cases when something should be rounded,
    // like .999999 should round to 1.
    return parseFloat(this.top.toFixed(4)) === parseFloat(rect.top.toFixed(4)) && parseFloat(this.bottom.toFixed(4)) === parseFloat(rect.bottom.toFixed(4)) && parseFloat(this.left.toFixed(4)) === parseFloat(rect.left.toFixed(4)) && parseFloat(this.right.toFixed(4)) === parseFloat(rect.right.toFixed(4));
  };

  return Rectangle;
}();

exports.Rectangle = Rectangle;
},{}],"eGkY":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.appendFunction = appendFunction;

// tslint:disable:no-any

/**
 * Returns a single function which will call each of the given functions in the context of the
 * parent.
 */
function appendFunction(parent) {
  var functions = [];

  for (var _i = 1; _i < arguments.length; _i++) {
    functions[_i - 1] = arguments[_i];
  }

  if (functions.length < 2) {
    return functions[0];
  }

  return function () {
    var args = [];

    for (var _i = 0; _i < arguments.length; _i++) {
      args[_i] = arguments[_i];
    }

    functions.forEach(function (f) {
      return f && f.apply(parent, args);
    });
  };
}
},{}],"Miyv":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.mergeAriaAttributeValues = mergeAriaAttributeValues;

/**
 * ARIA helper to concatenate attributes, returning undefined if all attributes
 * are undefined. (Empty strings are not a valid ARIA attribute value.)
 *
 * @param ariaAttributes - ARIA attributes to merge
 */
function mergeAriaAttributeValues() {
  var ariaAttributes = [];

  for (var _i = 0; _i < arguments.length; _i++) {
    ariaAttributes[_i] = arguments[_i];
  }

  var mergedAttribute = ariaAttributes.filter(function (arg) {
    return arg;
  }).join(' ').trim();
  return mergedAttribute === '' ? undefined : mergedAttribute;
}
},{}],"jRHz":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.findIndex = findIndex;
exports.find = find;
exports.createArray = createArray;
exports.toMatrix = toMatrix;
exports.removeIndex = removeIndex;
exports.replaceElement = replaceElement;
exports.addElementAtIndex = addElementAtIndex;
exports.flatten = flatten;
exports.arraysEqual = arraysEqual;

/**
 * Helper to find the index of an item within an array, using a callback to
 * determine the match.
 *
 * @public
 * @param array - Array to search.
 * @param cb - Callback which returns true on matches.
 */
function findIndex(array, cb) {
  var index = -1;

  for (var i = 0; array && i < array.length; i++) {
    if (cb(array[i], i)) {
      index = i;
      break;
    }
  }

  return index;
}
/**
 * Helper to find the first item within an array that satisfies the callback.
 * @param array - Array to search
 * @param cb - Callback which returns true on matches
 */


function find(array, cb) {
  var index = findIndex(array, cb);

  if (index < 0) {
    return undefined;
  }

  return array[index];
}
/**
 * Creates an array of a given size and helper method to populate.
 *
 * @public
 * @param size - Size of array.
 * @param getItem - Callback to populate given cell index.
 */


function createArray(size, getItem) {
  var array = [];

  for (var i = 0; i < size; i++) {
    array.push(getItem(i));
  }

  return array;
}
/**
 * Convert the given array to a matrix with columnCount number
 * of columns.
 *
 * @public
 * @param items - The array to convert
 * @param columnCount - The number of columns for the resulting matrix
 * @returns A matrix of items
 */


function toMatrix(items, columnCount) {
  return items.reduce(function (rows, currentValue, index) {
    if (index % columnCount === 0) {
      rows.push([currentValue]);
    } else {
      rows[rows.length - 1].push(currentValue);
    }

    return rows;
  }, []);
}
/**
 * Given an array, it returns a new array that does not contain the item at the given index.
 * @param array - The array to operate on
 * @param index - The index of the element to remove
 */


function removeIndex(array, index) {
  return array.filter(function (_, i) {
    return index !== i;
  });
}
/**
 * Given an array, this function returns a new array where the element at a given index has been replaced.
 * @param array - The array to operate on
 * @param newElement - The element that will be placed in the new array
 * @param index - The index of the element that should be replaced
 */


function replaceElement(array, newElement, index) {
  var copy = array.slice();
  copy[index] = newElement;
  return copy;
}
/**
 * Given an array, this function returns a new array where an element has been inserted at the given index.
 * @param array - The array to operate on
 * @param index - The index where an element should be inserted
 * @param itemToAdd - The element to insert
 */


function addElementAtIndex(array, index, itemToAdd) {
  var copy = array.slice();
  copy.splice(index, 0, itemToAdd);
  return copy;
}
/**
 * Given an array where each element is of type T or T[], flatten it into an array of T
 * @param array - The array where each element can optionally also be an array
 */


function flatten(array) {
  var result = [];
  array.forEach(function (item) {
    return result = result.concat(item);
  });
  return result;
}
/**
 * Returns a boolean indicating if the two given arrays are equal in length and values.
 *
 * @param array1 - First array to compare
 * @param array2 - Second array to compare
 * @returns True if the arrays are the same length and have the same values in the same positions, false otherwise.
 */


function arraysEqual(array1, array2) {
  if (array1.length !== array2.length) {
    return false;
  }

  for (var i = 0; i < array1.length; i++) {
    if (array1[i] !== array2[i]) {
      return false;
    }
  }

  return true;
}
},{}],"VHwT":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.asAsync = asAsync;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * asAsync - a HOC for async loading components.
 *
 * Usage:
 *
 * const AsyncDialog = asAsync({
 *   load: () => import('Dialog').then(result => result.default),
 * });
 *
 * React.render(domElement, <AsyncDialog asyncPlaceholder={ () => <Spinner/> } { ...dialogProps } />);
 *
 * Note the `asyncPlaceholder` prop will be respected when rendering the async component and it hasn't
 * been loaded yet.
 */

/**
 * If possible, use a WeakMap to maintain a cache of loaded components.
 * This can be used to synchronously render components that have already been loaded,
 * rather than having to wait for at least one async tick.
 */
var _syncModuleCache = typeof WeakMap !== 'undefined' ? // tslint:disable-next-line:no-any
new WeakMap() : undefined;
/**
 * Produces a component which internally loads the target component before first mount.
 * The component passes all props through to the loaded component.
 *
 * This overload accepts a module with a default export for the component.
 */


function asAsync(options) {
  var Async =
  /** @class */
  function (_super) {
    tslib_1.__extends(Async, _super);

    function Async() {
      var _this = _super !== null && _super.apply(this, arguments) || this;

      _this.state = {
        Component: _syncModuleCache ? _syncModuleCache.get(options.load) : undefined
      };
      return _this;
    }

    Async.prototype.render = function () {
      // Typescript issue: the rest can't be pulled without the any cast, as TypeScript fails with rest on generics.
      // tslint:disable-next-line:no-any
      var _a = this.props,
          forwardedRef = _a.forwardedRef,
          Placeholder = _a.asyncPlaceholder,
          rest = tslib_1.__rest(_a, ["forwardedRef", "asyncPlaceholder"]);

      var Component = this.state.Component;
      return Component ? React.createElement(Component, tslib_1.__assign({
        ref: forwardedRef
      }, rest)) : Placeholder ? React.createElement(Placeholder, null) : null;
    };

    Async.prototype.componentDidMount = function () {
      var _this = this;

      var Component = this.state.Component;

      if (!Component) {
        options.load().then(function (LoadedComponent) {
          if (LoadedComponent) {
            // Cache component for future reference.
            _syncModuleCache && _syncModuleCache.set(options.load, LoadedComponent); // Set state.

            _this.setState({
              Component: LoadedComponent
            }, options.onLoad);
          }
        }).catch(options.onError);
      }
    };

    return Async;
  }(React.Component);

  return React.forwardRef(function (props, ref) {
    return React.createElement(Async, tslib_1.__assign({}, props, {
      forwardedRef: ref
    }));
  });
}
},{"tslib":"xgwM","react":"mpTF"}],"LuVf":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.assertNever = assertNever;

/**
 * AssertNever is a utility function that can be used for exhaustiveness checks in switch statements.
 *
 * @public
 */
function assertNever(x) {
  throw new Error('Unexpected object: ' + x);
}
},{}],"CzxO":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.autobind = autobind;

/**
 * Autobind is a utility for binding methods in a class. This simplifies tagging methods as being "bound" to the this pointer
 * so that they can be used in scenarios that simply require a function callback.
 * @deprecated This has been deprecated in favor of using arrow function properties
 */
function autobind( // tslint:disable-next-line:no-any
target, key, descriptor) {
  var fn = descriptor.value;
  var defining = false;
  return {
    configurable: true,
    get: function () {
      if (defining || fn && this === fn.prototype || this.hasOwnProperty(key)) {
        return fn;
      } // Bind method only once, and update the property to return the bound value from now on


      var fnBound = fn && fn.bind(this);
      defining = true;
      Object.defineProperty(this, key, {
        configurable: true,
        writable: true,
        enumerable: true,
        value: fnBound
      });
      defining = false;
      return fnBound;
    },
    // tslint:disable-next-line:no-any
    set: function (newValue) {
      Object.defineProperty(this, key, {
        configurable: true,
        writable: true,
        enumerable: true,
        value: newValue
      });
    }
  };
}
},{}],"cHjD":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.classNamesFunction = classNamesFunction;

var _mergeStyles = require("@uifabric/merge-styles");

var MAX_CACHE_COUNT = 50;
var _memoizedClassNames = 0;

var stylesheet = _mergeStyles.Stylesheet.getInstance();

if (stylesheet && stylesheet.onReset) {
  stylesheet.onReset(function () {
    return _memoizedClassNames++;
  });
} // Note that because of the caching nature within the classNames memoization,
// I've disabled this rule to simply be able to work with any types.
// tslint:disable:no-any
// This represents a prop we attach to each Map to indicate the cached return value
// associated with the graph node.


var RetVal = '__retval__';
/**
 * Creates a getClassNames function which calls getStyles given the props, and injects them
 * into mergeStyleSets.
 *
 * Note that the props you pass in on every render should be in the same order and
 * immutable (numbers, strings, and booleans). This will allow the results to be memoized. Violating
 * these will cause extra recalcs to occur.
 */

function classNamesFunction(options) {
  // We build a trie where each node is a Map. The map entry key represents an argument
  // value, and the entry value is another node (Map). Each node has a `__retval__`
  // property which is used to hold the cached response.
  if (options === void 0) {
    options = {};
  } // To derive the response, we can simply ensure the arguments are added or already
  // exist in the trie. At the last node, if there is a `__retval__` we return that. Otherwise
  // we call the `getStyles` api to evaluate, cache on the property, and return that.


  var map = new Map();
  var resultCount = 0;
  var currentMemoizedClassNames = _memoizedClassNames;

  var getClassNames = function (styleFunctionOrObject, styleProps) {
    if (styleProps === void 0) {
      styleProps = {};
    }

    var current = map;
    var disableCaching = options.disableCaching; // On reset of our stylesheet, reset memoized cache.

    if (currentMemoizedClassNames !== _memoizedClassNames) {
      currentMemoizedClassNames = _memoizedClassNames;
      map = new Map();
      resultCount = 0;
    }

    if (!options.disableCaching) {
      current = _traverseMap(map, styleFunctionOrObject);
      current = _traverseMap(current, styleProps);
    }

    if (disableCaching || !current[RetVal]) {
      if (styleFunctionOrObject === undefined) {
        current[RetVal] = {};
      } else {
        current[RetVal] = (0, _mergeStyles.mergeStyleSets)(typeof styleFunctionOrObject === 'function' ? styleFunctionOrObject(styleProps) : styleFunctionOrObject);
      }

      if (!disableCaching) {
        resultCount++;
      }
    }

    if (resultCount > MAX_CACHE_COUNT) {
      map.clear();
      resultCount = 0; // Mutate the options passed in, that's all we can do.

      options.disableCaching = true; // Note: this code is great for debugging problems with styles being recaculated, but commenting it out
      // to avoid confusing consumers.
      // if (process.env.NODE_ENV !== 'production') {
      //  console.log('Styles are being recalculated far too frequently. Something is mutating the class over and over.');
      //  // tslint:disable-next-line:no-console
      //  console.trace();
      // }
    } // Note: the RetVal is an attached property on the Map; not a key in the Map. We use this attached property to
    // cache the return value for this branch of the graph.


    return current[RetVal];
  };

  return getClassNames;
}

function _derive(obj) {
  return typeof obj === 'function' ? obj(this) : obj;
}

function _traverseEdge(current, value) {
  value = _normalizeValue(value);

  if (!current.has(value)) {
    current.set(value, new Map());
  }

  return current.get(value);
}

function _traverseMap(current, inputs) {
  // The styled helper will generate the styles function and will attach the cached
  // inputs (consisting of the default styles, customzied styles, and user provided styles.)
  // These should be used as cache keys for deriving the memoized value.
  if (typeof inputs === 'function' && inputs.__cachedInputs__) {
    for (var _i = 0, _a = inputs.__cachedInputs__; _i < _a.length; _i++) {
      var input = _a[_i];
      current = _traverseEdge(current, input);
    }
  } else if (typeof inputs === 'object') {
    for (var propName in inputs) {
      if (inputs.hasOwnProperty(propName)) {
        current = _traverseEdge(current, inputs[propName]);
      }
    }
  }

  return current;
}

function _normalizeValue(value) {
  switch (value) {
    case undefined:
      return '__undefined__';

    case null:
      return '__null__';

    default:
      return value;
  }
}
},{"@uifabric/merge-styles":"w5wT"}],"uNHc":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.createRef = createRef;

/**
 * @deprecated Use React.createRef.
 * May be removed in 6 months (Jan '19).
 */
function createRef() {
  var refObject = function (element) {
    refObject.current = element;
  }; // This getter is here to support the deprecated value prop on the refObject.


  Object.defineProperty(refObject, 'value', {
    get: function () {
      return refObject.current;
    }
  });
  refObject.current = null;
  return refObject;
}
},{}],"kL5n":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.css = css;

/**
 * Concatination helper, which can merge class names together. Skips over falsey values.
 *
 * @public
 */
function css() {
  var args = [];

  for (var _i = 0; _i < arguments.length; _i++) {
    args[_i] = arguments[_i];
  }

  var classes = [];

  for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {
    var arg = args_1[_a];

    if (arg) {
      if (typeof arg === 'string') {
        classes.push(arg);
      } else if (arg.hasOwnProperty('toString') && typeof arg.toString === 'function') {
        classes.push(arg.toString());
      } else {
        // tslint:disable-next-line:no-any
        for (var key in arg) {
          // tslint:disable-next-line:no-any
          if (arg[key]) {
            classes.push(key);
          }
        }
      }
    }
  }

  return classes.join(' ');
}
},{}],"PUOB":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Customizations = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var _GlobalSettings = require("../GlobalSettings");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var CustomizationsGlobalKey = 'customizations';
var NO_CUSTOMIZATIONS = {
  settings: {},
  scopedSettings: {},
  inCustomizerContext: false
};

var _allSettings = _GlobalSettings.GlobalSettings.getValue(CustomizationsGlobalKey, {
  settings: {},
  scopedSettings: {},
  inCustomizerContext: false
});

var _events = [];

var Customizations =
/** @class */
function () {
  function Customizations() {}

  Customizations.reset = function () {
    _allSettings.settings = {};
    _allSettings.scopedSettings = {};
  };
  /** Apply global Customization settings.
   * @example Customizations.applySettings(\{ theme: \{...\} \});
   */


  Customizations.applySettings = function (settings) {
    _allSettings.settings = tslib_1.__assign({}, _allSettings.settings, settings);

    Customizations._raiseChange();
  };
  /** Apply Customizations to a particular named scope, like a component.
   * @example Customizations.applyScopedSettings('Nav', \{ styles: () =\> \{\} \});
   */


  Customizations.applyScopedSettings = function (scopeName, settings) {
    _allSettings.scopedSettings[scopeName] = tslib_1.__assign({}, _allSettings.scopedSettings[scopeName], settings);

    Customizations._raiseChange();
  };

  Customizations.getSettings = function (properties, scopeName, localSettings // tslint:disable-next-line:no-any
  ) {
    if (localSettings === void 0) {
      localSettings = NO_CUSTOMIZATIONS;
    }

    var settings = {};
    var localScopedSettings = scopeName && localSettings.scopedSettings[scopeName] || {};
    var globalScopedSettings = scopeName && _allSettings.scopedSettings[scopeName] || {};

    for (var _i = 0, properties_1 = properties; _i < properties_1.length; _i++) {
      var property = properties_1[_i];
      settings[property] = localScopedSettings[property] || localSettings.settings[property] || globalScopedSettings[property] || _allSettings.settings[property];
    }

    return settings;
  };
  /** Used to run some code that sets Customizations without triggering an update until the end.
   * Useful for applying Customizations that don't affect anything currently rendered, or for
   * applying many customizations at once.
   * @param suppressUpdate - Do not raise the change event at the end, preventing all updates
   */


  Customizations.applyBatchedUpdates = function (code, suppressUpdate) {
    Customizations._suppressUpdates = true;

    try {
      code();
    } catch (
    /* do nothing */
    _a) {
      /* do nothing */
    }

    Customizations._suppressUpdates = false;

    if (!suppressUpdate) {
      Customizations._raiseChange();
    }
  };

  Customizations.observe = function (onChange) {
    _events.push(onChange);
  };

  Customizations.unobserve = function (onChange) {
    _events = _events.filter(function (cb) {
      return cb !== onChange;
    });
  };

  Customizations._raiseChange = function () {
    if (!Customizations._suppressUpdates) {
      _events.forEach(function (cb) {
        return cb();
      });
    }
  };

  return Customizations;
}();

exports.Customizations = Customizations;
},{"tslib":"xgwM","../GlobalSettings":"hmlX"}],"bJts":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.CustomizerContext = void 0;

var React = _interopRequireWildcard(require("react"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var CustomizerContext = React.createContext({
  customizations: {
    inCustomizerContext: false,
    settings: {},
    scopedSettings: {}
  }
});
exports.CustomizerContext = CustomizerContext;
},{"react":"mpTF"}],"Chex":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.mergeSettings = mergeSettings;
exports.mergeScopedSettings = mergeScopedSettings;

var tslib_1 = _interopRequireWildcard(require("tslib"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * Merge new and old settings, giving priority to new settings.
 * New settings is optional in which case oldSettings is returned as-is.
 * @param oldSettings - Old settings to fall back to.
 * @param newSettings - New settings that will be merged over oldSettings.
 * @returns Merged settings.
 */
function mergeSettings(oldSettings, newSettings) {
  if (oldSettings === void 0) {
    oldSettings = {};
  }

  var mergeSettingsWith = _isSettingsFunction(newSettings) ? newSettings : _settingsMergeWith(newSettings);
  return mergeSettingsWith(oldSettings);
}

function mergeScopedSettings(oldSettings, newSettings) {
  if (oldSettings === void 0) {
    oldSettings = {};
  }

  var mergeSettingsWith = _isSettingsFunction(newSettings) ? newSettings : _scopedSettingsMergeWith(newSettings);
  return mergeSettingsWith(oldSettings);
}

function _isSettingsFunction(settings) {
  return typeof settings === 'function';
}

function _settingsMergeWith(newSettings) {
  return function (settings) {
    return newSettings ? tslib_1.__assign({}, settings, newSettings) : settings;
  };
}

function _scopedSettingsMergeWith(scopedSettingsFromProps) {
  if (scopedSettingsFromProps === void 0) {
    scopedSettingsFromProps = {};
  }

  return function (oldScopedSettings) {
    var newScopedSettings = tslib_1.__assign({}, oldScopedSettings);

    for (var scopeName in scopedSettingsFromProps) {
      if (scopedSettingsFromProps.hasOwnProperty(scopeName)) {
        newScopedSettings[scopeName] = tslib_1.__assign({}, oldScopedSettings[scopeName], scopedSettingsFromProps[scopeName]);
      }
    }

    return newScopedSettings;
  };
}
},{"tslib":"xgwM"}],"R4Sr":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.mergeCustomizations = mergeCustomizations;

var _mergeSettings = require("./mergeSettings");

/**
 * Merge props and customizations giving priority to props over context.
 * NOTE: This function will always perform multiple merge operations. Use with caution.
 * @param props - New settings to merge in.
 * @param parentContext - Context containing current settings.
 * @returns Merged customizations.
 */
function mergeCustomizations(props, parentContext) {
  var _a = (parentContext || {}).customizations,
      customizations = _a === void 0 ? {
    settings: {},
    scopedSettings: {}
  } : _a;
  return {
    customizations: {
      settings: (0, _mergeSettings.mergeSettings)(customizations.settings, props.settings),
      scopedSettings: (0, _mergeSettings.mergeScopedSettings)(customizations.scopedSettings, props.scopedSettings),
      inCustomizerContext: true
    }
  };
}
},{"./mergeSettings":"Chex"}],"oOPX":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Customizer = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Customizations = require("./Customizations");

var _CustomizerContext = require("./CustomizerContext");

var _mergeCustomizations = require("./mergeCustomizations");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * The Customizer component allows for default props to be mixed into components which
 * are decorated with the customizable() decorator, or use the styled HOC. This enables
 * injection scenarios like:
 *
 * 1. render svg icons instead of the icon font within all buttons
 * 2. inject a custom theme object into a component
 *
 * Props are provided via the settings prop which should be one of the following:
 * - A json map which contains 1 or more name/value pairs representing injectable props.
 * - A function that receives the current settings and returns the new ones that apply to the scope
 *
 * @public
 */
var Customizer =
/** @class */
function (_super) {
  tslib_1.__extends(Customizer, _super);

  function Customizer() {
    var _this = _super !== null && _super.apply(this, arguments) || this;

    _this._onCustomizationChange = function () {
      return _this.forceUpdate();
    };

    return _this;
  }

  Customizer.prototype.componentDidMount = function () {
    _Customizations.Customizations.observe(this._onCustomizationChange);
  };

  Customizer.prototype.componentWillUnmount = function () {
    _Customizations.Customizations.unobserve(this._onCustomizationChange);
  };

  Customizer.prototype.render = function () {
    var _this = this;

    var contextTransform = this.props.contextTransform;
    return React.createElement(_CustomizerContext.CustomizerContext.Consumer, null, function (parentContext) {
      var newContext = (0, _mergeCustomizations.mergeCustomizations)(_this.props, parentContext);

      if (contextTransform) {
        newContext = contextTransform(newContext);
      }

      return React.createElement(_CustomizerContext.CustomizerContext.Provider, {
        value: newContext
      }, _this.props.children);
    });
  };

  return Customizer;
}(React.Component);

exports.Customizer = Customizer;
},{"tslib":"xgwM","react":"mpTF","./Customizations":"PUOB","./CustomizerContext":"bJts","./mergeCustomizations":"R4Sr"}],"QlrS":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.hoistStatics = hoistStatics;

/**
 * Allows you to hoist static functions in components.
 * Created for the purpose of fixing broken static functions in classes
 * that utilize decorators.
 *
 * @public
 * @param source - The object where the methods are hoisted from.
 * @param dest - The object to hoist the methods onto.
 * @returns The dest object with methods added
 */
function hoistStatics(source, dest) {
  for (var name_1 in source) {
    if (source.hasOwnProperty(name_1)) {
      // tslint:disable-next-line:no-any
      dest[name_1] = source[name_1];
    }
  }

  return dest;
}
},{}],"Ypg4":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.customizable = customizable;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Customizations = require("./Customizations");

var _hoistStatics = require("../hoistStatics");

var _CustomizerContext = require("./CustomizerContext");

var _mergeStyles = require("@uifabric/merge-styles");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function customizable(scope, fields, concatStyles // tslint:disable-next-line:no-any
) {
  // tslint:disable-next-line:no-shadowed-variable
  return function customizableFactory( // tslint:disable-next-line:no-any
  ComposedComponent // tslint:disable-next-line:no-any
  ) {
    var resultClass = (_a =
    /** @class */
    function (_super) {
      tslib_1.__extends(ComponentWithInjectedProps, _super); // tslint:disable-next-line:no-any


      function ComponentWithInjectedProps(props) {
        var _this = _super.call(this, props) || this;

        _this._onSettingChanged = _this._onSettingChanged.bind(_this);
        return _this;
      }

      ComponentWithInjectedProps.prototype.componentDidMount = function () {
        _Customizations.Customizations.observe(this._onSettingChanged);
      };

      ComponentWithInjectedProps.prototype.componentWillUnmount = function () {
        _Customizations.Customizations.unobserve(this._onSettingChanged);
      };

      ComponentWithInjectedProps.prototype.render = function () {
        var _this = this;

        return React.createElement(_CustomizerContext.CustomizerContext.Consumer, null, function (context) {
          var defaultProps = _Customizations.Customizations.getSettings(fields, scope, context.customizations); // tslint:disable-next-line:no-any


          var componentProps = _this.props; // If defaultProps.styles is a function, evaluate it before calling concatStyleSets

          if (defaultProps.styles && typeof defaultProps.styles === 'function') {
            defaultProps.styles = defaultProps.styles(tslib_1.__assign({}, defaultProps, componentProps));
          } // If concatStyles is true and custom styles have been defined compute those styles


          if (concatStyles && (defaultProps.styles || componentProps.styles)) {
            var mergedStyles = (0, _mergeStyles.concatStyleSets)(defaultProps.styles, componentProps.styles);
            return React.createElement(ComposedComponent, tslib_1.__assign({}, defaultProps, componentProps, {
              styles: mergedStyles
            }));
          }

          return React.createElement(ComposedComponent, tslib_1.__assign({}, defaultProps, componentProps));
        });
      };

      ComponentWithInjectedProps.prototype._onSettingChanged = function () {
        this.forceUpdate();
      };

      return ComponentWithInjectedProps;
    }(React.Component), _a.displayName = 'Customized' + scope, _a);
    return (0, _hoistStatics.hoistStatics)(ComposedComponent, resultClass);

    var _a;
  };
}
},{"tslib":"xgwM","react":"mpTF","./Customizations":"PUOB","../hoistStatics":"QlrS","./CustomizerContext":"bJts","@uifabric/merge-styles":"w5wT"}],"oUpE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.isVirtualElement = isVirtualElement;

/**
 * Determines whether or not an element has the virtual hierarchy extension.
 *
 * @public
 */
function isVirtualElement(element) {
  return element && !!element._virtual;
}
},{}],"zU1n":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getVirtualParent = getVirtualParent;

var _isVirtualElement = require("./isVirtualElement");

/**
 * Gets the virtual parent given the child element, if it exists.
 *
 * @public
 */
function getVirtualParent(child) {
  var parent;

  if (child && (0, _isVirtualElement.isVirtualElement)(child)) {
    parent = child._virtual.parent;
  }

  return parent;
}
},{"./isVirtualElement":"oUpE"}],"E8U8":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getParent = getParent;

var _getVirtualParent = require("./getVirtualParent");

/**
 * Gets the element which is the parent of a given element.
 * If `allowVirtuaParents` is `true`, this method prefers the virtual parent over
 * real DOM parent when present.
 *
 * @public
 */
function getParent(child, allowVirtualParents) {
  if (allowVirtualParents === void 0) {
    allowVirtualParents = true;
  }

  return child && (allowVirtualParents && (0, _getVirtualParent.getVirtualParent)(child) || child.parentNode && child.parentNode);
}
},{"./getVirtualParent":"zU1n"}],"sre9":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.elementContains = elementContains;

var _getParent = require("./getParent");

/**
 * Determines whether or not a parent element contains a given child element.
 * If `allowVirtualParents` is true, this method may return `true` if the child
 * has the parent in its virtual element hierarchy.
 *
 * @public
 */
function elementContains(parent, child, allowVirtualParents) {
  if (allowVirtualParents === void 0) {
    allowVirtualParents = true;
  }

  var isContained = false;

  if (parent && child) {
    if (allowVirtualParents) {
      isContained = false;

      while (child) {
        var nextParent = (0, _getParent.getParent)(child);

        if (nextParent === parent) {
          isContained = true;
          break;
        }

        child = nextParent;
      }
    } else if (parent.contains) {
      isContained = parent.contains(child);
    }
  }

  return isContained;
}
},{"./getParent":"E8U8"}],"uHZ7":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.findElementRecursive = findElementRecursive;

var _getParent = require("./getParent");

/**
 * Finds the first parent element where the matchFunction returns true
 * @param element - element to start searching at
 * @param matchFunction - the function that determines if the element is a match
 * @returns the matched element or null no match was found
 */
function findElementRecursive(element, matchFunction) {
  if (!element || element === document.body) {
    return null;
  }

  return matchFunction(element) ? element : findElementRecursive((0, _getParent.getParent)(element), matchFunction);
}
},{"./getParent":"E8U8"}],"s6vx":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.elementContainsAttribute = elementContainsAttribute;

var _findElementRecursive = require("./findElementRecursive");

/**
 * Determines if an element, or any of its ancestors, contain the given attribute
 * @param element - element to start searching at
 * @param attribute - the attribute to search for
 * @returns the value of the first instance found
 */
function elementContainsAttribute(element, attribute) {
  var elementMatch = (0, _findElementRecursive.findElementRecursive)(element, function (testElement) {
    return testElement.hasAttribute(attribute);
  });
  return elementMatch && elementMatch.getAttribute(attribute);
}
},{"./findElementRecursive":"uHZ7"}],"x0HE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getChildren = getChildren;

var _isVirtualElement = require("./isVirtualElement");

/**
 * Gets the elements which are child elements of the given element.
 * If `allowVirtualChildren` is `true`, this method enumerates virtual child elements
 * after the original children.
 * @param parent - The element to get the children of.
 * @param allowVirtualChildren - true if the method should enumerate virtual child elements.
 */
function getChildren(parent, allowVirtualChildren) {
  if (allowVirtualChildren === void 0) {
    allowVirtualChildren = true;
  }

  var children = [];

  if (parent) {
    for (var i = 0; i < parent.children.length; i++) {
      children.push(parent.children.item(i));
    }

    if (allowVirtualChildren && (0, _isVirtualElement.isVirtualElement)(parent)) {
      children.push.apply(children, parent._virtual.children);
    }
  }

  return children;
}
},{"./isVirtualElement":"oUpE"}],"S6PZ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.on = on;

function on(element, eventName, callback, options) {
  element.addEventListener(eventName, callback, options);
  return function () {
    return element.removeEventListener(eventName, callback, options);
  };
}
},{}],"czue":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.setPortalAttribute = setPortalAttribute;
exports.DATA_PORTAL_ATTRIBUTE = void 0;
var DATA_PORTAL_ATTRIBUTE = 'data-portal-element';
/**
 * Identify element as a portal by setting an attribute.
 * @param element - Element to mark as a portal.
 */

exports.DATA_PORTAL_ATTRIBUTE = DATA_PORTAL_ATTRIBUTE;

function setPortalAttribute(element) {
  element.setAttribute(DATA_PORTAL_ATTRIBUTE, 'true');
}
},{}],"sJqt":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.portalContainsElement = portalContainsElement;

var _findElementRecursive = require("./findElementRecursive");

var _setPortalAttribute = require("./setPortalAttribute");

/**
 * Determine whether a target is within a portal from perspective of root or optional parent.
 * This function only works against portal components that use the setPortalAttribute function.
 * If both parent and child are within the same portal this function will return false.
 * @param target - Element to query portal containment status of.
 * @param parent - Optional parent perspective. Search for containing portal stops at parent (or root if parent is undefined or invalid.)
 */
function portalContainsElement(target, parent) {
  var elementMatch = (0, _findElementRecursive.findElementRecursive)(target, function (testElement) {
    return parent === testElement || testElement.hasAttribute(_setPortalAttribute.DATA_PORTAL_ATTRIBUTE);
  });
  return elementMatch !== null && elementMatch.hasAttribute(_setPortalAttribute.DATA_PORTAL_ATTRIBUTE);
}
},{"./findElementRecursive":"uHZ7","./setPortalAttribute":"czue"}],"Tg4t":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.raiseClick = raiseClick;

/** Raises a click event. */
function raiseClick(target) {
  var event = createNewEvent('MouseEvents');
  event.initEvent('click', true, true);
  target.dispatchEvent(event);
}

function createNewEvent(eventName) {
  var event;

  if (typeof Event === 'function') {
    // Chrome, Opera, Firefox
    event = new Event(eventName);
  } else {
    // IE
    event = document.createEvent('Event');
    event.initEvent(eventName, true, true);
  }

  return event;
}
},{}],"mBra":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.setVirtualParent = setVirtualParent;

/**
 * Sets the virtual parent of an element.
 * Pass `undefined` as the `parent` to clear the virtual parent.
 *
 * @public
 */
function setVirtualParent(child, parent) {
  var virtualChild = child;
  var virtualParent = parent;

  if (!virtualChild._virtual) {
    virtualChild._virtual = {
      children: []
    };
  }

  var oldParent = virtualChild._virtual.parent;

  if (oldParent && oldParent !== parent) {
    // Remove the child from its old parent.
    var index = oldParent._virtual.children.indexOf(virtualChild);

    if (index > -1) {
      oldParent._virtual.children.splice(index, 1);
    }
  }

  virtualChild._virtual.parent = virtualParent || undefined;

  if (virtualParent) {
    if (!virtualParent._virtual) {
      virtualParent._virtual = {
        children: []
      };
    }

    virtualParent._virtual.children.push(virtualChild);
  }
}
},{}],"P7UA":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _elementContains = require("./dom/elementContains");

Object.keys(_elementContains).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _elementContains[key];
    }
  });
});

var _elementContainsAttribute = require("./dom/elementContainsAttribute");

Object.keys(_elementContainsAttribute).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _elementContainsAttribute[key];
    }
  });
});

var _findElementRecursive = require("./dom/findElementRecursive");

Object.keys(_findElementRecursive).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _findElementRecursive[key];
    }
  });
});

var _getChildren = require("./dom/getChildren");

Object.keys(_getChildren).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _getChildren[key];
    }
  });
});

var _getDocument = require("./dom/getDocument");

Object.keys(_getDocument).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _getDocument[key];
    }
  });
});

var _getParent = require("./dom/getParent");

Object.keys(_getParent).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _getParent[key];
    }
  });
});

var _getRect = require("./dom/getRect");

Object.keys(_getRect).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _getRect[key];
    }
  });
});

var _getVirtualParent = require("./dom/getVirtualParent");

Object.keys(_getVirtualParent).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _getVirtualParent[key];
    }
  });
});

var _getWindow = require("./dom/getWindow");

Object.keys(_getWindow).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _getWindow[key];
    }
  });
});

var _isVirtualElement = require("./dom/isVirtualElement");

Object.keys(_isVirtualElement).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _isVirtualElement[key];
    }
  });
});

var _on = require("./dom/on");

Object.keys(_on).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _on[key];
    }
  });
});

var _portalContainsElement = require("./dom/portalContainsElement");

Object.keys(_portalContainsElement).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _portalContainsElement[key];
    }
  });
});

var _raiseClick = require("./dom/raiseClick");

Object.keys(_raiseClick).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _raiseClick[key];
    }
  });
});

var _setPortalAttribute = require("./dom/setPortalAttribute");

Object.keys(_setPortalAttribute).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _setPortalAttribute[key];
    }
  });
});

var _setVirtualParent = require("./dom/setVirtualParent");

Object.keys(_setVirtualParent).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _setVirtualParent[key];
    }
  });
});
},{"./dom/elementContains":"sre9","./dom/elementContainsAttribute":"s6vx","./dom/findElementRecursive":"uHZ7","./dom/getChildren":"x0HE","./dom/getDocument":"NngM","./dom/getParent":"E8U8","./dom/getRect":"D9tF","./dom/getVirtualParent":"zU1n","./dom/getWindow":"mtGO","./dom/isVirtualElement":"oUpE","./dom/on":"S6PZ","./dom/portalContainsElement":"sJqt","./dom/raiseClick":"Tg4t","./dom/setPortalAttribute":"czue","./dom/setVirtualParent":"mBra"}],"vjt7":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.extendComponent = extendComponent;

var _appendFunction = require("./appendFunction");

/**
 * Extends a component's lifetime methods by appending new functions to the existing lifetime functions.
 */
function extendComponent(parent, methods) {
  for (var name_1 in methods) {
    if (methods.hasOwnProperty(name_1)) {
      // tslint:disable-next-line:no-any
      parent[name_1] = (0, _appendFunction.appendFunction)(parent, parent[name_1], methods[name_1]);
    }
  }
}
},{"./appendFunction":"eGkY"}],"w6Tz":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getFirstFocusable = getFirstFocusable;
exports.getLastFocusable = getLastFocusable;
exports.getFirstTabbable = getFirstTabbable;
exports.getLastTabbable = getLastTabbable;
exports.focusFirstChild = focusFirstChild;
exports.getPreviousElement = getPreviousElement;
exports.getNextElement = getNextElement;
exports.isElementVisible = isElementVisible;
exports.isElementTabbable = isElementTabbable;
exports.isElementFocusZone = isElementFocusZone;
exports.isElementFocusSubZone = isElementFocusSubZone;
exports.doesElementContainFocus = doesElementContainFocus;
exports.shouldWrapFocus = shouldWrapFocus;
exports.focusAsync = focusAsync;
exports.getFocusableByIndexPath = getFocusableByIndexPath;
exports.getElementIndexPath = getElementIndexPath;

var _elementContainsAttribute = require("./dom/elementContainsAttribute");

var _elementContains = require("./dom/elementContains");

var _getParent = require("./dom/getParent");

var _getWindow = require("./dom/getWindow");

var _getDocument = require("./dom/getDocument");

var IS_FOCUSABLE_ATTRIBUTE = 'data-is-focusable';
var IS_VISIBLE_ATTRIBUTE = 'data-is-visible';
var FOCUSZONE_ID_ATTRIBUTE = 'data-focuszone-id';
var FOCUSZONE_SUB_ATTRIBUTE = 'data-is-sub-focuszone';
/**
 * Gets the first focusable element.
 *
 * @public
 */

function getFirstFocusable(rootElement, currentElement, includeElementsInFocusZones) {
  return getNextElement(rootElement, currentElement, true
  /*checkNode*/
  , false
  /*suppressParentTraversal*/
  , false
  /*suppressChildTraversal*/
  , includeElementsInFocusZones);
}
/**
 * Gets the last focusable element.
 *
 * @public
 */


function getLastFocusable(rootElement, currentElement, includeElementsInFocusZones) {
  return getPreviousElement(rootElement, currentElement, true
  /*checkNode*/
  , false
  /*suppressParentTraversal*/
  , true
  /*traverseChildren*/
  , includeElementsInFocusZones);
}
/**
 * Gets the first tabbable element.
 * The difference between focusable and tabbable is that tabbable elements are focusable elements that also have tabIndex != -1.
 * @param rootElement - The parent element to search beneath.
 * @param currentElement - The descendant of rootElement to start the search at.  This element is the first one checked,
 * and iteration continues forward.  Typical use passes rootElement.firstChild.
 * @param includeElementsInFocusZones - true if traversal should go into FocusZone descendants.
 * @param checkNode - Include currentElement in search when true. Defaults to true.
 * @public
 */


function getFirstTabbable(rootElement, currentElement, includeElementsInFocusZones, checkNode) {
  if (checkNode === void 0) {
    checkNode = true;
  }

  return getNextElement(rootElement, currentElement, checkNode, false
  /*suppressParentTraversal*/
  , false
  /*suppressChildTraversal*/
  , includeElementsInFocusZones, false
  /*allowFocusRoot*/
  , true
  /*tabbable*/
  );
}
/**
 * Gets the last tabbable element.
 * The difference between focusable and tabbable is that tabbable elements are focusable elements that also have tabIndex != -1.
 * @param rootElement - The parent element to search beneath.
 * @param currentElement - The descendant of rootElement to start the search at.  This element is the first one checked,
 * and iteration continues in reverse.  Typical use passes rootElement.lastChild.
 * @param includeElementsInFocusZones - true if traversal should go into FocusZone descendants.
 * @param checkNode - Include currentElement in search when true. Defaults to true.
 * @public
 */


function getLastTabbable(rootElement, currentElement, includeElementsInFocusZones, checkNode) {
  if (checkNode === void 0) {
    checkNode = true;
  }

  return getPreviousElement(rootElement, currentElement, checkNode, false
  /*suppressParentTraversal*/
  , true
  /*traverseChildren*/
  , includeElementsInFocusZones, false
  /*allowFocusRoot*/
  , true
  /*tabbable*/
  );
}
/**
 * Attempts to focus the first focusable element that is a child or child's child of the rootElement.
 *
 * @public
 * @param rootElement - Element to start the search for a focusable child.
 * @returns True if focus was set, false if it was not.
 */


function focusFirstChild(rootElement) {
  var element = getNextElement(rootElement, rootElement, true, false, false, true);

  if (element) {
    focusAsync(element);
    return true;
  }

  return false;
}
/**
 * Traverse to find the previous element.
 * If tabbable is true, the element must have tabIndex != -1.
 *
 * @public
 */


function getPreviousElement(rootElement, currentElement, checkNode, suppressParentTraversal, traverseChildren, includeElementsInFocusZones, allowFocusRoot, tabbable) {
  if (!currentElement || !allowFocusRoot && currentElement === rootElement) {
    return null;
  }

  var isCurrentElementVisible = isElementVisible(currentElement); // Check its children.

  if (traverseChildren && isCurrentElementVisible && (includeElementsInFocusZones || !(isElementFocusZone(currentElement) || isElementFocusSubZone(currentElement)))) {
    var childMatch = getPreviousElement(rootElement, currentElement.lastElementChild, true, true, true, includeElementsInFocusZones, allowFocusRoot, tabbable);

    if (childMatch) {
      if (tabbable && isElementTabbable(childMatch, true) || !tabbable) {
        return childMatch;
      }

      var childMatchSiblingMatch = getPreviousElement(rootElement, childMatch.previousElementSibling, true, true, true, includeElementsInFocusZones, allowFocusRoot, tabbable);

      if (childMatchSiblingMatch) {
        return childMatchSiblingMatch;
      }

      var childMatchParent = childMatch.parentElement; // At this point if we have not found any potential matches
      // start looking at the rest of the subtree under the currentParent.
      // NOTE: We do not want to recurse here because doing so could
      // cause elements to get skipped.

      while (childMatchParent && childMatchParent !== currentElement) {
        var childMatchParentMatch = getPreviousElement(rootElement, childMatchParent.previousElementSibling, true, true, true, includeElementsInFocusZones, allowFocusRoot, tabbable);

        if (childMatchParentMatch) {
          return childMatchParentMatch;
        }

        childMatchParent = childMatchParent.parentElement;
      }
    }
  } // Check the current node, if it's not the first traversal.


  if (checkNode && isCurrentElementVisible && isElementTabbable(currentElement, tabbable)) {
    return currentElement;
  } // Check its previous sibling.


  var siblingMatch = getPreviousElement(rootElement, currentElement.previousElementSibling, true, true, true, includeElementsInFocusZones, allowFocusRoot, tabbable);

  if (siblingMatch) {
    return siblingMatch;
  } // Check its parent.


  if (!suppressParentTraversal) {
    return getPreviousElement(rootElement, currentElement.parentElement, true, false, false, includeElementsInFocusZones, allowFocusRoot, tabbable);
  }

  return null;
}
/**
 * Traverse to find the next focusable element.
 * If tabbable is true, the element must have tabIndex != -1.
 *
 * @public
 * @param checkNode - Include currentElement in search when true.
 */


function getNextElement(rootElement, currentElement, checkNode, suppressParentTraversal, suppressChildTraversal, includeElementsInFocusZones, allowFocusRoot, tabbable) {
  if (!currentElement || currentElement === rootElement && suppressChildTraversal && !allowFocusRoot) {
    return null;
  }

  var isCurrentElementVisible = isElementVisible(currentElement); // Check the current node, if it's not the first traversal.

  if (checkNode && isCurrentElementVisible && isElementTabbable(currentElement, tabbable)) {
    return currentElement;
  } // Check its children.


  if (!suppressChildTraversal && isCurrentElementVisible && (includeElementsInFocusZones || !(isElementFocusZone(currentElement) || isElementFocusSubZone(currentElement)))) {
    var childMatch = getNextElement(rootElement, currentElement.firstElementChild, true, true, false, includeElementsInFocusZones, allowFocusRoot, tabbable);

    if (childMatch) {
      return childMatch;
    }
  }

  if (currentElement === rootElement) {
    return null;
  } // Check its sibling.


  var siblingMatch = getNextElement(rootElement, currentElement.nextElementSibling, true, true, false, includeElementsInFocusZones, allowFocusRoot, tabbable);

  if (siblingMatch) {
    return siblingMatch;
  }

  if (!suppressParentTraversal) {
    return getNextElement(rootElement, currentElement.parentElement, false, false, true, includeElementsInFocusZones, allowFocusRoot, tabbable);
  }

  return null;
}
/**
 * Determines if an element is visible.
 *
 * @public
 */


function isElementVisible(element) {
  // If the element is not valid, return false.
  if (!element || !element.getAttribute) {
    return false;
  }

  var visibilityAttribute = element.getAttribute(IS_VISIBLE_ATTRIBUTE); // If the element is explicitly marked with the visibility attribute, return that value as boolean.

  if (visibilityAttribute !== null && visibilityAttribute !== undefined) {
    return visibilityAttribute === 'true';
  } // Fallback to other methods of determining actual visibility.


  return element.offsetHeight !== 0 || element.offsetParent !== null || // tslint:disable-next-line:no-any
  element.isVisible === true; // used as a workaround for testing.
}
/**
 * Determines if an element can receive focus programmatically or via a mouse click.
 * If checkTabIndex is true, additionally checks to ensure the element can be focused with the tab key, meaning tabIndex != -1.
 *
 * @public
 */


function isElementTabbable(element, checkTabIndex) {
  // If this element is null or is disabled, it is not considered tabbable.
  if (!element || element.disabled) {
    return false;
  }

  var tabIndex = 0;
  var tabIndexAttributeValue = null;

  if (element && element.getAttribute) {
    tabIndexAttributeValue = element.getAttribute('tabIndex');

    if (tabIndexAttributeValue) {
      tabIndex = parseInt(tabIndexAttributeValue, 10);
    }
  }

  var isFocusableAttribute = element.getAttribute ? element.getAttribute(IS_FOCUSABLE_ATTRIBUTE) : null;
  var isTabIndexSet = tabIndexAttributeValue !== null && tabIndex >= 0;
  var result = !!element && isFocusableAttribute !== 'false' && (element.tagName === 'A' || element.tagName === 'BUTTON' || element.tagName === 'INPUT' || element.tagName === 'TEXTAREA' || isFocusableAttribute === 'true' || isTabIndexSet);
  return checkTabIndex ? tabIndex !== -1 && result : result;
}
/**
 * Determines if a given element is a focus zone.
 *
 * @public
 */


function isElementFocusZone(element) {
  return !!(element && element.getAttribute && !!element.getAttribute(FOCUSZONE_ID_ATTRIBUTE));
}
/**
 * Determines if a given element is a focus sub zone.
 *
 * @public
 */


function isElementFocusSubZone(element) {
  return !!(element && element.getAttribute && element.getAttribute(FOCUSZONE_SUB_ATTRIBUTE) === 'true');
}
/**
 * Determines if an element, or any of its children, contain focus.
 *
 * @public
 */


function doesElementContainFocus(element) {
  var document = (0, _getDocument.getDocument)(element);
  var currentActiveElement = document && document.activeElement;

  if (currentActiveElement && (0, _elementContains.elementContains)(element, currentActiveElement)) {
    return true;
  }

  return false;
}
/**
 * Determines if an, or any of its ancestors, sepcificies that it doesn't want focus to wrap
 * @param element - element to start searching from
 * @param noWrapDataAttribute - the no wrap data attribute to match (either)
 * @returns true if focus should wrap, false otherwise
 */


function shouldWrapFocus(element, noWrapDataAttribute) {
  return (0, _elementContainsAttribute.elementContainsAttribute)(element, noWrapDataAttribute) === 'true' ? false : true;
}

var targetToFocusOnNextRepaint = undefined;
/**
 * Sets focus to an element asynchronously. The focus will be set at the next browser repaint,
 * meaning it won't cause any extra recalculations. If more than one focusAsync is called during one frame,
 * only the latest called focusAsync element will actually be focused
 * @param element - The element to focus
 */

function focusAsync(element) {
  if (element) {
    // An element was already queued to be focused, so replace that one with the new element
    if (targetToFocusOnNextRepaint) {
      targetToFocusOnNextRepaint = element;
      return;
    }

    targetToFocusOnNextRepaint = element;
    var win = (0, _getWindow.getWindow)(element);

    if (win) {
      // element.focus() is a no-op if the element is no longer in the DOM, meaning this is always safe
      win.requestAnimationFrame(function () {
        targetToFocusOnNextRepaint && targetToFocusOnNextRepaint.focus(); // We are done focusing for this frame, so reset the queued focus element

        targetToFocusOnNextRepaint = undefined;
      });
    }
  }
}
/**
 * Finds the closest focusable element via an index path from a parent. See
 * `getElementIndexPath` for getting an index path from an element to a child.
 */


function getFocusableByIndexPath(parent, path) {
  var element = parent;

  for (var _i = 0, path_1 = path; _i < path_1.length; _i++) {
    var index = path_1[_i];
    var nextChild = element.children[Math.min(index, element.children.length - 1)];

    if (!nextChild) {
      break;
    }

    element = nextChild;
  }

  element = isElementTabbable(element) && isElementVisible(element) ? element : getNextElement(parent, element, true) || getPreviousElement(parent, element);
  return element;
}
/**
 * Finds the element index path from a parent element to a child element.
 *
 * If you had this node structure: "A has children [B, C] and C has child D",
 * the index path from A to D would be [1, 0], or `parent.chidren[1].children[0]`.
 */


function getElementIndexPath(fromElement, toElement) {
  var path = [];

  while (toElement && fromElement && toElement !== fromElement) {
    var parent_1 = (0, _getParent.getParent)(toElement, true);

    if (parent_1 === null) {
      return [];
    }

    path.unshift(Array.prototype.indexOf.call(parent_1.children, toElement));
    toElement = parent_1;
  }

  return path;
}
},{"./dom/elementContainsAttribute":"s6vx","./dom/elementContains":"sre9","./dom/getParent":"E8U8","./dom/getWindow":"mtGO","./dom/getDocument":"NngM"}],"miKP":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.hoistMethods = hoistMethods;
exports.unhoistMethods = unhoistMethods;
var REACT_LIFECYCLE_EXCLUSIONS = ['setState', 'render', 'componentWillMount', 'UNSAFE_componentWillMount', 'componentDidMount', 'componentWillReceiveProps', 'UNSAFE_componentWillReceiveProps', 'shouldComponentUpdate', 'componentWillUpdate', 'getSnapshotBeforeUpdate', 'UNSAFE_componentWillUpdate', 'componentDidUpdate', 'componentWillUnmount'];
/**
 * Allows you to hoist methods, except those in an exclusion set from a source object into a destination object.
 *
 * @public
 * @param destination - The instance of the object to hoist the methods onto.
 * @param source - The instance of the object where the methods are hoisted from.
 * @param exclusions - (Optional) What methods to exclude from being hoisted.
 * @returns An array of names of methods that were hoisted.
 */

function hoistMethods( // tslint:disable-next-line:no-any
destination, // tslint:disable-next-line:no-any
source, exclusions) {
  if (exclusions === void 0) {
    exclusions = REACT_LIFECYCLE_EXCLUSIONS;
  }

  var hoisted = [];

  var _loop_1 = function (methodName) {
    if (typeof source[methodName] === 'function' && destination[methodName] === undefined && (!exclusions || exclusions.indexOf(methodName) === -1)) {
      hoisted.push(methodName);
      /* tslint:disable:no-function-expression */

      destination[methodName] = function () {
        source[methodName].apply(source, arguments);
      };
      /* tslint:enable */

    }
  };

  for (var methodName in source) {
    _loop_1(methodName);
  }

  return hoisted;
}
/**
 * Provides a method for convenience to unhoist hoisted methods.
 *
 * @public
 * @param source - The source object upon which methods were hoisted.
 * @param methodNames - An array of method names to unhoist.
 */
// tslint:disable-next-line:no-any


function unhoistMethods(source, methodNames) {
  methodNames.forEach(function (methodName) {
    return delete source[methodName];
  });
}
},{}],"OxAO":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.initializeComponentRef = initializeComponentRef;

var _extendComponent = require("./extendComponent");

/**
 * Helper to manage componentRef resolution. Internally appends logic to
 * lifetime methods to resolve componentRef to the passed in object.
 *
 * Usage: call initializeComponentRef(this) in the constructor,
 */
function initializeComponentRef(obj) {
  (0, _extendComponent.extendComponent)(obj, {
    componentDidMount: _onMount,
    componentDidUpdate: _onUpdate,
    componentWillUnmount: _onUnmount
  });
}

function _onMount() {
  _setComponentRef(this.props.componentRef, this);
}

function _onUpdate(prevProps) {
  if (prevProps.componentRef !== this.props.componentRef) {
    // tslint:disable-next-line:no-any
    _setComponentRef(prevProps.componentRef, null);

    _setComponentRef(this.props.componentRef, this);
  }
}

function _onUnmount() {
  _setComponentRef(this.props.componentRef, null);
}

function _setComponentRef(componentRef, value) {
  if (componentRef) {
    if (typeof componentRef === 'object') {
      componentRef.current = value;
    } else if (typeof componentRef === 'function') {
      componentRef(value);
    }
  }
}
},{"./extendComponent":"vjt7"}],"CSIR":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getInitials = getInitials;

/**
 * Regular expression matching characters to ignore when calculating the initials.
 * The first part matches characters within parenthesis, including the parenthesis.
 * The second part matches special ASCII characters except space, plus some unicode special characters.
 */
var UNWANTED_CHARS_REGEX = /\([^)]*\)|[\0-\u001F\!-/:-@\[-`\{-\u00BF\u0250-\u036F\uD800-\uFFFF]/g;
/**
 * Regular expression matching phone numbers. Applied after chars matching UNWANTED_CHARS_REGEX have been removed
 * and number has been trimmed for whitespaces
 */

var PHONENUMBER_REGEX = /^\d+[\d\s]*(:?ext|x|)\s*\d+$/i;
/** Regular expression matching one or more spaces. */

var MULTIPLE_WHITESPACES_REGEX = /\s+/g;
/**
 * Regular expression matching languages for which we currently don't support initials.
 * Arabic:   Arabic, Arabic Supplement, Arabic Extended-A.
 * Korean:   Hangul Jamo, Hangul Compatibility Jamo, Hangul Jamo Extended-A, Hangul Syllables, Hangul Jamo Extended-B.
 * Japanese: Hiragana, Katakana.
 * CJK:      CJK Unified Ideographs Extension A, CJK Unified Ideographs, CJK Compatibility Ideographs, CJK Unified Ideographs Extension B
 */

/* tslint:disable:max-line-length */

var UNSUPPORTED_TEXT_REGEX = /[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\u1100-\u11FF\u3130-\u318F\uA960-\uA97F\uAC00-\uD7AF\uD7B0-\uD7FF\u3040-\u309F\u30A0-\u30FF\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF]|[\uD840-\uD869][\uDC00-\uDED6]/;
/* tslint:enable:max-line-length */

function getInitialsLatin(displayName, isRtl) {
  var initials = '';
  var splits = displayName.split(' ');

  if (splits.length === 2) {
    initials += splits[0].charAt(0).toUpperCase();
    initials += splits[1].charAt(0).toUpperCase();
  } else if (splits.length === 3) {
    initials += splits[0].charAt(0).toUpperCase();
    initials += splits[2].charAt(0).toUpperCase();
  } else if (splits.length !== 0) {
    initials += splits[0].charAt(0).toUpperCase();
  }

  if (isRtl && initials.length > 1) {
    return initials.charAt(1) + initials.charAt(0);
  }

  return initials;
}

function cleanupDisplayName(displayName) {
  displayName = displayName.replace(UNWANTED_CHARS_REGEX, '');
  displayName = displayName.replace(MULTIPLE_WHITESPACES_REGEX, ' ');
  displayName = displayName.trim();
  return displayName;
}
/**
 * Get (up to 2 characters) initials based on display name of the persona.
 *
 * @public
 */


function getInitials(displayName, isRtl, allowPhoneInitials) {
  if (!displayName) {
    return '';
  }

  displayName = cleanupDisplayName(displayName); // For names containing CJK characters, and phone numbers, we don't display initials

  if (UNSUPPORTED_TEXT_REGEX.test(displayName) || !allowPhoneInitials && PHONENUMBER_REGEX.test(displayName)) {
    return '';
  }

  return getInitialsLatin(displayName, isRtl);
}
},{}],"em0I":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getItem = getItem;
exports.setItem = setItem;

var _getWindow = require("./dom/getWindow");

/**
 * Fetches an item from local storage without throwing an exception
 * @param key The key of the item to fetch from local storage
 */
function getItem(key) {
  var result = null;

  try {
    var win = (0, _getWindow.getWindow)();
    result = win ? win.localStorage.getItem(key) : null;
  } catch (e) {
    /* Eat the exception */
  }

  return result;
}
/**
 * Inserts an item into local storage without throwing an exception
 * @param key The key of the item to add to local storage
 * @param data The data to put into local storage
 */


function setItem(key, data) {
  try {
    var win = (0, _getWindow.getWindow)();
    win && win.localStorage.setItem(key, data);
  } catch (e) {
    /* Eat the exception */
  }
}
},{"./dom/getWindow":"mtGO"}],"sNmC":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getLanguage = getLanguage;
exports.setLanguage = setLanguage;

var _getDocument = require("./dom/getDocument");

var _localStorage = require("./localStorage");

// Default to undefined so that we initialize on first read.
var _language;
/**
 * Gets the rtl state of the page (returns true if in rtl.)
 *
 * @public
 */


function getLanguage() {
  if (_language === undefined) {
    var doc = (0, _getDocument.getDocument)();
    var savedLanguage = (0, _localStorage.getItem)('language');

    if (savedLanguage !== null) {
      _language = savedLanguage;
    }

    if (_language === undefined && doc) {
      _language = doc.documentElement.getAttribute('lang');
    }

    if (_language === undefined) {
      _language = 'en';
    }
  }

  return _language;
}
/**
 * Sets the rtl state of the page (by adjusting the dir attribute of the html element.)
 *
 * @public
 */


function setLanguage(language, avoidPersisting) {
  if (avoidPersisting === void 0) {
    avoidPersisting = false;
  }

  var doc = (0, _getDocument.getDocument)();

  if (doc) {
    doc.documentElement.setAttribute('lang', language);
  }

  if (!avoidPersisting) {
    (0, _localStorage.setItem)('language', language);
  }

  _language = language;
}
},{"./dom/getDocument":"NngM","./localStorage":"em0I"}],"XjLb":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getDistanceBetweenPoints = getDistanceBetweenPoints;
exports.fitContentToBounds = fitContentToBounds;
exports.calculatePrecision = calculatePrecision;
exports.precisionRound = precisionRound;

/**
 * Determines the distance between two points.
 *
 * @public
 */
function getDistanceBetweenPoints(point1, point2) {
  var distance = Math.sqrt(Math.pow(point1.x - point2.x, 2) + Math.pow(point1.y - point2.y, 2));
  return distance;
}
/**
 * Produces a proportionally-scaled version of an input content size when fit to a bounding size.
 * Given a `contentSize` and a `boundsSize`, this function scales `contentSize` proportionally
 * using either `contain` or `cover` fit behaviors.
 * Use this function to pre-calculate the layout for the CSS `object-fit` and `background-fit` behaviors.
 * With `contain`, the output size must be the largest it can be while completely within the `boundsSize`.
 * With `cover`, the output size must be the smallest it can be while completely around the `boundsSize`.
 * By default, there is a `maxScale` value of 1, which prevents the `contentSize` from being scaled larger.
 *
 * @param options - the options for the bounds fit operation
 */


function fitContentToBounds(options) {
  var contentSize = options.contentSize,
      boundsSize = options.boundsSize,
      _a = options.mode,
      mode = _a === void 0 ? 'contain' : _a,
      _b = options.maxScale,
      maxScale = _b === void 0 ? 1 : _b;
  var contentAspectRatio = contentSize.width / contentSize.height;
  var boundsAspectRatio = boundsSize.width / boundsSize.height;
  var scale;

  if (mode === 'contain' ? contentAspectRatio > boundsAspectRatio : contentAspectRatio < boundsAspectRatio) {
    scale = boundsSize.width / contentSize.width;
  } else {
    scale = boundsSize.height / contentSize.height;
  }

  var finalScale = Math.min(maxScale, scale);
  return {
    width: contentSize.width * finalScale,
    height: contentSize.height * finalScale
  };
}
/**
 * Calculates a number's precision based on the number of trailing
 * zeros if the number does not have a decimal indicated by a negative
 * precision. Otherwise, it calculates the number of digits after
 * the decimal point indicated by a positive precision.
 * @param value - the value to determine the precision of
 */


function calculatePrecision(value) {
  /**
   * Group 1:
   * [1-9]([0]+$) matches trailing zeros
   * Group 2:
   * \.([0-9]*) matches all digits after a decimal point.
   */
  var groups = /[1-9]([0]+$)|\.([0-9]*)/.exec(String(value));

  if (!groups) {
    return 0;
  }

  if (groups[1]) {
    return -groups[1].length;
  }

  if (groups[2]) {
    return groups[2].length;
  }

  return 0;
}
/**
 * Rounds a number to a certain level of precision. Accepts negative precision.
 * @param value - The value that is being rounded.
 * @param precision - The number of decimal places to round the number to
 */


function precisionRound(value, precision, base) {
  if (base === void 0) {
    base = 10;
  }

  var exp = Math.pow(base, precision);
  return Math.round(value * exp) / exp;
}
},{}],"rzwf":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.setMemoizeWeakMap = setMemoizeWeakMap;
exports.resetMemoizations = resetMemoizations;
exports.memoize = memoize;
exports.memoizeFunction = memoizeFunction;

var _mergeStyles = require("@uifabric/merge-styles");

var stylesheet = _mergeStyles.Stylesheet.getInstance();

if (stylesheet && stylesheet.onReset) {
  _mergeStyles.Stylesheet.getInstance().onReset(resetMemoizations);
}

var _resetCounter = 0;
var _emptyObject = {
  empty: true
};
var _dictionary = {};

var _weakMap = typeof WeakMap === 'undefined' ? null : WeakMap;
/**
 *  Test utility for providing a custom weakmap.
 *
 * @internal
 * */


function setMemoizeWeakMap(weakMap) {
  _weakMap = weakMap;
}
/**
 * Reset memoizations.
 */


function resetMemoizations() {
  _resetCounter++;
}
/**
 * Memoize decorator to be used on class methods. WARNING: the `this` reference
 * will be inaccessible within a memoized method, given that a cached method's `this`
 * would not be instance-specific.
 *
 * @public
 */


function memoize(target, key, descriptor) {
  // We bind to "null" to prevent people from inadvertently pulling values from "this",
  // rather than passing them in as input values which can be memoized.
  var fn = memoizeFunction(descriptor.value && descriptor.value.bind(null));
  return {
    configurable: true,
    get: function () {
      return fn;
    }
  };
}
/**
 * Memoizes a function; when you pass in the same parameters multiple times, it returns a cached result.
 * Be careful when passing in objects, you need to pass in the same INSTANCE for caching to work. Otherwise
 * it will grow the cache unnecessarily. Also avoid using default values that evaluate functions; passing in
 * undefined for a value and relying on a default function will execute it the first time, but will not
 * re-evaluate subsequent times which may have been unexpected.
 *
 * By default, the cache will reset after 100 permutations, to avoid abuse cases where the function is
 * unintendedly called with unique objects. Without a reset, the cache could grow infinitely, so we safeguard
 * by resetting. To override this behavior, pass a value of 0 to the maxCacheSize parameter.
 *
 * @public
 * @param cb - The function to memoize.
 * @param maxCacheSize - Max results to cache. If the cache exceeds this value, it will reset on the next call.
 * @returns A memoized version of the function.
 */


function memoizeFunction(cb, maxCacheSize) {
  if (maxCacheSize === void 0) {
    maxCacheSize = 100;
  } // Avoid breaking scenarios which don't have weak map.


  if (!_weakMap) {
    return cb;
  }

  var rootNode;
  var cacheSize = 0;
  var localResetCounter = _resetCounter; // tslint:disable-next-line:no-function-expression

  return function memoizedFunction() {
    var args = [];

    for (var _i = 0; _i < arguments.length; _i++) {
      args[_i] = arguments[_i];
    }

    var currentNode = rootNode;

    if (rootNode === undefined || localResetCounter !== _resetCounter || maxCacheSize > 0 && cacheSize > maxCacheSize) {
      rootNode = _createNode();
      cacheSize = 0;
      localResetCounter = _resetCounter;
    }

    currentNode = rootNode; // Traverse the tree until we find the match.

    for (var i = 0; i < args.length; i++) {
      var arg = _normalizeArg(args[i]);

      if (!currentNode.map.has(arg)) {
        currentNode.map.set(arg, _createNode());
      }

      currentNode = currentNode.map.get(arg);
    }

    if (!currentNode.hasOwnProperty('value')) {
      currentNode.value = cb.apply(void 0, args);
      cacheSize++;
    }

    return currentNode.value;
  };
}

function _normalizeArg(val) {
  if (!val) {
    return _emptyObject;
  } else if (typeof val === 'object' || typeof val === 'function') {
    return val;
  } else if (!_dictionary[val]) {
    _dictionary[val] = {
      val: val
    };
  }

  return _dictionary[val];
}

function _createNode() {
  return {
    map: _weakMap ? new _weakMap() : null
  };
}
},{"@uifabric/merge-styles":"w5wT"}],"J62f":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.merge = merge;

/**
 * Simple deep merge function. Takes all arguments and returns a deep copy of the objects merged
 * together in the order provided. If an object creates a circular reference, it will assign the
 * original reference.
 */
function merge(target) {
  var args = [];

  for (var _i = 1; _i < arguments.length; _i++) {
    args[_i - 1] = arguments[_i];
  }

  for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {
    var arg = args_1[_a];

    _merge(target || {}, arg);
  }

  return target;
}
/**
 * The _merge helper iterates through all props on source and assigns them to target.
 * When the value is an object, we will create a deep clone of the object. However if
 * there is a circular reference, the value will not be deep cloned and will persist
 * the reference.
 */
// tslint:disable-next-line:no-any


function _merge(target, source, circularReferences) {
  if (circularReferences === void 0) {
    circularReferences = [];
  }

  circularReferences.push(source);

  for (var name_1 in source) {
    if (source.hasOwnProperty(name_1)) {
      var value = source[name_1];

      if (typeof value === 'object') {
        var isCircularReference = circularReferences.indexOf(value) > -1; // tslint:disable-next-line:no-any

        target[name_1] = isCircularReference ? value : _merge(target[name_1] || {}, value, circularReferences);
      } else {
        target[name_1] = value;
      }
    }
  }

  circularReferences.pop();
  return target;
}
},{}],"rhvg":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.isIOS = void 0;

/**
 * Returns true if and only if the user is on a iOS device.
 * Used to determine whether iOS-specific behavior should be applied.
 */
var isIOS = function () {
  if (!window || !window.navigator || !window.navigator.userAgent) {
    return false;
  }

  return /iPad|iPhone|iPod/i.test(window.navigator.userAgent);
};

exports.isIOS = isIOS;
},{}],"uY0u":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.isMac = isMac;

var _getWindow = require("./dom/getWindow");

var isMacResult;
/**
 * Returns true if the user is on a Mac. Caches the result value.
 * @param reset - Reset the cached result value (mainly for testing).
 */

function isMac(reset) {
  if (typeof isMacResult === 'undefined' || reset) {
    var win = (0, _getWindow.getWindow)();
    var userAgent = win && win.navigator.userAgent;
    isMacResult = !!userAgent && userAgent.indexOf('Macintosh') !== -1;
  }

  return !!isMacResult;
}
},{"./dom/getWindow":"mtGO"}],"Zb2f":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.hasHorizontalOverflow = hasHorizontalOverflow;
exports.hasVerticalOverflow = hasVerticalOverflow;
exports.hasOverflow = hasOverflow;

/**
 * Detects whether an element's content has horizontal overflow
 *
 * @public
 * @param element - Element to check for overflow
 * @returns True if element's content overflows
 */
function hasHorizontalOverflow(element) {
  return element.clientWidth < element.scrollWidth;
}
/**
 * Detects whether an element's content has vertical overflow
 *
 * @public
 * @param element - Element to check for overflow
 * @returns True if element's content overflows
 */


function hasVerticalOverflow(element) {
  return element.clientHeight < element.scrollHeight;
}
/**
 * Detects whether an element's content has overflow in any direction
 *
 * @public
 * @param element - Element to check for overflow
 * @returns True if element's content overflows
 */


function hasOverflow(element) {
  return hasHorizontalOverflow(element) || hasVerticalOverflow(element);
}
},{}],"GUga":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getNativeProps = getNativeProps;
exports.divProperties = exports.imageProperties = exports.imgProperties = exports.iframeProperties = exports.formProperties = exports.colProperties = exports.colGroupProperties = exports.tdProperties = exports.thProperties = exports.trProperties = exports.tableProperties = exports.optionProperties = exports.selectProperties = exports.textAreaProperties = exports.inputProperties = exports.buttonProperties = exports.anchorProperties = exports.liProperties = exports.olProperties = exports.videoProperties = exports.audioProperties = exports.labelProperties = exports.htmlElementProperties = exports.baseElementProperties = exports.baseElementEvents = void 0;

var _object = require("./object");

/**
 * An array of events that are allowed on every html element type.
 *
 * @public
 */
var baseElementEvents = ['onCopy', 'onCut', 'onPaste', 'onCompositionEnd', 'onCompositionStart', 'onCompositionUpdate', 'onFocus', 'onFocusCapture', 'onBlur', 'onBlurCapture', 'onChange', 'onInput', 'onSubmit', 'onLoad', 'onError', 'onKeyDown', 'onKeyDownCapture', 'onKeyPress', 'onKeyUp', 'onAbort', 'onCanPlay', 'onCanPlayThrough', 'onDurationChange', 'onEmptied', 'onEncrypted', 'onEnded', 'onLoadedData', 'onLoadedMetadata', 'onLoadStart', 'onPause', 'onPlay', 'onPlaying', 'onProgress', 'onRateChange', 'onSeeked', 'onSeeking', 'onStalled', 'onSuspend', 'onTimeUpdate', 'onVolumeChange', 'onWaiting', 'onClick', 'onClickCapture', 'onContextMenu', 'onDoubleClick', 'onDrag', 'onDragEnd', 'onDragEnter', 'onDragExit', 'onDragLeave', 'onDragOver', 'onDragStart', 'onDrop', 'onMouseDown', 'onMouseDownCapture', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseOut', 'onMouseOver', 'onMouseUp', 'onMouseUpCapture', 'onSelect', 'onTouchCancel', 'onTouchEnd', 'onTouchMove', 'onTouchStart', 'onScroll', 'onWheel', 'onPointerCancel', 'onPointerDown', 'onPointerEnter', 'onPointerLeave', 'onPointerMove', 'onPointerOut', 'onPointerOver', 'onPointerUp', 'onGotPointerCapture', 'onLostPointerCapture'];
/**
 * An array of element attributes which are allowed on every html element type.
 *
 * @public
 */

exports.baseElementEvents = baseElementEvents;
var baseElementProperties = ['accessKey', 'children', 'className', 'contentEditable', 'dir', 'draggable', 'hidden', 'htmlFor', 'id', 'lang', 'role', 'style', 'tabIndex', 'title', 'translate', 'spellCheck', 'name' // global
];
/**
 * An array of HTML element properties and events.
 *
 * @public
 */

exports.baseElementProperties = baseElementProperties;
var htmlElementProperties = baseElementProperties.concat(baseElementEvents);
/**
 * An array of LABEL tag properties and events.
 *
 * @public
 */

exports.htmlElementProperties = htmlElementProperties;
var labelProperties = htmlElementProperties.concat(['form' // button, fieldset, input, label, meter, object, output, select, textarea
]);
/**
 * An array of AUDIO tag properties and events.
 *
 * @public
 */

exports.labelProperties = labelProperties;
var audioProperties = htmlElementProperties.concat(['height', 'loop', 'muted', 'preload', 'src', 'width' // canvas, embed, iframe, img, input, object, video
]);
/**
 * An array of VIDEO tag properties and events.
 *
 * @public
 */

exports.audioProperties = audioProperties;
var videoProperties = audioProperties.concat(['poster' // video
]);
/**
 * An array of OL tag properties and events.
 *
 * @public
 */

exports.videoProperties = videoProperties;
var olProperties = htmlElementProperties.concat(['start' // ol
]);
/**
 * An array of LI tag properties and events.
 *
 * @public
 */

exports.olProperties = olProperties;
var liProperties = htmlElementProperties.concat(['value' // button, input, li, option, meter, progress, param
]);
/**
 * An array of A tag properties and events.
 *
 * @public
 */

exports.liProperties = liProperties;
var anchorProperties = htmlElementProperties.concat(['download', 'href', 'hrefLang', 'media', 'rel', 'target', 'type' // a, button, input, link, menu, object, script, source, style
]);
/**
 * An array of BUTTON tag properties and events.
 *
 * @public
 */

exports.anchorProperties = anchorProperties;
var buttonProperties = htmlElementProperties.concat(['autoFocus', 'disabled', 'form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'type', 'value' // button, input, li, option, meter, progress, param,
]);
/**
 * An array of INPUT tag properties and events.
 *
 * @public
 */

exports.buttonProperties = buttonProperties;
var inputProperties = buttonProperties.concat(['accept', 'alt', 'autoComplete', 'checked', 'dirname', 'form', 'height', 'inputMode', 'list', 'max', 'maxLength', 'min', 'multiple', 'pattern', 'placeholder', 'readOnly', 'required', 'src', 'step', 'size', 'type', 'value', 'width' // canvas, embed, iframe, img, input, object, video
]);
/**
 * An array of TEXTAREA tag properties and events.
 *
 * @public
 */

exports.inputProperties = inputProperties;
var textAreaProperties = buttonProperties.concat(['cols', 'dirname', 'form', 'maxLength', 'placeholder', 'readOnly', 'required', 'rows', 'wrap' // textarea
]);
/**
 * An array of SELECT tag properties and events.
 *
 * @public
 */

exports.textAreaProperties = textAreaProperties;
var selectProperties = buttonProperties.concat(['form', 'multiple', 'required' // input, select, textarea
]);
exports.selectProperties = selectProperties;
var optionProperties = htmlElementProperties.concat(['selected', 'value' // button, input, li, option, meter, progress, param
]);
/**
 * An array of TABLE tag properties and events.
 *
 * @public
 */

exports.optionProperties = optionProperties;
var tableProperties = htmlElementProperties.concat(['cellPadding', 'cellSpacing' // table
]);
/**
 * An array of TR tag properties and events.
 *
 * @public
 */

exports.tableProperties = tableProperties;
var trProperties = htmlElementProperties;
/**
 * An array of TH tag properties and events.
 *
 * @public
 */

exports.trProperties = trProperties;
var thProperties = htmlElementProperties.concat(['rowSpan', 'scope' // th
]);
/**
 * An array of TD tag properties and events.
 *
 * @public
 */

exports.thProperties = thProperties;
var tdProperties = htmlElementProperties.concat(['colSpan', 'headers', 'rowSpan', 'scope' // th
]);
exports.tdProperties = tdProperties;
var colGroupProperties = htmlElementProperties.concat(['span' // col, colgroup
]);
exports.colGroupProperties = colGroupProperties;
var colProperties = htmlElementProperties.concat(['span' // col, colgroup
]);
/**
 * An array of FORM tag properties and events.
 *
 * @public
 */

exports.colProperties = colProperties;
var formProperties = htmlElementProperties.concat(['acceptCharset', 'action', 'encType', 'encType', 'method', 'noValidate', 'target' // form
]);
/**
 * An array of IFRAME tag properties and events.
 *
 * @public
 */

exports.formProperties = formProperties;
var iframeProperties = htmlElementProperties.concat(['allow', 'allowFullScreen', 'allowPaymentRequest', 'allowTransparency', 'csp', 'height', 'importance', 'referrerPolicy', 'sandbox', 'src', 'srcDoc', 'width' // canvas, embed, iframe, img, input, object, video,
]);
/**
 * An array of IMAGE tag properties and events.
 *
 * @public
 */

exports.iframeProperties = iframeProperties;
var imgProperties = htmlElementProperties.concat(['alt', 'crossOrigin', 'height', 'src', 'srcSet', 'useMap', 'width' // canvas, embed, iframe, img, input, object, video
]);
/**
 * @deprecated Use imgProperties for img elements.
 */

exports.imgProperties = imgProperties;
var imageProperties = imgProperties;
/**
 * An array of DIV tag properties and events.
 *
 * @public
 */

exports.imageProperties = imageProperties;
var divProperties = htmlElementProperties;
/**
 * Gets native supported props for an html element provided the allowance set. Use one of the property
 * sets defined (divProperties, buttonPropertes, etc) to filter out supported properties from a given
 * props set. Note that all data- and aria- prefixed attributes will be allowed.
 * NOTE: getNativeProps should always be applied first when adding props to a react component. The
 * non-native props should be applied second. This will prevent getNativeProps from overriding your custom props.
 * For example, if props passed to getNativeProps has an onClick function and getNativeProps is added to
 * the component after an onClick function is added, then the getNativeProps onClick will override it.
 *
 * @public
 * @param props - The unfiltered input props
 * @param allowedPropsNames-  The array of allowed propnames.
 * @returns The filtered props
 */

exports.divProperties = divProperties;

function getNativeProps(props, allowedPropNames, excludedPropNames) {
  return (0, _object.filteredAssign)(function (propName) {
    return (!excludedPropNames || excludedPropNames.indexOf(propName) < 0) && (propName.indexOf('data-') === 0 || propName.indexOf('aria-') === 0 || allowedPropNames.indexOf(propName) >= 0);
  }, {}, props);
}
},{"./object":"j10K"}],"ydPw":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getResourceUrl = getResourceUrl;
exports.setBaseUrl = setBaseUrl;
var _baseUrl = '';
/** Sets the current base url used for fetching images. */

function getResourceUrl(url) {
  return _baseUrl + url;
}
/** Gets the current base url used for fetching images. */


function setBaseUrl(baseUrl) {
  _baseUrl = baseUrl;
}
},{}],"FNaX":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getItem = getItem;
exports.setItem = setItem;

/**
 * Fetches an item from session storage without throwing an exception
 * @param key The key of the item to fetch from session storage
 */
function getItem(key) {
  var result = null;

  try {
    result = window.sessionStorage.getItem(key);
  } catch (e) {
    /* Eat the exception */
  }

  return result;
}
/**
 * Inserts an item into session storage without throwing an exception
 * @param key The key of the item to add to session storage
 * @param data The data to put into session storage
 */


function setItem(key, data) {
  try {
    window.sessionStorage.setItem(key, data);
  } catch (e) {
    /* Eat the exception */
  }
}
},{}],"JqET":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getRTL = getRTL;
exports.setRTL = setRTL;
exports.getRTLSafeKeyCode = getRTLSafeKeyCode;

var _KeyCodes = require("./KeyCodes");

var _getDocument = require("./dom/getDocument");

var _sessionStorage = require("./sessionStorage");

var _mergeStyles = require("@uifabric/merge-styles");

var RTL_LOCAL_STORAGE_KEY = 'isRTL'; // Default to undefined so that we initialize on first read.

var _isRTL;
/**
 * Gets the rtl state of the page (returns true if in rtl.)
 */


function getRTL() {
  if (_isRTL === undefined) {
    // Fabric supports persisting the RTL setting between page refreshes via session storage
    var savedRTL = (0, _sessionStorage.getItem)(RTL_LOCAL_STORAGE_KEY);

    if (savedRTL !== null) {
      _isRTL = savedRTL === '1';
      setRTL(_isRTL);
    }

    var doc = (0, _getDocument.getDocument)();

    if (_isRTL === undefined && doc) {
      _isRTL = (doc.body && doc.body.getAttribute('dir') || doc.documentElement.getAttribute('dir')) === 'rtl';
      (0, _mergeStyles.setRTL)(_isRTL);
    }
  }

  return !!_isRTL;
}
/**
 * Sets the rtl state of the page (by adjusting the dir attribute of the html element.)
 */


function setRTL(isRTL, persistSetting) {
  if (persistSetting === void 0) {
    persistSetting = false;
  }

  var doc = (0, _getDocument.getDocument)();

  if (doc) {
    doc.documentElement.setAttribute('dir', isRTL ? 'rtl' : 'ltr');
  }

  if (persistSetting) {
    (0, _sessionStorage.setItem)(RTL_LOCAL_STORAGE_KEY, isRTL ? '1' : '0');
  }

  _isRTL = isRTL;
  (0, _mergeStyles.setRTL)(_isRTL);
}
/**
 * Returns the given key, but flips right/left arrows if necessary.
 */


function getRTLSafeKeyCode(key) {
  if (getRTL()) {
    if (key === _KeyCodes.KeyCodes.left) {
      key = _KeyCodes.KeyCodes.right;
    } else if (key === _KeyCodes.KeyCodes.right) {
      key = _KeyCodes.KeyCodes.left;
    }
  }

  return key;
}
},{"./KeyCodes":"YHig","./dom/getDocument":"NngM","./sessionStorage":"FNaX","@uifabric/merge-styles":"w5wT"}],"uBzA":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.safeRequestAnimationFrame = void 0;

var _extendComponent = require("./extendComponent");

/**
 * Generates a function to be attached to a React component, which can be called
 * as a replacement to RAF. In-flight async calls will be auto canceled if the component
 * is unmounting before the async code is executed, preventing bugs where code
 * accesses things within the component after being unmounted.
 */
var safeRequestAnimationFrame = function (component) {
  var activeTimeouts;
  return function (cb) {
    if (!activeTimeouts) {
      activeTimeouts = new Set();
      (0, _extendComponent.extendComponent)(component, {
        componentWillUnmount: function () {
          activeTimeouts.forEach(function (id) {
            return cancelAnimationFrame(id);
          });
        }
      });
    }

    var timeoutId = requestAnimationFrame(function () {
      activeTimeouts.delete(timeoutId);
      cb();
    });
    activeTimeouts.add(timeoutId);
  };
};

exports.safeRequestAnimationFrame = safeRequestAnimationFrame;
},{"./extendComponent":"vjt7"}],"LskN":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.safeSetTimeout = void 0;

var _extendComponent = require("./extendComponent");

/**
 * Generates a function to be attached to a React component, which can be called
 * as a replacement to setTimeout. In-flight async calls will be auto canceled if the component
 * is unmounting before the async code is executed, preventing bugs where code
 * accesses things within the component after being unmounted.
 */
var safeSetTimeout = function (component) {
  var activeTimeouts;
  return function (cb, duration) {
    if (!activeTimeouts) {
      activeTimeouts = new Set();
      (0, _extendComponent.extendComponent)(component, {
        componentWillUnmount: function () {
          activeTimeouts.forEach(function (id) {
            return clearTimeout(id);
          });
        }
      });
    }

    var timeoutId = setTimeout(function () {
      activeTimeouts.delete(timeoutId);
      cb();
    }, duration);
    activeTimeouts.add(timeoutId);
  };
};

exports.safeSetTimeout = safeSetTimeout;
},{"./extendComponent":"vjt7"}],"EZxY":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.SelectionDirection = exports.SelectionMode = exports.SELECTION_CHANGE = void 0;
var SELECTION_CHANGE = 'change';
/**
 * {@docCategory Selection}
 */

exports.SELECTION_CHANGE = SELECTION_CHANGE;
var SelectionMode;
exports.SelectionMode = SelectionMode;

(function (SelectionMode) {
  SelectionMode[SelectionMode["none"] = 0] = "none";
  SelectionMode[SelectionMode["single"] = 1] = "single";
  SelectionMode[SelectionMode["multiple"] = 2] = "multiple";
})(SelectionMode || (exports.SelectionMode = SelectionMode = {}));
/**
 * {@docCategory Selection}
 */


var SelectionDirection;
exports.SelectionDirection = SelectionDirection;

(function (SelectionDirection) {
  SelectionDirection[SelectionDirection["horizontal"] = 0] = "horizontal";
  SelectionDirection[SelectionDirection["vertical"] = 1] = "vertical";
})(SelectionDirection || (exports.SelectionDirection = SelectionDirection = {}));
},{}],"azPD":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Selection = void 0;

var _Selection = require("./Selection.types");

var _EventGroup = require("../EventGroup");

/**
 * {@docCategory Selection}
 */
var Selection =
/** @class */
function () {
  function Selection(options) {
    if (options === void 0) {
      options = {};
    }

    var onSelectionChanged = options.onSelectionChanged,
        getKey = options.getKey,
        _a = options.canSelectItem,
        canSelectItem = _a === void 0 ? function (item) {
      return true;
    } : _a,
        _b = options.selectionMode,
        selectionMode = _b === void 0 ? _Selection.SelectionMode.multiple : _b;
    this.mode = selectionMode;
    this._getKey = getKey || defaultGetKey;
    this._changeEventSuppressionCount = 0;
    this._exemptedCount = 0;
    this._anchoredIndex = 0;
    this._unselectableCount = 0;
    this._onSelectionChanged = onSelectionChanged;
    this._canSelectItem = canSelectItem;
    this._isModal = false;
    this.setItems([], true);
    this.count = this.getSelectedCount();
  }

  Selection.prototype.canSelectItem = function (item, index) {
    if (typeof index === 'number' && index < 0) {
      return false;
    }

    return this._canSelectItem(item, index);
  };

  Selection.prototype.getKey = function (item, index) {
    var key = this._getKey(item, index);

    return typeof key === 'number' || key ? "" + key : '';
  };

  Selection.prototype.setChangeEvents = function (isEnabled, suppressChange) {
    this._changeEventSuppressionCount += isEnabled ? -1 : 1;

    if (this._changeEventSuppressionCount === 0 && this._hasChanged) {
      this._hasChanged = false;

      if (!suppressChange) {
        this._change();
      }
    }
  };

  Selection.prototype.isModal = function () {
    return this._isModal;
  };

  Selection.prototype.setModal = function (isModal) {
    if (this._isModal !== isModal) {
      this.setChangeEvents(false);
      this._isModal = isModal;

      if (!isModal) {
        this.setAllSelected(false);
      }

      this._change();

      this.setChangeEvents(true);
    }
  };
  /**
   * Selection needs the items, call this method to set them. If the set
   * of items is the same, this will re-evaluate selection and index maps.
   * Otherwise, shouldClear should be set to true, so that selection is
   * cleared.
   */


  Selection.prototype.setItems = function (items, shouldClear) {
    if (shouldClear === void 0) {
      shouldClear = true;
    }

    var newKeyToIndexMap = {};
    var newUnselectableIndices = {};
    var hasSelectionChanged = false;
    this.setChangeEvents(false); // Reset the unselectable count.

    this._unselectableCount = 0; // Build lookup table for quick selection evaluation.

    for (var i = 0; i < items.length; i++) {
      var item = items[i];

      if (item) {
        var key = this.getKey(item, i);

        if (key) {
          newKeyToIndexMap[key] = i;
        }
      }

      newUnselectableIndices[i] = item && !this.canSelectItem(item);

      if (newUnselectableIndices[i]) {
        this._unselectableCount++;
      }
    }

    if (shouldClear || items.length === 0) {
      this._setAllSelected(false, true);
    } // Check the exemption list for discrepencies.


    var newExemptedIndicies = {};
    var newExemptedCount = 0;

    for (var indexProperty in this._exemptedIndices) {
      if (this._exemptedIndices.hasOwnProperty(indexProperty)) {
        var index = Number(indexProperty);
        var item = this._items[index];
        var exemptKey = item ? this.getKey(item, Number(index)) : undefined;
        var newIndex = exemptKey ? newKeyToIndexMap[exemptKey] : index;

        if (newIndex === undefined) {
          // The item has likely been replaced or removed.
          hasSelectionChanged = true;
        } else {
          // We know the new index of the item. update the existing exemption table.
          newExemptedIndicies[newIndex] = true;
          newExemptedCount++;
          hasSelectionChanged = hasSelectionChanged || newIndex !== index;
        }
      }
    }

    if (this._items && this._exemptedCount === 0 && items.length !== this._items.length && this._isAllSelected) {
      // If everything was selected but the number of items has changed, selection has changed.
      hasSelectionChanged = true;
    }

    this._exemptedIndices = newExemptedIndicies;
    this._exemptedCount = newExemptedCount;
    this._keyToIndexMap = newKeyToIndexMap;
    this._unselectableIndices = newUnselectableIndices;
    this._items = items;
    this._selectedItems = null;

    if (hasSelectionChanged) {
      this._updateCount();

      this._change();
    }

    this.setChangeEvents(true);
  };

  Selection.prototype.getItems = function () {
    return this._items;
  };

  Selection.prototype.getSelection = function () {
    if (!this._selectedItems) {
      this._selectedItems = [];
      var items = this._items;

      if (items) {
        for (var i = 0; i < items.length; i++) {
          if (this.isIndexSelected(i)) {
            this._selectedItems.push(items[i]);
          }
        }
      }
    }

    return this._selectedItems;
  };

  Selection.prototype.getSelectedCount = function () {
    return this._isAllSelected ? this._items.length - this._exemptedCount - this._unselectableCount : this._exemptedCount;
  };

  Selection.prototype.getSelectedIndices = function () {
    if (!this._selectedIndices) {
      this._selectedIndices = [];
      var items = this._items;

      if (items) {
        for (var i = 0; i < items.length; i++) {
          if (this.isIndexSelected(i)) {
            this._selectedIndices.push(i);
          }
        }
      }
    }

    return this._selectedIndices;
  };

  Selection.prototype.isRangeSelected = function (fromIndex, count) {
    if (count === 0) {
      return false;
    }

    var endIndex = fromIndex + count;

    for (var i = fromIndex; i < endIndex; i++) {
      if (!this.isIndexSelected(i)) {
        return false;
      }
    }

    return true;
  };

  Selection.prototype.isAllSelected = function () {
    var selectableCount = this._items.length - this._unselectableCount; // In single mode, we can only have a max of 1 item.

    if (this.mode === _Selection.SelectionMode.single) {
      selectableCount = Math.min(selectableCount, 1);
    }

    return this.count > 0 && this._isAllSelected && this._exemptedCount === 0 || !this._isAllSelected && this._exemptedCount === selectableCount && selectableCount > 0;
  };

  Selection.prototype.isKeySelected = function (key) {
    var index = this._keyToIndexMap[key];
    return this.isIndexSelected(index);
  };

  Selection.prototype.isIndexSelected = function (index) {
    return !!(this.count > 0 && this._isAllSelected && !this._exemptedIndices[index] && !this._unselectableIndices[index] || !this._isAllSelected && this._exemptedIndices[index]);
  };

  Selection.prototype.setAllSelected = function (isAllSelected) {
    if (isAllSelected && this.mode !== _Selection.SelectionMode.multiple) {
      return;
    }

    var selectableCount = this._items ? this._items.length - this._unselectableCount : 0;
    this.setChangeEvents(false);

    if (selectableCount > 0 && (this._exemptedCount > 0 || isAllSelected !== this._isAllSelected)) {
      this._exemptedIndices = {};

      if (isAllSelected !== this._isAllSelected || this._exemptedCount > 0) {
        this._exemptedCount = 0;
        this._isAllSelected = isAllSelected;

        this._change();
      }

      this._updateCount();
    }

    this.setChangeEvents(true);
  };

  Selection.prototype.setKeySelected = function (key, isSelected, shouldAnchor) {
    var index = this._keyToIndexMap[key];

    if (index >= 0) {
      this.setIndexSelected(index, isSelected, shouldAnchor);
    }
  };

  Selection.prototype.setIndexSelected = function (index, isSelected, shouldAnchor) {
    if (this.mode === _Selection.SelectionMode.none) {
      return;
    } // Clamp the index.


    index = Math.min(Math.max(0, index), this._items.length - 1); // No-op on out of bounds selections.

    if (index < 0 || index >= this._items.length) {
      return;
    }

    this.setChangeEvents(false);
    var isExempt = this._exemptedIndices[index];
    var canSelect = !this._unselectableIndices[index];

    if (canSelect) {
      if (isSelected && this.mode === _Selection.SelectionMode.single) {
        // If this is single-select, the previous selection should be removed.
        this._setAllSelected(false, true);
      } // Determine if we need to remove the exemption.


      if (isExempt && (isSelected && this._isAllSelected || !isSelected && !this._isAllSelected)) {
        delete this._exemptedIndices[index];
        this._exemptedCount--;
      } // Determine if we need to add the exemption.


      if (!isExempt && (isSelected && !this._isAllSelected || !isSelected && this._isAllSelected)) {
        this._exemptedIndices[index] = true;
        this._exemptedCount++;
      }

      if (shouldAnchor) {
        this._anchoredIndex = index;
      }
    }

    this._updateCount();

    this.setChangeEvents(true);
  };

  Selection.prototype.selectToKey = function (key, clearSelection) {
    this.selectToIndex(this._keyToIndexMap[key], clearSelection);
  };

  Selection.prototype.selectToIndex = function (index, clearSelection) {
    if (this.mode === _Selection.SelectionMode.none) {
      return;
    }

    if (this.mode === _Selection.SelectionMode.single) {
      this.setIndexSelected(index, true, true);
      return;
    }

    var anchorIndex = this._anchoredIndex || 0;
    var startIndex = Math.min(index, anchorIndex);
    var endIndex = Math.max(index, anchorIndex);
    this.setChangeEvents(false);

    if (clearSelection) {
      this._setAllSelected(false, true);
    }

    for (; startIndex <= endIndex; startIndex++) {
      this.setIndexSelected(startIndex, true, false);
    }

    this.setChangeEvents(true);
  };

  Selection.prototype.toggleAllSelected = function () {
    this.setAllSelected(!this.isAllSelected());
  };

  Selection.prototype.toggleKeySelected = function (key) {
    this.setKeySelected(key, !this.isKeySelected(key), true);
  };

  Selection.prototype.toggleIndexSelected = function (index) {
    this.setIndexSelected(index, !this.isIndexSelected(index), true);
  };

  Selection.prototype.toggleRangeSelected = function (fromIndex, count) {
    if (this.mode === _Selection.SelectionMode.none) {
      return;
    }

    var isRangeSelected = this.isRangeSelected(fromIndex, count);
    var endIndex = fromIndex + count;

    if (this.mode === _Selection.SelectionMode.single && count > 1) {
      return;
    }

    this.setChangeEvents(false);

    for (var i = fromIndex; i < endIndex; i++) {
      this.setIndexSelected(i, !isRangeSelected, false);
    }

    this.setChangeEvents(true);
  };

  Selection.prototype._updateCount = function (preserveModalState) {
    if (preserveModalState === void 0) {
      preserveModalState = false;
    }

    var count = this.getSelectedCount();

    if (count !== this.count) {
      this.count = count;

      this._change();
    }

    if (!this.count && !preserveModalState) {
      this.setModal(false);
    }
  };

  Selection.prototype._setAllSelected = function (isAllSelected, preserveModalState) {
    if (preserveModalState === void 0) {
      preserveModalState = false;
    }

    if (isAllSelected && this.mode !== _Selection.SelectionMode.multiple) {
      return;
    }

    var selectableCount = this._items ? this._items.length - this._unselectableCount : 0;
    this.setChangeEvents(false);

    if (selectableCount > 0 && (this._exemptedCount > 0 || isAllSelected !== this._isAllSelected)) {
      this._exemptedIndices = {};

      if (isAllSelected !== this._isAllSelected || this._exemptedCount > 0) {
        this._exemptedCount = 0;
        this._isAllSelected = isAllSelected;

        this._change();
      }

      this._updateCount(preserveModalState);
    }

    this.setChangeEvents(true);
  };

  Selection.prototype._change = function () {
    if (this._changeEventSuppressionCount === 0) {
      this._selectedItems = null;
      this._selectedIndices = undefined;

      _EventGroup.EventGroup.raise(this, _Selection.SELECTION_CHANGE);

      if (this._onSelectionChanged) {
        this._onSelectionChanged();
      }
    } else {
      this._hasChanged = true;
    }
  };

  return Selection;
}();

exports.Selection = Selection;

function defaultGetKey(item, index) {
  return item && item.key ? item.key : "" + index;
}
},{"./Selection.types":"EZxY","../EventGroup":"n8h2"}],"QtpN":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _Selection = require("./Selection.types");

Object.keys(_Selection).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Selection[key];
    }
  });
});

var _Selection2 = require("./Selection");

Object.keys(_Selection2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Selection2[key];
    }
  });
});
},{"./Selection.types":"EZxY","./Selection":"azPD"}],"jr8d":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.format = format;
// Regex that finds { and } so they can be removed on a lookup for string format
var FORMAT_ARGS_REGEX = /[\{\}]/g; // Regex that finds {#} so it can be replaced by the arguments in string format

var FORMAT_REGEX = /\{\d+\}/g;
/**
 * String format method, used for scenarios where at runtime you
 * need to evaluate a formatted string given a tokenized string. This
 * usually only is needed in localization scenarios.

 * @example
 * ```tsx
 * "I love {0} every {1}".format("CXP")
 * ```
 * will result in a Debug Exception.
 *
 * @public
 */
// tslint:disable-next-line:no-any

function format(s) {
  'use strict';

  var values = [];

  for (var _i = 1; _i < arguments.length; _i++) {
    values[_i - 1] = arguments[_i];
  }

  var args = values; // Callback match function

  function replace_func(match) {
    // looks up in the args
    // tslint:disable-next-line:no-any
    var replacement = args[match.replace(FORMAT_ARGS_REGEX, '')]; // catches undefined in nondebug and null in debug and nondebug

    if (replacement === null || replacement === undefined) {
      replacement = '';
    }

    return replacement;
  }

  return s.replace(FORMAT_REGEX, replace_func);
}
},{}],"f5Br":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.styled = styled;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _mergeStyles = require("@uifabric/merge-styles");

var _Customizations = require("./customizations/Customizations");

var _CustomizerContext = require("./customizations/CustomizerContext");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var DefaultFields = ['theme', 'styles'];
/**
 * The styled HOC wrapper allows you to create a functional wrapper around a given component which will resolve
 * getStyles functional props, and mix customized props passed in using concatStyleSets.
 *
 * @example
 * ```tsx
 * export const Toggle = styled(
 *   ToggleBase,
 *   props => ({ root: { background: 'red' }})
 * );
 * ```
 * @param Component - The unstyled base component to render, which receives styles.
 * @param baseStyles - The styles which should be curried with the component.
 * @param getProps - A helper which provides default props.
 * @param customizable - An object which defines which props can be customized using the Customizer.
 * @param pure - A boolean indicating if the component should avoid re-rendering when props haven't changed.
 * Note that pure should not be used on components which allow children, or take in complex objects or
 * arrays as props which could mutate on every render.
 */

function styled(Component, baseStyles, getProps, customizable, pure) {
  customizable = customizable || {
    scope: '',
    fields: undefined
  };
  var scope = customizable.scope,
      _a = customizable.fields,
      fields = _a === void 0 ? DefaultFields : _a;
  var ParentComponent = pure ? React.PureComponent : React.Component;

  var Wrapped =
  /** @class */
  function (_super) {
    tslib_1.__extends(Wrapped, _super);

    function Wrapped() {
      var _this = _super !== null && _super.apply(this, arguments) || this;

      _this._inCustomizerContext = false;

      _this._renderContent = function (context) {
        _this._inCustomizerContext = !!context.customizations.inCustomizerContext;

        var settings = _Customizations.Customizations.getSettings(fields, scope, context.customizations);

        var customizedStyles = settings.styles,
            dir = settings.dir,
            rest = tslib_1.__rest(settings, ["styles", "dir"]);

        var additionalProps = getProps ? getProps(_this.props) : undefined;

        _this._updateStyles(customizedStyles);

        return React.createElement(Component, tslib_1.__assign({}, rest, additionalProps, _this.props, {
          styles: _this._styles
        }));
      };

      _this._onSettingsChanged = function () {
        return _this.forceUpdate();
      };

      return _this;
    }

    Wrapped.prototype.render = function () {
      return React.createElement(_CustomizerContext.CustomizerContext.Consumer, null, this._renderContent);
    };

    Wrapped.prototype.componentDidMount = function () {
      if (!this._inCustomizerContext) {
        _Customizations.Customizations.observe(this._onSettingsChanged);
      }
    };

    Wrapped.prototype.componentWillUnmount = function () {
      if (!this._inCustomizerContext) {
        _Customizations.Customizations.unobserve(this._onSettingsChanged);
      }
    };

    Wrapped.prototype._updateStyles = function (customizedStyles) {
      var _this = this; // tslint:disable-next-line:no-any


      if (!this._styles || customizedStyles !== this._styles.__cachedInputs__[1] || !!this.props.styles) {
        // Cache the customized styles.
        // this._customizedStyles = customizedStyles;
        // Using styled components as the Component arg will result in nested styling arrays.
        this._styles = function (styleProps) {
          return _resolve(styleProps, baseStyles, customizedStyles, _this.props.styles);
        }; // The __cachedInputs__ array is attached to the function and consumed by the
        // classNamesFunction as a list of keys to include for memoizing classnames.
        // tslint:disable-next-line:no-any


        this._styles.__cachedInputs__ = [baseStyles, customizedStyles, this.props.styles];
      }
    }; // Function.prototype.name is an ES6 feature, so the cast to any is required until we're
    // able to drop IE 11 support and compile with ES6 libs
    // tslint:disable-next-line:no-any


    Wrapped.displayName = "Styled" + (Component.displayName || Component.name);
    return Wrapped;
  }(ParentComponent); // This preserves backwards compatibility.
  // tslint:disable-next-line:no-any


  return Wrapped;
}

function _resolve(styleProps) {
  var allStyles = [];

  for (var _i = 1; _i < arguments.length; _i++) {
    allStyles[_i - 1] = arguments[_i];
  }

  var result = [];

  for (var _a = 0, allStyles_1 = allStyles; _a < allStyles_1.length; _a++) {
    var styles = allStyles_1[_a];

    if (styles) {
      result.push(typeof styles === 'function' ? styles(styleProps) : styles);
    }
  }

  if (result.length === 1) {
    return result[0];
  } else if (result.length) {
    // cliffkoh: I cannot figure out how to avoid the cast to any here.
    // It is something to do with the use of Omit in IStyleSet.
    // It might not be necessary once  Omit becomes part of lib.d.ts (when we remove our own Omit and rely on
    // the official version).
    // tslint:disable-next-line:no-any
    return _mergeStyles.concatStyleSets.apply(void 0, result);
  }

  return {};
}
},{"tslib":"xgwM","react":"mpTF","@uifabric/merge-styles":"w5wT","./customizations/Customizations":"PUOB","./customizations/CustomizerContext":"bJts"}],"srd7":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _warn = require("./warn/warn");

Object.keys(_warn).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _warn[key];
    }
  });
});

var _warnConditionallyRequiredProps = require("./warn/warnConditionallyRequiredProps");

Object.keys(_warnConditionallyRequiredProps).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _warnConditionallyRequiredProps[key];
    }
  });
});

var _warnDeprecations = require("./warn/warnDeprecations");

Object.keys(_warnDeprecations).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _warnDeprecations[key];
    }
  });
});

var _warnMutuallyExclusive = require("./warn/warnMutuallyExclusive");

Object.keys(_warnMutuallyExclusive).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _warnMutuallyExclusive[key];
    }
  });
});
},{"./warn/warn":"aOi7","./warn/warnConditionallyRequiredProps":"U3x3","./warn/warnDeprecations":"eQmD","./warn/warnMutuallyExclusive":"yHHK"}],"MWIa":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.setFocusVisibility = setFocusVisibility;
exports.IsFocusVisibleClassName = void 0;

var _getWindow = require("./dom/getWindow");

var IsFocusVisibleClassName = 'ms-Fabric--isFocusVisible';
/**
 * Sets the visibility of focus styling.
 * By default, focus styling (the box surrounding a focused Button, for example) only show up when navigational
 * keypresses occur (through TAB, arrows, pgup/down, home and end), and are hidden when mouse interactions occur.
 * This API provides an imperative way to turn them on/off.
 * A use case might be when you have a keypress like ctrl-f6 navigate to a particular region on the page, and want focus to show up.
 *
 * @param enabled - whether to remove or add focus
 * @param target - optional target
 */

exports.IsFocusVisibleClassName = IsFocusVisibleClassName;

function setFocusVisibility(enabled, target) {
  var win = target ? (0, _getWindow.getWindow)(target) : (0, _getWindow.getWindow)();

  if (win) {
    var classList = win.document.body.classList;

    if (enabled) {
      classList.add(IsFocusVisibleClassName);
    } else {
      classList.remove(IsFocusVisibleClassName);
    }
  }
}
},{"./dom/getWindow":"mtGO"}],"RAPn":[function(require,module,exports) {
"use strict";

var _setVersion = require("@uifabric/set-version");

// @uifabric/utilities@6.45.0
// Do not modify this file, the file is generated as part of publish. The checked in version is a placeholder only.
(0, _setVersion.setVersion)('@uifabric/utilities', '6.45.0');
},{"@uifabric/set-version":"c7t6"}],"PHCX":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
var _exportNames = {
  setFocusVisibility: true,
  setSSR: true
};
Object.defineProperty(exports, "setFocusVisibility", {
  enumerable: true,
  get: function () {
    return _setFocusVisibility.setFocusVisibility;
  }
});
Object.defineProperty(exports, "setSSR", {
  enumerable: true,
  get: function () {
    return _setSSR.setSSR;
  }
});

var _Async = require("./Async");

Object.keys(_Async).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Async[key];
    }
  });
});

var _AutoScroll = require("./AutoScroll");

Object.keys(_AutoScroll).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _AutoScroll[key];
    }
  });
});

var _BaseComponent = require("./BaseComponent");

Object.keys(_BaseComponent).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _BaseComponent[key];
    }
  });
});

var _Context = require("./Context");

Object.keys(_Context).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Context[key];
    }
  });
});

var _DelayedRender = require("./DelayedRender");

Object.keys(_DelayedRender).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _DelayedRender[key];
    }
  });
});

var _EventGroup = require("./EventGroup");

Object.keys(_EventGroup).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _EventGroup[key];
    }
  });
});

var _FabricPerformance = require("./FabricPerformance");

Object.keys(_FabricPerformance).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _FabricPerformance[key];
    }
  });
});

var _GlobalSettings = require("./GlobalSettings");

Object.keys(_GlobalSettings).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _GlobalSettings[key];
    }
  });
});

var _KeyCodes = require("./KeyCodes");

Object.keys(_KeyCodes).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _KeyCodes[key];
    }
  });
});

var _Rectangle = require("./Rectangle");

Object.keys(_Rectangle).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Rectangle[key];
    }
  });
});

var _appendFunction = require("./appendFunction");

Object.keys(_appendFunction).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _appendFunction[key];
    }
  });
});

var _aria = require("./aria");

Object.keys(_aria).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _aria[key];
    }
  });
});

var _array = require("./array");

Object.keys(_array).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _array[key];
    }
  });
});

var _asAsync = require("./asAsync");

Object.keys(_asAsync).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _asAsync[key];
    }
  });
});

var _assertNever = require("./assertNever");

Object.keys(_assertNever).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _assertNever[key];
    }
  });
});

var _autobind = require("./autobind");

Object.keys(_autobind).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _autobind[key];
    }
  });
});

var _classNamesFunction = require("./classNamesFunction");

Object.keys(_classNamesFunction).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _classNamesFunction[key];
    }
  });
});

var _createRef = require("./createRef");

Object.keys(_createRef).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _createRef[key];
    }
  });
});

var _css = require("./css");

Object.keys(_css).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _css[key];
    }
  });
});

var _Customizations = require("./customizations/Customizations");

Object.keys(_Customizations).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Customizations[key];
    }
  });
});

var _Customizer = require("./customizations/Customizer");

Object.keys(_Customizer).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Customizer[key];
    }
  });
});

var _CustomizerContext = require("./customizations/CustomizerContext");

Object.keys(_CustomizerContext).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _CustomizerContext[key];
    }
  });
});

var _customizable = require("./customizations/customizable");

Object.keys(_customizable).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _customizable[key];
    }
  });
});

var _mergeCustomizations = require("./customizations/mergeCustomizations");

Object.keys(_mergeCustomizations).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _mergeCustomizations[key];
    }
  });
});

var _mergeSettings = require("./customizations/mergeSettings");

Object.keys(_mergeSettings).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _mergeSettings[key];
    }
  });
});

var _dom = require("./dom");

Object.keys(_dom).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _dom[key];
    }
  });
});

var _extendComponent = require("./extendComponent");

Object.keys(_extendComponent).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _extendComponent[key];
    }
  });
});

var _focus = require("./focus");

Object.keys(_focus).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _focus[key];
    }
  });
});

var _hoist = require("./hoist");

Object.keys(_hoist).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _hoist[key];
    }
  });
});

var _hoistStatics = require("./hoistStatics");

Object.keys(_hoistStatics).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _hoistStatics[key];
    }
  });
});

var _initializeComponentRef = require("./initializeComponentRef");

Object.keys(_initializeComponentRef).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _initializeComponentRef[key];
    }
  });
});

var _initializeFocusRects = require("./initializeFocusRects");

Object.keys(_initializeFocusRects).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _initializeFocusRects[key];
    }
  });
});

var _initials = require("./initials");

Object.keys(_initials).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _initials[key];
    }
  });
});

var _keyboard = require("./keyboard");

Object.keys(_keyboard).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _keyboard[key];
    }
  });
});

var _language = require("./language");

Object.keys(_language).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _language[key];
    }
  });
});

var _math = require("./math");

Object.keys(_math).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _math[key];
    }
  });
});

var _memoize = require("./memoize");

Object.keys(_memoize).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _memoize[key];
    }
  });
});

var _merge = require("./merge");

Object.keys(_merge).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _merge[key];
    }
  });
});

var _mobileDetector = require("./mobileDetector");

Object.keys(_mobileDetector).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _mobileDetector[key];
    }
  });
});

var _object = require("./object");

Object.keys(_object).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _object[key];
    }
  });
});

var _osDetector = require("./osDetector");

Object.keys(_osDetector).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _osDetector[key];
    }
  });
});

var _overflow = require("./overflow");

Object.keys(_overflow).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _overflow[key];
    }
  });
});

var _properties = require("./properties");

Object.keys(_properties).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _properties[key];
    }
  });
});

var _resources = require("./resources");

Object.keys(_resources).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _resources[key];
    }
  });
});

var _rtl = require("./rtl");

Object.keys(_rtl).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _rtl[key];
    }
  });
});

var _safeRequestAnimationFrame = require("./safeRequestAnimationFrame");

Object.keys(_safeRequestAnimationFrame).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _safeRequestAnimationFrame[key];
    }
  });
});

var _safeSetTimeout = require("./safeSetTimeout");

Object.keys(_safeSetTimeout).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _safeSetTimeout[key];
    }
  });
});

var _scroll = require("./scroll");

Object.keys(_scroll).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _scroll[key];
    }
  });
});

var _index = require("./selection/index");

Object.keys(_index).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index[key];
    }
  });
});

var _string = require("./string");

Object.keys(_string).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _string[key];
    }
  });
});

var _styled = require("./styled");

Object.keys(_styled).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _styled[key];
    }
  });
});

var _warn = require("./warn");

Object.keys(_warn).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _warn[key];
    }
  });
});

var _setFocusVisibility = require("./setFocusVisibility");

var _setSSR = require("./dom/setSSR");

require("./version");
},{"./Async":"JzaE","./AutoScroll":"mD02","./BaseComponent":"EfJk","./Context":"oo6l","./DelayedRender":"F1fh","./EventGroup":"n8h2","./FabricPerformance":"j9Va","./GlobalSettings":"hmlX","./KeyCodes":"YHig","./Rectangle":"MdWq","./appendFunction":"eGkY","./aria":"Miyv","./array":"jRHz","./asAsync":"VHwT","./assertNever":"LuVf","./autobind":"CzxO","./classNamesFunction":"cHjD","./createRef":"uNHc","./css":"kL5n","./customizations/Customizations":"PUOB","./customizations/Customizer":"oOPX","./customizations/CustomizerContext":"bJts","./customizations/customizable":"Ypg4","./customizations/mergeCustomizations":"R4Sr","./customizations/mergeSettings":"Chex","./dom":"P7UA","./extendComponent":"vjt7","./focus":"w6Tz","./hoist":"miKP","./hoistStatics":"QlrS","./initializeComponentRef":"OxAO","./initializeFocusRects":"Si1v","./initials":"CSIR","./keyboard":"JDbk","./language":"sNmC","./math":"XjLb","./memoize":"rzwf","./merge":"J62f","./mobileDetector":"rhvg","./object":"j10K","./osDetector":"uY0u","./overflow":"Zb2f","./properties":"GUga","./resources":"ydPw","./rtl":"JqET","./safeRequestAnimationFrame":"uBzA","./safeSetTimeout":"LskN","./scroll":"oLlr","./selection/index":"QtpN","./string":"jr8d","./styled":"f5Br","./warn":"srd7","./setFocusVisibility":"MWIa","./dom/setSSR":"tKHx","./version":"RAPn"}],"B5nc":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

require("./version");

var _utilities = require("@uifabric/utilities");

Object.keys(_utilities).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _utilities[key];
    }
  });
});
},{"./version":"xNUS","@uifabric/utilities":"PHCX"}],"L3Tw":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.IconType = void 0;

/**
 * @deprecated Icon type is inferred based on presence of `IIconProps.imageProps`
 */
var IconType;
exports.IconType = IconType;

(function (IconType) {
  /**
   * Render using the fabric icon font.
   * @deprecated Icon type is inferred based on presence of `IIconProps.imageProps`
   */
  IconType[IconType["default"] = 0] = "default";
  /**
   * Render using an image, where imageProps would be used.
   * @deprecated Icon type is inferred based on presence of `IIconProps.imageProps`
   */

  IconType[IconType["image"] = 1] = "image";
  /**
   * Deprecated, use `default`.
   * @deprecated Use `default`.
   */

  IconType[IconType["Default"] = 100000] = "Default";
  /**
   * Deprecated, use `image`.
   * @deprecated Use `image`.
   */

  IconType[IconType["Image"] = 100001] = "Image";
})(IconType || (exports.IconType = IconType = {}));
},{}],"BxHs":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ImageLoadState = exports.ImageCoverStyle = exports.ImageFit = void 0;

/**
 * The possible methods that can be used to fit the image.
 * {@docCategory Image}
 */
var ImageFit;
exports.ImageFit = ImageFit;

(function (ImageFit) {
  /**
   * The image is not scaled. The image is centered and cropped within the content box.
   */
  ImageFit[ImageFit["center"] = 0] = "center";
  /**
   * The image is scaled to maintain its aspect ratio while being fully contained within the frame. The image will
   * be centered horizontally and vertically within the frame. The space in the top and bottom or in the sides of
   * the frame will be empty depending on the difference in aspect ratio between the image and the frame.
   */

  ImageFit[ImageFit["contain"] = 1] = "contain";
  /**
   * The image is scaled to maintain its aspect ratio while filling the frame. Portions of the image will be cropped from
   * the top and bottom, or from the sides, depending on the difference in aspect ratio between the image and the frame.
   */

  ImageFit[ImageFit["cover"] = 2] = "cover";
  /**
   * Neither the image nor the frame are scaled. If their sizes do not match, the image will either be cropped or the
   * frame will have empty space.
   */

  ImageFit[ImageFit["none"] = 3] = "none";
  /**
   * The image will be centered horizontally and vertically within the frame and maintains its aspect ratio. It will
   * behave as ImageFit.center if the image's natural height or width is less than the Image frame's height or width,
   * but if both natural height and width are larger than the frame it will behave as ImageFit.cover.
   */

  ImageFit[ImageFit["centerCover"] = 4] = "centerCover";
  /**
   * The image will be centered horizontally and vertically within the frame and maintains its aspect ratio. It will
   * behave as ImageFit.center if the image's natural height and width is less than the Image frame's height and width,
   * but if either natural height or width are larger than the frame it will behave as ImageFit.contain.
   */

  ImageFit[ImageFit["centerContain"] = 5] = "centerContain";
})(ImageFit || (exports.ImageFit = ImageFit = {}));
/**
 * The cover style to be used on the image
 * {@docCategory Image}
 */


var ImageCoverStyle;
exports.ImageCoverStyle = ImageCoverStyle;

(function (ImageCoverStyle) {
  /**
   * The image will be shown at 100% height of container and the width will be scaled accordingly
   */
  ImageCoverStyle[ImageCoverStyle["landscape"] = 0] = "landscape";
  /**
   * The image will be shown at 100% width of container and the height will be scaled accordingly
   */

  ImageCoverStyle[ImageCoverStyle["portrait"] = 1] = "portrait";
})(ImageCoverStyle || (exports.ImageCoverStyle = ImageCoverStyle = {}));
/**
 * {@docCategory Image}
 */


var ImageLoadState;
exports.ImageLoadState = ImageLoadState;

(function (ImageLoadState) {
  /**
   * The image has not yet been loaded, and there is no error yet.
   */
  ImageLoadState[ImageLoadState["notLoaded"] = 0] = "notLoaded";
  /**
   * The image has been loaded successfully.
   */

  ImageLoadState[ImageLoadState["loaded"] = 1] = "loaded";
  /**
   * An error has been encountered while loading the image.
   */

  ImageLoadState[ImageLoadState["error"] = 2] = "error";
  /**
   * Deprecated at v1.3.6, to replace the src in case of errors, use `onLoadingStateChange` instead
   * and rerender the Image with a difference src.
   * @deprecated Use `onLoadingStateChange` instead
   * and rerender the Image with a difference src.
   */

  ImageLoadState[ImageLoadState["errorLoaded"] = 3] = "errorLoaded";
})(ImageLoadState || (exports.ImageLoadState = ImageLoadState = {}));
},{}],"uqL9":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ImageBase = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Utilities = require("../../Utilities");

var _Image = require("./Image.types");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var getClassNames = (0, _Utilities.classNamesFunction)();
var KEY_PREFIX = 'fabricImage';

var ImageBase =
/** @class */
function (_super) {
  tslib_1.__extends(ImageBase, _super);

  function ImageBase(props) {
    var _this = _super.call(this, props) || this; // Make an initial assumption about the image layout until we can
    // check the rendered element. The value here only takes effect when
    // shouldStartVisible is true.


    _this._coverStyle = _Image.ImageCoverStyle.portrait;
    _this._imageElement = React.createRef();
    _this._frameElement = React.createRef();

    _this._onImageLoaded = function (ev) {
      var _a = _this.props,
          src = _a.src,
          onLoad = _a.onLoad;

      if (onLoad) {
        onLoad(ev);
      }

      _this._computeCoverStyle(_this.props);

      if (src) {
        _this.setState({
          loadState: _Image.ImageLoadState.loaded
        });
      }
    };

    _this._onImageError = function (ev) {
      if (_this.props.onError) {
        _this.props.onError(ev);
      }

      _this.setState({
        loadState: _Image.ImageLoadState.error
      });
    };

    _this.state = {
      loadState: _Image.ImageLoadState.notLoaded
    };
    return _this;
  }

  ImageBase.prototype.componentWillReceiveProps = function (nextProps) {
    if (nextProps.src !== this.props.src) {
      this.setState({
        loadState: _Image.ImageLoadState.notLoaded
      });
    } else if (this.state.loadState === _Image.ImageLoadState.loaded) {
      this._computeCoverStyle(nextProps);
    }
  };

  ImageBase.prototype.componentDidUpdate = function (prevProps, prevState) {
    this._checkImageLoaded();

    if (this.props.onLoadingStateChange && prevState.loadState !== this.state.loadState) {
      this.props.onLoadingStateChange(this.state.loadState);
    }
  };

  ImageBase.prototype.render = function () {
    var imageProps = (0, _Utilities.getNativeProps)(this.props, _Utilities.imageProperties, ['width', 'height']);
    var _a = this.props,
        src = _a.src,
        alt = _a.alt,
        width = _a.width,
        height = _a.height,
        shouldFadeIn = _a.shouldFadeIn,
        shouldStartVisible = _a.shouldStartVisible,
        className = _a.className,
        imageFit = _a.imageFit,
        role = _a.role,
        maximizeFrame = _a.maximizeFrame,
        styles = _a.styles,
        theme = _a.theme;
    var loadState = this.state.loadState;
    var coverStyle = this.props.coverStyle !== undefined ? this.props.coverStyle : this._coverStyle;
    var classNames = getClassNames(styles, {
      theme: theme,
      className: className,
      width: width,
      height: height,
      maximizeFrame: maximizeFrame,
      shouldFadeIn: shouldFadeIn,
      shouldStartVisible: shouldStartVisible,
      isLoaded: loadState === _Image.ImageLoadState.loaded || loadState === _Image.ImageLoadState.notLoaded && this.props.shouldStartVisible,
      isLandscape: coverStyle === _Image.ImageCoverStyle.landscape,
      isCenter: imageFit === _Image.ImageFit.center,
      isCenterContain: imageFit === _Image.ImageFit.centerContain,
      isCenterCover: imageFit === _Image.ImageFit.centerCover,
      isContain: imageFit === _Image.ImageFit.contain,
      isCover: imageFit === _Image.ImageFit.cover,
      isNone: imageFit === _Image.ImageFit.none,
      isError: loadState === _Image.ImageLoadState.error,
      isNotImageFit: imageFit === undefined
    }); // If image dimensions aren't specified, the natural size of the image is used.

    return React.createElement("div", {
      className: classNames.root,
      style: {
        width: width,
        height: height
      },
      ref: this._frameElement
    }, React.createElement("img", tslib_1.__assign({}, imageProps, {
      onLoad: this._onImageLoaded,
      onError: this._onImageError,
      key: KEY_PREFIX + this.props.src || '',
      className: classNames.image,
      ref: this._imageElement,
      src: src,
      alt: alt,
      role: role
    })));
  };

  ImageBase.prototype._checkImageLoaded = function () {
    var src = this.props.src;
    var loadState = this.state.loadState;

    if (loadState === _Image.ImageLoadState.notLoaded) {
      // testing if naturalWidth and naturalHeight are greater than zero is better than checking
      // .complete, because .complete will also be set to true if the image breaks. However,
      // for some browsers, SVG images do not have a naturalWidth or naturalHeight, so fall back
      // to checking .complete for these images.
      var isLoaded = this._imageElement.current ? src && this._imageElement.current.naturalWidth > 0 && this._imageElement.current.naturalHeight > 0 || this._imageElement.current.complete && ImageBase._svgRegex.test(src) : false;

      if (isLoaded) {
        this._computeCoverStyle(this.props);

        this.setState({
          loadState: _Image.ImageLoadState.loaded
        });
      }
    }
  };

  ImageBase.prototype._computeCoverStyle = function (props) {
    var imageFit = props.imageFit,
        width = props.width,
        height = props.height; // Do not compute cover style if it was already specified in props

    if ((imageFit === _Image.ImageFit.cover || imageFit === _Image.ImageFit.contain || imageFit === _Image.ImageFit.centerContain || imageFit === _Image.ImageFit.centerCover) && this.props.coverStyle === undefined && this._imageElement.current && this._frameElement.current) {
      // Determine the desired ratio using the width and height props.
      // If those props aren't available, measure measure the frame.
      var desiredRatio = void 0;

      if (!!width && !!height && imageFit !== _Image.ImageFit.centerContain && imageFit !== _Image.ImageFit.centerCover) {
        desiredRatio = width / height;
      } else {
        desiredRatio = this._frameElement.current.clientWidth / this._frameElement.current.clientHeight;
      } // Examine the source image to determine its original ratio.


      var naturalRatio = this._imageElement.current.naturalWidth / this._imageElement.current.naturalHeight; // Should we crop from the top or the sides?

      if (naturalRatio > desiredRatio) {
        this._coverStyle = _Image.ImageCoverStyle.landscape;
      } else {
        this._coverStyle = _Image.ImageCoverStyle.portrait;
      }
    }
  };

  ImageBase.defaultProps = {
    shouldFadeIn: true
  };
  ImageBase._svgRegex = /\.svg$/i;
  return ImageBase;
}(React.Component);

exports.ImageBase = ImageBase;
},{"tslib":"xgwM","react":"mpTF","../../Utilities":"B5nc","./Image.types":"BxHs"}],"m3pw":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "InjectionMode", {
  enumerable: true,
  get: function () {
    return _mergeStyles.InjectionMode;
  }
});
Object.defineProperty(exports, "Stylesheet", {
  enumerable: true,
  get: function () {
    return _mergeStyles.Stylesheet;
  }
});
Object.defineProperty(exports, "concatStyleSets", {
  enumerable: true,
  get: function () {
    return _mergeStyles.concatStyleSets;
  }
});
Object.defineProperty(exports, "fontFace", {
  enumerable: true,
  get: function () {
    return _mergeStyles.fontFace;
  }
});
Object.defineProperty(exports, "keyframes", {
  enumerable: true,
  get: function () {
    return _mergeStyles.keyframes;
  }
});
Object.defineProperty(exports, "mergeStyleSets", {
  enumerable: true,
  get: function () {
    return _mergeStyles.mergeStyleSets;
  }
});
Object.defineProperty(exports, "mergeStyles", {
  enumerable: true,
  get: function () {
    return _mergeStyles.mergeStyles;
  }
});

var _mergeStyles = require("@uifabric/merge-styles");
},{"@uifabric/merge-styles":"w5wT"}],"fO4L":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.buildClassMap = buildClassMap;

var _MergeStyles = require("../MergeStyles");

/**
 * Builds a class names object from a given map.
 *
 * @param styles - Map of unprocessed styles.
 * @returns Map of property name to class name.
 */
function buildClassMap(styles) {
  var classes = {};

  var _loop_1 = function (styleName) {
    if (styles.hasOwnProperty(styleName)) {
      var className_1;
      Object.defineProperty(classes, styleName, {
        get: function () {
          if (className_1 === undefined) {
            // tslint:disable-next-line:no-any
            className_1 = (0, _MergeStyles.mergeStyles)(styles[styleName]).toString();
          }

          return className_1;
        },
        enumerable: true,
        configurable: true
      });
    }
  };

  for (var styleName in styles) {
    _loop_1(styleName);
  }

  return classes;
}
},{"../MergeStyles":"m3pw"}],"qS1A":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.registerIcons = registerIcons;
exports.unregisterIcons = unregisterIcons;
exports.registerIconAlias = registerIconAlias;
exports.getIcon = getIcon;
exports.setIconOptions = setIconOptions;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var _utilities = require("@uifabric/utilities");

var _mergeStyles = require("@uifabric/merge-styles");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var ICON_SETTING_NAME = 'icons';

var _iconSettings = _utilities.GlobalSettings.getValue(ICON_SETTING_NAME, {
  __options: {
    disableWarnings: false,
    warnOnMissingIcons: true
  },
  __remapped: {}
}); // Reset icon registration on stylesheet resets.


var stylesheet = _mergeStyles.Stylesheet.getInstance();

if (stylesheet && stylesheet.onReset) {
  stylesheet.onReset(function () {
    for (var name_1 in _iconSettings) {
      if (_iconSettings.hasOwnProperty(name_1) && !!_iconSettings[name_1].subset) {
        _iconSettings[name_1].subset.className = undefined;
      }
    }
  });
}
/**
 * Normalizes an icon name for consistent mapping.
 * Current implementation is to convert the icon name to lower case.
 *
 * @param name - Icon name to normalize.
 * @returns {string} Normalized icon name to use for indexing and mapping.
 */


var normalizeIconName = function (name) {
  return name.toLowerCase();
};
/**
 * Registers a given subset of icons.
 *
 * @param iconSubset - the icon subset definition.
 */


function registerIcons(iconSubset, options) {
  var subset = tslib_1.__assign({}, iconSubset, {
    isRegistered: false,
    className: undefined
  });

  var icons = iconSubset.icons; // Grab options, optionally mix user provided ones on top.

  options = options ? tslib_1.__assign({}, _iconSettings.__options, options) : _iconSettings.__options;

  for (var iconName in icons) {
    if (icons.hasOwnProperty(iconName)) {
      var code = icons[iconName];
      var normalizedIconName = normalizeIconName(iconName);

      if (_iconSettings[normalizedIconName]) {
        _warnDuplicateIcon(iconName);
      } else {
        _iconSettings[normalizedIconName] = {
          code: code,
          subset: subset
        };
      }
    }
  }
}
/**
 * Unregisters icons by name.
 *
 * @param iconNames - List of icons to unregister.
 */


function unregisterIcons(iconNames) {
  var options = _iconSettings.__options;

  var _loop_1 = function (iconName) {
    var normalizedIconName = normalizeIconName(iconName);

    if (_iconSettings[normalizedIconName]) {
      delete _iconSettings[normalizedIconName];
    } else {
      // Warn that we are trying to delete an icon that doesn't exist
      if (!options.disableWarnings) {
        (0, _utilities.warn)("The icon \"" + iconName + "\" tried to unregister but was not registered.");
      }
    } // Delete any aliases for this iconName


    if (_iconSettings.__remapped[normalizedIconName]) {
      delete _iconSettings.__remapped[normalizedIconName];
    } // Delete any items that were an alias for this iconName


    Object.keys(_iconSettings.__remapped).forEach(function (key) {
      if (_iconSettings.__remapped[key] === normalizedIconName) {
        delete _iconSettings.__remapped[key];
      }
    });
  };

  for (var _i = 0, iconNames_1 = iconNames; _i < iconNames_1.length; _i++) {
    var iconName = iconNames_1[_i];

    _loop_1(iconName);
  }
}
/**
 * Remaps one icon name to another.
 */


function registerIconAlias(iconName, mappedToName) {
  _iconSettings.__remapped[normalizeIconName(iconName)] = normalizeIconName(mappedToName);
}
/**
 * Gets an icon definition. If an icon is requested but the subset has yet to be registered,
 * it will get registered immediately.
 *
 * @public
 * @param name - Name of icon.
 */


function getIcon(name) {
  var icon = undefined;
  var options = _iconSettings.__options;
  name = name ? normalizeIconName(name) : '';
  name = _iconSettings.__remapped[name] || name;

  if (name) {
    icon = _iconSettings[name];

    if (icon) {
      var subset = icon.subset;

      if (subset && subset.fontFace) {
        if (!subset.isRegistered) {
          (0, _mergeStyles.fontFace)(subset.fontFace);
          subset.isRegistered = true;
        }

        if (!subset.className) {
          subset.className = (0, _mergeStyles.mergeStyles)(subset.style, {
            fontFamily: subset.fontFace.fontFamily,
            fontWeight: subset.fontFace.fontWeight || 'normal',
            fontStyle: subset.fontFace.fontStyle || 'normal'
          });
        }
      }
    } else {
      if (!options.disableWarnings && options.warnOnMissingIcons) {
        (0, _utilities.warn)("The icon \"" + name + "\" was used but not registered. See http://aka.ms/fabric-icon-usage for more information.");
      }
    }
  }

  return icon;
}
/**
 * Sets the icon options.
 *
 * @public
 */


function setIconOptions(options) {
  _iconSettings.__options = tslib_1.__assign({}, _iconSettings.__options, options);
}

var _missingIcons = [];
var _missingIconsTimer = undefined;

function _warnDuplicateIcon(iconName) {
  var options = _iconSettings.__options;
  var warningDelay = 2000;
  var maxIconsInMessage = 10;

  if (!options.disableWarnings) {
    _missingIcons.push(iconName);

    if (_missingIconsTimer === undefined) {
      _missingIconsTimer = setTimeout(function () {
        (0, _utilities.warn)("Some icons were re-registered. Applications should only call registerIcons for any given " + "icon once. Redefining what an icon is may have unintended consequences. Duplicates " + "include: \n" + _missingIcons.slice(0, maxIconsInMessage).join(', ') + (_missingIcons.length > maxIconsInMessage ? " (+ " + (_missingIcons.length - maxIconsInMessage) + " more)" : ''));
        _missingIconsTimer = undefined;
        _missingIcons = [];
      }, warningDelay);
    }
  }
}
},{"tslib":"xgwM","@uifabric/utilities":"PHCX","@uifabric/merge-styles":"w5wT"}],"UU6r":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getIconClassName = getIconClassName;

var _mergeStyles = require("@uifabric/merge-styles");

var _icons = require("./icons");

var defaultIconStyles = {
  display: 'inline-block'
};
/**
 * Gets an icon classname. You should be able to add this classname to an I tag with no
 * additional classnames, and render the icon.
 *
 * @public
 */

function getIconClassName(name) {
  var className = '';
  var icon = (0, _icons.getIcon)(name);

  if (icon) {
    className = (0, _mergeStyles.mergeStyles)(icon.subset.className, defaultIconStyles, {
      selectors: {
        '::before': {
          content: "\"" + icon.code + "\""
        }
      }
    });
  }

  return className;
}
},{"@uifabric/merge-styles":"w5wT","./icons":"qS1A"}],"mN76":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "buildClassMap", {
  enumerable: true,
  get: function () {
    return _buildClassMap.buildClassMap;
  }
});
Object.defineProperty(exports, "getIcon", {
  enumerable: true,
  get: function () {
    return _icons.getIcon;
  }
});
Object.defineProperty(exports, "registerIcons", {
  enumerable: true,
  get: function () {
    return _icons.registerIcons;
  }
});
Object.defineProperty(exports, "registerIconAlias", {
  enumerable: true,
  get: function () {
    return _icons.registerIconAlias;
  }
});
Object.defineProperty(exports, "unregisterIcons", {
  enumerable: true,
  get: function () {
    return _icons.unregisterIcons;
  }
});
Object.defineProperty(exports, "setIconOptions", {
  enumerable: true,
  get: function () {
    return _icons.setIconOptions;
  }
});
Object.defineProperty(exports, "getIconClassName", {
  enumerable: true,
  get: function () {
    return _getIconClassName.getIconClassName;
  }
});

var _buildClassMap = require("./buildClassMap");

var _icons = require("./icons");

var _getIconClassName = require("./getIconClassName");
},{"./buildClassMap":"fO4L","./icons":"qS1A","./getIconClassName":"UU6r"}],"e4zz":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.AnimationStyles = exports.AnimationVariables = void 0;

var _mergeStyles = require("@uifabric/merge-styles");

/* Register the keyframes */
var EASING_FUNCTION_1 = 'cubic-bezier(.1,.9,.2,1)';
var EASING_FUNCTION_2 = 'cubic-bezier(.1,.25,.75,.9)';
var DURATION_1 = '0.167s';
var DURATION_2 = '0.267s';
var DURATION_3 = '0.367s';
var DURATION_4 = '0.467s';
var FADE_IN = (0, _mergeStyles.keyframes)({
  from: {
    opacity: 0
  },
  to: {
    opacity: 1
  }
});
var FADE_OUT = (0, _mergeStyles.keyframes)({
  from: {
    opacity: 1
  },
  to: {
    opacity: 0
  }
});

var SLIDE_RIGHT_IN10 = _createSlideInX(-10);

var SLIDE_RIGHT_IN20 = _createSlideInX(-20);

var SLIDE_RIGHT_IN40 = _createSlideInX(-40);

var SLIDE_RIGHT_IN400 = _createSlideInX(-400);

var SLIDE_LEFT_IN10 = _createSlideInX(10);

var SLIDE_LEFT_IN20 = _createSlideInX(20);

var SLIDE_LEFT_IN40 = _createSlideInX(40);

var SLIDE_LEFT_IN400 = _createSlideInX(400);

var SLIDE_UP_IN10 = _createSlideInY(10);

var SLIDE_UP_IN20 = _createSlideInY(20);

var SLIDE_DOWN_IN10 = _createSlideInY(-10);

var SLIDE_DOWN_IN20 = _createSlideInY(-20);

var SLIDE_RIGHT_OUT10 = _createSlideOutX(10);

var SLIDE_RIGHT_OUT20 = _createSlideOutX(20);

var SLIDE_RIGHT_OUT40 = _createSlideOutX(40);

var SLIDE_RIGHT_OUT400 = _createSlideOutX(400);

var SLIDE_LEFT_OUT10 = _createSlideOutX(-10);

var SLIDE_LEFT_OUT20 = _createSlideOutX(-20);

var SLIDE_LEFT_OUT40 = _createSlideOutX(-40);

var SLIDE_LEFT_OUT400 = _createSlideOutX(-400);

var SLIDE_UP_OUT10 = _createSlideOutY(-10);

var SLIDE_UP_OUT20 = _createSlideOutY(-20);

var SLIDE_DOWN_OUT10 = _createSlideOutY(10);

var SLIDE_DOWN_OUT20 = _createSlideOutY(20);

var SCALE_UP100 = (0, _mergeStyles.keyframes)({
  from: {
    transform: 'scale3d(.98,.98,1)'
  },
  to: {
    transform: 'scale3d(1,1,1)'
  }
});
var SCALE_DOWN98 = (0, _mergeStyles.keyframes)({
  from: {
    transform: 'scale3d(1,1,1)'
  },
  to: {
    transform: 'scale3d(.98,.98,1)'
  }
});
var SCALE_DOWN100 = (0, _mergeStyles.keyframes)({
  from: {
    transform: 'scale3d(1.03,1.03,1)'
  },
  to: {
    transform: 'scale3d(1,1,1)'
  }
});
var SCALE_UP103 = (0, _mergeStyles.keyframes)({
  from: {
    transform: 'scale3d(1,1,1)'
  },
  to: {
    transform: 'scale3d(1.03,1.03,1)'
  }
});
var ROTATE90 = (0, _mergeStyles.keyframes)({
  from: {
    transform: 'rotateZ(0deg)'
  },
  to: {
    transform: 'rotateZ(90deg)'
  }
});
var ROTATE_N90 = (0, _mergeStyles.keyframes)({
  from: {
    transform: 'rotateZ(0deg)'
  },
  to: {
    transform: 'rotateZ(-90deg)'
  }
});
/**
 * Exporting raw duraction values and easing functions to be used in custom animations
 */

var AnimationVariables = {
  easeFunction1: EASING_FUNCTION_1,
  easeFunction2: EASING_FUNCTION_2,
  durationValue1: DURATION_1,
  durationValue2: DURATION_2,
  durationValue3: DURATION_3,
  durationValue4: DURATION_4
};
/**
 * All Fabric standard animations, exposed as json objects referencing predefined
 * keyframes. These objects can be mixed in with other class definitions.
 */

exports.AnimationVariables = AnimationVariables;
var AnimationStyles = {
  slideRightIn10: _createAnimation(FADE_IN + "," + SLIDE_RIGHT_IN10, DURATION_3, EASING_FUNCTION_1),
  slideRightIn20: _createAnimation(FADE_IN + "," + SLIDE_RIGHT_IN20, DURATION_3, EASING_FUNCTION_1),
  slideRightIn40: _createAnimation(FADE_IN + "," + SLIDE_RIGHT_IN40, DURATION_3, EASING_FUNCTION_1),
  slideRightIn400: _createAnimation(FADE_IN + "," + SLIDE_RIGHT_IN400, DURATION_3, EASING_FUNCTION_1),
  slideLeftIn10: _createAnimation(FADE_IN + "," + SLIDE_LEFT_IN10, DURATION_3, EASING_FUNCTION_1),
  slideLeftIn20: _createAnimation(FADE_IN + "," + SLIDE_LEFT_IN20, DURATION_3, EASING_FUNCTION_1),
  slideLeftIn40: _createAnimation(FADE_IN + "," + SLIDE_LEFT_IN40, DURATION_3, EASING_FUNCTION_1),
  slideLeftIn400: _createAnimation(FADE_IN + "," + SLIDE_LEFT_IN400, DURATION_3, EASING_FUNCTION_1),
  slideUpIn10: _createAnimation(FADE_IN + "," + SLIDE_UP_IN10, DURATION_3, EASING_FUNCTION_1),
  slideUpIn20: _createAnimation(FADE_IN + "," + SLIDE_UP_IN20, DURATION_3, EASING_FUNCTION_1),
  slideDownIn10: _createAnimation(FADE_IN + "," + SLIDE_DOWN_IN10, DURATION_3, EASING_FUNCTION_1),
  slideDownIn20: _createAnimation(FADE_IN + "," + SLIDE_DOWN_IN20, DURATION_3, EASING_FUNCTION_1),
  slideRightOut10: _createAnimation(FADE_OUT + "," + SLIDE_RIGHT_OUT10, DURATION_3, EASING_FUNCTION_1),
  slideRightOut20: _createAnimation(FADE_OUT + "," + SLIDE_RIGHT_OUT20, DURATION_3, EASING_FUNCTION_1),
  slideRightOut40: _createAnimation(FADE_OUT + "," + SLIDE_RIGHT_OUT40, DURATION_3, EASING_FUNCTION_1),
  slideRightOut400: _createAnimation(FADE_OUT + "," + SLIDE_RIGHT_OUT400, DURATION_3, EASING_FUNCTION_1),
  slideLeftOut10: _createAnimation(FADE_OUT + "," + SLIDE_LEFT_OUT10, DURATION_3, EASING_FUNCTION_1),
  slideLeftOut20: _createAnimation(FADE_OUT + "," + SLIDE_LEFT_OUT20, DURATION_3, EASING_FUNCTION_1),
  slideLeftOut40: _createAnimation(FADE_OUT + "," + SLIDE_LEFT_OUT40, DURATION_3, EASING_FUNCTION_1),
  slideLeftOut400: _createAnimation(FADE_OUT + "," + SLIDE_LEFT_OUT400, DURATION_3, EASING_FUNCTION_1),
  slideUpOut10: _createAnimation(FADE_OUT + "," + SLIDE_UP_OUT10, DURATION_3, EASING_FUNCTION_1),
  slideUpOut20: _createAnimation(FADE_OUT + "," + SLIDE_UP_OUT20, DURATION_3, EASING_FUNCTION_1),
  slideDownOut10: _createAnimation(FADE_OUT + "," + SLIDE_DOWN_OUT10, DURATION_3, EASING_FUNCTION_1),
  slideDownOut20: _createAnimation(FADE_OUT + "," + SLIDE_DOWN_OUT20, DURATION_3, EASING_FUNCTION_1),
  scaleUpIn100: _createAnimation(FADE_IN + "," + SCALE_UP100, DURATION_3, EASING_FUNCTION_1),
  scaleDownIn100: _createAnimation(FADE_IN + "," + SCALE_DOWN100, DURATION_3, EASING_FUNCTION_1),
  scaleUpOut103: _createAnimation(FADE_OUT + "," + SCALE_UP103, DURATION_1, EASING_FUNCTION_2),
  scaleDownOut98: _createAnimation(FADE_OUT + "," + SCALE_DOWN98, DURATION_1, EASING_FUNCTION_2),
  fadeIn100: _createAnimation(FADE_IN, DURATION_1, EASING_FUNCTION_2),
  fadeIn200: _createAnimation(FADE_IN, DURATION_2, EASING_FUNCTION_2),
  fadeIn400: _createAnimation(FADE_IN, DURATION_3, EASING_FUNCTION_2),
  fadeIn500: _createAnimation(FADE_IN, DURATION_4, EASING_FUNCTION_2),
  fadeOut100: _createAnimation(FADE_OUT, DURATION_1, EASING_FUNCTION_2),
  fadeOut200: _createAnimation(FADE_OUT, DURATION_2, EASING_FUNCTION_2),
  fadeOut400: _createAnimation(FADE_OUT, DURATION_3, EASING_FUNCTION_2),
  fadeOut500: _createAnimation(FADE_OUT, DURATION_4, EASING_FUNCTION_2),
  rotate90deg: _createAnimation(ROTATE90, '0.1s', EASING_FUNCTION_2),
  rotateN90deg: _createAnimation(ROTATE_N90, '0.1s', EASING_FUNCTION_2) // expandCollapse 100/200/400, delay 100/200

};
exports.AnimationStyles = AnimationStyles;

function _createAnimation(animationName, animationDuration, animationTimingFunction) {
  return {
    animationName: animationName,
    animationDuration: animationDuration,
    animationTimingFunction: animationTimingFunction,
    animationFillMode: 'both'
  };
}

function _createSlideInX(fromX) {
  return (0, _mergeStyles.keyframes)({
    from: {
      transform: "translate3d(" + fromX + "px,0,0)"
    },
    to: {
      transform: "translate3d(0,0,0)"
    }
  });
}

function _createSlideInY(fromY) {
  return (0, _mergeStyles.keyframes)({
    from: {
      transform: "translate3d(0," + fromY + "px,0)"
    },
    to: {
      transform: "translate3d(0,0,0)"
    }
  });
}

function _createSlideOutX(toX) {
  return (0, _mergeStyles.keyframes)({
    from: {
      transform: "translate3d(0,0,0)"
    },
    to: {
      transform: "translate3d(" + toX + "px,0,0)"
    }
  });
}

function _createSlideOutY(toY) {
  return (0, _mergeStyles.keyframes)({
    from: {
      transform: "translate3d(0,0,0)"
    },
    to: {
      transform: "translate3d(0," + toY + "px,0)"
    }
  });
}
},{"@uifabric/merge-styles":"w5wT"}],"KOmB":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.DefaultPalette = void 0;
// When adding or removing a color, make sure you keep this consistent with IColorClassNames by adding the color variants.
var DefaultPalette = {
  themeDarker: '#004578',
  themeDark: '#005a9e',
  themeDarkAlt: '#106ebe',
  themePrimary: '#0078d4',
  themeSecondary: '#2b88d8',
  themeTertiary: '#71afe5',
  themeLight: '#c7e0f4',
  themeLighter: '#deecf9',
  themeLighterAlt: '#eff6fc',
  black: '#000000',
  blackTranslucent40: 'rgba(0,0,0,.4)',
  neutralDark: '#212121',
  neutralPrimary: '#333333',
  neutralPrimaryAlt: '#3c3c3c',
  neutralSecondary: '#666666',
  neutralSecondaryAlt: '#767676',
  neutralTertiary: '#a6a6a6',
  neutralTertiaryAlt: '#c8c8c8',
  neutralQuaternary: '#d0d0d0',
  neutralQuaternaryAlt: '#dadada',
  neutralLight: '#eaeaea',
  neutralLighter: '#f4f4f4',
  neutralLighterAlt: '#f8f8f8',
  accent: '#0078d4',
  white: '#ffffff',
  whiteTranslucent40: 'rgba(255,255,255,.4)',
  yellowDark: '#d29200',
  yellow: '#ffb900',
  yellowLight: '#fff100',
  orange: '#d83b01',
  orangeLight: '#ea4300',
  orangeLighter: '#ff8c00',
  redDark: '#a80000',
  red: '#e81123',
  magentaDark: '#5c005c',
  magenta: '#b4009e',
  magentaLight: '#e3008c',
  purpleDark: '#32145a',
  purple: '#5c2d91',
  purpleLight: '#b4a0ff',
  blueDark: '#002050',
  blueMid: '#00188f',
  blue: '#0078d4',
  blueLight: '#00bcf2',
  tealDark: '#004b50',
  teal: '#008272',
  tealLight: '#00b294',
  greenDark: '#004b1c',
  green: '#107c10',
  greenLight: '#bad80a'
};
exports.DefaultPalette = DefaultPalette;
},{}],"eG5z":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.createFontStyles = createFontStyles;
exports.IconFontSizes = exports.FontWeights = exports.FontSizes = exports.LocalizedFontFamilies = exports.LocalizedFontNames = void 0;
// Fallback fonts, if specified system or web fonts are unavailable.
var FontFamilyFallbacks = "'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', sans-serif"; // Font face names to be registered.

var LocalizedFontNames;
exports.LocalizedFontNames = LocalizedFontNames;

(function (LocalizedFontNames) {
  LocalizedFontNames.Arabic = 'Segoe UI Web (Arabic)';
  LocalizedFontNames.Cyrillic = 'Segoe UI Web (Cyrillic)';
  LocalizedFontNames.EastEuropean = 'Segoe UI Web (East European)';
  LocalizedFontNames.Greek = 'Segoe UI Web (Greek)';
  LocalizedFontNames.Hebrew = 'Segoe UI Web (Hebrew)';
  LocalizedFontNames.Thai = 'Leelawadee UI Web';
  LocalizedFontNames.Vietnamese = 'Segoe UI Web (Vietnamese)';
  LocalizedFontNames.WestEuropean = 'Segoe UI Web (West European)';
  LocalizedFontNames.Selawik = 'Selawik Web';
})(LocalizedFontNames || (exports.LocalizedFontNames = LocalizedFontNames = {})); // Font families with fallbacks, for the general regions.


var LocalizedFontFamilies;
exports.LocalizedFontFamilies = LocalizedFontFamilies;

(function (LocalizedFontFamilies) {
  LocalizedFontFamilies.Arabic = "'" + LocalizedFontNames.Arabic + "'";
  LocalizedFontFamilies.ChineseSimplified = "'Microsoft Yahei UI', Verdana, Simsun";
  LocalizedFontFamilies.ChineseTraditional = "'Microsoft Jhenghei UI', Pmingliu";
  LocalizedFontFamilies.Cyrillic = "'" + LocalizedFontNames.Cyrillic + "'";
  LocalizedFontFamilies.EastEuropean = "'" + LocalizedFontNames.EastEuropean + "'";
  LocalizedFontFamilies.Greek = "'" + LocalizedFontNames.Greek + "'";
  LocalizedFontFamilies.Hebrew = "'" + LocalizedFontNames.Hebrew + "'";
  LocalizedFontFamilies.Hindi = "'Nirmala UI'";
  LocalizedFontFamilies.Japanese = "'Yu Gothic UI', 'Meiryo UI', Meiryo, 'MS Pgothic', Osaka";
  LocalizedFontFamilies.Korean = "'Malgun Gothic', Gulim";
  LocalizedFontFamilies.Selawik = "'" + LocalizedFontNames.Selawik + "'";
  LocalizedFontFamilies.Thai = "'Leelawadee UI Web', 'Kmer UI'";
  LocalizedFontFamilies.Vietnamese = "'" + LocalizedFontNames.Vietnamese + "'";
  LocalizedFontFamilies.WestEuropean = "'" + LocalizedFontNames.WestEuropean + "'";
})(LocalizedFontFamilies || (exports.LocalizedFontFamilies = LocalizedFontFamilies = {})); // By default, we favor system fonts for the default.
// All localized fonts use a web font and never use the system font.


var defaultFontFamily = "'Segoe UI', '" + LocalizedFontNames.WestEuropean + "'"; // Mapping of language prefix to to font family.

var LanguageToFontMap = {
  ar: LocalizedFontFamilies.Arabic,
  bg: LocalizedFontFamilies.Cyrillic,
  cs: LocalizedFontFamilies.EastEuropean,
  el: LocalizedFontFamilies.Greek,
  et: LocalizedFontFamilies.EastEuropean,
  he: LocalizedFontFamilies.Hebrew,
  hi: LocalizedFontFamilies.Hindi,
  hr: LocalizedFontFamilies.EastEuropean,
  hu: LocalizedFontFamilies.EastEuropean,
  ja: LocalizedFontFamilies.Japanese,
  kk: LocalizedFontFamilies.EastEuropean,
  ko: LocalizedFontFamilies.Korean,
  lt: LocalizedFontFamilies.EastEuropean,
  lv: LocalizedFontFamilies.EastEuropean,
  pl: LocalizedFontFamilies.EastEuropean,
  ru: LocalizedFontFamilies.Cyrillic,
  sk: LocalizedFontFamilies.EastEuropean,
  'sr-latn': LocalizedFontFamilies.EastEuropean,
  th: LocalizedFontFamilies.Thai,
  tr: LocalizedFontFamilies.EastEuropean,
  uk: LocalizedFontFamilies.Cyrillic,
  vi: LocalizedFontFamilies.Vietnamese,
  'zh-hans': LocalizedFontFamilies.ChineseSimplified,
  'zh-hant': LocalizedFontFamilies.ChineseTraditional
}; // Standard font sizes.

var FontSizes;
exports.FontSizes = FontSizes;

(function (FontSizes) {
  FontSizes.mini = '10px';
  FontSizes.xSmall = '11px';
  FontSizes.small = '12px';
  FontSizes.smallPlus = '13px';
  FontSizes.medium = '14px';
  FontSizes.mediumPlus = '15px';
  FontSizes.icon = '16px';
  FontSizes.large = '17px';
  FontSizes.xLarge = '21px';
  FontSizes.xLargePlus = '21px';
  FontSizes.xxLarge = '28px';
  FontSizes.xxLargePlus = '28px';
  FontSizes.superLarge = '42px';
  FontSizes.mega = '72px';
})(FontSizes || (exports.FontSizes = FontSizes = {})); // Standard font weights.


var FontWeights;
exports.FontWeights = FontWeights;

(function (FontWeights) {
  FontWeights.light = 100;
  FontWeights.semilight = 300;
  FontWeights.regular = 400;
  FontWeights.semibold = 600;
  FontWeights.bold = 700;
})(FontWeights || (exports.FontWeights = FontWeights = {})); // Standard Icon Sizes.


var IconFontSizes;
exports.IconFontSizes = IconFontSizes;

(function (IconFontSizes) {
  IconFontSizes.xSmall = '10px';
  IconFontSizes.small = '12px';
  IconFontSizes.medium = '16px';
  IconFontSizes.large = '20px';
})(IconFontSizes || (exports.IconFontSizes = IconFontSizes = {}));

function _fontFamilyWithFallbacks(fontFamily) {
  return fontFamily + ", " + FontFamilyFallbacks;
}

function createFontStyles(localeCode) {
  var localizedFont = _getLocalizedFontFamily(localeCode);

  var fontFamilyWithFallback = _fontFamilyWithFallbacks(localizedFont);

  var semilightFontFamilyWithFallback = fontFamilyWithFallback; // Chrome has a bug where it does not render Segoe UI Semilight correctly, so we force the webfont to be used in that case

  if (localizedFont === defaultFontFamily) {
    semilightFontFamilyWithFallback = _fontFamilyWithFallbacks(LocalizedFontFamilies.WestEuropean);
  }

  var fontStyles = {
    tiny: _createFont(FontSizes.mini, FontWeights.semibold, fontFamilyWithFallback),
    xSmall: _createFont(FontSizes.xSmall, FontWeights.regular, fontFamilyWithFallback),
    small: _createFont(FontSizes.small, FontWeights.regular, fontFamilyWithFallback),
    smallPlus: _createFont(FontSizes.smallPlus, FontWeights.regular, fontFamilyWithFallback),
    medium: _createFont(FontSizes.medium, FontWeights.regular, fontFamilyWithFallback),
    mediumPlus: _createFont(FontSizes.mediumPlus, FontWeights.regular, fontFamilyWithFallback),
    large: _createFont(FontSizes.large, FontWeights.semilight, semilightFontFamilyWithFallback),
    xLarge: _createFont(FontSizes.xLarge, FontWeights.light, fontFamilyWithFallback),
    xLargePlus: _createFont(FontSizes.xLargePlus, FontWeights.light, fontFamilyWithFallback),
    xxLarge: _createFont(FontSizes.xxLarge, FontWeights.light, fontFamilyWithFallback),
    xxLargePlus: _createFont(FontSizes.xxLargePlus, FontWeights.light, fontFamilyWithFallback),
    superLarge: _createFont(FontSizes.superLarge, FontWeights.light, fontFamilyWithFallback),
    mega: _createFont(FontSizes.mega, FontWeights.light, fontFamilyWithFallback)
  };
  return fontStyles;
}
/**
 * If there is a localized font for this language, return that. Returns undefined if there is no localized font for that language.
 */


function _getLocalizedFontFamily(language) {
  for (var lang in LanguageToFontMap) {
    if (LanguageToFontMap.hasOwnProperty(lang) && language && lang.indexOf(language) === 0) {
      // tslint:disable-next-line:no-any
      return LanguageToFontMap[lang];
    }
  }

  return defaultFontFamily;
}

function _createFont(size, weight, fontFamily) {
  return {
    fontFamily: fontFamily,
    MozOsxFontSmoothing: 'grayscale',
    WebkitFontSmoothing: 'antialiased',
    fontSize: size,
    fontWeight: weight
  };
}
},{}],"qmNj":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.registerDefaultFontFaces = registerDefaultFontFaces;
exports.DefaultFontStyles = void 0;

var _mergeStyles = require("@uifabric/merge-styles");

var _fonts = require("./fonts");

var _utilities = require("@uifabric/utilities");

// Default urls.
var DefaultBaseUrl = 'https://static2.sharepointonline.com/files/fabric/assets'; // Standard font styling.

var DefaultFontStyles = (0, _fonts.createFontStyles)((0, _utilities.getLanguage)());
exports.DefaultFontStyles = DefaultFontStyles;

function _registerFontFace(fontFamily, url, fontWeight, localFontName) {
  fontFamily = "'" + fontFamily + "'";
  var localFontSrc = localFontName !== undefined ? "local('" + localFontName + "')," : '';
  (0, _mergeStyles.fontFace)({
    fontFamily: fontFamily,
    src: localFontSrc + ("url('" + url + ".woff2') format('woff2'),") + ("url('" + url + ".woff') format('woff')"),
    fontWeight: fontWeight,
    fontStyle: 'normal'
  });
}

function _registerFontFaceSet(baseUrl, fontFamily, cdnFolder, cdnFontName, localFontName) {
  if (cdnFontName === void 0) {
    cdnFontName = 'segoeui';
  }

  var urlBase = baseUrl + "/" + cdnFolder + "/" + cdnFontName;

  _registerFontFace(fontFamily, urlBase + '-light', _fonts.FontWeights.light, localFontName && localFontName + ' Light');

  _registerFontFace(fontFamily, urlBase + '-semilight', _fonts.FontWeights.semilight, localFontName && localFontName + ' SemiLight');

  _registerFontFace(fontFamily, urlBase + '-regular', _fonts.FontWeights.regular, localFontName);

  _registerFontFace(fontFamily, urlBase + '-semibold', _fonts.FontWeights.semibold, localFontName && localFontName + ' SemiBold');
}

function registerDefaultFontFaces(baseUrl) {
  if (baseUrl) {
    var fontUrl = baseUrl + "/fonts"; // Produce @font-face definitions for all supported web fonts.

    _registerFontFaceSet(fontUrl, _fonts.LocalizedFontNames.Thai, 'leelawadeeui-thai', 'leelawadeeui');

    _registerFontFaceSet(fontUrl, _fonts.LocalizedFontNames.Arabic, 'segoeui-arabic');

    _registerFontFaceSet(fontUrl, _fonts.LocalizedFontNames.Cyrillic, 'segoeui-cyrillic');

    _registerFontFaceSet(fontUrl, _fonts.LocalizedFontNames.EastEuropean, 'segoeui-easteuropean');

    _registerFontFaceSet(fontUrl, _fonts.LocalizedFontNames.Greek, 'segoeui-greek');

    _registerFontFaceSet(fontUrl, _fonts.LocalizedFontNames.Hebrew, 'segoeui-hebrew');

    _registerFontFaceSet(fontUrl, _fonts.LocalizedFontNames.Vietnamese, 'segoeui-vietnamese');

    _registerFontFaceSet(fontUrl, _fonts.LocalizedFontNames.WestEuropean, 'segoeui-westeuropean', 'segoeui', 'Segoe UI');

    _registerFontFaceSet(fontUrl, _fonts.LocalizedFontFamilies.Selawik, 'selawik', 'selawik'); // Leelawadee UI (Thai) does not have a 'light' weight, so we override
    // the font-face generated above to use the 'semilight' weight instead.


    _registerFontFace('Leelawadee UI Web', fontUrl + "/leelawadeeui-thai/leelawadeeui-semilight", _fonts.FontWeights.light); // Leelawadee UI (Thai) does not have a 'semibold' weight, so we override
    // the font-face generated above to use the 'bold' weight instead.


    _registerFontFace('Leelawadee UI Web', fontUrl + "/leelawadeeui-thai/leelawadeeui-bold", _fonts.FontWeights.semibold);
  }
}
/**
 * Reads the fontBaseUrl from window.FabricConfig.fontBaseUrl or falls back to a default.
 */


function _getFontBaseUrl() {
  var win = (0, _utilities.getWindow)(); // tslint:disable-next-line:no-string-literal no-any

  var fabricConfig = win ? win['FabricConfig'] : undefined;
  return fabricConfig && fabricConfig.fontBaseUrl !== undefined ? fabricConfig.fontBaseUrl : DefaultBaseUrl;
}
/**
 * Register the font faces.
 */


registerDefaultFontFaces(_getFontBaseUrl());
},{"@uifabric/merge-styles":"w5wT","./fonts":"eG5z","@uifabric/utilities":"PHCX"}],"sM7y":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getScreenSelector = getScreenSelector;
exports.ScreenWidthMinUhfMobile = exports.ScreenWidthMaxXXLarge = exports.ScreenWidthMaxXLarge = exports.ScreenWidthMaxLarge = exports.ScreenWidthMaxMedium = exports.ScreenWidthMaxSmall = exports.ScreenWidthMinXXXLarge = exports.ScreenWidthMinXXLarge = exports.ScreenWidthMinXLarge = exports.ScreenWidthMinLarge = exports.ScreenWidthMinMedium = exports.ScreenWidthMinSmall = exports.HighContrastSelectorBlack = exports.HighContrastSelectorWhite = exports.HighContrastSelector = void 0;
var HighContrastSelector = '@media screen and (-ms-high-contrast: active)';
exports.HighContrastSelector = HighContrastSelector;
var HighContrastSelectorWhite = '@media screen and (-ms-high-contrast: black-on-white)';
exports.HighContrastSelectorWhite = HighContrastSelectorWhite;
var HighContrastSelectorBlack = '@media screen and (-ms-high-contrast: white-on-black)';
exports.HighContrastSelectorBlack = HighContrastSelectorBlack;
var ScreenWidthMinSmall = 320;
exports.ScreenWidthMinSmall = ScreenWidthMinSmall;
var ScreenWidthMinMedium = 480;
exports.ScreenWidthMinMedium = ScreenWidthMinMedium;
var ScreenWidthMinLarge = 640;
exports.ScreenWidthMinLarge = ScreenWidthMinLarge;
var ScreenWidthMinXLarge = 1024;
exports.ScreenWidthMinXLarge = ScreenWidthMinXLarge;
var ScreenWidthMinXXLarge = 1366;
exports.ScreenWidthMinXXLarge = ScreenWidthMinXXLarge;
var ScreenWidthMinXXXLarge = 1920;
exports.ScreenWidthMinXXXLarge = ScreenWidthMinXXXLarge;
var ScreenWidthMaxSmall = ScreenWidthMinMedium - 1;
exports.ScreenWidthMaxSmall = ScreenWidthMaxSmall;
var ScreenWidthMaxMedium = ScreenWidthMinLarge - 1;
exports.ScreenWidthMaxMedium = ScreenWidthMaxMedium;
var ScreenWidthMaxLarge = ScreenWidthMinXLarge - 1;
exports.ScreenWidthMaxLarge = ScreenWidthMaxLarge;
var ScreenWidthMaxXLarge = ScreenWidthMinXXLarge - 1;
exports.ScreenWidthMaxXLarge = ScreenWidthMaxXLarge;
var ScreenWidthMaxXXLarge = ScreenWidthMinXXXLarge - 1;
exports.ScreenWidthMaxXXLarge = ScreenWidthMaxXXLarge;
var ScreenWidthMinUhfMobile = 768;
exports.ScreenWidthMinUhfMobile = ScreenWidthMinUhfMobile;

function getScreenSelector(min, max) {
  return "@media only screen and (min-width: " + min + "px) and (max-width: " + max + "px)";
}
},{}],"yroA":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ZIndexes = void 0;
var ZIndexes;
exports.ZIndexes = ZIndexes;

(function (ZIndexes) {
  ZIndexes.Nav = 1;
  /**
   * @deprecated ScrollablePane
   */

  ZIndexes.ScrollablePane = 1;
  ZIndexes.FocusStyle = 1;
  ZIndexes.Coachmark = 1000;
  ZIndexes.Layer = 1000000;
  ZIndexes.KeytipLayer = 1000001;
})(ZIndexes || (exports.ZIndexes = ZIndexes = {}));
},{}],"Prht":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getFocusStyle = getFocusStyle;
exports.focusClear = focusClear;
exports.getFocusOutlineStyle = getFocusOutlineStyle;

var _CommonStyles = require("./CommonStyles");

var _utilities = require("@uifabric/utilities");

var _zIndexes = require("./zIndexes");

function getFocusStyle(theme, insetOrOptions, position, highContrastStyle, borderColor, outlineColor, isFocusedOnly) {
  if (typeof insetOrOptions === 'number' || !insetOrOptions) {
    return _getFocusStyleInternal(theme, {
      inset: insetOrOptions,
      position: position,
      highContrastStyle: highContrastStyle,
      borderColor: borderColor,
      outlineColor: outlineColor,
      isFocusedOnly: isFocusedOnly
    });
  } else {
    return _getFocusStyleInternal(theme, insetOrOptions);
  }
}

function _getFocusStyleInternal(theme, options) {
  if (options === void 0) {
    options = {};
  }

  var _a = options.inset,
      inset = _a === void 0 ? 0 : _a,
      _b = options.width,
      width = _b === void 0 ? 1 : _b,
      _c = options.position,
      position = _c === void 0 ? 'relative' : _c,
      highContrastStyle = options.highContrastStyle,
      _d = options.borderColor,
      borderColor = _d === void 0 ? theme.palette.white : _d,
      _e = options.outlineColor,
      outlineColor = _e === void 0 ? theme.palette.neutralSecondary : _e,
      _f = options.isFocusedOnly,
      isFocusedOnly = _f === void 0 ? true : _f;
  return {
    // Clear browser-specific focus styles and use 'transparent' as placeholder for focus style.
    outline: 'transparent',
    // Requirement because pseudo-element is absolutely positioned.
    position: position,
    selectors: (_g = {
      // Clear the focus border in Firefox.
      // Reference: http://stackoverflow.com/a/199319/1436671
      '::-moz-focus-inner': {
        border: '0'
      }
    }, // When the element that uses this mixin is in a :focus state, add a pseudo-element to
    // create a border.
    _g["." + _utilities.IsFocusVisibleClassName + " &" + (isFocusedOnly ? ':focus' : '') + ":after"] = {
      content: '""',
      position: 'absolute',
      left: inset + 1,
      top: inset + 1,
      bottom: inset + 1,
      right: inset + 1,
      border: width + "px solid " + borderColor,
      outline: width + "px solid " + outlineColor,
      zIndex: _zIndexes.ZIndexes.FocusStyle,
      selectors: (_h = {}, _h[_CommonStyles.HighContrastSelector] = highContrastStyle, _h)
    }, _g)
  };

  var _g, _h;
}
/**
 * Generates style to clear browser specific focus styles.
 */


function focusClear() {
  return {
    selectors: {
      '&::-moz-focus-inner': {
        // Clear the focus border in Firefox. Reference: http://stackoverflow.com/a/199319/1436671
        border: 0
      },
      '&': {
        // Clear browser specific focus styles and use transparent as placeholder for focus style
        outline: 'transparent'
      }
    }
  };
}
/**
 * Generates a style which can be used to set a border on focus.
 *
 * @param theme - The theme object to use.
 * @param inset - The number of pixels to inset the border (default 0)
 * @param width - The border width in pixels (default 1)
 * @param color - Color of the outline (default `theme.palette.neutralSecondary`)
 * @returns The style object.
 */


function getFocusOutlineStyle(theme, inset, width, color) {
  if (inset === void 0) {
    inset = 0;
  }

  if (width === void 0) {
    width = 1;
  }

  return {
    selectors: (_a = {}, _a[":global(" + _utilities.IsFocusVisibleClassName + ") &:focus"] = {
      outline: width + " solid " + (color || theme.palette.neutralSecondary),
      outlineOffset: -inset + "px"
    }, _a)
  };

  var _a;
}
},{"./CommonStyles":"sM7y","@uifabric/utilities":"PHCX","./zIndexes":"yroA"}],"G1Qy":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.hiddenContentStyle = void 0;
var hiddenContentStyle = {
  position: 'absolute',
  width: 1,
  height: 1,
  margin: -1,
  padding: 0,
  border: 0,
  overflow: 'hidden'
};
exports.hiddenContentStyle = hiddenContentStyle;
},{}],"WQU8":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.PulsingBeaconAnimationStyles = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var _mergeStyles = require("@uifabric/merge-styles");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var DEFAULT_DURATION = '14s';
var DEFAULT_DELAY = '2s';
var DEFAULT_ITERATION_COUNT = '1';

function _continuousPulseStepOne(beaconColorOne, innerDimension) {
  return {
    borderColor: beaconColorOne,
    borderWidth: '0px',
    width: innerDimension,
    height: innerDimension
  };
}

function _continuousPulseStepTwo(borderWidth) {
  return {
    opacity: 1,
    borderWidth: borderWidth
  };
}

function _continuousPulseStepThree() {
  return {
    opacity: 1
  };
}

function _continuousPulseStepFour(beaconColorTwo, outerDimension) {
  return {
    borderWidth: '0',
    width: outerDimension,
    height: outerDimension,
    opacity: 0,
    borderColor: beaconColorTwo
  };
}

function _continuousPulseStepFive(beaconColorOne, innerDimension) {
  return tslib_1.__assign({}, _continuousPulseStepOne(beaconColorOne, innerDimension), {
    opacity: 0
  });
}

function _continuousPulseAnimationDouble(beaconColorOne, beaconColorTwo, innerDimension, outerDimension, borderWidth) {
  return (0, _mergeStyles.keyframes)({
    '0%': _continuousPulseStepOne(beaconColorOne, innerDimension),
    '1.42%': _continuousPulseStepTwo(borderWidth),
    '3.57%': _continuousPulseStepThree(),
    '7.14%': _continuousPulseStepFour(beaconColorTwo, outerDimension),
    '8%': _continuousPulseStepFive(beaconColorOne, innerDimension),
    '29.99%': _continuousPulseStepFive(beaconColorOne, innerDimension),
    '30%': _continuousPulseStepOne(beaconColorOne, innerDimension),
    '31.42%': _continuousPulseStepTwo(borderWidth),
    '33.57%': _continuousPulseStepThree(),
    '37.14%': _continuousPulseStepFour(beaconColorTwo, outerDimension),
    '38%': _continuousPulseStepFive(beaconColorOne, innerDimension),
    '79.42%': _continuousPulseStepFive(beaconColorOne, innerDimension),
    '79.43': _continuousPulseStepOne(beaconColorOne, innerDimension),
    '81.85': _continuousPulseStepTwo(borderWidth),
    '83.42': _continuousPulseStepThree(),
    '87%': _continuousPulseStepFour(beaconColorTwo, outerDimension),
    '100%': {}
  });
}

function _continuousPulseAnimationSingle(beaconColorOne, beaconColorTwo, innerDimension, outerDimension, borderWidth) {
  return (0, _mergeStyles.keyframes)({
    '0%': _continuousPulseStepOne(beaconColorOne, innerDimension),
    '14.2%': _continuousPulseStepTwo(borderWidth),
    '35.7%': _continuousPulseStepThree(),
    '71.4%': _continuousPulseStepFour(beaconColorTwo, outerDimension),
    '100%': {}
  });
}

function _createDefaultAnimation(animationName, delayLength) {
  return {
    animationName: animationName,
    animationIterationCount: DEFAULT_ITERATION_COUNT,
    animationDuration: DEFAULT_DURATION,
    animationDelay: delayLength || DEFAULT_DELAY
  };
}

var PulsingBeaconAnimationStyles = {
  continuousPulseAnimationDouble: _continuousPulseAnimationDouble,
  continuousPulseAnimationSingle: _continuousPulseAnimationSingle,
  createDefaultAnimation: _createDefaultAnimation
};
exports.PulsingBeaconAnimationStyles = PulsingBeaconAnimationStyles;
},{"tslib":"xgwM","@uifabric/merge-styles":"w5wT"}],"ROTX":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getGlobalClassNames = getGlobalClassNames;

var _mergeStyles = require("@uifabric/merge-styles");

var _utilities = require("@uifabric/utilities");

/**
 * Internal memoized function which simply takes in the class map and the
 * disable boolean. These immutable values can be memoized.
 */
var _getGlobalClassNames = (0, _utilities.memoizeFunction)(function (classNames, disableGlobalClassNames) {
  var styleSheet = _mergeStyles.Stylesheet.getInstance();

  if (disableGlobalClassNames) {
    // disable global classnames
    return Object.keys(classNames).reduce(function (acc, className) {
      acc[className] = styleSheet.getClassName(classNames[className]);
      return acc;
    }, {});
  } // use global classnames


  return classNames;
});
/**
 * Checks for the `disableGlobalClassNames` property on the `theme` to determine if it should return `classNames`
 * Note that calls to this function are memoized.
 *
 * @param classNames - The collection of global class names that apply when the flag is false. Make sure to pass in
 * the same instance on each call to benefit from memoization.
 * @param theme - The theme to check the flag on
 * @param disableGlobalClassNames - Optional. Explicitly opt in/out of disabling global classnames. Defaults to false.
 */


function getGlobalClassNames(classNames, theme, disableGlobalClassNames) {
  return _getGlobalClassNames(classNames, disableGlobalClassNames !== undefined ? disableGlobalClassNames : theme.disableGlobalClassNames);
}
},{"@uifabric/merge-styles":"w5wT","@uifabric/utilities":"PHCX"}],"Pyih":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getThemedContext = getThemedContext;

var _utilities = require("@uifabric/utilities");

/**
 * @internal
 * This function is still in experimental phase in support of Foundation experimental development. Its API signature and existence
 * are subject to change.
 *
 * Modify context to activate the specified scheme or theme. For schemes, look in context (if available) and fall back to global
 * Customizations. If both scheme and theme are specified, scheme will be looked up in theme. In this case, scheme must be
 * present in theme arg, otherwise new context will default to theme arg (there is no fallback to settings to look up scheme.)
 *
 * @param context - Context in which to get schemed customizations.
 * @param scheme - Scheme to get customizations for from theme arg (if supplied) OR from context and global settings.
 * @param theme - Theme to merge into context.
 * @returns modified schemed context if scheme is valid and not already applied, unmodified context otherwise.
 */
function getThemedContext(context, scheme, theme) {
  var newContext = context;
  var newSettings; // Only fall back to context and customizations when theme arg is not provided.

  var schemeSource = theme || _utilities.Customizations.getSettings(['theme'], undefined, context.customizations).theme;

  if (theme) {
    newSettings = {
      theme: theme
    };
  }

  var schemeTheme = scheme && schemeSource && schemeSource.schemes && schemeSource.schemes[scheme]; // These first two checks are logically redundant but TS doesn't infer schemeSource.schemes is defined when schemeTheme is defined.

  if (schemeSource && schemeTheme && schemeSource !== schemeTheme) {
    newSettings = {
      theme: schemeTheme
    };
    newSettings.theme.schemes = schemeSource.schemes;
  }

  if (newSettings) {
    newContext = {
      customizations: {
        settings: (0, _utilities.mergeSettings)(context.customizations.settings, newSettings),
        scopedSettings: context.customizations.scopedSettings
      }
    };
  }

  return newContext;
}
},{"@uifabric/utilities":"PHCX"}],"wrk4":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.DefaultSpacing = void 0;
var DefaultSpacing = {
  s2: '4px',
  s1: '8px',
  m: '16px',
  l1: '20px',
  l2: '32px'
};
exports.DefaultSpacing = DefaultSpacing;
},{}],"iLZH":[function(require,module,exports) {
var global = arguments[3];
"use strict";
/**
 * An IThemingInstruction can specify a rawString to be preserved or a theme slot and a default value
 * to use if that slot is not specified by the theme.
 */
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(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);
};
Object.defineProperty(exports, "__esModule", { value: true });
// Store the theming state in __themeState__ global scope for reuse in the case of duplicate
// load-themed-styles hosted on the page.
var _root = (typeof window === 'undefined') ? global : window; // eslint-disable-line @typescript-eslint/no-explicit-any
// Nonce string to inject into script tag if one provided. This is used in CSP (Content Security Policy).
var _styleNonce = _root && _root.CSPSettings && _root.CSPSettings.nonce;
var _themeState = initializeThemeState();
/**
 * Matches theming tokens. For example, "[theme: themeSlotName, default: #FFF]" (including the quotes).
 */
var _themeTokenRegex = /[\'\"]\[theme:\s*(\w+)\s*(?:\,\s*default:\s*([\\"\']?[\.\,\(\)\#\-\s\w]*[\.\,\(\)\#\-\w][\"\']?))?\s*\][\'\"]/g;
var now = function () { return (typeof performance !== 'undefined' && !!performance.now) ? performance.now() : Date.now(); };
function measure(func) {
    var start = now();
    func();
    var end = now();
    _themeState.perf.duration += end - start;
}
/**
 * initialize global state object
 */
function initializeThemeState() {
    var state = _root.__themeState__ || {
        theme: undefined,
        lastStyleElement: undefined,
        registeredStyles: []
    };
    if (!state.runState) {
        state = __assign({}, (state), { perf: {
                count: 0,
                duration: 0
            }, runState: {
                flushTimer: 0,
                mode: 0 /* sync */,
                buffer: []
            } });
    }
    if (!state.registeredThemableStyles) {
        state = __assign({}, (state), { registeredThemableStyles: [] });
    }
    _root.__themeState__ = state;
    return state;
}
/**
 * Loads a set of style text. If it is registered too early, we will register it when the window.load
 * event is fired.
 * @param {string | ThemableArray} styles Themable style text to register.
 * @param {boolean} loadAsync When true, always load styles in async mode, irrespective of current sync mode.
 */
function loadStyles(styles, loadAsync) {
    if (loadAsync === void 0) { loadAsync = false; }
    measure(function () {
        var styleParts = Array.isArray(styles) ? styles : splitStyles(styles);
        var _a = _themeState.runState, mode = _a.mode, buffer = _a.buffer, flushTimer = _a.flushTimer;
        if (loadAsync || mode === 1 /* async */) {
            buffer.push(styleParts);
            if (!flushTimer) {
                _themeState.runState.flushTimer = asyncLoadStyles();
            }
        }
        else {
            applyThemableStyles(styleParts);
        }
    });
}
exports.loadStyles = loadStyles;
/**
 * Allows for customizable loadStyles logic. e.g. for server side rendering application
 * @param {(processedStyles: string, rawStyles?: string | ThemableArray) => void}
 * a loadStyles callback that gets called when styles are loaded or reloaded
 */
function configureLoadStyles(loadStylesFn) {
    _themeState.loadStyles = loadStylesFn;
}
exports.configureLoadStyles = configureLoadStyles;
/**
 * Configure run mode of load-themable-styles
 * @param mode load-themable-styles run mode, async or sync
 */
function configureRunMode(mode) {
    _themeState.runState.mode = mode;
}
exports.configureRunMode = configureRunMode;
/**
 * external code can call flush to synchronously force processing of currently buffered styles
 */
function flush() {
    measure(function () {
        var styleArrays = _themeState.runState.buffer.slice();
        _themeState.runState.buffer = [];
        var mergedStyleArray = [].concat.apply([], styleArrays);
        if (mergedStyleArray.length > 0) {
            applyThemableStyles(mergedStyleArray);
        }
    });
}
exports.flush = flush;
/**
 * register async loadStyles
 */
function asyncLoadStyles() {
    return setTimeout(function () {
        _themeState.runState.flushTimer = 0;
        flush();
    }, 0);
}
/**
 * Loads a set of style text. If it is registered too early, we will register it when the window.load event
 * is fired.
 * @param {string} styleText Style to register.
 * @param {IStyleRecord} styleRecord Existing style record to re-apply.
 */
function applyThemableStyles(stylesArray, styleRecord) {
    if (_themeState.loadStyles) {
        _themeState.loadStyles(resolveThemableArray(stylesArray).styleString, stylesArray);
    }
    else {
        registerStyles(stylesArray);
    }
}
/**
 * Registers a set theme tokens to find and replace. If styles were already registered, they will be
 * replaced.
 * @param {theme} theme JSON object of theme tokens to values.
 */
function loadTheme(theme) {
    _themeState.theme = theme;
    // reload styles.
    reloadStyles();
}
exports.loadTheme = loadTheme;
/**
 * Clear already registered style elements and style records in theme_State object
 * @param option - specify which group of registered styles should be cleared.
 * Default to be both themable and non-themable styles will be cleared
 */
function clearStyles(option) {
    if (option === void 0) { option = 3 /* all */; }
    if (option === 3 /* all */ || option === 2 /* onlyNonThemable */) {
        clearStylesInternal(_themeState.registeredStyles);
        _themeState.registeredStyles = [];
    }
    if (option === 3 /* all */ || option === 1 /* onlyThemable */) {
        clearStylesInternal(_themeState.registeredThemableStyles);
        _themeState.registeredThemableStyles = [];
    }
}
exports.clearStyles = clearStyles;
function clearStylesInternal(records) {
    records.forEach(function (styleRecord) {
        var styleElement = styleRecord && styleRecord.styleElement;
        if (styleElement && styleElement.parentElement) {
            styleElement.parentElement.removeChild(styleElement);
        }
    });
}
/**
 * Reloads styles.
 */
function reloadStyles() {
    if (_themeState.theme) {
        var themableStyles = [];
        for (var _i = 0, _a = _themeState.registeredThemableStyles; _i < _a.length; _i++) {
            var styleRecord = _a[_i];
            themableStyles.push(styleRecord.themableStyle);
        }
        if (themableStyles.length > 0) {
            clearStyles(1 /* onlyThemable */);
            applyThemableStyles([].concat.apply([], themableStyles));
        }
    }
}
/**
 * Find theme tokens and replaces them with provided theme values.
 * @param {string} styles Tokenized styles to fix.
 */
function detokenize(styles) {
    if (styles) {
        styles = resolveThemableArray(splitStyles(styles)).styleString;
    }
    return styles;
}
exports.detokenize = detokenize;
/**
 * Resolves ThemingInstruction objects in an array and joins the result into a string.
 * @param {ThemableArray} splitStyleArray ThemableArray to resolve and join.
 */
function resolveThemableArray(splitStyleArray) {
    var theme = _themeState.theme;
    var themable = false;
    // Resolve the array of theming instructions to an array of strings.
    // Then join the array to produce the final CSS string.
    var resolvedArray = (splitStyleArray || []).map(function (currentValue) {
        var themeSlot = currentValue.theme;
        if (themeSlot) {
            themable = true;
            // A theming annotation. Resolve it.
            var themedValue = theme ? theme[themeSlot] : undefined;
            var defaultValue = currentValue.defaultValue || 'inherit';
            // Warn to console if we hit an unthemed value even when themes are provided, but only if "DEBUG" is true.
            // Allow the themedValue to be undefined to explicitly request the default value.
            if (theme && !themedValue && console && !(themeSlot in theme) && typeof DEBUG !== 'undefined' && DEBUG) {
                console.warn("Theming value not provided for \"" + themeSlot + "\". Falling back to \"" + defaultValue + "\".");
            }
            return themedValue || defaultValue;
        }
        else {
            // A non-themable string. Preserve it.
            return currentValue.rawString;
        }
    });
    return {
        styleString: resolvedArray.join(''),
        themable: themable
    };
}
/**
 * Split tokenized CSS into an array of strings and theme specification objects
 * @param {string} styles Tokenized styles to split.
 */
function splitStyles(styles) {
    var result = [];
    if (styles) {
        var pos = 0; // Current position in styles.
        var tokenMatch = void 0; // eslint-disable-line no-restricted-syntax
        while ((tokenMatch = _themeTokenRegex.exec(styles))) {
            var matchIndex = tokenMatch.index;
            if (matchIndex > pos) {
                result.push({
                    rawString: styles.substring(pos, matchIndex)
                });
            }
            result.push({
                theme: tokenMatch[1],
                defaultValue: tokenMatch[2] // May be undefined
            });
            // index of the first character after the current match
            pos = _themeTokenRegex.lastIndex;
        }
        // Push the rest of the string after the last match.
        result.push({
            rawString: styles.substring(pos)
        });
    }
    return result;
}
exports.splitStyles = splitStyles;
/**
 * Registers a set of style text. If it is registered too early, we will register it when the
 * window.load event is fired.
 * @param {ThemableArray} styleArray Array of IThemingInstruction objects to register.
 * @param {IStyleRecord} styleRecord May specify a style Element to update.
 */
function registerStyles(styleArray) {
    if (typeof document === 'undefined') {
        return;
    }
    var head = document.getElementsByTagName('head')[0];
    var styleElement = document.createElement('style');
    var _a = resolveThemableArray(styleArray), styleString = _a.styleString, themable = _a.themable;
    styleElement.setAttribute('data-load-themed-styles', 'true');
    styleElement.type = 'text/css';
    if (_styleNonce) {
        styleElement.setAttribute('nonce', _styleNonce);
    }
    styleElement.appendChild(document.createTextNode(styleString));
    _themeState.perf.count++;
    head.appendChild(styleElement);
    var ev = document.createEvent('HTMLEvents');
    ev.initEvent('styleinsert', true /* bubbleEvent */, false /* cancelable */);
    ev.args = {
        newStyle: styleElement
    };
    document.dispatchEvent(ev);
    var record = {
        styleElement: styleElement,
        themableStyle: styleArray
    };
    if (themable) {
        _themeState.registeredThemableStyles.push(record);
    }
    else {
        _themeState.registeredStyles.push(record);
    }
}
//# sourceMappingURL=index.js.map
},{}],"U3qv":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.DefaultEffects = void 0;
var DefaultEffects = {
  // commented values are the defaults for Fluent
  elevation4: '0 0 5px 0 rgba(0,0,0,.4)',
  elevation8: '0 0 5px 0 rgba(0,0,0,.4)',
  elevation16: '0 0 5px 0 rgba(0,0,0,.4)',
  elevation64: '0 0 5px 0 rgba(0,0,0,.4)',
  roundedCorner2: '0px' // 2

};
exports.DefaultEffects = DefaultEffects;
},{}],"YO7o":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getTheme = getTheme;
exports.registerOnThemeChangeCallback = registerOnThemeChangeCallback;
exports.removeOnThemeChangeCallback = removeOnThemeChangeCallback;
exports.loadTheme = loadTheme;
exports.createTheme = createTheme;
exports.ThemeSettingName = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var _utilities = require("@uifabric/utilities");

var _DefaultFontStyles = require("./DefaultFontStyles");

var _DefaultPalette = require("./DefaultPalette");

var _DefaultSpacing = require("./DefaultSpacing");

var _loadThemedStyles = require("@microsoft/load-themed-styles");

var _DefaultEffects = require("./DefaultEffects");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var _theme = createTheme({
  palette: _DefaultPalette.DefaultPalette,
  semanticColors: _makeSemanticColorsFromPalette(_DefaultPalette.DefaultPalette, false, false),
  fonts: _DefaultFontStyles.DefaultFontStyles,
  isInverted: false,
  disableGlobalClassNames: false
});

var _onThemeChangeCallbacks = [];
var ThemeSettingName = 'theme';
exports.ThemeSettingName = ThemeSettingName;

if (!_utilities.Customizations.getSettings([ThemeSettingName]).theme) {
  var win = (0, _utilities.getWindow)(); // tslint:disable:no-string-literal no-any

  if (win && win['FabricConfig'] && win['FabricConfig'].theme) {
    _theme = createTheme(win['FabricConfig'].theme);
  } // tslint:enable:no-string-literal no-any
  // Set the default theme.


  _utilities.Customizations.applySettings((_a = {}, _a[ThemeSettingName] = _theme, _a));
}
/**
 * Gets the theme object
 * @param depComments - Whether to include deprecated tags as comments for deprecated slots.
 */


function getTheme(depComments) {
  if (depComments === void 0) {
    depComments = false;
  }

  if (depComments === true) {
    _theme = createTheme({}, depComments);
  }

  return _theme;
}
/**
 * Registers a callback that gets called whenever the theme changes.
 * This should only be used when the component cannot automatically get theme changes through its state.
 * This will not register duplicate callbacks.
 */


function registerOnThemeChangeCallback(callback) {
  if (_onThemeChangeCallbacks.indexOf(callback) === -1) {
    _onThemeChangeCallbacks.push(callback);
  }
}
/**
 * See registerOnThemeChangeCallback().
 * Removes previously registered callbacks.
 */


function removeOnThemeChangeCallback(callback) {
  var i = _onThemeChangeCallbacks.indexOf(callback);

  if (i === -1) {
    return;
  }

  _onThemeChangeCallbacks.splice(i, 1);
}
/**
 * Applies the theme, while filling in missing slots.
 * @param theme - Partial theme object.
 * @param depComments - Whether to include deprecated tags as comments for deprecated slots.
 */


function loadTheme(theme, depComments) {
  if (depComments === void 0) {
    depComments = false;
  }

  _theme = createTheme(theme, depComments); // Invoke the legacy method of theming the page as well.

  (0, _loadThemedStyles.loadTheme)(tslib_1.__assign({}, _theme.palette, _theme.semanticColors, _theme.effects, _loadFonts(_theme)));

  _utilities.Customizations.applySettings((_a = {}, _a[ThemeSettingName] = _theme, _a));

  _onThemeChangeCallbacks.forEach(function (callback) {
    try {
      callback(_theme);
    } catch (e) {// don't let a bad callback break everything else
    }
  });

  return _theme;

  var _a;
}
/**
 * Loads font variables into a JSON object.
 * @param theme - The theme object
 */


function _loadFonts(theme) {
  var lines = {};

  for (var _i = 0, _a = Object.keys(theme.fonts); _i < _a.length; _i++) {
    var fontName = _a[_i];
    var font = theme.fonts[fontName];

    for (var _b = 0, _c = Object.keys(font); _b < _c.length; _b++) {
      var propName = _c[_b];
      var name_1 = fontName + propName.charAt(0).toUpperCase() + propName.slice(1);
      var value = font[propName];

      if (propName === 'fontSize' && typeof value === 'number') {
        value = value + 'px';
      }

      lines[name_1] = value;
    }
  }

  return lines;
}
/**
 * Creates a custom theme definition which can be used with the Customizer.
 * @param theme - Partial theme object.
 * @param depComments - Whether to include deprecated tags as comments for deprecated slots.
 */


function createTheme(theme, depComments) {
  if (depComments === void 0) {
    depComments = false;
  }

  var newPalette = tslib_1.__assign({}, _DefaultPalette.DefaultPalette, theme.palette);

  if (!theme.palette || !theme.palette.accent) {
    newPalette.accent = newPalette.themePrimary;
  } // mix in custom overrides with good slots first, since custom overrides might be used in fixing deprecated slots


  var newSemanticColors = tslib_1.__assign({}, _makeSemanticColorsFromPalette(newPalette, !!theme.isInverted, depComments), theme.semanticColors);

  var defaultFontStyles = tslib_1.__assign({}, _DefaultFontStyles.DefaultFontStyles);

  if (theme.defaultFontStyle) {
    for (var _i = 0, _a = Object.keys(defaultFontStyles); _i < _a.length; _i++) {
      var fontStyle = _a[_i];
      defaultFontStyles[fontStyle] = (0, _utilities.merge)({}, defaultFontStyles[fontStyle], theme.defaultFontStyle);
    }
  }

  if (theme.fonts) {
    for (var _b = 0, _c = Object.keys(theme.fonts); _b < _c.length; _b++) {
      var fontStyle = _c[_b];
      defaultFontStyles[fontStyle] = (0, _utilities.merge)({}, defaultFontStyles[fontStyle], theme.fonts[fontStyle]);
    }
  }

  return {
    palette: newPalette,
    fonts: tslib_1.__assign({}, defaultFontStyles),
    semanticColors: newSemanticColors,
    isInverted: !!theme.isInverted,
    disableGlobalClassNames: !!theme.disableGlobalClassNames,
    spacing: tslib_1.__assign({}, _DefaultSpacing.DefaultSpacing, theme.spacing),
    effects: tslib_1.__assign({}, _DefaultEffects.DefaultEffects, theme.effects)
  };
}
/**
 * Helper to pull a given property name from a given set of sources, in order, if available. Otherwise returns the property name.
 */


function _expandFrom(propertyName) {
  var maps = [];

  for (var _i = 1; _i < arguments.length; _i++) {
    maps[_i - 1] = arguments[_i];
  }

  if (propertyName) {
    for (var _a = 0, maps_1 = maps; _a < maps_1.length; _a++) {
      var map = maps_1[_a];

      if (map[propertyName]) {
        return map[propertyName];
      }
    }
  }

  return propertyName;
} // Generates all the semantic slot colors based on the Fabric palette.
// We'll use these as fallbacks for semantic slots that the passed in theme did not define.


function _makeSemanticColorsFromPalette(p, isInverted, depComments) {
  var toReturn = {
    bodyBackground: p.white,
    bodyStandoutBackground: p.neutralLighterAlt,
    bodyFrameBackground: p.white,
    bodyFrameDivider: p.neutralLight,
    bodyText: p.neutralPrimary,
    bodyTextChecked: p.black,
    bodySubtext: p.neutralSecondary,
    bodyDivider: p.neutralLight,
    disabledBackground: p.neutralLighter,
    disabledText: p.neutralTertiary,
    disabledBodyText: p.neutralTertiary,
    disabledSubtext: p.neutralQuaternary,
    disabledBodySubtext: p.neutralTertiaryAlt,
    focusBorder: p.neutralSecondary,
    variantBorder: p.neutralLight,
    variantBorderHovered: p.neutralTertiary,
    defaultStateBackground: p.neutralLighterAlt,
    errorText: !isInverted ? p.redDark : '#ff5f5f',
    warningText: !isInverted ? '#333333' : '#ffffff',
    successText: !isInverted ? '#107C10' : '#92c353',
    errorBackground: !isInverted ? 'rgba(232, 17, 35, .2)' : 'rgba(232, 17, 35, .5)',
    blockingBackground: !isInverted ? 'rgba(234, 67, 0, .2)' : 'rgba(234, 67, 0, .5)',
    warningBackground: !isInverted ? 'rgba(255, 185, 0, .2)' : 'rgba(255, 251, 0, .6)',
    warningHighlight: !isInverted ? '#ffb900' : '#fff100',
    successBackground: !isInverted ? 'rgba(186, 216, 10, .2)' : 'rgba(186, 216, 10, .4)',
    inputBorder: p.neutralTertiary,
    inputBorderHovered: p.neutralPrimary,
    inputBackground: p.white,
    inputBackgroundChecked: p.themePrimary,
    inputBackgroundCheckedHovered: p.themeDarkAlt,
    inputForegroundChecked: p.white,
    inputFocusBorderAlt: p.themePrimary,
    smallInputBorder: p.neutralSecondary,
    inputText: p.neutralPrimary,
    inputTextHovered: p.neutralDark,
    inputPlaceholderText: p.neutralSecondary,
    buttonBackground: p.neutralLighter,
    buttonBackgroundChecked: p.neutralTertiaryAlt,
    buttonBackgroundHovered: p.neutralLight,
    buttonBackgroundCheckedHovered: p.neutralLight,
    buttonBackgroundPressed: p.neutralLight,
    buttonBackgroundDisabled: p.neutralLighter,
    buttonBorder: 'transparent',
    buttonText: p.neutralPrimary,
    buttonTextHovered: p.neutralDark,
    buttonTextChecked: p.neutralDark,
    buttonTextCheckedHovered: p.black,
    buttonTextPressed: p.neutralDark,
    buttonTextDisabled: p.neutralTertiary,
    buttonBorderDisabled: 'transparent',
    primaryButtonBackground: p.themePrimary,
    primaryButtonBackgroundHovered: p.themeDarkAlt,
    primaryButtonBackgroundPressed: p.themeDark,
    primaryButtonBackgroundDisabled: p.neutralLighter,
    primaryButtonBorder: 'transparent',
    primaryButtonText: p.white,
    primaryButtonTextHovered: p.white,
    primaryButtonTextPressed: p.white,
    primaryButtonTextDisabled: p.neutralQuaternary,
    accentButtonBackground: p.accent,
    accentButtonText: p.white,
    menuBackground: p.white,
    menuDivider: p.neutralTertiaryAlt,
    menuIcon: p.themePrimary,
    menuHeader: p.themePrimary,
    menuItemBackgroundHovered: p.neutralLighter,
    menuItemBackgroundPressed: p.neutralLight,
    menuItemText: p.neutralPrimary,
    menuItemTextHovered: p.neutralDark,
    listBackground: p.white,
    listText: p.neutralPrimary,
    listItemBackgroundHovered: p.neutralLighter,
    listItemBackgroundChecked: p.neutralLight,
    listItemBackgroundCheckedHovered: p.neutralQuaternaryAlt,
    listHeaderBackgroundHovered: p.neutralLighter,
    listHeaderBackgroundPressed: p.neutralLight,
    actionLink: p.neutralPrimary,
    actionLinkHovered: p.neutralDark,
    link: p.themePrimary,
    linkHovered: p.themeDarker,
    // Deprecated slots, second pass by _fixDeprecatedSlots() later for self-referential slots
    listTextColor: '',
    menuItemBackgroundChecked: p.neutralLight
  };
  return _fixDeprecatedSlots(toReturn, depComments);
}

function _fixDeprecatedSlots(s, depComments) {
  // Add @deprecated tag as comment if enabled
  var dep = '';

  if (depComments === true) {
    dep = ' /* @deprecated */';
  }

  s.listTextColor = s.listText + dep;
  s.menuItemBackgroundChecked += dep;
  return s;
}

var _a;
},{"tslib":"xgwM","@uifabric/utilities":"PHCX","./DefaultFontStyles":"qmNj","./DefaultPalette":"KOmB","./DefaultSpacing":"wrk4","@microsoft/load-themed-styles":"iLZH","./DefaultEffects":"U3qv"}],"ljgC":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.noWrap = exports.normalize = void 0;
// This file mimics styles and mixins from _General.Mixins.scss
var normalize = {
  boxShadow: 'none',
  margin: 0,
  padding: 0,
  boxSizing: 'border-box'
};
exports.normalize = normalize;
var noWrap = {
  overflow: 'hidden',
  textOverflow: 'ellipsis',
  whiteSpace: 'nowrap'
};
exports.noWrap = noWrap;
},{}],"fmSm":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getFadedOverflowStyle = getFadedOverflowStyle;
var DEFAULT_HEIGHT = '50%';
var DEFAULT_WIDTH = 20;
/**
 * - Generates a style used to fade out an overflowing content by defining a style for an :after pseudo element.
 * - Apply it to the :after selector for all combination of states the parent of content might have (normal, hover, selected, focus).
 * - Requires the target to have position set to relative and overflow set to hidden.
 *
 * @example
 * ```tsx
 * // Assuming the following DOM structure and the different background colors coming from the parent holding the content.
 * <div className={classNames.parent}>
 *   <span className={classNames.content}>Overflown Content</span>
 * </div>
 * ```
 * ```ts
 * // This is how the style set would look in Component.styles.ts
 * const { bodyBackground } = theme.semanticColors;
 * const { neutralLighter } = theme.palette;
 *
 * // The second argument of getFadedOverflowStyle function is a string representing a key of ISemanticColors or IPalette.
 *
 * const styles = {
 *   parent: [
 *     backgroundColor: bodyBackground,
 *     selectors: {
 *       '&:hover: {
 *         backgroundColor: neutralLighter
 *       },
 *       '$content:after': {
 *         ...getFadedOverflowStyle(theme, 'bodyBackground')
 *       },
 *       '&:hover $content:after': {
 *         ...getFadedOverflowStyle(theme, 'neutralLighter')
 *       }
 *     }
 *   ],
 *   content: [
 *     width: '100%',
 *     display: 'inline-block',
 *     position: 'relative',
 *     overflow: 'hidden'
 *   ]
 * }
 * ```
 * @param theme - The theme object to use.
 * @param color - The background color to fade out to. Accepts only keys of ISemanticColors or IPalette. Defaults to 'bodyBackground'.
 * @param direction - The direction of the overflow. Defaults to horizontal.
 * @param width - The width of the fading overflow. Vertical direction defaults it to 100% vs 20px when horizontal.
 * @param height - The Height of the fading overflow. Vertical direction defaults it to 50% vs 100% when horizontal.
 * @returns The style object.
 */

function getFadedOverflowStyle(theme, color, direction, width, height) {
  if (color === void 0) {
    color = 'bodyBackground';
  }

  if (direction === void 0) {
    direction = 'horizontal';
  }

  if (width === void 0) {
    width = getDefaultValue('width', direction);
  }

  if (height === void 0) {
    height = getDefaultValue('height', direction);
  } // Get the color value string from the theme semanticColors or palette.


  var colorValue = theme.semanticColors[color] || theme.palette[color]; // Get the red, green, blue values of the colorValue.

  var rgbColor = color2rgb(colorValue); // Apply opacity 0 to serve as a start color of the gradient.

  var rgba = "rgba(" + rgbColor.r + ", " + rgbColor.g + ", " + rgbColor.b + ", 0)"; // Get the direction of the gradient.

  var gradientDirection = direction === 'vertical' ? 'to bottom' : 'to right'; // mergeStyles take care of RTL direction.

  return {
    content: '""',
    position: 'absolute',
    right: 0,
    bottom: 0,
    width: width,
    height: height,
    pointerEvents: 'none',
    backgroundImage: "linear-gradient(" + gradientDirection + ", " + rgba + " 0%, " + colorValue + " 100%)"
  };
} // TODO consider moving this to a separate module along with some more color functions from OUFR/utilities.

/**
 * Helper function to convert a string hex color to an RGB object.
 *
 * @param colorValue - Color to be converted from hex to rgba.
 */


function color2rgb(colorValue) {
  if (colorValue[0] === '#') {
    // If it's a hex code
    return {
      r: parseInt(colorValue.slice(1, 3), 16),
      g: parseInt(colorValue.slice(3, 5), 16),
      b: parseInt(colorValue.slice(5, 7), 16)
    };
  } else if (colorValue.indexOf('rgba(') === 0) {
    // If it's an rgba color string
    colorValue = colorValue.match(/rgba\(([^)]+)\)/)[1];
    var parts = colorValue.split(/ *, */).map(Number);
    return {
      r: parts[0],
      g: parts[1],
      b: parts[2]
    };
  } // The only remaining possibility is transparent.


  return {
    r: 255,
    g: 255,
    b: 255
  };
}
/**
 * Helper function to get the default values for parameters of main function.
 *
 * @param style - Which style to get the default value for.
 * @param direction - What direction to take into consideration.
 */


function getDefaultValue(style, direction) {
  if (style === 'width') {
    return direction === 'horizontal' ? DEFAULT_WIDTH : '100%';
  } else {
    return direction === 'vertical' ? DEFAULT_HEIGHT : '100%';
  }
}
},{}],"mxiB":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getPlaceholderStyles = getPlaceholderStyles;

/**
 * Generates placeholder style for each of the browsers supported by office-ui-fabric-react.
 * @param styles - The style to use.
 * @returns The placeholder style object for each browser depending on the placeholder directive it uses.
 */
function getPlaceholderStyles(styles) {
  return {
    selectors: {
      '::placeholder': styles,
      ':-ms-input-placeholder': styles,
      '::-ms-input-placeholder': styles // Edge

    }
  };
}
},{}],"xTSp":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
var _exportNames = {
  AnimationStyles: true,
  AnimationVariables: true,
  DefaultPalette: true,
  DefaultFontStyles: true,
  registerDefaultFontFaces: true,
  FontSizes: true,
  FontWeights: true,
  IconFontSizes: true,
  createFontStyles: true,
  hiddenContentStyle: true,
  PulsingBeaconAnimationStyles: true,
  getGlobalClassNames: true,
  ThemeSettingName: true,
  getTheme: true,
  loadTheme: true,
  createTheme: true,
  registerOnThemeChangeCallback: true,
  removeOnThemeChangeCallback: true
};
Object.defineProperty(exports, "AnimationStyles", {
  enumerable: true,
  get: function () {
    return _AnimationStyles.AnimationStyles;
  }
});
Object.defineProperty(exports, "AnimationVariables", {
  enumerable: true,
  get: function () {
    return _AnimationStyles.AnimationVariables;
  }
});
Object.defineProperty(exports, "DefaultPalette", {
  enumerable: true,
  get: function () {
    return _DefaultPalette.DefaultPalette;
  }
});
Object.defineProperty(exports, "DefaultFontStyles", {
  enumerable: true,
  get: function () {
    return _DefaultFontStyles.DefaultFontStyles;
  }
});
Object.defineProperty(exports, "registerDefaultFontFaces", {
  enumerable: true,
  get: function () {
    return _DefaultFontStyles.registerDefaultFontFaces;
  }
});
Object.defineProperty(exports, "FontSizes", {
  enumerable: true,
  get: function () {
    return _fonts.FontSizes;
  }
});
Object.defineProperty(exports, "FontWeights", {
  enumerable: true,
  get: function () {
    return _fonts.FontWeights;
  }
});
Object.defineProperty(exports, "IconFontSizes", {
  enumerable: true,
  get: function () {
    return _fonts.IconFontSizes;
  }
});
Object.defineProperty(exports, "createFontStyles", {
  enumerable: true,
  get: function () {
    return _fonts.createFontStyles;
  }
});
Object.defineProperty(exports, "hiddenContentStyle", {
  enumerable: true,
  get: function () {
    return _hiddenContentStyle.hiddenContentStyle;
  }
});
Object.defineProperty(exports, "PulsingBeaconAnimationStyles", {
  enumerable: true,
  get: function () {
    return _PulsingBeaconAnimationStyles.PulsingBeaconAnimationStyles;
  }
});
Object.defineProperty(exports, "getGlobalClassNames", {
  enumerable: true,
  get: function () {
    return _getGlobalClassNames.getGlobalClassNames;
  }
});
Object.defineProperty(exports, "ThemeSettingName", {
  enumerable: true,
  get: function () {
    return _theme.ThemeSettingName;
  }
});
Object.defineProperty(exports, "getTheme", {
  enumerable: true,
  get: function () {
    return _theme.getTheme;
  }
});
Object.defineProperty(exports, "loadTheme", {
  enumerable: true,
  get: function () {
    return _theme.loadTheme;
  }
});
Object.defineProperty(exports, "createTheme", {
  enumerable: true,
  get: function () {
    return _theme.createTheme;
  }
});
Object.defineProperty(exports, "registerOnThemeChangeCallback", {
  enumerable: true,
  get: function () {
    return _theme.registerOnThemeChangeCallback;
  }
});
Object.defineProperty(exports, "removeOnThemeChangeCallback", {
  enumerable: true,
  get: function () {
    return _theme.removeOnThemeChangeCallback;
  }
});

var _AnimationStyles = require("./AnimationStyles");

var _DefaultPalette = require("./DefaultPalette");

var _DefaultFontStyles = require("./DefaultFontStyles");

var _fonts = require("./fonts");

var _getFocusStyle = require("./getFocusStyle");

Object.keys(_getFocusStyle).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _getFocusStyle[key];
    }
  });
});

var _hiddenContentStyle = require("./hiddenContentStyle");

var _PulsingBeaconAnimationStyles = require("./PulsingBeaconAnimationStyles");

var _getGlobalClassNames = require("./getGlobalClassNames");

var _scheme = require("./scheme");

Object.keys(_scheme).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _scheme[key];
    }
  });
});

var _theme = require("./theme");

var _CommonStyles = require("./CommonStyles");

Object.keys(_CommonStyles).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _CommonStyles[key];
    }
  });
});

var _GeneralStyles = require("./GeneralStyles");

Object.keys(_GeneralStyles).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _GeneralStyles[key];
    }
  });
});

var _getFadedOverflowStyle = require("./getFadedOverflowStyle");

Object.keys(_getFadedOverflowStyle).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _getFadedOverflowStyle[key];
    }
  });
});

var _getPlaceholderStyles = require("./getPlaceholderStyles");

Object.keys(_getPlaceholderStyles).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _getPlaceholderStyles[key];
    }
  });
});

var _zIndexes = require("./zIndexes");

Object.keys(_zIndexes).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _zIndexes[key];
    }
  });
});
},{"./AnimationStyles":"e4zz","./DefaultPalette":"KOmB","./DefaultFontStyles":"qmNj","./fonts":"eG5z","./getFocusStyle":"Prht","./hiddenContentStyle":"G1Qy","./PulsingBeaconAnimationStyles":"WQU8","./getGlobalClassNames":"ROTX","./scheme":"Pyih","./theme":"YO7o","./CommonStyles":"sM7y","./GeneralStyles":"ljgC","./getFadedOverflowStyle":"fmSm","./getPlaceholderStyles":"mxiB","./zIndexes":"yroA"}],"cPBW":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.AnimationClassNames = void 0;

var _index = require("../utilities/index");

var _index2 = require("../styles/index");

/**
 * {@docCategory AnimationClassNames}
 */
var AnimationClassNames = (0, _index.buildClassMap)(_index2.AnimationStyles);
exports.AnimationClassNames = AnimationClassNames;
},{"../utilities/index":"mN76","../styles/index":"xTSp"}],"zMGN":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.FontClassNames = void 0;

var _buildClassMap = require("../utilities/buildClassMap");

var _DefaultFontStyles = require("../styles/DefaultFontStyles");

/**
 * {@docCategory FontClassNames}
 */
var FontClassNames = (0, _buildClassMap.buildClassMap)(_DefaultFontStyles.DefaultFontStyles);
exports.FontClassNames = FontClassNames;
},{"../utilities/buildClassMap":"fO4L","../styles/DefaultFontStyles":"qmNj"}],"sza3":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ColorClassNames = void 0;

var _mergeStyles = require("@uifabric/merge-styles");

var _DefaultPalette = require("../styles/DefaultPalette");

var _index = require("../styles/index");

var ColorClassNames = {};
exports.ColorClassNames = ColorClassNames;

for (var colorName in _DefaultPalette.DefaultPalette) {
  if (_DefaultPalette.DefaultPalette.hasOwnProperty(colorName)) {
    // Foreground color
    _defineGetter(ColorClassNames, colorName, '', false, 'color'); // Hover color


    _defineGetter(ColorClassNames, colorName, 'Hover', true, 'color'); // Background color


    _defineGetter(ColorClassNames, colorName, 'Background', false, 'background'); // Background hover


    _defineGetter(ColorClassNames, colorName, 'BackgroundHover', true, 'background'); // Border color


    _defineGetter(ColorClassNames, colorName, 'Border', false, 'borderColor'); // Border hover color


    _defineGetter(ColorClassNames, colorName, 'BorderHover', true, 'borderColor');
  }
}
/**
 * Defines a getter for the given class configuration.
 */


function _defineGetter(obj, colorName, suffix, isHover, cssProperty) {
  Object.defineProperty(obj, colorName + suffix, {
    get: function () {
      // tslint:disable-next-line:no-any
      var style = (_a = {}, _a[cssProperty] = (0, _index.getTheme)().palette[colorName], _a);
      return (0, _mergeStyles.mergeStyles)(isHover ? {
        selectors: {
          ':hover': style
        }
      } : style).toString();

      var _a;
    },
    enumerable: true,
    configurable: true
  });
}
},{"@uifabric/merge-styles":"w5wT","../styles/DefaultPalette":"KOmB","../styles/index":"xTSp"}],"uWNR":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "AnimationClassNames", {
  enumerable: true,
  get: function () {
    return _AnimationClassNames.AnimationClassNames;
  }
});
Object.defineProperty(exports, "FontClassNames", {
  enumerable: true,
  get: function () {
    return _FontClassNames.FontClassNames;
  }
});
Object.defineProperty(exports, "ColorClassNames", {
  enumerable: true,
  get: function () {
    return _ColorClassNames.ColorClassNames;
  }
});

var _AnimationClassNames = require("./AnimationClassNames");

var _FontClassNames = require("./FontClassNames");

var _ColorClassNames = require("./ColorClassNames");
},{"./AnimationClassNames":"cPBW","./FontClassNames":"zMGN","./ColorClassNames":"sza3"}],"p3AB":[function(require,module,exports) {
"use strict";

var _setVersion = require("@uifabric/set-version");

// @uifabric/styling@6.50.6
// Do not modify this file, the file is generated as part of publish. The checked in version is a placeholder only.
(0, _setVersion.setVersion)('@uifabric/styling', '6.50.6');
},{"@uifabric/set-version":"c7t6"}],"Dytz":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _index = require("./classNames/index");

Object.keys(_index).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index[key];
    }
  });
});

var _index2 = require("./styles/index");

Object.keys(_index2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index2[key];
    }
  });
});

var _index3 = require("./utilities/index");

Object.keys(_index3).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index3[key];
    }
  });
});

var _MergeStyles = require("./MergeStyles");

Object.keys(_MergeStyles).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _MergeStyles[key];
    }
  });
});

require("./version");
},{"./classNames/index":"uWNR","./styles/index":"xTSp","./utilities/index":"mN76","./MergeStyles":"m3pw","./version":"p3AB"}],"AHeq":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

require("./version");

var _styling = require("@uifabric/styling");

Object.keys(_styling).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _styling[key];
    }
  });
});
},{"./version":"xNUS","@uifabric/styling":"Dytz"}],"mqw7":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = void 0;

var _Styling = require("../../Styling");

var _Utilities = require("../../Utilities");

var GlobalClassNames = {
  root: 'ms-Image',
  rootMaximizeFrame: 'ms-Image--maximizeFrame',
  image: 'ms-Image-image',
  imageCenter: 'ms-Image-image--center',
  imageContain: 'ms-Image-image--contain',
  imageCover: 'ms-Image-image--cover',
  imageCenterContain: 'ms-Image-image--centerContain',
  imageCenterCover: 'ms-Image-image--centerCover',
  imageNone: 'ms-Image-image--none',
  imageLandscape: 'ms-Image-image--landscape',
  imagePortrait: 'ms-Image-image--portrait'
};

var getStyles = function (props) {
  var className = props.className,
      width = props.width,
      height = props.height,
      maximizeFrame = props.maximizeFrame,
      isLoaded = props.isLoaded,
      shouldFadeIn = props.shouldFadeIn,
      shouldStartVisible = props.shouldStartVisible,
      isLandscape = props.isLandscape,
      isCenter = props.isCenter,
      isContain = props.isContain,
      isCover = props.isCover,
      isCenterContain = props.isCenterContain,
      isCenterCover = props.isCenterCover,
      isNone = props.isNone,
      isError = props.isError,
      isNotImageFit = props.isNotImageFit,
      theme = props.theme;
  var classNames = (0, _Styling.getGlobalClassNames)(GlobalClassNames, theme);
  var ImageFitStyles = {
    position: 'absolute',
    left: '50% /* @noflip */',
    top: '50%',
    transform: 'translate(-50%,-50%)' // @todo test RTL renders transform: translate(50%,-50%);

  }; // Cut the mustard using msMaxTouchPoints to detect IE11 which does not support CSS object-fit

  var window = (0, _Utilities.getWindow)();
  var supportsObjectFit = window !== undefined && window.navigator.msMaxTouchPoints === undefined;
  var fallbackObjectFitStyles = isContain && isLandscape || isCover && !isLandscape ? {
    width: '100%',
    height: 'auto'
  } : {
    width: 'auto',
    height: '100%'
  };
  return {
    root: [classNames.root, theme.fonts.medium, {
      overflow: 'hidden'
    }, maximizeFrame && [classNames.rootMaximizeFrame, {
      height: '100%',
      width: '100%'
    }], isLoaded && shouldFadeIn && !shouldStartVisible && _Styling.AnimationClassNames.fadeIn400, (isCenter || isContain || isCover || isCenterContain || isCenterCover) && {
      position: 'relative'
    }, className],
    image: [classNames.image, {
      display: 'block',
      opacity: 0
    }, isLoaded && ['is-loaded', {
      opacity: 1
    }], isCenter && [classNames.imageCenter, ImageFitStyles], isContain && [classNames.imageContain, supportsObjectFit && {
      width: '100%',
      height: '100%',
      objectFit: 'contain'
    }, !supportsObjectFit && fallbackObjectFitStyles, ImageFitStyles], isCover && [classNames.imageCover, supportsObjectFit && {
      width: '100%',
      height: '100%',
      objectFit: 'cover'
    }, !supportsObjectFit && fallbackObjectFitStyles, ImageFitStyles], isCenterContain && [classNames.imageCenterContain, isLandscape && {
      maxWidth: '100%'
    }, !isLandscape && {
      maxHeight: '100%'
    }, ImageFitStyles], isCenterCover && [classNames.imageCenterCover, isLandscape && {
      maxHeight: '100%'
    }, !isLandscape && {
      maxWidth: '100%'
    }, ImageFitStyles], isNone && [classNames.imageNone, {
      width: 'auto',
      height: 'auto'
    }], isNotImageFit && [!!width && !height && {
      height: 'auto',
      width: '100%'
    }, !width && !!height && {
      height: '100%',
      width: 'auto'
    }, !!width && !!height && {
      height: '100%',
      width: '100%'
    }], isLandscape && classNames.imageLandscape, !isLandscape && classNames.imagePortrait, !isLoaded && 'is-notLoaded', shouldFadeIn && 'is-fadeIn', isError && 'is-error']
  };
};

exports.getStyles = getStyles;
},{"../../Styling":"AHeq","../../Utilities":"B5nc"}],"NS74":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Image = void 0;

var _Utilities = require("../../Utilities");

var _Image = require("./Image.base");

var _Image2 = require("./Image.styles");

var Image = (0, _Utilities.styled)(_Image.ImageBase, _Image2.getStyles, undefined, {
  scope: 'Image'
}, true);
exports.Image = Image;
},{"../../Utilities":"B5nc","./Image.base":"uqL9","./Image.styles":"mqw7"}],"FnBB":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = exports.MS_ICON = exports.classNames = void 0;

var _Styling = require("../../Styling");

/** Class names used in themeable and non-themeable Icon components */
var classNames = (0, _Styling.mergeStyleSets)({
  root: {
    display: 'inline-block'
  },
  placeholder: ['ms-Icon-placeHolder', {
    width: '1em'
  }],
  image: ['ms-Icon-imageContainer', {
    overflow: 'hidden'
  }]
});
/** Class name used only in non-themeable Icon components */

exports.classNames = classNames;
var MS_ICON = 'ms-Icon';
exports.MS_ICON = MS_ICON;

var getStyles = function (props) {
  var className = props.className,
      iconClassName = props.iconClassName,
      isPlaceholder = props.isPlaceholder,
      isImage = props.isImage,
      styles = props.styles;
  return {
    root: [isPlaceholder && classNames.placeholder, classNames.root, isImage && classNames.image, iconClassName, className, styles && styles.root, styles && styles.imageContainer]
  };
};

exports.getStyles = getStyles;
},{"../../Styling":"AHeq"}],"ouSo":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getFontIcon = exports.FontIcon = exports.getIconContent = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Icon = require("./Icon.styles");

var _Utilities = require("../../Utilities");

var _Styling = require("../../Styling");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var getIconContent = (0, _Utilities.memoizeFunction)(function (iconName) {
  var iconDefinition = (0, _Styling.getIcon)(iconName) || {
    subset: {
      className: undefined
    },
    code: undefined
  };
  return {
    children: iconDefinition.code,
    iconClassName: iconDefinition.subset.className
  };
});
/**
 * Fast icon component which only supports font glyphs (not images) and isn't themeable.
 * To style the icon, use `className` or reference `ms-Icon` in CSS.
 */

exports.getIconContent = getIconContent;

var FontIcon = function (props) {
  var iconName = props.iconName,
      className = props.className;

  var _a = getIconContent(iconName),
      iconClassName = _a.iconClassName,
      children = _a.children;

  var nativeProps = (0, _Utilities.getNativeProps)(props, _Utilities.htmlElementProperties);
  var containerProps = props['aria-label'] ? {} : {
    role: 'presentation',
    'aria-hidden': true
  };
  return React.createElement("i", tslib_1.__assign({
    "data-icon-name": iconName
  }, containerProps, nativeProps, {
    className: (0, _Utilities.css)(_Icon.MS_ICON, _Icon.classNames.root, iconClassName, !iconName && _Icon.classNames.placeholder, className)
  }), children);
};
/**
 * Memoized helper for rendering a FontIcon.
 * @param iconName - The name of the icon to use from the icon font.
 * @param className - Class name for styling the icon.
 * @param ariaLabel - Label for the icon for the benefit of screen readers.
 */


exports.FontIcon = FontIcon;
var getFontIcon = (0, _Utilities.memoizeFunction)(function (iconName, className, ariaLabel) {
  return FontIcon({
    iconName: iconName,
    className: className,
    'aria-label': ariaLabel
  });
});
exports.getFontIcon = getFontIcon;
},{"tslib":"xgwM","react":"mpTF","./Icon.styles":"FnBB","../../Utilities":"B5nc","../../Styling":"AHeq"}],"yZoG":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.IconBase = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Icon = require("./Icon.types");

var _Image = require("../Image/Image");

var _Image2 = require("../Image/Image.types");

var _Utilities = require("../../Utilities");

var _FontIcon = require("./FontIcon");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var getClassNames = (0, _Utilities.classNamesFunction)({
  disableCaching: true
});

var IconBase =
/** @class */
function (_super) {
  tslib_1.__extends(IconBase, _super);

  function IconBase(props) {
    var _this = _super.call(this, props) || this;

    _this.onImageLoadingStateChange = function (state) {
      if (_this.props.imageProps && _this.props.imageProps.onLoadingStateChange) {
        _this.props.imageProps.onLoadingStateChange(state);
      }

      if (state === _Image2.ImageLoadState.error) {
        _this.setState({
          imageLoadError: true
        });
      }
    };

    _this.state = {
      imageLoadError: false
    };
    return _this;
  }

  IconBase.prototype.render = function () {
    var _a = this.props,
        className = _a.className,
        styles = _a.styles,
        iconName = _a.iconName,
        imageErrorAs = _a.imageErrorAs,
        theme = _a.theme;
    var isPlaceholder = typeof iconName === 'string' && iconName.length === 0;
    var isImage = this.props.iconType === _Icon.IconType.image || this.props.iconType === _Icon.IconType.Image || !!this.props.imageProps;

    var _b = (0, _FontIcon.getIconContent)(iconName),
        iconClassName = _b.iconClassName,
        children = _b.children;

    var classNames = getClassNames(styles, {
      theme: theme,
      className: className,
      iconClassName: iconClassName,
      isImage: isImage,
      isPlaceholder: isPlaceholder
    });
    var RootType = isImage ? 'div' : 'i';
    var nativeProps = (0, _Utilities.getNativeProps)(this.props, _Utilities.htmlElementProperties, ['aria-label']);
    var imageLoadError = this.state.imageLoadError;

    var imageProps = tslib_1.__assign({}, this.props.imageProps, {
      onLoadingStateChange: this.onImageLoadingStateChange
    });

    var ImageType = imageLoadError && imageErrorAs || _Image.Image;
    var ariaLabel = this.props.ariaLabel || this.props['aria-label'];
    var containerProps = ariaLabel ? {
      'aria-label': ariaLabel
    } : {
      role: 'presentation',
      'aria-hidden': imageProps.alt || imageProps['aria-labelledby'] ? false : true
    };
    return React.createElement(RootType, tslib_1.__assign({
      "data-icon-name": iconName
    }, containerProps, nativeProps, {
      className: classNames.root
    }), isImage ? React.createElement(ImageType, tslib_1.__assign({}, imageProps)) : children);
  };

  return IconBase;
}(React.Component);

exports.IconBase = IconBase;
},{"tslib":"xgwM","react":"mpTF","./Icon.types":"L3Tw","../Image/Image":"NS74","../Image/Image.types":"BxHs","../../Utilities":"B5nc","./FontIcon":"ouSo"}],"a3cO":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Icon = void 0;

var _Utilities = require("../../Utilities");

var _Icon = require("./Icon.base");

var _Icon2 = require("./Icon.styles");

/**
 * Icons are used for rendering an individual's avatar, presence and details.
 * They are used within the PeoplePicker components.
 */
var Icon = (0, _Utilities.styled)(_Icon.IconBase, _Icon2.getStyles, undefined, {
  scope: 'Icon'
}, true);
exports.Icon = Icon;
},{"../../Utilities":"B5nc","./Icon.base":"yZoG","./Icon.styles":"FnBB"}],"dkO0":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ImageIcon = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Image = require("../Image/Image");

var _Utilities = require("../../Utilities");

var _Icon = require("./Icon.styles");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var ImageIcon = function (props) {
  var className = props.className,
      imageProps = props.imageProps;
  var nativeProps = (0, _Utilities.getNativeProps)(props, _Utilities.htmlElementProperties);
  var containerProps = props['aria-label'] ? {} : {
    role: 'presentation',
    'aria-hidden': imageProps.alt || imageProps['aria-labelledby'] ? false : true
  };
  return React.createElement("div", tslib_1.__assign({}, containerProps, nativeProps, {
    className: (0, _Utilities.css)(_Icon.MS_ICON, _Icon.classNames.root, _Icon.classNames.image, className)
  }), React.createElement(_Image.Image, tslib_1.__assign({}, imageProps)));
};

exports.ImageIcon = ImageIcon;
},{"tslib":"xgwM","react":"mpTF","../Image/Image":"NS74","../../Utilities":"B5nc","./Icon.styles":"FnBB"}],"QCkz":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _Icon = require("./Icon");

Object.keys(_Icon).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Icon[key];
    }
  });
});

var _Icon2 = require("./Icon.base");

Object.keys(_Icon2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Icon2[key];
    }
  });
});

var _Icon3 = require("./Icon.types");

Object.keys(_Icon3).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Icon3[key];
    }
  });
});

var _FontIcon = require("./FontIcon");

Object.keys(_FontIcon).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _FontIcon[key];
    }
  });
});

var _ImageIcon = require("./ImageIcon");

Object.keys(_ImageIcon).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _ImageIcon[key];
    }
  });
});
},{"./Icon":"a3cO","./Icon.base":"yZoG","./Icon.types":"L3Tw","./FontIcon":"ouSo","./ImageIcon":"dkO0"}],"s5pL":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _index = require("./components/Icon/index");

Object.keys(_index).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index[key];
    }
  });
});
},{"./components/Icon/index":"QCkz"}],"uAUO":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.DirectionalHint = void 0;
var DirectionalHint = {
  /**
   * Appear above the target element, with the left edges of the callout and target aligning.
   */
  topLeftEdge: 0,

  /**
   * Appear above the target element, with the centers of the callout and target aligning.
   */
  topCenter: 1,

  /**
   * Appear above the target element, with the right edges of the callout and target aligning.
   */
  topRightEdge: 2,

  /**
   * Appear above the target element, aligning with the target element such that the callout tends toward the center of the screen.
   */
  topAutoEdge: 3,

  /**
   * Appear below the target element, with the left edges of the callout and target aligning.
   */
  bottomLeftEdge: 4,

  /**
   * Appear below the target element, with the centers of the callout and target aligning.
   */
  bottomCenter: 5,

  /**
   * Appear below the target element, with the right edges of the callout and target aligning.
   */
  bottomRightEdge: 6,

  /**
   * Appear below the target element, aligning with the target element such that the callout tends toward the center of the screen.
   */
  bottomAutoEdge: 7,

  /**
   * Appear to the left of the target element, with the top edges of the callout and target aligning.
   */
  leftTopEdge: 8,

  /**
   * Appear to the left of the target element, with the centers of the callout and target aligning.
   */
  leftCenter: 9,

  /**
   * Appear to the left of the target element, with the bottom edges of the callout and target aligning.
   */
  leftBottomEdge: 10,

  /**
   * Appear to the right of the target element, with the top edges of the callout and target aligning.
   */
  rightTopEdge: 11,

  /**
   * Appear to the right of the target element, with the centers of the callout and target aligning.
   */
  rightCenter: 12,

  /**
   * Appear to the right of the target element, with the bottom edges of the callout and target aligning.
   */
  rightBottomEdge: 13
};
exports.DirectionalHint = DirectionalHint;
},{}],"H7D9":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "DirectionalHint", {
  enumerable: true,
  get: function () {
    return _DirectionalHint.DirectionalHint;
  }
});
exports.ContextualMenuItemType = void 0;

var _DirectionalHint = require("../../common/DirectionalHint");

/**
 * {@docCategory ContextualMenu}
 */
var ContextualMenuItemType;
exports.ContextualMenuItemType = ContextualMenuItemType;

(function (ContextualMenuItemType) {
  ContextualMenuItemType[ContextualMenuItemType["Normal"] = 0] = "Normal";
  ContextualMenuItemType[ContextualMenuItemType["Divider"] = 1] = "Divider";
  ContextualMenuItemType[ContextualMenuItemType["Header"] = 2] = "Header";
  ContextualMenuItemType[ContextualMenuItemType["Section"] = 3] = "Section";
})(ContextualMenuItemType || (exports.ContextualMenuItemType = ContextualMenuItemType = {}));
},{"../../common/DirectionalHint":"uAUO"}],"E5Fw":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.FocusZoneDirection = exports.FocusZoneTabbableElements = void 0;

/**
 * {@docCategory FocusZone}
 */
var FocusZoneTabbableElements = {
  /** Tabbing is not allowed */
  none: 0,

  /** All tabbing action is allowed */
  all: 1,

  /** Tabbing is allowed only on input elements */
  inputOnly: 2
};
/**
 * {@docCategory FocusZone}
 */

exports.FocusZoneTabbableElements = FocusZoneTabbableElements;
var FocusZoneDirection;
exports.FocusZoneDirection = FocusZoneDirection;

(function (FocusZoneDirection) {
  /** Only react to up/down arrows. */
  FocusZoneDirection[FocusZoneDirection["vertical"] = 0] = "vertical";
  /** Only react to left/right arrows. */

  FocusZoneDirection[FocusZoneDirection["horizontal"] = 1] = "horizontal";
  /** React to all arrows. */

  FocusZoneDirection[FocusZoneDirection["bidirectional"] = 2] = "bidirectional";
})(FocusZoneDirection || (exports.FocusZoneDirection = FocusZoneDirection = {}));
},{}],"SWLc":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.FocusZone = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _FocusZone = require("./FocusZone.types");

var _Utilities = require("../../Utilities");

var _mergeStyles = require("@uifabric/merge-styles");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var IS_FOCUSABLE_ATTRIBUTE = 'data-is-focusable';
var IS_ENTER_DISABLED_ATTRIBUTE = 'data-disable-click-on-enter';
var FOCUSZONE_ID_ATTRIBUTE = 'data-focuszone-id';
var TABINDEX = 'tabindex';
var NO_VERTICAL_WRAP = 'data-no-vertical-wrap';
var NO_HORIZONTAL_WRAP = 'data-no-horizontal-wrap';
var LARGE_DISTANCE_FROM_CENTER = 999999999;
var LARGE_NEGATIVE_DISTANCE_FROM_CENTER = -999999999;
var focusZoneStyles;
var focusZoneClass = 'ms-FocusZone'; // Helper function that will return a class for when the root is focused

function getRootClass() {
  if (!focusZoneStyles) {
    focusZoneStyles = (0, _mergeStyles.mergeStyles)({
      selectors: {
        ':focus': {
          outline: 'none'
        }
      }
    }, focusZoneClass);
  }

  return focusZoneStyles;
}

var _allInstances = {};

var _outerZones = new Set();

var ALLOWED_INPUT_TYPES = ['text', 'number', 'password', 'email', 'tel', 'url', 'search'];
var ALLOW_VIRTUAL_ELEMENTS = false;

var FocusZone =
/** @class */
function (_super) {
  tslib_1.__extends(FocusZone, _super);

  function FocusZone(props) {
    var _this = _super.call(this, props) || this;

    _this._disposables = [];
    _this._root = React.createRef();

    _this._onFocus = function (ev) {
      if (_this._portalContainsElement(ev.target)) {
        // If the event target is inside a portal do not process the event.
        return;
      }

      var _a = _this.props,
          onActiveElementChanged = _a.onActiveElementChanged,
          doNotAllowFocusEventToPropagate = _a.doNotAllowFocusEventToPropagate,
          onFocusNotification = _a.onFocusNotification;

      var isImmediateDescendant = _this._isImmediateDescendantOfZone(ev.target);

      var newActiveElement;

      if (onFocusNotification) {
        onFocusNotification();
      }

      if (isImmediateDescendant) {
        newActiveElement = ev.target;
      } else {
        var parentElement = ev.target;

        while (parentElement && parentElement !== _this._root.current) {
          if ((0, _Utilities.isElementTabbable)(parentElement) && _this._isImmediateDescendantOfZone(parentElement)) {
            newActiveElement = parentElement;
            break;
          }

          parentElement = (0, _Utilities.getParent)(parentElement, ALLOW_VIRTUAL_ELEMENTS);
        }
      }

      var initialElementFocused = !_this._activeElement; // If the new active element is a child of this zone and received focus,
      // update alignment an immediate descendant

      if (newActiveElement && newActiveElement !== _this._activeElement) {
        if (isImmediateDescendant || initialElementFocused) {
          _this._setFocusAlignment(newActiveElement, initialElementFocused);
        }

        _this._activeElement = newActiveElement;

        if (initialElementFocused) {
          _this._updateTabIndexes();
        }
      }

      if (onActiveElementChanged) {
        onActiveElementChanged(_this._activeElement, ev);
      }

      if (doNotAllowFocusEventToPropagate) {
        ev.stopPropagation();
      }
    };

    _this._onBlur = function () {
      _this._setParkedFocus(false);
    };
    /**
     * Handle global tab presses so that we can patch tabindexes on the fly.
     */


    _this._onKeyDownCapture = function (ev) {
      if (ev.which === _Utilities.KeyCodes.tab) {
        _outerZones.forEach(function (zone) {
          return zone._updateTabIndexes();
        });
      }
    };

    _this._onMouseDown = function (ev) {
      if (_this._portalContainsElement(ev.target)) {
        // If the event target is inside a portal do not process the event.
        return;
      }

      var disabled = _this.props.disabled;

      if (disabled) {
        return;
      }

      var target = ev.target;
      var path = [];

      while (target && target !== _this._root.current) {
        path.push(target);
        target = (0, _Utilities.getParent)(target, ALLOW_VIRTUAL_ELEMENTS);
      }

      while (path.length) {
        target = path.pop();

        if (target && (0, _Utilities.isElementTabbable)(target)) {
          _this._setActiveElement(target, true);
        }

        if ((0, _Utilities.isElementFocusZone)(target)) {
          // Stop here since the focus zone will take care of its own children.
          break;
        }
      }
    };
    /**
     * Handle the keystrokes.
     */


    _this._onKeyDown = function (ev) {
      if (_this._portalContainsElement(ev.target)) {
        // If the event target is inside a portal do not process the event.
        return;
      }

      var _a = _this.props,
          direction = _a.direction,
          disabled = _a.disabled,
          isInnerZoneKeystroke = _a.isInnerZoneKeystroke;

      if (disabled) {
        return;
      }

      if (_this.props.onKeyDown) {
        _this.props.onKeyDown(ev);
      } // If the default has been prevented, do not process keyboard events.


      if (ev.isDefaultPrevented()) {
        return;
      }

      if (document.activeElement === _this._root.current && _this._isInnerZone) {
        // If this element has focus, it is being controlled by a parent.
        // Ignore the keystroke.
        return;
      }

      if (isInnerZoneKeystroke && isInnerZoneKeystroke(ev) && _this._isImmediateDescendantOfZone(ev.target)) {
        // Try to focus
        var innerZone = _this._getFirstInnerZone();

        if (innerZone) {
          if (!innerZone.focus(true)) {
            return;
          }
        } else if ((0, _Utilities.isElementFocusSubZone)(ev.target)) {
          if (!_this.focusElement((0, _Utilities.getNextElement)(ev.target, ev.target.firstChild, true))) {
            return;
          }
        } else {
          return;
        }
      } else if (ev.altKey) {
        return;
      } else {
        switch (ev.which) {
          case _Utilities.KeyCodes.space:
            if (_this._tryInvokeClickForFocusable(ev.target)) {
              break;
            }

            return;

          case _Utilities.KeyCodes.left:
            if (direction !== _FocusZone.FocusZoneDirection.vertical && _this._moveFocusLeft()) {
              break;
            }

            return;

          case _Utilities.KeyCodes.right:
            if (direction !== _FocusZone.FocusZoneDirection.vertical && _this._moveFocusRight()) {
              break;
            }

            return;

          case _Utilities.KeyCodes.up:
            if (direction !== _FocusZone.FocusZoneDirection.horizontal && _this._moveFocusUp()) {
              break;
            }

            return;

          case _Utilities.KeyCodes.down:
            if (direction !== _FocusZone.FocusZoneDirection.horizontal && _this._moveFocusDown()) {
              break;
            }

            return;

          case _Utilities.KeyCodes.tab:
            if (_this.props.allowTabKey || _this.props.handleTabKey === _FocusZone.FocusZoneTabbableElements.all || _this.props.handleTabKey === _FocusZone.FocusZoneTabbableElements.inputOnly && _this._isElementInput(ev.target)) {
              var focusChanged = false;
              _this._processingTabKey = true;

              if (direction === _FocusZone.FocusZoneDirection.vertical || !_this._shouldWrapFocus(_this._activeElement, NO_HORIZONTAL_WRAP)) {
                focusChanged = ev.shiftKey ? _this._moveFocusUp() : _this._moveFocusDown();
              } else if (direction === _FocusZone.FocusZoneDirection.horizontal || direction === _FocusZone.FocusZoneDirection.bidirectional) {
                var tabWithDirection = (0, _Utilities.getRTL)() ? !ev.shiftKey : ev.shiftKey;
                focusChanged = tabWithDirection ? _this._moveFocusLeft() : _this._moveFocusRight();
              }

              _this._processingTabKey = false;

              if (focusChanged) {
                break;
              }
            }

            return;

          case _Utilities.KeyCodes.home:
            if (_this._isElementInput(ev.target) && !_this._shouldInputLoseFocus(ev.target, false)) {
              return false;
            }

            var firstChild = _this._root.current && _this._root.current.firstChild;

            if (_this._root.current && firstChild && _this.focusElement((0, _Utilities.getNextElement)(_this._root.current, firstChild, true))) {
              break;
            }

            return;

          case _Utilities.KeyCodes.end:
            if (_this._isElementInput(ev.target) && !_this._shouldInputLoseFocus(ev.target, true)) {
              return false;
            }

            var lastChild = _this._root.current && _this._root.current.lastChild;

            if (_this._root.current && _this.focusElement((0, _Utilities.getPreviousElement)(_this._root.current, lastChild, true, true, true))) {
              break;
            }

            return;

          case _Utilities.KeyCodes.enter:
            if (_this._tryInvokeClickForFocusable(ev.target)) {
              break;
            }

            return;

          default:
            return;
        }
      }

      ev.preventDefault();
      ev.stopPropagation();
    }; // Manage componentRef resolution.


    (0, _Utilities.initializeComponentRef)(_this);

    if ("production" !== 'production') {
      (0, _Utilities.warnDeprecations)('FocusZone', props, {
        rootProps: undefined,
        allowTabKey: 'handleTabKey',
        elementType: 'as',
        ariaDescribedBy: 'aria-describedby',
        ariaLabelledBy: 'aria-labelledby'
      });
    }

    _this._id = (0, _Utilities.getId)('FocusZone');
    _this._focusAlignment = {
      x: 0,
      y: 0
    };
    _this._processingTabKey = false;
    return _this;
  }
  /** Used for testing purposes only. */


  FocusZone.getOuterZones = function () {
    return _outerZones.size;
  };

  FocusZone.prototype.componentDidMount = function () {
    var root = this._root.current;
    _allInstances[this._id] = this;

    if (root) {
      var windowElement = root.ownerDocument.defaultView;
      var parentElement = (0, _Utilities.getParent)(root, ALLOW_VIRTUAL_ELEMENTS);

      while (parentElement && parentElement !== document.body && parentElement.nodeType === 1) {
        if ((0, _Utilities.isElementFocusZone)(parentElement)) {
          this._isInnerZone = true;
          break;
        }

        parentElement = (0, _Utilities.getParent)(parentElement, ALLOW_VIRTUAL_ELEMENTS);
      }

      if (!this._isInnerZone) {
        _outerZones.add(this);
      }

      if (windowElement && _outerZones.size === 1) {
        this._disposables.push((0, _Utilities.on)(windowElement, 'keydown', this._onKeyDownCapture, true));
      }

      this._disposables.push((0, _Utilities.on)(root, 'blur', this._onBlur, true)); // Assign initial tab indexes so that we can set initial focus as appropriate.


      this._updateTabIndexes();

      if (this.props.defaultActiveElement) {
        this._activeElement = (0, _Utilities.getDocument)().querySelector(this.props.defaultActiveElement);
        this.focus();
      }
    }
  };

  FocusZone.prototype.componentDidUpdate = function () {
    var root = this._root.current;
    var doc = (0, _Utilities.getDocument)(root);

    if (doc && this._lastIndexPath && (doc.activeElement === doc.body || doc.activeElement === root)) {
      // The element has been removed after the render, attempt to restore focus.
      var elementToFocus = (0, _Utilities.getFocusableByIndexPath)(root, this._lastIndexPath);

      if (elementToFocus) {
        this._setActiveElement(elementToFocus, true);

        elementToFocus.focus();

        this._setParkedFocus(false);
      } else {
        // We had a focus path to restore, but now that path is unresolvable. Park focus
        // on the container until we can try again.
        this._setParkedFocus(true);
      }
    }
  };

  FocusZone.prototype.componentWillUnmount = function () {
    delete _allInstances[this._id];

    if (!this._isInnerZone) {
      _outerZones.delete(this);
    } // Dispose all events.


    this._disposables.forEach(function (d) {
      return d();
    });
  };

  FocusZone.prototype.render = function () {
    var _a = this.props,
        rootProps = _a.rootProps,
        ariaDescribedBy = _a.ariaDescribedBy,
        ariaLabelledBy = _a.ariaLabelledBy,
        className = _a.className;
    var divProps = (0, _Utilities.getNativeProps)(this.props, _Utilities.htmlElementProperties);
    var Tag = this.props.as || this.props.elementType || 'div'; // Note, right before rendering/reconciling proceeds, we need to record if focus
    // was in the zone before the update. This helper will track this and, if focus
    // was actually in the zone, what the index path to the element is at this time.
    // Then, later in componentDidUpdate, we can evaluate if we need to restore it in
    // the case the element was removed.

    this._evaluateFocusBeforeRender();

    return React.createElement(Tag, tslib_1.__assign({
      role: "presentation",
      "aria-labelledby": ariaLabelledBy,
      "aria-describedby": ariaDescribedBy
    }, divProps, rootProps, {
      // Once the getClassName correctly memoizes inputs this should
      // be replaced so that className is passed to getRootClass and is included there so
      // the class names will always be in the same order.
      className: (0, _Utilities.css)(getRootClass(), className),
      ref: this._root,
      "data-focuszone-id": this._id,
      onKeyDown: this._onKeyDown,
      onFocus: this._onFocus,
      onMouseDownCapture: this._onMouseDown
    }), this.props.children);
  };
  /**
   * Sets focus to the first tabbable item in the zone.
   * @param forceIntoFirstElement - If true, focus will be forced into the first element, even
   * if focus is already in the focus zone.
   * @returns True if focus could be set to an active element, false if no operation was taken.
   */


  FocusZone.prototype.focus = function (forceIntoFirstElement) {
    if (forceIntoFirstElement === void 0) {
      forceIntoFirstElement = false;
    }

    if (this._root.current) {
      if (!forceIntoFirstElement && this._root.current.getAttribute(IS_FOCUSABLE_ATTRIBUTE) === 'true' && this._isInnerZone) {
        var ownerZoneElement = this._getOwnerZone(this._root.current);

        if (ownerZoneElement !== this._root.current) {
          var ownerZone = _allInstances[ownerZoneElement.getAttribute(FOCUSZONE_ID_ATTRIBUTE)];

          return !!ownerZone && ownerZone.focusElement(this._root.current);
        }

        return false;
      } else if (!forceIntoFirstElement && this._activeElement && (0, _Utilities.elementContains)(this._root.current, this._activeElement) && (0, _Utilities.isElementTabbable)(this._activeElement)) {
        this._activeElement.focus();

        return true;
      } else {
        var firstChild = this._root.current.firstChild;
        return this.focusElement((0, _Utilities.getNextElement)(this._root.current, firstChild, true));
      }
    }

    return false;
  };
  /**
   * Sets focus to a specific child element within the zone. This can be used in conjunction with
   * onBeforeFocus to created delayed focus scenarios (like animate the scroll position to the correct
   * location and then focus.)
   * @param element - The child element within the zone to focus.
   * @returns True if focus could be set to an active element, false if no operation was taken.
   */


  FocusZone.prototype.focusElement = function (element) {
    var onBeforeFocus = this.props.onBeforeFocus;

    if (onBeforeFocus && !onBeforeFocus(element)) {
      return false;
    }

    if (element) {
      // when we Set focus to a specific child, we should recalculate the alignment depend on its position
      this._setActiveElement(element);

      if (this._activeElement) {
        this._activeElement.focus();
      }

      return true;
    }

    return false;
  };
  /**
   * Forces horizontal alignment in the context of vertical arrowing to use specific point as the reference, rather than a center based on
   * the last horizontal motion.
   * @param point - the new reference point.
   */


  FocusZone.prototype.setFocusAlignment = function (point) {
    this._focusAlignment = point;
  };

  FocusZone.prototype._evaluateFocusBeforeRender = function () {
    var root = this._root.current;
    var doc = (0, _Utilities.getDocument)(root);

    if (doc) {
      var focusedElement = doc.activeElement; // Only update the index path if we are not parked on the root.

      if (focusedElement !== root) {
        var shouldRestoreFocus = (0, _Utilities.elementContains)(root, focusedElement, false);
        this._lastIndexPath = shouldRestoreFocus ? (0, _Utilities.getElementIndexPath)(root, doc.activeElement) : undefined;
      }
    }
  };
  /**
   * When focus is in the zone at render time but then all focusable elements are removed,
   * we "park" focus temporarily on the root. Once we update with focusable children, we restore
   * focus to the closest path from previous. If the user tabs away from the parked container,
   * we restore focusability to the pre-parked state.
   */


  FocusZone.prototype._setParkedFocus = function (isParked) {
    var root = this._root.current;

    if (root && this._isParked !== isParked) {
      this._isParked = isParked;

      if (isParked) {
        if (!this.props.allowFocusRoot) {
          this._parkedTabIndex = root.getAttribute('tabindex');
          root.setAttribute('tabindex', '-1');
        }

        root.focus();
      } else {
        if (!this.props.allowFocusRoot) {
          if (this._parkedTabIndex) {
            root.setAttribute('tabindex', this._parkedTabIndex);
            this._parkedTabIndex = undefined;
          } else {
            root.removeAttribute('tabindex');
          }
        }
      }
    }
  };

  FocusZone.prototype._setActiveElement = function (element, forceAlignment) {
    var previousActiveElement = this._activeElement;
    this._activeElement = element;

    if (previousActiveElement) {
      if ((0, _Utilities.isElementFocusZone)(previousActiveElement)) {
        this._updateTabIndexes(previousActiveElement);
      }

      previousActiveElement.tabIndex = -1;
    }

    if (this._activeElement) {
      if (!this._focusAlignment || forceAlignment) {
        this._setFocusAlignment(element, true, true);
      }

      this._activeElement.tabIndex = 0;
    }
  };
  /**
   * Walk up the dom try to find a focusable element.
   */


  FocusZone.prototype._tryInvokeClickForFocusable = function (target) {
    if (target === this._root.current) {
      return false;
    }

    do {
      if (target.tagName === 'BUTTON' || target.tagName === 'A' || target.tagName === 'INPUT' || target.tagName === 'TEXTAREA') {
        return false;
      }

      if (this._isImmediateDescendantOfZone(target) && target.getAttribute(IS_FOCUSABLE_ATTRIBUTE) === 'true' && target.getAttribute(IS_ENTER_DISABLED_ATTRIBUTE) !== 'true') {
        (0, _Utilities.raiseClick)(target);
        return true;
      }

      target = (0, _Utilities.getParent)(target, ALLOW_VIRTUAL_ELEMENTS);
    } while (target !== this._root.current);

    return false;
  };
  /**
   * Traverse to find first child zone.
   */


  FocusZone.prototype._getFirstInnerZone = function (rootElement) {
    rootElement = rootElement || this._activeElement || this._root.current;

    if (!rootElement) {
      return null;
    }

    if ((0, _Utilities.isElementFocusZone)(rootElement)) {
      return _allInstances[rootElement.getAttribute(FOCUSZONE_ID_ATTRIBUTE)];
    }

    var child = rootElement.firstElementChild;

    while (child) {
      if ((0, _Utilities.isElementFocusZone)(child)) {
        return _allInstances[child.getAttribute(FOCUSZONE_ID_ATTRIBUTE)];
      }

      var match = this._getFirstInnerZone(child);

      if (match) {
        return match;
      }

      child = child.nextElementSibling;
    }

    return null;
  };

  FocusZone.prototype._moveFocus = function (isForward, getDistanceFromCenter, ev, useDefaultWrap) {
    if (useDefaultWrap === void 0) {
      useDefaultWrap = true;
    }

    var element = this._activeElement;
    var candidateDistance = -1;
    var candidateElement = undefined;
    var changedFocus = false;
    var isBidirectional = this.props.direction === _FocusZone.FocusZoneDirection.bidirectional;

    if (!element || !this._root.current) {
      return false;
    }

    if (this._isElementInput(element)) {
      if (!this._shouldInputLoseFocus(element, isForward)) {
        return false;
      }
    }

    var activeRect = isBidirectional ? element.getBoundingClientRect() : null;

    do {
      element = isForward ? (0, _Utilities.getNextElement)(this._root.current, element) : (0, _Utilities.getPreviousElement)(this._root.current, element);

      if (isBidirectional) {
        if (element) {
          var targetRect = element.getBoundingClientRect();
          var elementDistance = getDistanceFromCenter(activeRect, targetRect);

          if (elementDistance === -1 && candidateDistance === -1) {
            candidateElement = element;
            break;
          }

          if (elementDistance > -1 && (candidateDistance === -1 || elementDistance < candidateDistance)) {
            candidateDistance = elementDistance;
            candidateElement = element;
          }

          if (candidateDistance >= 0 && elementDistance < 0) {
            break;
          }
        }
      } else {
        candidateElement = element;
        break;
      }
    } while (element); // Focus the closest candidate


    if (candidateElement && candidateElement !== this._activeElement) {
      changedFocus = true;
      this.focusElement(candidateElement);
    } else if (this.props.isCircularNavigation && useDefaultWrap) {
      if (isForward) {
        return this.focusElement((0, _Utilities.getNextElement)(this._root.current, this._root.current.firstElementChild, true));
      } else {
        return this.focusElement((0, _Utilities.getPreviousElement)(this._root.current, this._root.current.lastElementChild, true, true, true));
      }
    }

    return changedFocus;
  };

  FocusZone.prototype._moveFocusDown = function () {
    var _this = this;

    var targetTop = -1;
    var leftAlignment = this._focusAlignment.x;

    if (this._moveFocus(true, function (activeRect, targetRect) {
      var distance = -1; // ClientRect values can be floats that differ by very small fractions of a decimal.
      // If the difference between top and bottom are within a pixel then we should treat
      // them as equivalent by using Math.floor. For instance 5.2222 and 5.222221 should be equivalent,
      // but without Math.Floor they will be handled incorrectly.

      var targetRectTop = Math.floor(targetRect.top);
      var activeRectBottom = Math.floor(activeRect.bottom);

      if (targetRectTop < activeRectBottom) {
        if (!_this._shouldWrapFocus(_this._activeElement, NO_VERTICAL_WRAP)) {
          return LARGE_NEGATIVE_DISTANCE_FROM_CENTER;
        }

        return LARGE_DISTANCE_FROM_CENTER;
      }

      if (targetTop === -1 && targetRectTop >= activeRectBottom || targetRectTop === targetTop) {
        targetTop = targetRectTop;

        if (leftAlignment >= targetRect.left && leftAlignment <= targetRect.left + targetRect.width) {
          distance = 0;
        } else {
          distance = Math.abs(targetRect.left + targetRect.width / 2 - leftAlignment);
        }
      }

      return distance;
    })) {
      this._setFocusAlignment(this._activeElement, false, true);

      return true;
    }

    return false;
  };

  FocusZone.prototype._moveFocusUp = function () {
    var _this = this;

    var targetTop = -1;
    var leftAlignment = this._focusAlignment.x;

    if (this._moveFocus(false, function (activeRect, targetRect) {
      var distance = -1; // ClientRect values can be floats that differ by very small fractions of a decimal.
      // If the difference between top and bottom are within a pixel then we should treat
      // them as equivalent by using Math.floor. For instance 5.2222 and 5.222221 should be equivalent,
      // but without Math.Floor they will be handled incorrectly.

      var targetRectBottom = Math.floor(targetRect.bottom);
      var targetRectTop = Math.floor(targetRect.top);
      var activeRectTop = Math.floor(activeRect.top);

      if (targetRectBottom > activeRectTop) {
        if (!_this._shouldWrapFocus(_this._activeElement, NO_VERTICAL_WRAP)) {
          return LARGE_NEGATIVE_DISTANCE_FROM_CENTER;
        }

        return LARGE_DISTANCE_FROM_CENTER;
      }

      if (targetTop === -1 && targetRectBottom <= activeRectTop || targetRectTop === targetTop) {
        targetTop = targetRectTop;

        if (leftAlignment >= targetRect.left && leftAlignment <= targetRect.left + targetRect.width) {
          distance = 0;
        } else {
          distance = Math.abs(targetRect.left + targetRect.width / 2 - leftAlignment);
        }
      }

      return distance;
    })) {
      this._setFocusAlignment(this._activeElement, false, true);

      return true;
    }

    return false;
  };

  FocusZone.prototype._moveFocusLeft = function () {
    var _this = this;

    var shouldWrap = this._shouldWrapFocus(this._activeElement, NO_HORIZONTAL_WRAP);

    if (this._moveFocus((0, _Utilities.getRTL)(), function (activeRect, targetRect) {
      var distance = -1;
      var topBottomComparison;

      if ((0, _Utilities.getRTL)()) {
        // When in RTL, this comparison should be the same as the one in _moveFocusRight for LTR.
        // Going left at a leftmost rectangle will go down a line instead of up a line like in LTR.
        // This is important, because we want to be comparing the top of the target rect
        // with the bottom of the active rect.
        topBottomComparison = targetRect.top.toFixed(3) < activeRect.bottom.toFixed(3);
      } else {
        topBottomComparison = targetRect.bottom.toFixed(3) > activeRect.top.toFixed(3);
      }

      if (topBottomComparison && targetRect.right <= activeRect.right && _this.props.direction !== _FocusZone.FocusZoneDirection.vertical) {
        distance = activeRect.right - targetRect.right;
      } else {
        if (!shouldWrap) {
          distance = LARGE_NEGATIVE_DISTANCE_FROM_CENTER;
        }
      }

      return distance;
    }, undefined
    /*ev*/
    , shouldWrap)) {
      this._setFocusAlignment(this._activeElement, true, false);

      return true;
    }

    return false;
  };

  FocusZone.prototype._moveFocusRight = function () {
    var _this = this;

    var shouldWrap = this._shouldWrapFocus(this._activeElement, NO_HORIZONTAL_WRAP);

    if (this._moveFocus(!(0, _Utilities.getRTL)(), function (activeRect, targetRect) {
      var distance = -1;
      var topBottomComparison;

      if ((0, _Utilities.getRTL)()) {
        // When in RTL, this comparison should be the same as the one in _moveFocusLeft for LTR.
        // Going right at a rightmost rectangle will go up a line instead of down a line like in LTR.
        // This is important, because we want to be comparing the bottom of the target rect
        // with the top of the active rect.
        topBottomComparison = targetRect.bottom.toFixed(3) > activeRect.top.toFixed(3);
      } else {
        topBottomComparison = targetRect.top.toFixed(3) < activeRect.bottom.toFixed(3);
      }

      if (topBottomComparison && targetRect.left >= activeRect.left && _this.props.direction !== _FocusZone.FocusZoneDirection.vertical) {
        distance = targetRect.left - activeRect.left;
      } else if (!shouldWrap) {
        distance = LARGE_NEGATIVE_DISTANCE_FROM_CENTER;
      }

      return distance;
    }, undefined
    /*ev*/
    , shouldWrap)) {
      this._setFocusAlignment(this._activeElement, true, false);

      return true;
    }

    return false;
  };

  FocusZone.prototype._setFocusAlignment = function (element, isHorizontal, isVertical) {
    if (this.props.direction === _FocusZone.FocusZoneDirection.bidirectional && (!this._focusAlignment || isHorizontal || isVertical)) {
      var rect = element.getBoundingClientRect();
      var left = rect.left + rect.width / 2;
      var top_1 = rect.top + rect.height / 2;

      if (!this._focusAlignment) {
        this._focusAlignment = {
          x: left,
          y: top_1
        };
      }

      if (isHorizontal) {
        this._focusAlignment.x = left;
      }

      if (isVertical) {
        this._focusAlignment.y = top_1;
      }
    }
  };

  FocusZone.prototype._isImmediateDescendantOfZone = function (element) {
    return this._getOwnerZone(element) === this._root.current;
  };

  FocusZone.prototype._getOwnerZone = function (element) {
    var parentElement = (0, _Utilities.getParent)(element, ALLOW_VIRTUAL_ELEMENTS);

    while (parentElement && parentElement !== this._root.current && parentElement !== document.body) {
      if ((0, _Utilities.isElementFocusZone)(parentElement)) {
        return parentElement;
      }

      parentElement = (0, _Utilities.getParent)(parentElement, ALLOW_VIRTUAL_ELEMENTS);
    }

    return parentElement;
  };

  FocusZone.prototype._updateTabIndexes = function (element) {
    if (!element && this._root.current) {
      this._defaultFocusElement = null;
      element = this._root.current;

      if (this._activeElement && !(0, _Utilities.elementContains)(element, this._activeElement)) {
        this._activeElement = null;
      }
    } // If active element changes state to disabled, set it to null.
    // Otherwise, we lose keyboard accessibility to other elements in focus zone.


    if (this._activeElement && !(0, _Utilities.isElementTabbable)(this._activeElement)) {
      this._activeElement = null;
    }

    var childNodes = element && element.children;

    for (var childIndex = 0; childNodes && childIndex < childNodes.length; childIndex++) {
      var child = childNodes[childIndex];

      if (!(0, _Utilities.isElementFocusZone)(child)) {
        // If the item is explicitly set to not be focusable then TABINDEX needs to be set to -1.
        if (child.getAttribute && child.getAttribute(IS_FOCUSABLE_ATTRIBUTE) === 'false') {
          child.setAttribute(TABINDEX, '-1');
        }

        if ((0, _Utilities.isElementTabbable)(child)) {
          if (this.props.disabled) {
            child.setAttribute(TABINDEX, '-1');
          } else if (!this._isInnerZone && (!this._activeElement && !this._defaultFocusElement || this._activeElement === child)) {
            this._defaultFocusElement = child;

            if (child.getAttribute(TABINDEX) !== '0') {
              child.setAttribute(TABINDEX, '0');
            }
          } else if (child.getAttribute(TABINDEX) !== '-1') {
            child.setAttribute(TABINDEX, '-1');
          }
        } else if (child.tagName === 'svg' && child.getAttribute('focusable') !== 'false') {
          // Disgusting IE hack. Sad face.
          child.setAttribute('focusable', 'false');
        }
      } else if (child.getAttribute(IS_FOCUSABLE_ATTRIBUTE) === 'true') {
        if (!this._isInnerZone && (!this._activeElement && !this._defaultFocusElement || this._activeElement === child)) {
          this._defaultFocusElement = child;

          if (child.getAttribute(TABINDEX) !== '0') {
            child.setAttribute(TABINDEX, '0');
          }
        } else if (child.getAttribute(TABINDEX) !== '-1') {
          child.setAttribute(TABINDEX, '-1');
        }
      }

      this._updateTabIndexes(child);
    }
  };

  FocusZone.prototype._isElementInput = function (element) {
    if (element && element.tagName && (element.tagName.toLowerCase() === 'input' || element.tagName.toLowerCase() === 'textarea')) {
      return true;
    }

    return false;
  };

  FocusZone.prototype._shouldInputLoseFocus = function (element, isForward) {
    // If a tab was used, we want to focus on the next element.
    if (!this._processingTabKey && element && element.type && ALLOWED_INPUT_TYPES.indexOf(element.type.toLowerCase()) > -1) {
      var selectionStart = element.selectionStart;
      var selectionEnd = element.selectionEnd;
      var isRangeSelected = selectionStart !== selectionEnd;
      var inputValue = element.value; // We shouldn't lose focus in the following cases:
      // 1. There is range selected.
      // 2. When selection start is larger than 0 and it is backward.
      // 3. when selection start is not the end of length and it is forward.
      // 4. We press any of the arrow keys when our handleTabKey isn't none or undefined (only losing focus if we hit tab)
      // and if shouldInputLoseFocusOnArrowKey is defined, if scenario prefers to not loose the focus which is determined by calling the
      // callback shouldInputLoseFocusOnArrowKey

      if (isRangeSelected || selectionStart > 0 && !isForward || selectionStart !== inputValue.length && isForward || !!this.props.handleTabKey && !(this.props.shouldInputLoseFocusOnArrowKey && this.props.shouldInputLoseFocusOnArrowKey(element))) {
        return false;
      }
    }

    return true;
  };

  FocusZone.prototype._shouldWrapFocus = function (element, noWrapDataAttribute) {
    return !!this.props.checkForNoWrap ? (0, _Utilities.shouldWrapFocus)(element, noWrapDataAttribute) : true;
  };
  /**
   * Returns true if the element is a descendant of the FocusZone through a React portal.
   */


  FocusZone.prototype._portalContainsElement = function (element) {
    return element && !!this._root.current && (0, _Utilities.portalContainsElement)(element, this._root.current);
  };

  FocusZone.defaultProps = {
    isCircularNavigation: false,
    direction: _FocusZone.FocusZoneDirection.bidirectional
  };
  return FocusZone;
}(React.Component);

exports.FocusZone = FocusZone;
},{"tslib":"xgwM","react":"mpTF","./FocusZone.types":"E5Fw","../../Utilities":"B5nc","@uifabric/merge-styles":"w5wT"}],"SJWb":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _FocusZone = require("./FocusZone");

Object.keys(_FocusZone).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _FocusZone[key];
    }
  });
});

var _FocusZone2 = require("./FocusZone.types");

Object.keys(_FocusZone2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _FocusZone2[key];
    }
  });
});
},{"./FocusZone":"SWLc","./FocusZone.types":"E5Fw"}],"v3nN":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _index = require("./components/FocusZone/index");

Object.keys(_index).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index[key];
    }
  });
});
},{"./components/FocusZone/index":"SJWb"}],"CGIo":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getIsChecked = getIsChecked;
exports.hasSubmenu = hasSubmenu;
exports.isItemDisabled = isItemDisabled;

/**
 * Determines the effective checked state of a menu item.
 *
 * @param item {IContextualMenuItem} to get the check state of.
 * @returns {true} if the item is checked.
 * @returns {false} if the item is unchecked.
 * @returns {null} if the item is not checkable.
 */
function getIsChecked(item) {
  if (item.canCheck) {
    return !!(item.isChecked || item.checked);
  }

  if (typeof item.isChecked === 'boolean') {
    return item.isChecked;
  }

  if (typeof item.checked === 'boolean') {
    return item.checked;
  } // Item is not checkable.


  return null;
}

function hasSubmenu(item) {
  return !!(item.subMenuProps || item.items);
}

function isItemDisabled(item) {
  return !!(item.isDisabled || item.disabled);
}
},{}],"Q6fV":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _contextualMenuUtility = require("./contextualMenuUtility");

Object.keys(_contextualMenuUtility).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _contextualMenuUtility[key];
    }
  });
});
},{"./contextualMenuUtility":"CGIo"}],"TOSS":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.BaseDecorator = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var _Utilities = require("../../Utilities");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var BaseDecorator =
/** @class */
function (_super) {
  tslib_1.__extends(BaseDecorator, _super);

  function BaseDecorator(props) {
    var _this = _super.call(this, props) || this; // tslint:disable-next-line:typedef


    _this._skipComponentRefResolution = true;
    _this._updateComposedComponentRef = _this._updateComposedComponentRef.bind(_this);
    return _this;
  }
  /**
   * Updates the ref to the component composed by the decorator, which will also take care of hoisting
   * (and unhoisting as appropriate) methods from said component.
   *
   * Pass this method as the argument to the 'ref' property of the composed component.
   */


  BaseDecorator.prototype._updateComposedComponentRef = function (composedComponentInstance) {
    this._composedComponentInstance = composedComponentInstance;

    if (composedComponentInstance) {
      this._hoisted = (0, _Utilities.hoistMethods)(this, composedComponentInstance);
    } else if (this._hoisted) {
      (0, _Utilities.unhoistMethods)(this, this._hoisted);
    }
  };

  return BaseDecorator;
}(_Utilities.BaseComponent);

exports.BaseDecorator = BaseDecorator;
},{"tslib":"xgwM","../../Utilities":"B5nc"}],"Q4um":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.setResponsiveMode = setResponsiveMode;
exports.withResponsiveMode = withResponsiveMode;
exports.ResponsiveMode = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _BaseDecorator = require("./BaseDecorator");

var _Utilities = require("../../Utilities");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var ResponsiveMode;
exports.ResponsiveMode = ResponsiveMode;

(function (ResponsiveMode) {
  ResponsiveMode[ResponsiveMode["small"] = 0] = "small";
  ResponsiveMode[ResponsiveMode["medium"] = 1] = "medium";
  ResponsiveMode[ResponsiveMode["large"] = 2] = "large";
  ResponsiveMode[ResponsiveMode["xLarge"] = 3] = "xLarge";
  ResponsiveMode[ResponsiveMode["xxLarge"] = 4] = "xxLarge";
  ResponsiveMode[ResponsiveMode["xxxLarge"] = 5] = "xxxLarge";
})(ResponsiveMode || (exports.ResponsiveMode = ResponsiveMode = {}));

var RESPONSIVE_MAX_CONSTRAINT = [479, 639, 1023, 1365, 1919, 99999999];

var _defaultMode;
/**
 * Allows a server rendered scenario to provide a default responsive mode.
 */


function setResponsiveMode(responsiveMode) {
  _defaultMode = responsiveMode;
}

function withResponsiveMode(ComposedComponent) {
  var resultClass =
  /** @class */
  function (_super) {
    tslib_1.__extends(WithResponsiveMode, _super);

    function WithResponsiveMode(props) {
      var _this = _super.call(this, props) || this;

      _this._updateComposedComponentRef = _this._updateComposedComponentRef.bind(_this);
      _this.state = {
        responsiveMode: _this._getResponsiveMode()
      };
      return _this;
    }

    WithResponsiveMode.prototype.componentDidMount = function () {
      var _this = this;

      this._events.on(window, 'resize', function () {
        var responsiveMode = _this._getResponsiveMode();

        if (responsiveMode !== _this.state.responsiveMode) {
          _this.setState({
            responsiveMode: responsiveMode
          });
        }
      });
    };

    WithResponsiveMode.prototype.componentWillUnmount = function () {
      this._events.dispose();
    };

    WithResponsiveMode.prototype.render = function () {
      var responsiveMode = this.state.responsiveMode;
      return React.createElement(ComposedComponent, tslib_1.__assign({
        ref: this._updateComposedComponentRef,
        responsiveMode: responsiveMode
      }, this.props));
    };

    WithResponsiveMode.prototype._getResponsiveMode = function () {
      var responsiveMode = ResponsiveMode.small;
      var win = (0, _Utilities.getWindow)();

      if (typeof win !== 'undefined') {
        try {
          while (win.innerWidth > RESPONSIVE_MAX_CONSTRAINT[responsiveMode]) {
            responsiveMode++;
          }
        } catch (e) {
          // Return a best effort result in cases where we're in the browser but it throws on getting innerWidth.
          responsiveMode = ResponsiveMode.large;
        }
      } else {
        if (_defaultMode !== undefined) {
          responsiveMode = _defaultMode;
        } else {
          throw new Error('Content was rendered in a server environment without providing a default responsive mode. ' + 'Call setResponsiveMode to define what the responsive mode is.');
        }
      }

      return responsiveMode;
    };

    return WithResponsiveMode;
  }(_BaseDecorator.BaseDecorator);

  return (0, _Utilities.hoistStatics)(ComposedComponent, resultClass);
}
},{"tslib":"xgwM","react":"mpTF","./BaseDecorator":"TOSS","../../Utilities":"B5nc"}],"uA2f":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Position = exports.RectangleEdge = void 0;
var RectangleEdge;
exports.RectangleEdge = RectangleEdge;

(function (RectangleEdge) {
  RectangleEdge[RectangleEdge["top"] = 1] = "top";
  RectangleEdge[RectangleEdge["bottom"] = -1] = "bottom";
  RectangleEdge[RectangleEdge["left"] = 2] = "left";
  RectangleEdge[RectangleEdge["right"] = -2] = "right";
})(RectangleEdge || (exports.RectangleEdge = RectangleEdge = {}));

var Position;
exports.Position = Position;

(function (Position) {
  Position[Position["top"] = 0] = "top";
  Position[Position["bottom"] = 1] = "bottom";
  Position[Position["start"] = 2] = "start";
  Position[Position["end"] = 3] = "end";
})(Position || (exports.Position = Position = {}));
},{}],"ua1g":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.positionElement = positionElement;
exports.positionCallout = positionCallout;
exports.getMaxHeight = getMaxHeight;
exports.getOppositeEdge = getOppositeEdge;
exports.__positioningTestPackage = exports.Rectangle = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var _DirectionalHint = require("../../common/DirectionalHint");

var _Utilities = require("../../Utilities");

var _positioning = require("./positioning.types");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var Rectangle =
/** @class */
function (_super) {
  tslib_1.__extends(Rectangle, _super);

  function Rectangle() {
    return _super !== null && _super.apply(this, arguments) || this;
  }

  return Rectangle;
}(_Utilities.Rectangle);

exports.Rectangle = Rectangle;

function _createPositionData(targetEdge, alignmentEdge, isAuto) {
  return {
    targetEdge: targetEdge,
    alignmentEdge: alignmentEdge,
    isAuto: isAuto
  };
} // Currently the beakPercent is set to 50 for all positions meaning that it should tend to the center of the target


var DirectionalDictionary = (_a = {}, _a[_DirectionalHint.DirectionalHint.topLeftEdge] = _createPositionData(_positioning.RectangleEdge.top, _positioning.RectangleEdge.left), _a[_DirectionalHint.DirectionalHint.topCenter] = _createPositionData(_positioning.RectangleEdge.top), _a[_DirectionalHint.DirectionalHint.topRightEdge] = _createPositionData(_positioning.RectangleEdge.top, _positioning.RectangleEdge.right), _a[_DirectionalHint.DirectionalHint.topAutoEdge] = _createPositionData(_positioning.RectangleEdge.top, undefined, true), _a[_DirectionalHint.DirectionalHint.bottomLeftEdge] = _createPositionData(_positioning.RectangleEdge.bottom, _positioning.RectangleEdge.left), _a[_DirectionalHint.DirectionalHint.bottomCenter] = _createPositionData(_positioning.RectangleEdge.bottom), _a[_DirectionalHint.DirectionalHint.bottomRightEdge] = _createPositionData(_positioning.RectangleEdge.bottom, _positioning.RectangleEdge.right), _a[_DirectionalHint.DirectionalHint.bottomAutoEdge] = _createPositionData(_positioning.RectangleEdge.bottom, undefined, true), _a[_DirectionalHint.DirectionalHint.leftTopEdge] = _createPositionData(_positioning.RectangleEdge.left, _positioning.RectangleEdge.top), _a[_DirectionalHint.DirectionalHint.leftCenter] = _createPositionData(_positioning.RectangleEdge.left), _a[_DirectionalHint.DirectionalHint.leftBottomEdge] = _createPositionData(_positioning.RectangleEdge.left, _positioning.RectangleEdge.bottom), _a[_DirectionalHint.DirectionalHint.rightTopEdge] = _createPositionData(_positioning.RectangleEdge.right, _positioning.RectangleEdge.top), _a[_DirectionalHint.DirectionalHint.rightCenter] = _createPositionData(_positioning.RectangleEdge.right), _a[_DirectionalHint.DirectionalHint.rightBottomEdge] = _createPositionData(_positioning.RectangleEdge.right, _positioning.RectangleEdge.bottom), _a);

function _isRectangleWithinBounds(rect, boundingRect) {
  if (rect.top < boundingRect.top) {
    return false;
  }

  if (rect.bottom > boundingRect.bottom) {
    return false;
  }

  if (rect.left < boundingRect.left) {
    return false;
  }

  if (rect.right > boundingRect.right) {
    return false;
  }

  return true;
}
/**
 * Gets all of the edges of a rectangle that are outside of the given bounds.
 * If there are no out of bounds edges it returns an empty array.
 */


function _getOutOfBoundsEdges(rect, boundingRect) {
  var outOfBounds = new Array();

  if (rect.top < boundingRect.top) {
    outOfBounds.push(_positioning.RectangleEdge.top);
  }

  if (rect.bottom > boundingRect.bottom) {
    outOfBounds.push(_positioning.RectangleEdge.bottom);
  }

  if (rect.left < boundingRect.left) {
    outOfBounds.push(_positioning.RectangleEdge.left);
  }

  if (rect.right > boundingRect.right) {
    outOfBounds.push(_positioning.RectangleEdge.right);
  }

  return outOfBounds;
}

function _getEdgeValue(rect, edge) {
  return rect[_positioning.RectangleEdge[edge]];
}

function _setEdgeValue(rect, edge, value) {
  rect[_positioning.RectangleEdge[edge]] = value;
  return rect;
}
/**
 * Returns the middle value of an edge. Only returns 1 value rather than xy coordinates as
 * the itself already contains the other coordinate.
 * For instance, a bottom edge's current value is it's y coordinate, so the number returned is the x.
 *
 * @param {Rectangle} rect
 * @param {RectangleEdge} edge
 * @returns {number}
 */


function _getCenterValue(rect, edge) {
  var edges = _getFlankingEdges(edge);

  return (_getEdgeValue(rect, edges.positiveEdge) + _getEdgeValue(rect, edges.negativeEdge)) / 2;
}
/**
 * Flips the value depending on the edge.
 * If the edge is a "positive" edge, Top or Left, then the value should stay as it is.
 * If the edge is a "negative" edge, Bottom or Right, then the value should be flipped.
 * This is to account for the fact that the coordinates are effectively reveserved in certain cases for the "negative" edges.
 * For example, when testing to see if a bottom edge 1 is within the bounds of another bottom edge 2.
 * If edge 1 is greater than edge 2 then it is out of bounds. This is reversed for top edge 1 and top edge 2.
 * If top edge 1 is less than edge 2 then it is out of bounds.
 *
 *
 * @param {RectangleEdge} edge
 * @param {number} value
 * @returns {number}
 */


function _getRelativeEdgeValue(edge, value) {
  if (edge > 0) {
    return value;
  } else {
    return value * -1;
  }
}

function _getRelativeRectEdgeValue(edge, rect) {
  return _getRelativeEdgeValue(edge, _getEdgeValue(rect, edge));
}

function _getRelativeEdgeDifference(rect, hostRect, edge) {
  var edgeDifference = _getEdgeValue(rect, edge) - _getEdgeValue(hostRect, edge);

  return _getRelativeEdgeValue(edge, edgeDifference);
}
/**
 * Moves the edge of a rectangle to the value given. It only moves the edge in a linear direction based on that edge.
 * For example, if it's a bottom edge it will only change y coordinates.
 *
 * @param {Rectangle} rect
 * @param {RectangleEdge} edge
 * @param {number} newValue
 * @returns {Rectangle}
 */


function _moveEdge(rect, edge, newValue) {
  var difference = _getEdgeValue(rect, edge) - newValue;
  rect = _setEdgeValue(rect, edge, newValue);
  rect = _setEdgeValue(rect, edge * -1, _getEdgeValue(rect, edge * -1) - difference);
  return rect;
}
/**
 * Aligns the edge on the passed in rect to the target. If there is a gap then it will have that space between the two.
 *
 * @param {Rectangle} rect
 * @param {Rectangle} target
 * @param {RectangleEdge} edge
 * @param {number} [gap=0]
 * @returns {Rectangle}
 */


function _alignEdges(rect, target, edge, gap) {
  if (gap === void 0) {
    gap = 0;
  }

  return _moveEdge(rect, edge, _getEdgeValue(target, edge) + _getRelativeEdgeValue(edge, gap));
}
/**
 * Aligns the targetEdge on the passed in target to the rects corresponding opposite edge.
 * For instance if targetEdge is bottom, then the rects top will be moved to match it.
 *
 * @param {Rectangle} rect
 * @param {Rectangle} target
 * @param {RectangleEdge} targetEdge
 * @param {number} [gap=0]
 * @returns {Rectangle}
 */


function _alignOppositeEdges(rect, target, targetEdge, gap) {
  if (gap === void 0) {
    gap = 0;
  }

  var oppositeEdge = targetEdge * -1;

  var adjustedGap = _getRelativeEdgeValue(oppositeEdge, gap);

  return _moveEdge(rect, targetEdge * -1, _getEdgeValue(target, targetEdge) + adjustedGap);
}
/**
 * Tests to see if the given edge is within the bounds of the given rectangle.
 *
 * @param {Rectangle} rect
 * @param {Rectangle} bounds
 * @param {RectangleEdge} edge
 * @returns {boolean}
 */


function _isEdgeInBounds(rect, bounds, edge) {
  var adjustedRectValue = _getRelativeRectEdgeValue(edge, rect);

  return adjustedRectValue > _getRelativeRectEdgeValue(edge, bounds);
}
/**
 * Attempts to move the rectangle through various sides of the target to find a place to fit.
 * If no fit is found, the original position should be returned.
 *
 * @param {Rectangle} rect
 * @param {Rectangle} target
 * @param {Rectangle} bounding
 * @param {IPositionDirectionalHintData} positionData
 * @param {number} [gap=0]
 * @returns {IElementPosition}
 */


function _flipToFit(rect, target, bounding, positionData, gap) {
  if (gap === void 0) {
    gap = 0;
  }

  var directions = [_positioning.RectangleEdge.left, _positioning.RectangleEdge.right, _positioning.RectangleEdge.bottom, _positioning.RectangleEdge.top];
  var currentEstimate = rect;
  var currentEdge = positionData.targetEdge;
  var currentAlignment = positionData.alignmentEdge; // Keep switching sides until one is found with enough space. If all sides don't fit then return the unmodified element.

  for (var i = 0; i < 4; i++) {
    if (!_isEdgeInBounds(currentEstimate, bounding, currentEdge)) {
      directions.splice(directions.indexOf(currentEdge), 1);

      if (directions.indexOf(currentEdge * -1) > -1) {
        currentEdge = currentEdge * -1;
      } else {
        currentAlignment = currentEdge;
        currentEdge = directions.slice(-1)[0];
      }

      currentEstimate = _estimatePosition(rect, target, {
        targetEdge: currentEdge,
        alignmentEdge: currentAlignment
      }, gap);
    } else {
      return {
        elementRectangle: currentEstimate,
        targetEdge: currentEdge,
        alignmentEdge: currentAlignment
      };
    }
  }

  return {
    elementRectangle: rect,
    targetEdge: positionData.targetEdge,
    alignmentEdge: currentAlignment
  };
}
/**
 * Flips only the alignment edge of an element rectangle. This is used instead of nudging the alignment edges into position,
 * when alignTargetEdge is specified.
 * @param elementEstimate
 * @param target
 * @param bounding
 * @param gap
 */


function _flipAlignmentEdge(elementEstimate, target, gap, coverTarget) {
  var alignmentEdge = elementEstimate.alignmentEdge,
      targetEdge = elementEstimate.targetEdge,
      elementRectangle = elementEstimate.elementRectangle;
  var oppositeEdge = alignmentEdge * -1;

  var newEstimate = _estimatePosition(elementRectangle, target, {
    targetEdge: targetEdge,
    alignmentEdge: oppositeEdge
  }, gap, coverTarget);

  return {
    elementRectangle: newEstimate,
    targetEdge: targetEdge,
    alignmentEdge: oppositeEdge
  };
}
/**
 * Adjusts a element rectangle to fit within the bounds given. If directionalHintFixed or covertarget is passed in
 * then the element will not flip sides on the target. They will, however, be nudged to fit within the bounds given.
 *
 * @param {Rectangle} element
 * @param {Rectangle} target
 * @param {Rectangle} bounding
 * @param {IPositionDirectionalHintData} positionData
 * @param {number} [gap=0]
 * @param {boolean} [directionalHintFixed]
 * @param {boolean} [coverTarget]
 * @returns {IElementPosition}
 */


function _adjustFitWithinBounds(element, target, bounding, positionData, gap, directionalHintFixed, coverTarget) {
  if (gap === void 0) {
    gap = 0;
  }

  var alignmentEdge = positionData.alignmentEdge,
      alignTargetEdge = positionData.alignTargetEdge;
  var elementEstimate = {
    elementRectangle: element,
    targetEdge: positionData.targetEdge,
    alignmentEdge: alignmentEdge
  };

  if (!directionalHintFixed && !coverTarget) {
    elementEstimate = _flipToFit(element, target, bounding, positionData, gap);
  }

  var outOfBounds = _getOutOfBoundsEdges(element, bounding);

  if (alignTargetEdge) {
    // The edge opposite to the alignment edge might be out of bounds. Flip alignment to see if we can get it within bounds.
    if (elementEstimate.alignmentEdge && outOfBounds.indexOf(elementEstimate.alignmentEdge * -1) > -1) {
      var flippedElementEstimate = _flipAlignmentEdge(elementEstimate, target, gap, coverTarget);

      if (_isRectangleWithinBounds(flippedElementEstimate.elementRectangle, bounding)) {
        return flippedElementEstimate;
      }
    }
  } else {
    for (var _i = 0, outOfBounds_1 = outOfBounds; _i < outOfBounds_1.length; _i++) {
      var direction = outOfBounds_1[_i];
      elementEstimate.elementRectangle = _alignEdges(elementEstimate.elementRectangle, bounding, direction);
    }
  }

  return elementEstimate;
}
/**
 * Moves the middle point on an edge to the point given.
 * Only moves in one direction. For instance if a bottom edge is passed in, then
 * the bottom edge will be moved in the x axis to match the point.
 *
 * @param {Rectangle} rect
 * @param {RectangleEdge} edge
 * @param {number} point
 * @returns {Rectangle}
 */


function _centerEdgeToPoint(rect, edge, point) {
  var positiveEdge = _getFlankingEdges(edge).positiveEdge;

  var elementMiddle = _getCenterValue(rect, edge);

  var distanceToMiddle = elementMiddle - _getEdgeValue(rect, positiveEdge);

  return _moveEdge(rect, positiveEdge, point - distanceToMiddle);
}
/**
 * Moves the element rectangle to be appropriately positioned relative to a given target.
 * Does not flip or adjust the element.
 *
 * @param {Rectangle} elementToPosition
 * @param {Rectangle} target
 * @param {IPositionDirectionalHintData} positionData
 * @param {number} [gap=0]
 * @param {boolean} [coverTarget]
 * @returns {Rectangle}
 */


function _estimatePosition(elementToPosition, target, positionData, gap, coverTarget) {
  if (gap === void 0) {
    gap = 0;
  }

  var estimatedElementPosition;
  var alignmentEdge = positionData.alignmentEdge,
      targetEdge = positionData.targetEdge;
  var elementEdge = coverTarget ? targetEdge : targetEdge * -1;
  estimatedElementPosition = coverTarget ? _alignEdges(elementToPosition, target, targetEdge, gap) : _alignOppositeEdges(elementToPosition, target, targetEdge, gap); // if no alignment edge is provided it's supposed to be centered.

  if (!alignmentEdge) {
    var targetMiddlePoint = _getCenterValue(target, targetEdge);

    estimatedElementPosition = _centerEdgeToPoint(estimatedElementPosition, elementEdge, targetMiddlePoint);
  } else {
    estimatedElementPosition = _alignEdges(estimatedElementPosition, target, alignmentEdge);
  }

  return estimatedElementPosition;
}
/**
 * Returns the non-opposite edges of the target edge.
 * For instance if bottom is passed in then left and right will be returned.
 *
 * @param {RectangleEdge} edge
 * @returns {{ firstEdge: RectangleEdge, secondEdge: RectangleEdge }}
 */


function _getFlankingEdges(edge) {
  if (edge === _positioning.RectangleEdge.top || edge === _positioning.RectangleEdge.bottom) {
    return {
      positiveEdge: _positioning.RectangleEdge.left,
      negativeEdge: _positioning.RectangleEdge.right
    };
  } else {
    return {
      positiveEdge: _positioning.RectangleEdge.top,
      negativeEdge: _positioning.RectangleEdge.bottom
    };
  }
}
/**
 * Retrieve the final value for the return edge of elementRectangle.
 * If the elementRectangle is closer to one side of the bounds versus the other, the return edge is flipped to grow inward.
 * The finalized return edge should not flip if the element has already been positiuoned successfully to prevent the callout from
 * appearing to jump
 *
 * @param elementRectangle
 * @param targetEdge
 * @param bounds
 * @param previousPositions
 */


function _finalizeReturnEdge(elementRectangle, returnEdge, bounds, previousPositions) {
  if (!previousPositions && bounds && Math.abs(_getRelativeEdgeDifference(elementRectangle, bounds, returnEdge)) > Math.abs(_getRelativeEdgeDifference(elementRectangle, bounds, returnEdge * -1))) {
    return returnEdge * -1;
  }

  return returnEdge;
}
/**
 * Finalizes the element positon based on the hostElement. Only returns the
 * rectangle values to position such that they are anchored to the target.
 * This helps prevent resizing from looking very strange.
 * For instance, if the target edge is top and aligned with the left side then
 * the bottom and left values are returned so as the callou shrinks it shrinks towards that corner.
 *
 * @param {Rectangle} elementRectangle
 * @param {HTMLElement} hostElement
 * @param {RectangleEdge} targetEdge
 * @param {RectangleEdge} bounds
 * @param {RectangleEdge} [alignmentEdge]
 * @param {boolean} coverTarget
 * @param {previousPositions} previousPositions
 * @returns {IPartialIRectangle}
 */


function _finalizeElementPosition(elementRectangle, hostElement, targetEdge, bounds, alignmentEdge, coverTarget, previousPositions) {
  var returnValue = {};

  var hostRect = _getRectangleFromElement(hostElement);

  var elementEdge = coverTarget ? targetEdge : targetEdge * -1;
  var elementEdgeString = _positioning.RectangleEdge[elementEdge];

  var returnEdge = _finalizeReturnEdge(elementRectangle, alignmentEdge ? alignmentEdge : _getFlankingEdges(targetEdge).positiveEdge, bounds, previousPositions);

  returnValue[elementEdgeString] = _getRelativeEdgeDifference(elementRectangle, hostRect, elementEdge);
  returnValue[_positioning.RectangleEdge[returnEdge]] = _getRelativeEdgeDifference(elementRectangle, hostRect, returnEdge);
  return returnValue;
} // Since the beak is rotated 45 degrees the actual height/width is the length of the diagonal.
// We still want to position the beak based on it's midpoint which does not change. It will
// be at (beakwidth / 2, beakwidth / 2)


function _calculateActualBeakWidthInPixels(beakWidth) {
  return Math.sqrt(beakWidth * beakWidth * 2);
}
/**
 * Returns the appropriate IPositionData based on the props altered for RTL.
 * If directionalHintForRTL is passed in that is used if the page is RTL.
 * If a directionalHint is specified and no directionalHintForRTL is available and the page is RTL the hint will be flipped.
 * For instance bottomLeftEdge would become bottomRightEdge.
 * If there is no directionalHint passed in bottomAutoEdge is chosen automatically.
 *
 * @param {IPositionProps} props
 * @returns {IPositionDirectionalHintData}
 */


function _getPositionData(directionalHint, directionalHintForRTL, previousPositions) {
  if (directionalHint === void 0) {
    directionalHint = _DirectionalHint.DirectionalHint.bottomAutoEdge;
  }

  if (previousPositions) {
    return {
      alignmentEdge: previousPositions.alignmentEdge,
      isAuto: previousPositions.isAuto,
      targetEdge: previousPositions.targetEdge
    };
  }

  var positionInformation = tslib_1.__assign({}, DirectionalDictionary[directionalHint]);

  if ((0, _Utilities.getRTL)()) {
    // If alignment edge exists and that alignment edge is -2 or 2, right or left, then flip it.
    if (positionInformation.alignmentEdge && positionInformation.alignmentEdge % 2 === 0) {
      positionInformation.alignmentEdge = positionInformation.alignmentEdge * -1;
    }

    return directionalHintForRTL !== undefined ? DirectionalDictionary[directionalHintForRTL] : positionInformation;
  }

  return positionInformation;
}
/**
 * Get's the alignment data for the given information. This only really matters if the positioning is Auto.
 * If it is auto then the alignmentEdge should be chosen based on the target edge's position relative to
 * the center of the page.
 *
 * @param {IPositionDirectionalHintData} positionData
 * @param {Rectangle} target
 * @param {Rectangle} boundingRect
 * @param {boolean} [coverTarget]
 * @returns {IPositionDirectionalHintData}
 */


function _getAlignmentData(positionData, target, boundingRect, coverTarget, alignTargetEdge) {
  if (positionData.isAuto) {
    positionData.alignmentEdge = getClosestEdge(positionData.targetEdge, target, boundingRect);
  }

  positionData.alignTargetEdge = alignTargetEdge;
  return positionData;
}

function getClosestEdge(targetEdge, target, boundingRect) {
  var targetCenter = _getCenterValue(target, targetEdge);

  var boundingCenter = _getCenterValue(boundingRect, targetEdge);

  var _a = _getFlankingEdges(targetEdge),
      positiveEdge = _a.positiveEdge,
      negativeEdge = _a.negativeEdge;

  if (targetCenter <= boundingCenter) {
    return positiveEdge;
  } else {
    return negativeEdge;
  }
}

function _positionElementWithinBounds(elementToPosition, target, bounding, positionData, gap, directionalHintFixed, coverTarget) {
  var estimatedElementPosition = _estimatePosition(elementToPosition, target, positionData, gap, coverTarget);

  if (_isRectangleWithinBounds(estimatedElementPosition, bounding)) {
    return {
      elementRectangle: estimatedElementPosition,
      targetEdge: positionData.targetEdge,
      alignmentEdge: positionData.alignmentEdge
    };
  } else {
    return _adjustFitWithinBounds(elementToPosition, target, bounding, positionData, gap, directionalHintFixed, coverTarget);
  }
}

function _finalizeBeakPosition(elementPosition, positionedBeak, bounds) {
  var targetEdge = elementPosition.targetEdge * -1; // The "host" element that we will use to help position the beak.

  var actualElement = new Rectangle(0, elementPosition.elementRectangle.width, 0, elementPosition.elementRectangle.height);
  var returnValue = {};

  var returnEdge = _finalizeReturnEdge(elementPosition.elementRectangle, elementPosition.alignmentEdge ? elementPosition.alignmentEdge : _getFlankingEdges(targetEdge).positiveEdge, bounds);

  returnValue[_positioning.RectangleEdge[targetEdge]] = _getEdgeValue(positionedBeak, targetEdge);
  returnValue[_positioning.RectangleEdge[returnEdge]] = _getRelativeEdgeDifference(positionedBeak, actualElement, returnEdge);
  return {
    elementPosition: tslib_1.__assign({}, returnValue),
    closestEdge: getClosestEdge(elementPosition.targetEdge, positionedBeak, actualElement),
    targetEdge: targetEdge
  };
}

function _positionBeak(beakWidth, elementPosition) {
  var target = elementPosition.targetRectangle;
  /**
   * Note about beak positioning: The actual beak width only matters for getting the gap between the callout and
   * target, it does not impact the beak placement within the callout. For example example, if the beakWidth is 8,
   * then the actual beakWidth is sqrroot(8^2 + 8^2) = 11.31x11.31. So the callout will need to be an extra 3 pixels
   * away from its target. While the beak is being positioned in the callout it still acts as though it were 8x8.
   * */

  var _a = _getFlankingEdges(elementPosition.targetEdge),
      positiveEdge = _a.positiveEdge,
      negativeEdge = _a.negativeEdge;

  var beakTargetPoint = _getCenterValue(target, elementPosition.targetEdge);

  var elementBounds = new Rectangle(beakWidth / 2, elementPosition.elementRectangle.width - beakWidth / 2, beakWidth / 2, elementPosition.elementRectangle.height - beakWidth / 2);
  var beakPosition = new Rectangle(0, beakWidth, 0, beakWidth);
  beakPosition = _moveEdge(beakPosition, elementPosition.targetEdge * -1, -beakWidth / 2);
  beakPosition = _centerEdgeToPoint(beakPosition, elementPosition.targetEdge * -1, beakTargetPoint - _getRelativeRectEdgeValue(positiveEdge, elementPosition.elementRectangle));

  if (!_isEdgeInBounds(beakPosition, elementBounds, positiveEdge)) {
    beakPosition = _alignEdges(beakPosition, elementBounds, positiveEdge);
  } else if (!_isEdgeInBounds(beakPosition, elementBounds, negativeEdge)) {
    beakPosition = _alignEdges(beakPosition, elementBounds, negativeEdge);
  }

  return beakPosition;
}

function _getRectangleFromElement(element) {
  var clientRect = element.getBoundingClientRect();
  return new Rectangle(clientRect.left, clientRect.right, clientRect.top, clientRect.bottom);
}

function _getRectangleFromIRect(rect) {
  return new Rectangle(rect.left, rect.right, rect.top, rect.bottom);
}

function _getTargetRect(bounds, target) {
  var targetRectangle;

  if (target) {
    if (target.preventDefault) {
      var ev = target;
      targetRectangle = new Rectangle(ev.clientX, ev.clientX, ev.clientY, ev.clientY);
    } else if (target.getBoundingClientRect) {
      targetRectangle = _getRectangleFromElement(target); // HTMLImgElements can have x and y values. The check for it being a point must go last.
    } else {
      var point = target;
      targetRectangle = new Rectangle(point.x, point.x, point.y, point.y);
    }

    if (!_isRectangleWithinBounds(targetRectangle, bounds)) {
      var outOfBounds = _getOutOfBoundsEdges(targetRectangle, bounds);

      for (var _i = 0, outOfBounds_2 = outOfBounds; _i < outOfBounds_2.length; _i++) {
        var direction = outOfBounds_2[_i];
        targetRectangle[_positioning.RectangleEdge[direction]] = bounds[_positioning.RectangleEdge[direction]];
      }
    }
  } else {
    targetRectangle = new Rectangle(0, 0, 0, 0);
  }

  return targetRectangle;
}
/**
 * If max height is less than zero it returns the bounds height instead.
 */


function _getMaxHeightFromTargetRectangle(targetRectangle, targetEdge, gapSpace, bounds, coverTarget) {
  var maxHeight = 0;
  var directionalHint = DirectionalDictionary[targetEdge]; // If cover target is set, then the max height should be calculated using the opposite of the target edge since
  // that's the direction that the callout will expand in.
  // For instance, if the directionalhint is bottomLeftEdge then the callout will position so it's bottom edge
  // is aligned with the bottom of the target and expand up towards the top of the screen and the calculated max height
  // is (bottom of target) - (top of screen) - gapSpace.

  var target = coverTarget ? directionalHint.targetEdge * -1 : directionalHint.targetEdge;

  if (target === _positioning.RectangleEdge.top) {
    maxHeight = _getEdgeValue(targetRectangle, directionalHint.targetEdge) - bounds.top - gapSpace;
  } else if (target === _positioning.RectangleEdge.bottom) {
    maxHeight = bounds.bottom - _getEdgeValue(targetRectangle, directionalHint.targetEdge) - gapSpace;
  } else {
    maxHeight = bounds.bottom - targetRectangle.top - gapSpace;
  }

  return maxHeight > 0 ? maxHeight : bounds.height;
}

function _positionElementRelative(props, elementToPosition, boundingRect, previousPositions) {
  var gap = props.gapSpace ? props.gapSpace : 0;

  var targetRect = _getTargetRect(boundingRect, props.target);

  var positionData = _getAlignmentData(_getPositionData(props.directionalHint, props.directionalHintForRTL, previousPositions), targetRect, boundingRect, props.coverTarget, props.alignTargetEdge);

  var positionedElement = _positionElementWithinBounds(_getRectangleFromElement(elementToPosition), targetRect, boundingRect, positionData, gap, props.directionalHintFixed, props.coverTarget);

  return tslib_1.__assign({}, positionedElement, {
    targetRectangle: targetRect
  });
}
/**
 *
 * @param positionedElement The elements estimated position, is not page relative yet
 * @param hostElement The element which is hosting the positioning element
 * @param bounds The space in which the positioning element can render
 * @param coverTarget Whether or not the element should cover the target
 * @param previousPositions If the element has already been positioned before.
 */


function _finalizePositionData(positionedElement, hostElement, bounds, coverTarget, previousPositions) {
  var finalizedElement = _finalizeElementPosition(positionedElement.elementRectangle, hostElement, positionedElement.targetEdge, bounds, positionedElement.alignmentEdge, coverTarget, previousPositions);

  return {
    elementPosition: finalizedElement,
    targetEdge: positionedElement.targetEdge,
    alignmentEdge: positionedElement.alignmentEdge
  };
}

function _positionElement(props, hostElement, elementToPosition, previousPositions) {
  var boundingRect = props.bounds ? _getRectangleFromIRect(props.bounds) : new Rectangle(0, window.innerWidth - (0, _Utilities.getScrollbarWidth)(), 0, window.innerHeight);

  var positionedElement = _positionElementRelative(props, elementToPosition, boundingRect, previousPositions);

  return _finalizePositionData(positionedElement, hostElement, boundingRect, props.coverTarget, !!previousPositions);
}

function _positionCallout(props, hostElement, callout, previousPositions) {
  var beakWidth = props.isBeakVisible ? props.beakWidth || 0 : 0;
  var gap = _calculateActualBeakWidthInPixels(beakWidth) / 2 + (props.gapSpace ? props.gapSpace : 0);
  var positionProps = props;
  positionProps.gapSpace = gap;
  var boundingRect = props.bounds ? _getRectangleFromIRect(props.bounds) : new Rectangle(0, window.innerWidth - (0, _Utilities.getScrollbarWidth)(), 0, window.innerHeight);

  var positionedElement = _positionElementRelative(positionProps, callout, boundingRect, previousPositions);

  var beakPositioned = _positionBeak(beakWidth, positionedElement);

  var finalizedBeakPosition = _finalizeBeakPosition(positionedElement, beakPositioned, boundingRect);

  return tslib_1.__assign({}, _finalizePositionData(positionedElement, hostElement, boundingRect, props.coverTarget, !!previousPositions), {
    beakPosition: finalizedBeakPosition
  });
} // END PRIVATE FUNCTIONS

/* tslint:disable:variable-name */


var __positioningTestPackage = {
  _finalizePositionData: _finalizePositionData,
  _finalizeBeakPosition: _finalizeBeakPosition,
  _calculateActualBeakWidthInPixels: _calculateActualBeakWidthInPixels,
  _positionElementWithinBounds: _positionElementWithinBounds,
  _positionBeak: _positionBeak,
  _getPositionData: _getPositionData,
  _getMaxHeightFromTargetRectangle: _getMaxHeightFromTargetRectangle
};
/* tslint:enable:variable-name */

/**
 * Used to position an element relative to the given positioning props.
 * If positioning has been completed before, previousPositioningData
 * can be passed to ensure that the positioning element repositions based on
 * its previous targets rather than starting with directionalhint.
 *
 * @export
 * @param {IPositionProps} props
 * @param {HTMLElement} hostElement
 * @param {HTMLElement} elementToPosition
 * @param {IPositionedData} previousPositions
 * @returns
 */

exports.__positioningTestPackage = __positioningTestPackage;

function positionElement(props, hostElement, elementToPosition, previousPositions) {
  return _positionElement(props, hostElement, elementToPosition, previousPositions);
}

function positionCallout(props, hostElement, elementToPosition, previousPositions) {
  return _positionCallout(props, hostElement, elementToPosition, previousPositions);
}
/**
 * Get's the maximum height that a rectangle can have in order to fit below or above a target.
 * If the directional hint specifies a left or right edge (i.e. leftCenter) it will limit the height to the topBorder
 * of the target given.
 * If no bounds are provided then the window is treated as the bounds.
 */


function getMaxHeight(target, targetEdge, gapSpace, bounds, coverTarget) {
  if (gapSpace === void 0) {
    gapSpace = 0;
  }

  var mouseTarget = target;
  var elementTarget = target;
  var pointTarget = target;
  var targetRect;
  var boundingRectangle = bounds ? _getRectangleFromIRect(bounds) : new Rectangle(0, window.innerWidth - (0, _Utilities.getScrollbarWidth)(), 0, window.innerHeight);

  if (mouseTarget.stopPropagation) {
    targetRect = new Rectangle(mouseTarget.clientX, mouseTarget.clientX, mouseTarget.clientY, mouseTarget.clientY);
  } else if (pointTarget.x !== undefined && pointTarget.y !== undefined) {
    targetRect = new Rectangle(pointTarget.x, pointTarget.x, pointTarget.y, pointTarget.y);
  } else {
    targetRect = _getRectangleFromElement(elementTarget);
  }

  return _getMaxHeightFromTargetRectangle(targetRect, targetEdge, gapSpace, boundingRectangle, coverTarget);
}
/**
 * Returns the opposite edge of the given RectangleEdge.
 */


function getOppositeEdge(edge) {
  return edge * -1;
}

var _a;
},{"tslib":"xgwM","../../common/DirectionalHint":"uAUO","../../Utilities":"B5nc","./positioning.types":"uA2f"}],"JJJe":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _positioning = require("./positioning");

Object.keys(_positioning).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _positioning[key];
    }
  });
});

var _positioning2 = require("./positioning.types");

Object.keys(_positioning2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _positioning2[key];
    }
  });
});
},{"./positioning":"ua1g","./positioning.types":"uA2f"}],"FiDX":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _index = require("./positioning/index");

Object.keys(_index).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index[key];
    }
  });
});
},{"./positioning/index":"JJJe"}],"iZ8K":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Popup = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Utilities = require("../../Utilities");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * This adds accessibility to Dialog and Panel controls
 */
var Popup =
/** @class */
function (_super) {
  tslib_1.__extends(Popup, _super);

  function Popup(props) {
    var _this = _super.call(this, props) || this;

    _this._root = React.createRef();
    _this._disposables = [];

    _this._onKeyDown = function (ev) {
      switch (ev.which) {
        case _Utilities.KeyCodes.escape:
          if (_this.props.onDismiss) {
            _this.props.onDismiss(ev);

            ev.preventDefault();
            ev.stopPropagation();
          }

          break;
      }
    };

    _this._onFocus = function () {
      _this._containsFocus = true;
    };

    _this._onBlur = function (ev) {
      if (_this._root.current && _this._root.current.contains(ev.relatedTarget)) {
        _this._containsFocus = false;
      }
    };

    _this._async = new _Utilities.Async(_this);
    _this.state = {
      needsVerticalScrollBar: false
    };
    return _this;
  }

  Popup.prototype.componentWillMount = function () {
    this._originalFocusedElement = (0, _Utilities.getDocument)().activeElement;
  };

  Popup.prototype.componentDidMount = function () {
    if (this._root.current) {
      this._disposables.push((0, _Utilities.on)(this._root.current, 'focus', this._onFocus, true), (0, _Utilities.on)(this._root.current, 'blur', this._onBlur, true));

      if ((0, _Utilities.doesElementContainFocus)(this._root.current)) {
        this._containsFocus = true;
      }
    }

    this._updateScrollBarAsync();
  };

  Popup.prototype.componentDidUpdate = function () {
    this._updateScrollBarAsync();

    this._async.dispose();
  };

  Popup.prototype.componentWillUnmount = function () {
    this._disposables.forEach(function (dispose) {
      return dispose();
    });

    if (this.props.shouldRestoreFocus && this._originalFocusedElement && this._containsFocus && this._originalFocusedElement !== window) {
      // This slight delay is required so that we can unwind the stack, let react try to mess with focus, and then
      // apply the correct focus. Without the setTimeout, we end up focusing the correct thing, and then React wants
      // to reset the focus back to the thing it thinks should have been focused.
      if (this._originalFocusedElement) {
        this._originalFocusedElement.focus();
      }
    }
  };

  Popup.prototype.render = function () {
    var _a = this.props,
        role = _a.role,
        className = _a.className,
        ariaLabel = _a.ariaLabel,
        ariaLabelledBy = _a.ariaLabelledBy,
        ariaDescribedBy = _a.ariaDescribedBy,
        style = _a.style;
    return React.createElement("div", tslib_1.__assign({
      ref: this._root
    }, (0, _Utilities.getNativeProps)(this.props, _Utilities.divProperties), {
      className: className,
      role: role,
      "aria-label": ariaLabel,
      "aria-labelledby": ariaLabelledBy,
      "aria-describedby": ariaDescribedBy,
      onKeyDown: this._onKeyDown,
      style: tslib_1.__assign({
        overflowY: this.state.needsVerticalScrollBar ? 'scroll' : undefined,
        outline: 'none'
      }, style)
    }), this.props.children);
  };

  Popup.prototype._updateScrollBarAsync = function () {
    var _this = this;

    this._async.requestAnimationFrame(function () {
      _this._getScrollBar();
    });
  };

  Popup.prototype._getScrollBar = function () {
    // If overflowY is overriden, don't waste time calculating whether the scrollbar is necessary.
    if (this.props.style && this.props.style.overflowY) {
      return;
    }

    var needsVerticalScrollBar = false;

    if (this._root && this._root.current && this._root.current.firstElementChild) {
      // ClientHeight returns the client height of an element rounded to an
      // integer. On some browsers at different zoom levels this rounding
      // can generate different results for the root container and child even
      // though they are the same height. This causes us to show a scroll bar
      // when not needed. Ideally we would use BoundingClientRect().height
      // instead however seems that the API is 90% slower than using ClientHeight.
      // Therefore instead we will calculate the difference between heights and
      // allow for a 1px difference to still be considered ok and not show the
      // scroll bar.
      var rootHeight = this._root.current.clientHeight;
      var firstChildHeight = this._root.current.firstElementChild.clientHeight;

      if (rootHeight > 0 && firstChildHeight > rootHeight) {
        needsVerticalScrollBar = firstChildHeight - rootHeight > 1;
      }
    }

    if (this.state.needsVerticalScrollBar !== needsVerticalScrollBar) {
      this.setState({
        needsVerticalScrollBar: needsVerticalScrollBar
      });
    }
  };

  Popup.defaultProps = {
    shouldRestoreFocus: true
  };
  return Popup;
}(React.Component);

exports.Popup = Popup;
},{"tslib":"xgwM","react":"mpTF","../../Utilities":"B5nc"}],"rIRy":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _Popup = require("./Popup");

Object.keys(_Popup).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Popup[key];
    }
  });
});
},{"./Popup":"iZ8K"}],"XkwY":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _index = require("./components/Popup/index");

Object.keys(_index).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index[key];
    }
  });
});
},{"./components/Popup/index":"rIRy"}],"E69E":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.CalloutContentBase = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _DirectionalHint = require("../../common/DirectionalHint");

var _Utilities = require("../../Utilities");

var _positioning = require("../../utilities/positioning");

var _Popup = require("../../Popup");

var _Styling = require("../../Styling");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var ANIMATIONS = (_a = {}, _a[_positioning.RectangleEdge.top] = _Styling.AnimationClassNames.slideUpIn10, _a[_positioning.RectangleEdge.bottom] = _Styling.AnimationClassNames.slideDownIn10, _a[_positioning.RectangleEdge.left] = _Styling.AnimationClassNames.slideLeftIn10, _a[_positioning.RectangleEdge.right] = _Styling.AnimationClassNames.slideRightIn10, _a);
var getClassNames = (0, _Utilities.classNamesFunction)({
  disableCaching: true
});
var BORDER_WIDTH = 1;
var BEAK_ORIGIN_POSITION = {
  top: 0,
  left: 0
}; // Microsoft Edge will overwrite inline styles if there is an animation pertaining to that style.
// To help ensure that edge will respect the offscreen style opacity
// filter needs to be added as an additional way to set opacity.

var OFF_SCREEN_STYLE = {
  opacity: 0,
  filter: 'opacity(0)'
}; // role and role description go hand-in-hand. Both would be included by spreading getNativeProps for a basic element
// This constant array can be used to filter these out of native props spread on callout root and apply them together on
// calloutMain (the Popup component within the callout)

var ARIA_ROLE_ATTRIBUTES = ['role', 'aria-roledescription'];

var CalloutContentBase =
/** @class */
function (_super) {
  tslib_1.__extends(CalloutContentBase, _super);

  function CalloutContentBase(props) {
    var _this = _super.call(this, props) || this;

    _this._hostElement = React.createRef();
    _this._calloutElement = React.createRef();
    _this._hasListeners = false;
    _this._disposables = [];

    _this.dismiss = function (ev) {
      var onDismiss = _this.props.onDismiss;

      if (onDismiss) {
        onDismiss(ev);
      }
    };

    _this._dismissOnScroll = function (ev) {
      var preventDismissOnScroll = _this.props.preventDismissOnScroll;

      if (_this.state.positions && !preventDismissOnScroll) {
        _this._dismissOnClickOrScroll(ev);
      }
    };

    _this._dismissOnResize = function (ev) {
      var preventDismissOnResize = _this.props.preventDismissOnResize;

      if (!preventDismissOnResize) {
        _this.dismiss(ev);
      }
    };

    _this._dismissOnLostFocus = function (ev) {
      var preventDismissOnLostFocus = _this.props.preventDismissOnLostFocus;

      if (!preventDismissOnLostFocus) {
        _this._dismissOnClickOrScroll(ev);
      }
    };

    _this._setInitialFocus = function () {
      if (_this.props.setInitialFocus && !_this._didSetInitialFocus && _this.state.positions && _this._calloutElement.current) {
        _this._didSetInitialFocus = true;

        _this._async.requestAnimationFrame(function () {
          return (0, _Utilities.focusFirstChild)(_this._calloutElement.current);
        });
      }
    };

    _this._onComponentDidMount = function () {
      _this._addListeners();

      if (_this.props.onLayerMounted) {
        _this.props.onLayerMounted();
      }

      _this._updateAsyncPosition();

      _this._setHeightOffsetEveryFrame();
    };

    _this._async = new _Utilities.Async(_this);
    _this._didSetInitialFocus = false;
    _this.state = {
      positions: undefined,
      slideDirectionalClassName: undefined,
      // @TODO it looks like this is not even being used anymore.
      calloutElementRect: undefined,
      heightOffset: 0
    };
    _this._positionAttempts = 0;
    return _this;
  }

  CalloutContentBase.prototype.componentDidUpdate = function () {
    if (!this.props.hidden) {
      this._setInitialFocus();

      if (!this._hasListeners) {
        this._addListeners();
      }

      this._updateAsyncPosition();
    } else {
      if (this._hasListeners) {
        this._removeListeners();
      }
    }
  };

  CalloutContentBase.prototype.shouldComponentUpdate = function (newProps, newState) {
    if (this.props.hidden && newProps.hidden) {
      // Do not update when hidden.
      return false;
    }

    return !(0, _Utilities.shallowCompare)(this.props, newProps) || !(0, _Utilities.shallowCompare)(this.state, newState);
  };

  CalloutContentBase.prototype.componentWillMount = function () {
    this._setTargetWindowAndElement(this._getTarget());
  };

  CalloutContentBase.prototype.componentWillUnmount = function () {
    this._async.dispose();

    this._disposables.forEach(function (dispose) {
      return dispose();
    });
  };

  CalloutContentBase.prototype.componentWillUpdate = function (newProps) {
    // If the target element changed, find the new one. If we are tracking target with class name, always find element because we
    // do not know if fabric has rendered a new element and disposed the old element.
    var newTarget = this._getTarget(newProps);

    var oldTarget = this._getTarget();

    if ((newTarget !== oldTarget || typeof newTarget === 'string' || newTarget instanceof String) && !this._blockResetHeight) {
      this._maxHeight = undefined;

      this._setTargetWindowAndElement(newTarget);
    }

    if (newProps.gapSpace !== this.props.gapSpace || this.props.beakWidth !== newProps.beakWidth) {
      this._maxHeight = undefined;
    }

    if (newProps.finalHeight !== this.props.finalHeight) {
      this._setHeightOffsetEveryFrame();
    } // Ensure positioning is recalculated when we are about to show a persisted menu.


    if (!newProps.hidden && newProps.hidden !== this.props.hidden) {
      this._maxHeight = undefined; // Target might have been updated while hidden.

      this._setTargetWindowAndElement(newTarget);

      this.setState({
        positions: undefined
      });
      this._didSetInitialFocus = false;
      this._bounds = undefined;
    }

    this._blockResetHeight = false;
  };

  CalloutContentBase.prototype.componentDidMount = function () {
    if (!this.props.hidden) {
      this._onComponentDidMount();
    }
  };

  CalloutContentBase.prototype.render = function () {
    // If there is no target window then we are likely in server side rendering and we should not render anything.
    if (!this._targetWindow) {
      return null;
    }

    var target = this.props.target;
    var _a = this.props,
        styles = _a.styles,
        style = _a.style,
        ariaLabel = _a.ariaLabel,
        ariaDescribedBy = _a.ariaDescribedBy,
        ariaLabelledBy = _a.ariaLabelledBy,
        className = _a.className,
        isBeakVisible = _a.isBeakVisible,
        children = _a.children,
        beakWidth = _a.beakWidth,
        calloutWidth = _a.calloutWidth,
        calloutMaxWidth = _a.calloutMaxWidth,
        finalHeight = _a.finalHeight,
        _b = _a.hideOverflow,
        hideOverflow = _b === void 0 ? !!finalHeight : _b,
        backgroundColor = _a.backgroundColor,
        calloutMaxHeight = _a.calloutMaxHeight,
        onScroll = _a.onScroll,
        _c = _a.shouldRestoreFocus,
        shouldRestoreFocus = _c === void 0 ? true : _c;
    target = this._getTarget();
    var positions = this.state.positions;
    var getContentMaxHeight = this._getMaxHeight() ? this._getMaxHeight() + this.state.heightOffset : undefined;
    var contentMaxHeight = calloutMaxHeight && getContentMaxHeight && calloutMaxHeight < getContentMaxHeight ? calloutMaxHeight : getContentMaxHeight;
    var overflowYHidden = hideOverflow;
    var beakVisible = isBeakVisible && !!target;
    this._classNames = getClassNames(styles, {
      theme: this.props.theme,
      className: className,
      overflowYHidden: overflowYHidden,
      calloutWidth: calloutWidth,
      positions: positions,
      beakWidth: beakWidth,
      backgroundColor: backgroundColor,
      calloutMaxWidth: calloutMaxWidth
    });

    var overflowStyle = tslib_1.__assign({}, style, {
      maxHeight: contentMaxHeight
    }, overflowYHidden && {
      overflowY: 'hidden'
    });

    var visibilityStyle = this.props.hidden ? {
      visibility: 'hidden'
    } : undefined; // React.CSSProperties does not understand IRawStyle, so the inline animations will need to be cast as any for now.

    var content = React.createElement("div", {
      ref: this._hostElement,
      className: this._classNames.container,
      style: visibilityStyle
    }, React.createElement("div", tslib_1.__assign({}, (0, _Utilities.getNativeProps)(this.props, _Utilities.divProperties, ARIA_ROLE_ATTRIBUTES), {
      className: (0, _Utilities.css)(this._classNames.root, positions && positions.targetEdge && ANIMATIONS[positions.targetEdge]),
      style: positions ? positions.elementPosition : OFF_SCREEN_STYLE,
      tabIndex: -1,
      // See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus
      ref: this._calloutElement
    }), beakVisible && React.createElement("div", {
      className: this._classNames.beak,
      style: this._getBeakPosition()
    }), beakVisible && React.createElement("div", {
      className: this._classNames.beakCurtain
    }), React.createElement(_Popup.Popup, tslib_1.__assign({}, (0, _Utilities.getNativeProps)(this.props, ARIA_ROLE_ATTRIBUTES), {
      ariaLabel: ariaLabel,
      ariaDescribedBy: ariaDescribedBy,
      ariaLabelledBy: ariaLabelledBy,
      className: this._classNames.calloutMain,
      onDismiss: this.dismiss,
      onScroll: onScroll,
      shouldRestoreFocus: shouldRestoreFocus,
      style: overflowStyle
    }), children)));
    return content;
  };

  CalloutContentBase.prototype._dismissOnClickOrScroll = function (ev) {
    var target = ev.target;
    var isEventTargetOutsideCallout = this._hostElement.current && !(0, _Utilities.elementContains)(this._hostElement.current, target);

    if (!this._target && isEventTargetOutsideCallout || ev.target !== this._targetWindow && isEventTargetOutsideCallout && (this._target.stopPropagation || !this._target || target !== this._target && !(0, _Utilities.elementContains)(this._target, target))) {
      this.dismiss(ev);
    }
  };

  CalloutContentBase.prototype._addListeners = function () {
    var _this = this; // This is added so the callout will dismiss when the window is scrolled
    // but not when something inside the callout is scrolled. The delay seems
    // to be required to avoid React firing an async focus event in IE from
    // the target changing focus quickly prior to rendering the callout.


    this._async.setTimeout(function () {
      _this._disposables.push((0, _Utilities.on)(_this._targetWindow, 'scroll', _this._dismissOnScroll, true), (0, _Utilities.on)(_this._targetWindow, 'resize', _this._dismissOnResize, true), (0, _Utilities.on)(_this._targetWindow.document.documentElement, 'focus', _this._dismissOnLostFocus, true), (0, _Utilities.on)(_this._targetWindow.document.documentElement, 'click', _this._dismissOnLostFocus, true));

      _this._hasListeners = true;
    }, 0);
  };

  CalloutContentBase.prototype._removeListeners = function () {
    this._disposables.forEach(function (dispose) {
      return dispose();
    });

    this._disposables = [];
    this._hasListeners = false;
  };

  CalloutContentBase.prototype._updateAsyncPosition = function () {
    var _this = this;

    this._async.requestAnimationFrame(function () {
      return _this._updatePosition();
    });
  };

  CalloutContentBase.prototype._getBeakPosition = function () {
    var positions = this.state.positions;

    var beakPostionStyle = tslib_1.__assign({}, positions && positions.beakPosition ? positions.beakPosition.elementPosition : null);

    if (!beakPostionStyle.top && !beakPostionStyle.bottom && !beakPostionStyle.left && !beakPostionStyle.right) {
      beakPostionStyle.left = BEAK_ORIGIN_POSITION.left;
      beakPostionStyle.top = BEAK_ORIGIN_POSITION.top;
    }

    return beakPostionStyle;
  };

  CalloutContentBase.prototype._updatePosition = function () {
    // Try to update the target, page might have changed
    this._setTargetWindowAndElement(this._getTarget());

    var positions = this.state.positions;
    var hostElement = this._hostElement.current;
    var calloutElement = this._calloutElement.current; // If we expect a target element to position against, we need to wait until `this._target` is resolved. Otherwise
    // we can try to position.

    var expectsTarget = !!this.props.target;

    if (hostElement && calloutElement && (!expectsTarget || this._target)) {
      var currentProps = void 0;
      currentProps = (0, _Utilities.assign)(currentProps, this.props);
      currentProps.bounds = this._getBounds();
      currentProps.target = this._target;
      var newPositions = (0, _positioning.positionCallout)(currentProps, hostElement, calloutElement, positions); // Set the new position only when the positions are not exists or one of the new callout positions are different.
      // The position should not change if the position is within 2 decimal places.

      if (!positions && newPositions || positions && newPositions && !this._arePositionsEqual(positions, newPositions) && this._positionAttempts < 5) {
        // We should not reposition the callout more than a few times, if it is then the content is likely resizing
        // and we should stop trying to reposition to prevent a stack overflow.
        this._positionAttempts++;
        this.setState({
          positions: newPositions
        });
      } else if (this._positionAttempts > 0) {
        // Only call the onPositioned callback if the callout has been re-positioned at least once.
        this._positionAttempts = 0;

        if (this.props.onPositioned) {
          this.props.onPositioned(this.state.positions);
        }
      }
    }
  };

  CalloutContentBase.prototype._getBounds = function () {
    if (!this._bounds) {
      var currentBounds = this.props.bounds;

      if (!currentBounds) {
        currentBounds = {
          top: 0 + this.props.minPagePadding,
          left: 0 + this.props.minPagePadding,
          right: this._targetWindow.innerWidth - this.props.minPagePadding,
          bottom: this._targetWindow.innerHeight - this.props.minPagePadding,
          width: this._targetWindow.innerWidth - this.props.minPagePadding * 2,
          height: this._targetWindow.innerHeight - this.props.minPagePadding * 2
        };
      }

      this._bounds = currentBounds;
    }

    return this._bounds;
  }; // Max height should remain as synchronous as possible, which is why it is not done using set state.
  // It needs to be synchronous since it will impact the ultimate position of the callout.


  CalloutContentBase.prototype._getMaxHeight = function () {
    var _this = this;

    if (!this._maxHeight) {
      if (this.props.directionalHintFixed && this._target) {
        var beakWidth = this.props.isBeakVisible ? this.props.beakWidth : 0;
        var gapSpace = this.props.gapSpace ? this.props.gapSpace : 0; // Since the callout cannot measure it's border size it must be taken into account here. Otherwise it will
        // overlap with the target.

        var totalGap_1 = gapSpace + beakWidth + BORDER_WIDTH * 2;

        this._async.requestAnimationFrame(function () {
          if (_this._target) {
            _this._maxHeight = (0, _positioning.getMaxHeight)(_this._target, _this.props.directionalHint, totalGap_1, _this._getBounds(), _this.props.coverTarget);
            _this._blockResetHeight = true;

            _this.forceUpdate();
          }
        });
      } else {
        this._maxHeight = this._getBounds().height - BORDER_WIDTH * 2;
      }
    }

    return this._maxHeight;
  };

  CalloutContentBase.prototype._arePositionsEqual = function (positions, newPosition) {
    return this._comparePositions(positions.elementPosition, newPosition.elementPosition) && this._comparePositions(positions.beakPosition.elementPosition, newPosition.beakPosition.elementPosition);
  };

  CalloutContentBase.prototype._comparePositions = function (oldPositions, newPositions) {
    for (var key in newPositions) {
      // This needs to be checked here and below because there is a linting error if for in does not immediately have an if statement
      if (newPositions.hasOwnProperty(key)) {
        var oldPositionEdge = oldPositions[key];
        var newPositionEdge = newPositions[key];

        if (oldPositionEdge !== undefined && newPositionEdge !== undefined) {
          if (oldPositionEdge.toFixed(2) !== newPositionEdge.toFixed(2)) {
            return false;
          }
        } else {
          return false;
        }
      }
    }

    return true;
  };

  CalloutContentBase.prototype._setTargetWindowAndElement = function (target) {
    if (target) {
      if (typeof target === 'string') {
        var currentDoc = (0, _Utilities.getDocument)();
        this._target = currentDoc ? currentDoc.querySelector(target) : null;
        this._targetWindow = (0, _Utilities.getWindow)();
      } else if (target.stopPropagation) {
        this._targetWindow = (0, _Utilities.getWindow)(target.toElement);
        this._target = target;
      } else if (target.getBoundingClientRect) {
        var targetElement = target;
        this._targetWindow = (0, _Utilities.getWindow)(targetElement);
        this._target = target; // HTMLImgElements can have x and y values. The check for it being a point must go last.
      } else {
        this._targetWindow = (0, _Utilities.getWindow)();
        this._target = target;
      }
    } else {
      this._targetWindow = (0, _Utilities.getWindow)();
    }
  };

  CalloutContentBase.prototype._setHeightOffsetEveryFrame = function () {
    var _this = this;

    if (this._calloutElement.current && this.props.finalHeight) {
      this._setHeightOffsetTimer = this._async.requestAnimationFrame(function () {
        var calloutMainElem = _this._calloutElement.current && _this._calloutElement.current.lastChild;

        if (!calloutMainElem) {
          return;
        }

        var cardScrollHeight = calloutMainElem.scrollHeight;
        var cardCurrHeight = calloutMainElem.offsetHeight;
        var scrollDiff = cardScrollHeight - cardCurrHeight;

        _this.setState({
          heightOffset: _this.state.heightOffset + scrollDiff
        });

        if (calloutMainElem.offsetHeight < _this.props.finalHeight) {
          _this._setHeightOffsetEveryFrame();
        } else {
          _this._async.cancelAnimationFrame(_this._setHeightOffsetTimer);
        }
      });
    }
  };

  CalloutContentBase.prototype._getTarget = function (props) {
    if (props === void 0) {
      props = this.props;
    }

    var target = props.target;
    return target;
  };

  CalloutContentBase.defaultProps = {
    preventDismissOnLostFocus: false,
    preventDismissOnScroll: false,
    preventDismissOnResize: false,
    isBeakVisible: true,
    beakWidth: 16,
    gapSpace: 0,
    minPagePadding: 8,
    directionalHint: _DirectionalHint.DirectionalHint.bottomAutoEdge
  };
  return CalloutContentBase;
}(React.Component);

exports.CalloutContentBase = CalloutContentBase;

var _a;
},{"tslib":"xgwM","react":"mpTF","../../common/DirectionalHint":"uAUO","../../Utilities":"B5nc","../../utilities/positioning":"FiDX","../../Popup":"XkwY","../../Styling":"AHeq"}],"DRbI":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = void 0;

var _Styling = require("../../Styling");

function getBeakStyle(beakWidth) {
  return {
    height: beakWidth,
    width: beakWidth
  };
}

var GlobalClassNames = {
  container: 'ms-Callout-container',
  root: 'ms-Callout',
  beak: 'ms-Callout-beak',
  beakCurtain: 'ms-Callout-beakCurtain',
  calloutMain: 'ms-Callout-main'
};

var getStyles = function (props) {
  var theme = props.theme,
      className = props.className,
      overflowYHidden = props.overflowYHidden,
      calloutWidth = props.calloutWidth,
      beakWidth = props.beakWidth,
      backgroundColor = props.backgroundColor,
      calloutMaxWidth = props.calloutMaxWidth;
  var classNames = (0, _Styling.getGlobalClassNames)(GlobalClassNames, theme);
  var palette = theme.palette;
  return {
    container: [classNames.container, {
      position: 'relative'
    }],
    root: [classNames.root, theme.fonts.medium, {
      position: 'absolute',
      boxSizing: 'border-box',
      borderWidth: 1,
      borderStyle: 'solid',
      borderColor: palette.neutralLight,
      boxShadow: '0 0 5px 0px rgba(0,0,0,0.4)',
      selectors: (_a = {}, _a[_Styling.HighContrastSelector] = {
        borderWidth: 1,
        borderStyle: 'solid',
        borderColor: 'WindowText'
      }, _a)
    }, (0, _Styling.focusClear)(), className, !!calloutWidth && {
      width: calloutWidth
    }, !!calloutMaxWidth && {
      maxWidth: calloutMaxWidth
    }],
    beak: [classNames.beak, {
      position: 'absolute',
      backgroundColor: palette.white,
      boxShadow: 'inherit',
      border: 'inherit',
      boxSizing: 'border-box',
      transform: 'rotate(45deg)'
    }, getBeakStyle(beakWidth), backgroundColor && {
      backgroundColor: backgroundColor
    }],
    beakCurtain: [classNames.beakCurtain, {
      position: 'absolute',
      top: 0,
      right: 0,
      bottom: 0,
      left: 0,
      backgroundColor: palette.white
    }],
    calloutMain: [classNames.calloutMain, {
      backgroundColor: palette.white,
      overflowX: 'hidden',
      overflowY: 'auto',
      position: 'relative'
    }, overflowYHidden && {
      overflowY: 'hidden'
    }, backgroundColor && {
      backgroundColor: backgroundColor
    }]
  };

  var _a;
};

exports.getStyles = getStyles;
},{"../../Styling":"AHeq"}],"HA6h":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.CalloutContent = void 0;

var _Utilities = require("../../Utilities");

var _CalloutContent = require("./CalloutContent.base");

var _CalloutContent2 = require("./CalloutContent.styles");

var CalloutContent = (0, _Utilities.styled)(_CalloutContent.CalloutContentBase, _CalloutContent2.getStyles, undefined, {
  scope: 'CalloutContent'
});
exports.CalloutContent = CalloutContent;
},{"../../Utilities":"B5nc","./CalloutContent.base":"E69E","./CalloutContent.styles":"DRbI"}],"S7Go":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = void 0;

var _Styling = require("../../Styling");

var inheritFont = {
  fontFamily: 'inherit'
};
var GlobalClassNames = {
  root: 'ms-Fabric'
};

var getStyles = function (props) {
  var theme = props.theme,
      className = props.className,
      isFocusVisible = props.isFocusVisible;
  var classNames = (0, _Styling.getGlobalClassNames)(GlobalClassNames, theme);
  return {
    root: [classNames.root, isFocusVisible && 'is-focusVisible', theme.fonts.medium, {
      color: theme.palette.neutralPrimary,
      selectors: {
        '& button': inheritFont,
        '& input': inheritFont,
        '& textarea': inheritFont
      }
    }, className]
  };
};

exports.getStyles = getStyles;
},{"../../Styling":"AHeq"}],"jOdi":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.FabricBase = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Utilities = require("../../Utilities");

var _Fabric = require("./Fabric.styles");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var getClassNames = (0, _Utilities.classNamesFunction)();

var FabricBase =
/** @class */
function (_super) {
  tslib_1.__extends(FabricBase, _super);

  function FabricBase(props) {
    var _this = _super.call(this, props) || this;

    _this._rootElement = React.createRef();
    _this._disposables = [];

    _this._onMouseDown = function (ev) {
      _this.setState({
        isFocusVisible: false
      });
    };

    _this._onKeyDown = function (ev) {
      if ((0, _Utilities.isDirectionalKeyCode)(ev.which)) {
        _this.setState({
          isFocusVisible: true
        });
      }
    };

    _this.state = {
      isFocusVisible: false
    };
    return _this;
  }

  FabricBase.prototype.render = function () {
    var _a = this.props,
        className = _a.className,
        rest = tslib_1.__rest(_a, ["className"]);

    var classNames = getClassNames(_Fabric.getStyles, {
      theme: this.props.theme,
      className: className,
      isFocusVisible: this.state.isFocusVisible
    });
    var divProps = (0, _Utilities.getNativeProps)(rest, _Utilities.divProperties);
    return React.createElement("div", tslib_1.__assign({}, divProps, {
      className: classNames.root,
      ref: this._rootElement
    }));
  };

  FabricBase.prototype.componentDidMount = function () {
    var win = (0, _Utilities.getWindow)(this._rootElement.current);

    if (win) {
      this._disposables.push((0, _Utilities.on)(win, 'mousedown', this._onMouseDown, true), (0, _Utilities.on)(win, 'keydown', this._onKeyDown, true));
    }
  };

  FabricBase.prototype.componentWillUnmount = function () {
    this._disposables.forEach(function (dispose) {
      return dispose();
    });
  };

  return FabricBase;
}(React.Component);

exports.FabricBase = FabricBase;
},{"tslib":"xgwM","react":"mpTF","../../Utilities":"B5nc","./Fabric.styles":"S7Go"}],"L4E6":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Fabric = void 0;

var _Utilities = require("../../Utilities");

var _Fabric = require("./Fabric.base");

var _Fabric2 = require("./Fabric.styles");

var Fabric = (0, _Utilities.styled)(_Fabric.FabricBase, _Fabric2.getStyles, undefined, {
  scope: 'Fabric'
});
exports.Fabric = Fabric;
},{"../../Utilities":"B5nc","./Fabric.base":"jOdi","./Fabric.styles":"S7Go"}],"ti2l":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _Fabric = require("./Fabric");

Object.keys(_Fabric).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Fabric[key];
    }
  });
});

var _Fabric2 = require("./Fabric.base");

Object.keys(_Fabric2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Fabric2[key];
    }
  });
});
},{"./Fabric":"L4E6","./Fabric.base":"jOdi"}],"IcJL":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _index = require("./components/Fabric/index");

Object.keys(_index).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index[key];
    }
  });
});
},{"./components/Fabric/index":"ti2l"}],"zSkE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.registerLayer = registerLayer;
exports.unregisterLayer = unregisterLayer;
exports.notifyHostChanged = notifyHostChanged;
exports.setDefaultTarget = setDefaultTarget;
exports.getDefaultTarget = getDefaultTarget;
var _layersByHostId = {};

var _defaultHostSelector;
/**
 * Register a layer for a given host id
 * @param hostId Id of the layer host
 * @param layer Layer instance
 */


function registerLayer(hostId, layer) {
  if (!_layersByHostId[hostId]) {
    _layersByHostId[hostId] = [];
  }

  _layersByHostId[hostId].push(layer);
}
/**
 * Unregister a layer for a given host id
 * @param hostId Id of the layer host
 * @param layer Layer instance
 */


function unregisterLayer(hostId, layer) {
  if (_layersByHostId[hostId]) {
    var idx = _layersByHostId[hostId].indexOf(layer);

    if (idx >= 0) {
      _layersByHostId[hostId].splice(idx, 1);

      if (_layersByHostId[hostId].length === 0) {
        delete _layersByHostId[hostId];
      }
    }
  }
}
/**
 * Used for notifying applicable Layers that a host is available/unavailable and to re-evaluate Layers that
 * care about the specific host.
 */


function notifyHostChanged(id) {
  if (_layersByHostId[id]) {
    _layersByHostId[id].forEach(function (layer) {
      return layer.forceUpdate();
    });
  }
}
/**
 * Sets the default target selector to use when determining the host in which
 * Layered content will be injected into. If not provided, an element will be
 * created at the end of the document body.
 *
 * Passing in a falsey value will clear the default target and reset back to
 * using a created element at the end of document body.
 */


function setDefaultTarget(selector) {
  _defaultHostSelector = selector;
}
/**
 * Get the default target selector when determining a host
 */


function getDefaultTarget() {
  return _defaultHostSelector;
}
},{}],"BNs8":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.LayerBase = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var ReactDOM = _interopRequireWildcard(require("react-dom"));

var _Fabric = require("../../Fabric");

var _Utilities = require("../../Utilities");

var _Layer = require("./Layer.notification");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var getClassNames = (0, _Utilities.classNamesFunction)();

var LayerBase =
/** @class */
function (_super) {
  tslib_1.__extends(LayerBase, _super);

  function LayerBase(props) {
    var _this = _super.call(this, props) || this;

    _this._rootElement = (0, _Utilities.createRef)();
    /**
     * rootElement wrapper for setting virtual parent as soon as root element ref is available.
     */

    _this._handleRootElementRef = function (ref) {
      _this._rootElement(ref);

      if (ref) {
        // TODO: Calling _setVirtualParent in this ref wrapper SHOULD allow us to remove
        //    other calls to _setVirtualParent throughout this class. However,
        //    as this is an immediate fix for a P0 issue the existing _setVirtualParent
        //    calls are left for now to minimize potential regression.
        _this._setVirtualParent();
      }
    };
    /**
     * Helper to stop events from bubbling up out of Layer.
     */


    _this._filterEvent = function (ev) {
      // We should just be able to check ev.bubble here and only stop events that are bubbling up. However, even though mouseenter and
      //    mouseleave do NOT bubble up, they are showing up as bubbling. Therefore we stop events based on event name rather than ev.bubble.
      if (ev.eventPhase === Event.BUBBLING_PHASE && ev.type !== 'mouseenter' && ev.type !== 'mouseleave') {
        ev.stopPropagation();
      }
    };

    _this.state = {
      hasMounted: false
    };

    if ("production" !== 'production') {
      (0, _Utilities.warnDeprecations)('Layer', props, {
        onLayerMounted: 'onLayerDidMount'
      });
    }

    if (_this.props.hostId) {
      (0, _Layer.registerLayer)(_this.props.hostId, _this);
    }

    return _this;
  }

  LayerBase.prototype.componentWillMount = function () {
    this._layerElement = this._getLayerElement();
  };

  LayerBase.prototype.componentWillUpdate = function () {
    if (!this._layerElement) {
      this._layerElement = this._getLayerElement();
    }
  };

  LayerBase.prototype.componentDidMount = function () {
    // We can safely set state immediately because the ref wrapper will make sure the virtual
    //    parent has been set before componentDidMount is called.
    this.setState({
      hasMounted: true
    });

    this._setVirtualParent();

    var _a = this.props,
        onLayerDidMount = _a.onLayerDidMount,
        onLayerMounted = _a.onLayerMounted;

    if (onLayerMounted) {
      onLayerMounted();
    }

    if (onLayerDidMount) {
      onLayerDidMount();
    }
  };

  LayerBase.prototype.componentWillUnmount = function () {
    this._removeLayerElement();

    var _a = this.props,
        onLayerWillUnmount = _a.onLayerWillUnmount,
        hostId = _a.hostId;

    if (onLayerWillUnmount) {
      onLayerWillUnmount();
    }

    if (hostId) {
      (0, _Layer.unregisterLayer)(hostId, this);
    }
  };

  LayerBase.prototype.componentDidUpdate = function () {
    this._setVirtualParent();
  };

  LayerBase.prototype.render = function () {
    var classNames = this._getClassNames();

    var eventBubblingEnabled = this.props.eventBubblingEnabled;
    var hasMounted = this.state.hasMounted;
    return React.createElement("span", {
      className: "ms-layer",
      ref: this._handleRootElementRef
    }, this._layerElement && hasMounted && ReactDOM.createPortal(eventBubblingEnabled ? React.createElement(_Fabric.Fabric, {
      className: classNames.content
    }, this.props.children) : React.createElement(_Fabric.Fabric, {
      className: classNames.content,
      onClick: this._filterEvent,
      onContextMenu: this._filterEvent,
      onDoubleClick: this._filterEvent,
      onDrag: this._filterEvent,
      onDragEnd: this._filterEvent,
      onDragEnter: this._filterEvent,
      onDragExit: this._filterEvent,
      onDragLeave: this._filterEvent,
      onDragOver: this._filterEvent,
      onDragStart: this._filterEvent,
      onDrop: this._filterEvent,
      onMouseDown: this._filterEvent,
      onMouseEnter: this._filterEvent,
      onMouseLeave: this._filterEvent,
      onMouseMove: this._filterEvent,
      onMouseOver: this._filterEvent,
      onMouseOut: this._filterEvent,
      onMouseUp: this._filterEvent,
      onKeyDown: this._filterEvent,
      onKeyPress: this._filterEvent,
      onKeyUp: this._filterEvent,
      onFocus: this._filterEvent,
      onBlur: this._filterEvent,
      onChange: this._filterEvent,
      onInput: this._filterEvent,
      onInvalid: this._filterEvent,
      onSubmit: this._filterEvent
    }, this.props.children), this._layerElement));
  };

  LayerBase.prototype._getClassNames = function () {
    var _a = this.props,
        className = _a.className,
        styles = _a.styles,
        theme = _a.theme;
    var classNames = getClassNames(styles, {
      theme: theme,
      className: className,
      isNotHost: !this.props.hostId
    });
    return classNames;
  };

  LayerBase.prototype._setVirtualParent = function () {
    if (this._rootElement && this._rootElement.current && this._layerElement) {
      (0, _Utilities.setVirtualParent)(this._layerElement, this._rootElement.current);
    }
  };

  LayerBase.prototype._getLayerElement = function () {
    var host = this._getHost();

    var classNames = this._getClassNames();

    if (host !== this._host) {
      this._removeLayerElement();
    }

    if (host) {
      this._host = host;

      if (!this._layerElement) {
        var doc = (0, _Utilities.getDocument)();

        if (!doc) {
          return;
        }

        this._layerElement = doc.createElement('div');
        this._layerElement.className = classNames.root;
        (0, _Utilities.setPortalAttribute)(this._layerElement);
        this.props.insertFirst ? host.insertBefore(this._layerElement, host.firstChild) : host.appendChild(this._layerElement);
      }
    }

    return this._layerElement;
  };

  LayerBase.prototype._removeLayerElement = function () {
    if (this._layerElement) {
      this.props.onLayerWillUnmount();
      var parentNode = this._layerElement.parentNode;

      if (parentNode) {
        parentNode.removeChild(this._layerElement);
      }

      this._layerElement = undefined;
    }
  };

  LayerBase.prototype._getHost = function () {
    var hostId = this.props.hostId;
    var doc = (0, _Utilities.getDocument)();

    if (!doc) {
      return undefined;
    }

    if (hostId) {
      return doc.getElementById(hostId);
    } else {
      var defaultHostSelector = (0, _Layer.getDefaultTarget)();
      return defaultHostSelector ? doc.querySelector(defaultHostSelector) : doc.body;
    }
  };

  LayerBase.defaultProps = {
    onLayerDidMount: function () {
      return undefined;
    },
    onLayerWillUnmount: function () {
      return undefined;
    }
  };
  LayerBase = tslib_1.__decorate([(0, _Utilities.customizable)('Layer', ['theme', 'hostId'])], LayerBase);
  return LayerBase;
}(React.Component);

exports.LayerBase = LayerBase;
},{"tslib":"xgwM","react":"mpTF","react-dom":"J77C","../../Fabric":"IcJL","../../Utilities":"B5nc","./Layer.notification":"zSkE"}],"Xjcp":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = void 0;

var _Styling = require("../../Styling");

var GlobalClassNames = {
  root: 'ms-Layer',
  rootNoHost: 'ms-Layer--fixed',
  content: 'ms-Layer-content'
};

var getStyles = function (props) {
  var className = props.className,
      isNotHost = props.isNotHost,
      theme = props.theme;
  var classNames = (0, _Styling.getGlobalClassNames)(GlobalClassNames, theme);
  return {
    root: [classNames.root, theme.fonts.medium, isNotHost && [classNames.rootNoHost, {
      position: 'fixed',
      zIndex: _Styling.ZIndexes.Layer,
      top: 0,
      left: 0,
      bottom: 0,
      right: 0,
      visibility: 'hidden'
    }], className],
    content: [classNames.content, {
      visibility: 'visible'
    }]
  };
};

exports.getStyles = getStyles;
},{"../../Styling":"AHeq"}],"lOor":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Layer = void 0;

var _Utilities = require("../../Utilities");

var _Layer = require("./Layer.base");

var _Layer2 = require("./Layer.styles");

var Layer = (0, _Utilities.styled)(_Layer.LayerBase, _Layer2.getStyles, undefined, {
  scope: 'Layer',
  fields: ['hostId', 'theme', 'styles']
});
exports.Layer = Layer;
},{"../../Utilities":"B5nc","./Layer.base":"BNs8","./Layer.styles":"Xjcp"}],"Vego":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.LayerHost = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Utilities = require("../../Utilities");

var _Layer = require("./Layer.notification");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var LayerHost =
/** @class */
function (_super) {
  tslib_1.__extends(LayerHost, _super);

  function LayerHost() {
    return _super !== null && _super.apply(this, arguments) || this;
  }

  LayerHost.prototype.shouldComponentUpdate = function () {
    return false;
  };

  LayerHost.prototype.componentDidMount = function () {
    (0, _Layer.notifyHostChanged)(this.props.id);
  };

  LayerHost.prototype.componentWillUnmount = function () {
    (0, _Layer.notifyHostChanged)(this.props.id);
  };

  LayerHost.prototype.render = function () {
    return React.createElement("div", tslib_1.__assign({}, this.props, {
      className: (0, _Utilities.css)('ms-LayerHost', this.props.className)
    }));
  };

  return LayerHost;
}(React.Component);

exports.LayerHost = LayerHost;
},{"tslib":"xgwM","react":"mpTF","../../Utilities":"B5nc","./Layer.notification":"zSkE"}],"yLRg":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _Layer = require("./Layer");

Object.keys(_Layer).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Layer[key];
    }
  });
});

var _Layer2 = require("./Layer.base");

Object.keys(_Layer2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Layer2[key];
    }
  });
});

var _LayerHost = require("./LayerHost");

Object.keys(_LayerHost).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _LayerHost[key];
    }
  });
});
},{"./Layer":"lOor","./Layer.base":"BNs8","./LayerHost":"Vego"}],"sWnj":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

require("./version");

var _index = require("./components/Layer/index");

Object.keys(_index).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index[key];
    }
  });
});
},{"./version":"xNUS","./components/Layer/index":"yLRg"}],"cRec":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Callout = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _CalloutContent = require("./CalloutContent");

var _Layer = require("../../Layer");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var Callout =
/** @class */
function (_super) {
  tslib_1.__extends(Callout, _super);

  function Callout() {
    return _super !== null && _super.apply(this, arguments) || this;
  }

  Callout.prototype.render = function () {
    var _a = this.props,
        layerProps = _a.layerProps,
        rest = tslib_1.__rest(_a, ["layerProps"]);

    var content = React.createElement(_CalloutContent.CalloutContent, tslib_1.__assign({}, rest));
    return this.props.doNotLayer ? content : React.createElement(_Layer.Layer, tslib_1.__assign({}, layerProps), content);
  };

  return Callout;
}(React.Component);

exports.Callout = Callout;
},{"tslib":"xgwM","react":"mpTF","./CalloutContent":"HA6h","../../Layer":"sWnj"}],"pSbi":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.FocusTrapZone = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Utilities = require("../../Utilities");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var FocusTrapZone =
/** @class */
function (_super) {
  tslib_1.__extends(FocusTrapZone, _super);

  function FocusTrapZone(props) {
    var _this = _super.call(this, props) || this;

    _this._root = React.createRef();
    _this._firstBumper = React.createRef();
    _this._lastBumper = React.createRef();
    _this._hasFocus = false;

    _this._onRootFocus = function (ev) {
      if (_this.props.onFocus) {
        _this.props.onFocus(ev);
      }

      _this._hasFocus = true;
    };

    _this._onRootBlur = function (ev) {
      if (_this.props.onBlur) {
        _this.props.onBlur(ev);
      }

      var relatedTarget = ev.relatedTarget;

      if (ev.relatedTarget === null) {
        // In IE11, due to lack of support, event.relatedTarget is always
        // null making every onBlur call to be "outside" of the ComboBox
        // even when it's not. Using document.activeElement is another way
        // for us to be able to get what the relatedTarget without relying
        // on the event
        relatedTarget = document.activeElement;
      }

      if (!(0, _Utilities.elementContains)(_this._root.current, relatedTarget)) {
        _this._hasFocus = false;
      }
    };

    _this._onFirstBumperFocus = function () {
      _this._onBumperFocus(true);
    };

    _this._onLastBumperFocus = function () {
      _this._onBumperFocus(false);
    };

    _this._onBumperFocus = function (isFirstBumper) {
      if (_this.props.disabled) {
        return;
      }

      var currentBumper = isFirstBumper === _this._hasFocus ? _this._lastBumper.current : _this._firstBumper.current;

      if (_this._root.current) {
        var nextFocusable = isFirstBumper === _this._hasFocus ? (0, _Utilities.getLastTabbable)(_this._root.current, currentBumper, true, false) : (0, _Utilities.getFirstTabbable)(_this._root.current, currentBumper, true, false);

        if (nextFocusable) {
          if (_this._isBumper(nextFocusable)) {
            // This can happen when FTZ contains no tabbable elements. focus will take care of finding a focusable element in FTZ.
            _this.focus();
          } else {
            nextFocusable.focus();
          }
        }
      }
    };

    _this._onFocusCapture = function (ev) {
      if (_this.props.onFocusCapture) {
        _this.props.onFocusCapture(ev);
      }

      if (ev.target !== ev.currentTarget && !_this._isBumper(ev.target)) {
        // every time focus changes within the trap zone, remember the focused element so that
        // it can be restored if focus leaves the pane and returns via keystroke (i.e. via a call to this.focus(true))
        _this._previouslyFocusedElementInTrapZone = ev.target;
      }
    };

    _this._forceFocusInTrap = function (ev) {
      if (_this.props.disabled) {
        return;
      }

      if (FocusTrapZone._focusStack.length && _this === FocusTrapZone._focusStack[FocusTrapZone._focusStack.length - 1]) {
        var focusedElement = document.activeElement;

        if (!(0, _Utilities.elementContains)(_this._root.current, focusedElement)) {
          _this.focus();

          _this._hasFocus = true; // set focus here since we stop event propagation

          ev.preventDefault();
          ev.stopPropagation();
        }
      }
    };

    _this._forceClickInTrap = function (ev) {
      if (_this.props.disabled) {
        return;
      }

      if (FocusTrapZone._focusStack.length && _this === FocusTrapZone._focusStack[FocusTrapZone._focusStack.length - 1]) {
        var clickedElement = ev.target;

        if (clickedElement && !(0, _Utilities.elementContains)(_this._root.current, clickedElement)) {
          _this.focus();

          _this._hasFocus = true; // set focus here since we stop event propagation

          ev.preventDefault();
          ev.stopPropagation();
        }
      }
    };

    (0, _Utilities.initializeComponentRef)(_this);
    return _this;
  }

  FocusTrapZone.prototype.componentDidMount = function () {
    this._bringFocusIntoZone();

    this._updateEventHandlers(this.props);
  };

  FocusTrapZone.prototype.componentWillReceiveProps = function (nextProps) {
    var elementToFocusOnDismiss = nextProps.elementToFocusOnDismiss;

    if (elementToFocusOnDismiss && this._previouslyFocusedElementOutsideTrapZone !== elementToFocusOnDismiss) {
      this._previouslyFocusedElementOutsideTrapZone = elementToFocusOnDismiss;
    }

    this._updateEventHandlers(nextProps);
  };

  FocusTrapZone.prototype.componentDidUpdate = function (prevProps) {
    var prevForceFocusInsideTrap = prevProps.forceFocusInsideTrap !== undefined ? prevProps.forceFocusInsideTrap : true;
    var newForceFocusInsideTrap = this.props.forceFocusInsideTrap !== undefined ? this.props.forceFocusInsideTrap : true;
    var prevDisabled = prevProps.disabled !== undefined ? prevProps.disabled : false;
    var newDisabled = this.props.disabled !== undefined ? this.props.disabled : false;

    if (!prevForceFocusInsideTrap && newForceFocusInsideTrap || prevDisabled && !newDisabled) {
      // Transition from forceFocusInsideTrap / FTZ disabled to enabled.
      // Emulate what happens when a FocusTrapZone gets mounted.
      this._bringFocusIntoZone();
    } else if (prevForceFocusInsideTrap && !newForceFocusInsideTrap || !prevDisabled && newDisabled) {
      // Transition from forceFocusInsideTrap / FTZ enabled to disabled.
      // Emulate what happens when a FocusTrapZone gets unmounted.
      this._returnFocusToInitiator();
    }
  };

  FocusTrapZone.prototype.componentWillUnmount = function () {
    // don't handle return focus unless forceFocusInsideTrap is true or focus is still within FocusTrapZone
    if (!this.props.disabled || this.props.forceFocusInsideTrap || !(0, _Utilities.elementContains)(this._root.current, document.activeElement)) {
      this._returnFocusToInitiator();
    }
  };

  FocusTrapZone.prototype.render = function () {
    var _a = this.props,
        className = _a.className,
        _b = _a.disabled,
        disabled = _b === void 0 ? false : _b,
        ariaLabelledBy = _a.ariaLabelledBy;
    var divProps = (0, _Utilities.getNativeProps)(this.props, _Utilities.divProperties);
    var bumperProps = {
      style: {
        pointerEvents: 'none',
        position: 'fixed' // 'fixed' prevents browsers from scrolling to bumpers when viewport does not contain them

      },
      tabIndex: disabled ? -1 : 0,
      'data-is-visible': true
    };
    return React.createElement("div", tslib_1.__assign({}, divProps, {
      className: className,
      ref: this._root,
      "aria-labelledby": ariaLabelledBy,
      onFocusCapture: this._onFocusCapture,
      onFocus: this._onRootFocus,
      onBlur: this._onRootBlur
    }), React.createElement("div", tslib_1.__assign({}, bumperProps, {
      ref: this._firstBumper,
      onFocus: this._onFirstBumperFocus
    })), this.props.children, React.createElement("div", tslib_1.__assign({}, bumperProps, {
      ref: this._lastBumper,
      onFocus: this._onLastBumperFocus
    })));
  };

  FocusTrapZone.prototype.focus = function () {
    var _a = this.props,
        focusPreviouslyFocusedInnerElement = _a.focusPreviouslyFocusedInnerElement,
        firstFocusableSelector = _a.firstFocusableSelector;

    if (focusPreviouslyFocusedInnerElement && this._previouslyFocusedElementInTrapZone && (0, _Utilities.elementContains)(this._root.current, this._previouslyFocusedElementInTrapZone)) {
      // focus on the last item that had focus in the zone before we left the zone
      this._focusAsync(this._previouslyFocusedElementInTrapZone);

      return;
    }

    var focusSelector = typeof firstFocusableSelector === 'string' ? firstFocusableSelector : firstFocusableSelector && firstFocusableSelector();

    var _firstFocusableChild;

    if (this._root.current) {
      if (focusSelector) {
        _firstFocusableChild = this._root.current.querySelector('.' + focusSelector);
      } // Fall back to first element if query selector did not match any elements.


      if (!_firstFocusableChild) {
        _firstFocusableChild = (0, _Utilities.getNextElement)(this._root.current, this._root.current.firstChild, false, false, false, true);
      }
    }

    if (_firstFocusableChild) {
      this._focusAsync(_firstFocusableChild);
    }
  };

  FocusTrapZone.prototype._focusAsync = function (element) {
    if (!this._isBumper(element)) {
      (0, _Utilities.focusAsync)(element);
    }
  };

  FocusTrapZone.prototype._bringFocusIntoZone = function () {
    var _a = this.props,
        elementToFocusOnDismiss = _a.elementToFocusOnDismiss,
        _b = _a.disabled,
        disabled = _b === void 0 ? false : _b,
        _c = _a.disableFirstFocus,
        disableFirstFocus = _c === void 0 ? false : _c;

    if (disabled) {
      return;
    }

    FocusTrapZone._focusStack.push(this);

    this._previouslyFocusedElementOutsideTrapZone = elementToFocusOnDismiss ? elementToFocusOnDismiss : document.activeElement;

    if (!disableFirstFocus && !(0, _Utilities.elementContains)(this._root.current, this._previouslyFocusedElementOutsideTrapZone)) {
      this.focus();
    }
  };

  FocusTrapZone.prototype._returnFocusToInitiator = function () {
    var _this = this;

    var ignoreExternalFocusing = this.props.ignoreExternalFocusing;
    FocusTrapZone._focusStack = FocusTrapZone._focusStack.filter(function (value) {
      return _this !== value;
    });
    var activeElement = document.activeElement;

    if (!ignoreExternalFocusing && this._previouslyFocusedElementOutsideTrapZone && typeof this._previouslyFocusedElementOutsideTrapZone.focus === 'function' && ((0, _Utilities.elementContains)(this._root.current, activeElement) || activeElement === document.body)) {
      this._focusAsync(this._previouslyFocusedElementOutsideTrapZone);
    }
  };

  FocusTrapZone.prototype._updateEventHandlers = function (newProps) {
    var _a = newProps.isClickableOutsideFocusTrap,
        isClickableOutsideFocusTrap = _a === void 0 ? false : _a,
        _b = newProps.forceFocusInsideTrap,
        forceFocusInsideTrap = _b === void 0 ? true : _b;

    if (forceFocusInsideTrap && !this._disposeFocusHandler) {
      this._disposeFocusHandler = (0, _Utilities.on)(window, 'focus', this._forceFocusInTrap, true);
    } else if (!forceFocusInsideTrap && this._disposeFocusHandler) {
      this._disposeFocusHandler();

      this._disposeFocusHandler = undefined;
    }

    if (!isClickableOutsideFocusTrap && !this._disposeClickHandler) {
      this._disposeClickHandler = (0, _Utilities.on)(window, 'click', this._forceClickInTrap, true);
    } else if (isClickableOutsideFocusTrap && this._disposeClickHandler) {
      this._disposeClickHandler();

      this._disposeClickHandler = undefined;
    }
  };

  FocusTrapZone.prototype._isBumper = function (element) {
    return element === this._firstBumper.current || element === this._lastBumper.current;
  };

  FocusTrapZone._focusStack = [];
  return FocusTrapZone;
}(React.Component);

exports.FocusTrapZone = FocusTrapZone;
},{"tslib":"xgwM","react":"mpTF","../../Utilities":"B5nc"}],"QOOm":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _FocusTrapZone = require("./FocusTrapZone");

Object.keys(_FocusTrapZone).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _FocusTrapZone[key];
    }
  });
});
},{"./FocusTrapZone":"pSbi"}],"N4W6":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _index = require("./components/FocusTrapZone/index");

Object.keys(_index).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index[key];
    }
  });
});
},{"./components/FocusTrapZone/index":"QOOm"}],"CM3o":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.FocusTrapCallout = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Callout = require("./Callout");

var _FocusTrapZone = require("../../FocusTrapZone");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * A special Callout that uses FocusTrapZone to trap focus
 * @param props - Props for the component
 */
var FocusTrapCallout = function (props) {
  return React.createElement(_Callout.Callout, tslib_1.__assign({}, props), React.createElement(_FocusTrapZone.FocusTrapZone, tslib_1.__assign({
    disabled: props.hidden
  }, props.focusTrapProps), props.children));
};

exports.FocusTrapCallout = FocusTrapCallout;
},{"tslib":"xgwM","react":"mpTF","./Callout":"cRec","../../FocusTrapZone":"N4W6"}],"jyN2":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _Callout = require("./Callout");

Object.keys(_Callout).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Callout[key];
    }
  });
});

var _FocusTrapCallout = require("./FocusTrapCallout");

Object.keys(_FocusTrapCallout).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _FocusTrapCallout[key];
    }
  });
});

var _DirectionalHint = require("../../common/DirectionalHint");

Object.keys(_DirectionalHint).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _DirectionalHint[key];
    }
  });
});
},{"./Callout":"cRec","./FocusTrapCallout":"CM3o","../../common/DirectionalHint":"uAUO"}],"jp3a":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _index = require("./components/Callout/index");

Object.keys(_index).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index[key];
    }
  });
});
},{"./components/Callout/index":"jyN2"}],"Vibn":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ContextualMenuItemBase = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _index = require("../../utilities/contextualMenu/index");

var _Utilities = require("../../Utilities");

var _Icon = require("../../Icon");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var renderItemIcon = function (props) {
  var item = props.item,
      hasIcons = props.hasIcons,
      classNames = props.classNames;
  var iconProps = item.iconProps;

  if (!hasIcons) {
    return null;
  }

  if (item.onRenderIcon) {
    return item.onRenderIcon(props);
  }

  return React.createElement(_Icon.Icon, tslib_1.__assign({}, iconProps, {
    className: classNames.icon
  }));
};

var renderCheckMarkIcon = function (_a) {
  var onCheckmarkClick = _a.onCheckmarkClick,
      item = _a.item,
      classNames = _a.classNames;
  var isItemChecked = (0, _index.getIsChecked)(item);

  if (onCheckmarkClick) {
    // Ensures that the item is passed as the first argument to the checkmark click callback.
    var onClick = function (e) {
      return onCheckmarkClick(item, e);
    };

    return React.createElement(_Icon.Icon, {
      iconName: isItemChecked ? 'CheckMark' : '',
      className: classNames.checkmarkIcon,
      onClick: onClick
    });
  }

  return null;
};

var renderItemName = function (_a) {
  var item = _a.item,
      classNames = _a.classNames;

  if (item.text || item.name) {
    return React.createElement("span", {
      className: classNames.label
    }, item.text || item.name);
  }

  return null;
};

var renderSecondaryText = function (_a) {
  var item = _a.item,
      classNames = _a.classNames;

  if (item.secondaryText) {
    return React.createElement("span", {
      className: classNames.secondaryText
    }, item.secondaryText);
  }

  return null;
};

var renderSubMenuIcon = function (_a) {
  var item = _a.item,
      classNames = _a.classNames;

  if ((0, _index.hasSubmenu)(item)) {
    return React.createElement(_Icon.Icon, tslib_1.__assign({
      iconName: (0, _Utilities.getRTL)() ? 'ChevronLeft' : 'ChevronRight'
    }, item.submenuIconProps, {
      className: classNames.subMenuIcon
    }));
  }

  return null;
};

var ContextualMenuItemBase =
/** @class */
function (_super) {
  tslib_1.__extends(ContextualMenuItemBase, _super);

  function ContextualMenuItemBase() {
    var _this = _super !== null && _super.apply(this, arguments) || this;

    _this.openSubMenu = function () {
      var _a = _this.props,
          item = _a.item,
          openSubMenu = _a.openSubMenu,
          getSubmenuTarget = _a.getSubmenuTarget;

      if (getSubmenuTarget) {
        var submenuTarget = getSubmenuTarget();

        if ((0, _index.hasSubmenu)(item) && openSubMenu && submenuTarget) {
          openSubMenu(item, submenuTarget);
        }
      }
    };

    _this.dismissSubMenu = function () {
      var _a = _this.props,
          item = _a.item,
          dismissSubMenu = _a.dismissSubMenu;

      if ((0, _index.hasSubmenu)(item) && dismissSubMenu) {
        dismissSubMenu();
      }
    };

    _this.dismissMenu = function (dismissAll) {
      var dismissMenu = _this.props.dismissMenu;

      if (dismissMenu) {
        dismissMenu(undefined
        /* ev */
        , dismissAll);
      }
    };

    return _this;
  }

  ContextualMenuItemBase.prototype.render = function () {
    var _a = this.props,
        item = _a.item,
        classNames = _a.classNames;
    return React.createElement("div", {
      className: item.split ? classNames.linkContentMenu : classNames.linkContent
    }, renderCheckMarkIcon(this.props), renderItemIcon(this.props), renderItemName(this.props), renderSecondaryText(this.props), renderSubMenuIcon(this.props));
  };

  return ContextualMenuItemBase;
}(_Utilities.BaseComponent);

exports.ContextualMenuItemBase = ContextualMenuItemBase;
},{"tslib":"xgwM","react":"mpTF","../../utilities/contextualMenu/index":"Q6fV","../../Utilities":"B5nc","../../Icon":"s5pL"}],"fbtm":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getDividerClassNames = void 0;

var _Utilities = require("../../Utilities");

var _Styling = require("../../Styling");

/**
 * @deprecated use getStyles exported from VerticalDivider.styles.ts
 */
var getDividerClassNames = (0, _Utilities.memoizeFunction)(function (theme) {
  return (0, _Styling.mergeStyleSets)({
    wrapper: {
      display: 'inline-flex',
      height: '100%',
      alignItems: 'center'
    },
    divider: {
      width: 1,
      height: '100%',
      backgroundColor: theme.palette.neutralTertiaryAlt
    }
  });
});
exports.getDividerClassNames = getDividerClassNames;
},{"../../Utilities":"B5nc","../../Styling":"AHeq"}],"h4LR":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getMenuItemStyles = exports.CONTEXTUAL_MENU_ITEM_HEIGHT = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var _Styling = require("../../Styling");

var _Utilities = require("../../Utilities");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var CONTEXTUAL_MENU_ITEM_HEIGHT = '32px';
exports.CONTEXTUAL_MENU_ITEM_HEIGHT = CONTEXTUAL_MENU_ITEM_HEIGHT;
var MediumScreenSelector = (0, _Styling.getScreenSelector)(0, _Styling.ScreenWidthMaxMedium);
var getItemHighContrastStyles = (0, _Utilities.memoizeFunction)(function () {
  return {
    selectors: (_a = {}, _a[_Styling.HighContrastSelector] = {
      backgroundColor: 'Highlight',
      borderColor: 'Highlight',
      color: 'HighlightText',
      MsHighContrastAdjust: 'none'
    }, _a)
  };

  var _a;
});
var getMenuItemStyles = (0, _Utilities.memoizeFunction)(function (theme) {
  var semanticColors = theme.semanticColors,
      fonts = theme.fonts;
  var ContextualMenuItemBackgroundHoverColor = semanticColors.menuItemBackgroundHovered;
  var ContextualMenuItemBackgroundSelectedColor = semanticColors.menuItemBackgroundChecked;
  var ContextualMenuItemDividerColor = semanticColors.bodyDivider;
  var menuItemStyles = {
    item: [fonts.medium, {
      color: semanticColors.bodyText,
      position: 'relative',
      boxSizing: 'border-box'
    }],
    divider: {
      display: 'block',
      height: '1px',
      backgroundColor: ContextualMenuItemDividerColor,
      position: 'relative'
    },
    root: [(0, _Styling.getFocusStyle)(theme), fonts.medium, {
      color: semanticColors.bodyText,
      backgroundColor: 'transparent',
      border: 'none',
      width: '100%',
      height: CONTEXTUAL_MENU_ITEM_HEIGHT,
      lineHeight: CONTEXTUAL_MENU_ITEM_HEIGHT,
      display: 'block',
      cursor: 'pointer',
      padding: '0px 8px 0 4px',
      textAlign: 'left'
    }],
    rootDisabled: {
      color: semanticColors.disabledBodyText,
      cursor: 'default',
      pointerEvents: 'none',
      selectors: (_a = {}, _a[_Styling.HighContrastSelector] = {
        color: 'GrayText',
        opacity: 1
      }, _a)
    },
    rootHovered: tslib_1.__assign({
      backgroundColor: ContextualMenuItemBackgroundHoverColor
    }, getItemHighContrastStyles()),
    rootFocused: tslib_1.__assign({
      backgroundColor: ContextualMenuItemBackgroundHoverColor
    }, getItemHighContrastStyles()),
    rootChecked: tslib_1.__assign({}, getItemHighContrastStyles()),
    rootPressed: tslib_1.__assign({
      backgroundColor: ContextualMenuItemBackgroundSelectedColor
    }, getItemHighContrastStyles()),
    rootExpanded: tslib_1.__assign({
      backgroundColor: ContextualMenuItemBackgroundSelectedColor,
      color: semanticColors.bodyTextChecked
    }, getItemHighContrastStyles()),
    linkContent: {
      whiteSpace: 'nowrap',
      height: 'inherit',
      display: 'flex',
      alignItems: 'center',
      maxWidth: '100%'
    },
    anchorLink: {
      padding: '0px 8px 0 4px',
      textRendering: 'auto',
      color: 'inherit',
      letterSpacing: 'normal',
      wordSpacing: 'normal',
      textTransform: 'none',
      textIndent: '0px',
      textShadow: 'none',
      textDecoration: 'none',
      boxSizing: 'border-box'
    },
    label: {
      margin: '0 4px',
      verticalAlign: 'middle',
      display: 'inline-block',
      flexGrow: '1',
      textOverflow: 'ellipsis',
      overflow: 'hidden',
      whiteSpace: 'nowrap'
    },
    secondaryText: {
      color: theme.palette.neutralSecondary,
      paddingLeft: '20px',
      textAlign: 'right'
    },
    icon: {
      display: 'inline-block',
      minHeight: '1px',
      maxHeight: CONTEXTUAL_MENU_ITEM_HEIGHT,
      width: '14px',
      margin: '0 4px',
      verticalAlign: 'middle',
      flexShrink: '0'
    },
    iconColor: {
      color: semanticColors.menuIcon,
      selectors: (_b = {}, _b[_Styling.HighContrastSelector] = {
        color: 'inherit'
      }, _b['$root:hover &'] = {
        selectors: (_c = {}, _c[_Styling.HighContrastSelector] = {
          color: 'HighlightText'
        }, _c)
      }, _b['$root:focus &'] = {
        selectors: (_d = {}, _d[_Styling.HighContrastSelector] = {
          color: 'HighlightText'
        }, _d)
      }, _b)
    },
    iconDisabled: {
      color: semanticColors.disabledBodyText
    },
    checkmarkIcon: {
      color: semanticColors.bodySubtext,
      selectors: (_e = {}, _e[_Styling.HighContrastSelector] = {
        color: 'HighlightText'
      }, _e)
    },
    subMenuIcon: {
      height: CONTEXTUAL_MENU_ITEM_HEIGHT,
      lineHeight: CONTEXTUAL_MENU_ITEM_HEIGHT,
      textAlign: 'center',
      display: 'inline-block',
      verticalAlign: 'middle',
      flexShrink: '0',
      fontSize: _Styling.FontSizes.small,
      selectors: (_f = {}, _f[MediumScreenSelector] = {
        fontSize: _Styling.FontSizes.icon // 16px

      }, _f)
    },
    splitButtonFlexContainer: [(0, _Styling.getFocusStyle)(theme), {
      display: 'flex',
      height: CONTEXTUAL_MENU_ITEM_HEIGHT,
      flexWrap: 'nowrap',
      justifyContent: 'center',
      alignItems: 'center'
    }]
  };
  return (0, _Styling.concatStyleSets)(menuItemStyles);

  var _a, _b, _c, _d, _e, _f;
});
exports.getMenuItemStyles = getMenuItemStyles;
},{"tslib":"xgwM","../../Styling":"AHeq","../../Utilities":"B5nc"}],"rug5":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getItemStyles = exports.getItemClassNames = exports.getSplitButtonVerticalDividerClassNames = void 0;

var _VerticalDivider = require("../Divider/VerticalDivider.classNames");

var _ContextualMenu = require("./ContextualMenu.cnstyles");

var _Styling = require("../../Styling");

var _Utilities = require("../../Utilities");

var MediumScreenSelector = (0, _Styling.getScreenSelector)(0, _Styling.ScreenWidthMaxMedium);
var getSplitButtonVerticalDividerClassNames = (0, _Utilities.memoizeFunction)(function (theme) {
  return (0, _Styling.mergeStyleSets)((0, _VerticalDivider.getDividerClassNames)(theme), {
    wrapper: {
      position: 'absolute',
      right: 28,
      selectors: (_a = {}, _a[MediumScreenSelector] = {
        right: 32 // fontSize of the icon increased from 12px to 16px

      }, _a)
    },
    divider: {
      height: 16,
      width: 1
    }
  });

  var _a;
});
exports.getSplitButtonVerticalDividerClassNames = getSplitButtonVerticalDividerClassNames;
var GlobalClassNames = {
  item: 'ms-ContextualMenu-item',
  divider: 'ms-ContextualMenu-divider',
  root: 'ms-ContextualMenu-link',
  isChecked: 'is-checked',
  isExpanded: 'is-expanded',
  isDisabled: 'is-disabled',
  linkContent: 'ms-ContextualMenu-linkContent',
  linkContentMenu: 'ms-ContextualMenu-linkContent',
  icon: 'ms-ContextualMenu-icon',
  iconColor: 'ms-ContextualMenu-iconColor',
  checkmarkIcon: 'ms-ContextualMenu-checkmarkIcon',
  subMenuIcon: 'ms-ContextualMenu-submenuIcon',
  label: 'ms-ContextualMenu-itemText',
  secondaryText: 'ms-ContextualMenu-secondaryText'
};
/**
 * @deprecated To be removed in 7.0.
 * @internal
 * This is a package-internal method that has been depended on.
 * It is being kept in this form for backwards compatibility.
 * It should be cleaned up in 7.0.
 *
 * TODO: Audit perf. impact of and potentially remove memoizeFunction.
 * https://github.com/OfficeDev/office-ui-fabric-react/issues/5534
 */

var getItemClassNames = (0, _Utilities.memoizeFunction)(function (theme, disabled, expanded, checked, isAnchorLink, knownIcon, itemClassName, dividerClassName, iconClassName, subMenuClassName, primaryDisabled, className) {
  var styles = (0, _ContextualMenu.getMenuItemStyles)(theme);
  var classNames = (0, _Styling.getGlobalClassNames)(GlobalClassNames, theme);
  return (0, _Styling.mergeStyleSets)({
    item: [classNames.item, styles.item, itemClassName],
    divider: [classNames.divider, styles.divider, dividerClassName],
    root: [classNames.root, styles.root, checked && [classNames.isChecked, styles.rootChecked], isAnchorLink && styles.anchorLink, expanded && [classNames.isExpanded, styles.rootExpanded], disabled && [classNames.isDisabled, styles.rootDisabled], !disabled && !expanded && [{
      selectors: (_a = {
        ':hover': styles.rootHovered,
        ':active': styles.rootPressed
      }, _a["." + _Utilities.IsFocusVisibleClassName + " &:focus, ." + _Utilities.IsFocusVisibleClassName + " &:focus:hover"] = styles.rootFocused, _a["." + _Utilities.IsFocusVisibleClassName + " &:hover"] = {
        background: 'inherit;'
      }, _a)
    }], className],
    splitPrimary: [styles.root, checked && ['is-checked', styles.rootChecked], (disabled || primaryDisabled) && ['is-disabled', styles.rootDisabled], !(disabled || primaryDisabled) && !checked && [{
      selectors: (_b = {
        ':hover': styles.rootHovered,
        ':hover ~ $splitMenu': styles.rootHovered,
        ':active': styles.rootPressed
      }, _b["." + _Utilities.IsFocusVisibleClassName + " &:focus, ." + _Utilities.IsFocusVisibleClassName + " &:focus:hover"] = styles.rootFocused, _b["." + _Utilities.IsFocusVisibleClassName + " &:hover"] = {
        background: 'inherit;'
      }, _b)
    }]],
    splitMenu: [styles.root, {
      flexBasis: '0',
      padding: '0 8px',
      minWidth: 28
    }, expanded && ['is-expanded', styles.rootExpanded], disabled && ['is-disabled', styles.rootDisabled], !disabled && !expanded && [{
      selectors: (_c = {
        ':hover': styles.rootHovered,
        ':active': styles.rootPressed
      }, _c["." + _Utilities.IsFocusVisibleClassName + " &:focus, ." + _Utilities.IsFocusVisibleClassName + " &:focus:hover"] = styles.rootFocused, _c["." + _Utilities.IsFocusVisibleClassName + " &:hover"] = {
        background: 'inherit;'
      }, _c)
    }]],
    anchorLink: styles.anchorLink,
    linkContent: [classNames.linkContent, styles.linkContent],
    linkContentMenu: [classNames.linkContentMenu, styles.linkContent, {
      justifyContent: 'center'
    }],
    icon: [classNames.icon, knownIcon && styles.iconColor, styles.icon, iconClassName, disabled && [classNames.isDisabled, styles.iconDisabled]],
    iconColor: styles.iconColor,
    checkmarkIcon: [classNames.checkmarkIcon, knownIcon && styles.checkmarkIcon, styles.icon, iconClassName],
    subMenuIcon: [classNames.subMenuIcon, styles.subMenuIcon, subMenuClassName],
    label: [classNames.label, styles.label],
    secondaryText: [classNames.secondaryText, styles.secondaryText],
    splitContainer: [styles.splitButtonFlexContainer, {
      alignItems: 'flex-start'
    }, !disabled && !checked && [{
      selectors: (_d = {}, _d["." + _Utilities.IsFocusVisibleClassName + " &:focus, ." + _Utilities.IsFocusVisibleClassName + " &:focus:hover"] = styles.rootFocused, _d)
    }]]
  });

  var _a, _b, _c, _d;
});
/**
 * Wrapper function for generating ContextualMenuItem classNames which adheres to
 * the getStyles API, but invokes memoized className generator function with
 * primitive values.
 *
 * @param props the ContextualMenuItem style props used to generate its styles.
 */

exports.getItemClassNames = getItemClassNames;

var getItemStyles = function (props) {
  var theme = props.theme,
      disabled = props.disabled,
      expanded = props.expanded,
      checked = props.checked,
      isAnchorLink = props.isAnchorLink,
      knownIcon = props.knownIcon,
      itemClassName = props.itemClassName,
      dividerClassName = props.dividerClassName,
      iconClassName = props.iconClassName,
      subMenuClassName = props.subMenuClassName,
      primaryDisabled = props.primaryDisabled,
      className = props.className;
  return getItemClassNames(theme, disabled, expanded, checked, isAnchorLink, knownIcon, itemClassName, dividerClassName, iconClassName, subMenuClassName, primaryDisabled, className);
};

exports.getItemStyles = getItemStyles;
},{"../Divider/VerticalDivider.classNames":"fbtm","./ContextualMenu.cnstyles":"h4LR","../../Styling":"AHeq","../../Utilities":"B5nc"}],"Px7u":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ContextualMenuItem = void 0;

var _Utilities = require("../../Utilities");

var _ContextualMenuItem = require("./ContextualMenuItem.base");

var _ContextualMenu = require("./ContextualMenu.classNames");

/**
 * ContextualMenuItem description
 */
var ContextualMenuItem = (0, _Utilities.styled)(_ContextualMenuItem.ContextualMenuItemBase, _ContextualMenu.getItemStyles, undefined, {
  scope: 'ContextualMenuItem'
});
exports.ContextualMenuItem = ContextualMenuItem;
},{"../../Utilities":"B5nc","./ContextualMenuItem.base":"Vibn","./ContextualMenu.classNames":"rug5"}],"PKWX":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ContextualMenuItemWrapper = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var _Utilities = require("../../../Utilities");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var ContextualMenuItemWrapper =
/** @class */
function (_super) {
  tslib_1.__extends(ContextualMenuItemWrapper, _super);

  function ContextualMenuItemWrapper() {
    var _this = _super !== null && _super.apply(this, arguments) || this;

    _this._onItemMouseEnter = function (ev) {
      var _a = _this.props,
          item = _a.item,
          onItemMouseEnter = _a.onItemMouseEnter;

      if (onItemMouseEnter) {
        onItemMouseEnter(item, ev, ev.currentTarget);
      }
    };

    _this._onItemClick = function (ev) {
      var _a = _this.props,
          item = _a.item,
          onItemClickBase = _a.onItemClickBase;

      if (onItemClickBase) {
        onItemClickBase(item, ev, ev.currentTarget);
      }
    };

    _this._onItemMouseLeave = function (ev) {
      var _a = _this.props,
          item = _a.item,
          onItemMouseLeave = _a.onItemMouseLeave;

      if (onItemMouseLeave) {
        onItemMouseLeave(item, ev);
      }
    };

    _this._onItemKeyDown = function (ev) {
      var _a = _this.props,
          item = _a.item,
          onItemKeyDown = _a.onItemKeyDown;

      if (onItemKeyDown) {
        onItemKeyDown(item, ev);
      }
    };

    _this._onItemMouseMove = function (ev) {
      var _a = _this.props,
          item = _a.item,
          onItemMouseMove = _a.onItemMouseMove;

      if (onItemMouseMove) {
        onItemMouseMove(item, ev, ev.currentTarget);
      }
    };

    _this._getSubMenuId = function (item) {
      var getSubMenuId = _this.props.getSubMenuId;

      if (getSubMenuId) {
        return getSubMenuId(item);
      }
    };

    _this._getSubmenuTarget = function () {
      return undefined;
    };

    return _this;
  }

  ContextualMenuItemWrapper.prototype.shouldComponentUpdate = function (newProps) {
    return !(0, _Utilities.shallowCompare)(newProps, this.props);
  };

  return ContextualMenuItemWrapper;
}(_Utilities.BaseComponent);

exports.ContextualMenuItemWrapper = ContextualMenuItemWrapper;
},{"tslib":"xgwM","../../../Utilities":"B5nc"}],"P6ki":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.KeytipEvents = exports.KTP_ARIA_SEPARATOR = exports.KTP_LAYER_ID = exports.DATAKTP_EXECUTE_TARGET = exports.DATAKTP_TARGET = exports.KTP_FULL_PREFIX = exports.KTP_SEPARATOR = exports.KTP_PREFIX = void 0;
var KTP_PREFIX = 'ktp';
exports.KTP_PREFIX = KTP_PREFIX;
var KTP_SEPARATOR = '-';
exports.KTP_SEPARATOR = KTP_SEPARATOR;
var KTP_FULL_PREFIX = KTP_PREFIX + KTP_SEPARATOR;
exports.KTP_FULL_PREFIX = KTP_FULL_PREFIX;
var DATAKTP_TARGET = 'data-ktp-target';
exports.DATAKTP_TARGET = DATAKTP_TARGET;
var DATAKTP_EXECUTE_TARGET = 'data-ktp-execute-target';
exports.DATAKTP_EXECUTE_TARGET = DATAKTP_EXECUTE_TARGET;
var KTP_LAYER_ID = 'ktp-layer-id';
exports.KTP_LAYER_ID = KTP_LAYER_ID;
var KTP_ARIA_SEPARATOR = ', '; // Events

exports.KTP_ARIA_SEPARATOR = KTP_ARIA_SEPARATOR;
var KeytipEvents;
exports.KeytipEvents = KeytipEvents;

(function (KeytipEvents) {
  KeytipEvents.KEYTIP_ADDED = 'keytipAdded';
  KeytipEvents.KEYTIP_REMOVED = 'keytipRemoved';
  KeytipEvents.KEYTIP_UPDATED = 'keytipUpdated';
  KeytipEvents.PERSISTED_KEYTIP_ADDED = 'persistedKeytipAdded';
  KeytipEvents.PERSISTED_KEYTIP_REMOVED = 'persistedKeytipRemoved';
  KeytipEvents.PERSISTED_KEYTIP_EXECUTE = 'persistedKeytipExecute';
  KeytipEvents.ENTER_KEYTIP_MODE = 'enterKeytipMode';
  KeytipEvents.EXIT_KEYTIP_MODE = 'exitKeytipMode';
})(KeytipEvents || (exports.KeytipEvents = KeytipEvents = {}));
},{}],"qsTL":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.KeytipManager = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var _Utilities = require("../../Utilities");

var _KeytipConstants = require("../../utilities/keytips/KeytipConstants");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * This class is responsible for handling registering, updating, and unregistering of keytips
 */
var KeytipManager =
/** @class */
function () {
  function KeytipManager() {
    this.keytips = [];
    this.persistedKeytips = []; // This is (and should be) updated and kept in sync
    // with the inKeytipMode in KeytipLayer.

    this.inKeytipMode = false; // Boolean that gets checked before entering keytip mode by the KeytipLayer
    // Used for an override in special cases (e.g. Disable entering keytip mode when a modal is shown)

    this.shouldEnterKeytipMode = true;
  }
  /**
   * Static function to get singleton KeytipManager instance
   *
   * @returns {KeytipManager} Singleton KeytipManager instance
   */


  KeytipManager.getInstance = function () {
    return this._instance;
  };
  /**
   * Registers a keytip
   *
   * @param keytipProps - Keytip to register
   * @param persisted - T/F if this keytip should be persisted, default is false
   * @returns {string} Unique ID for this keytip
   */


  KeytipManager.prototype.register = function (keytipProps, persisted) {
    if (persisted === void 0) {
      persisted = false;
    }

    var props = keytipProps;

    if (!persisted) {
      // Add the overflowSetSequence if necessary
      props = this.addParentOverflow(keytipProps);
    } // Create a unique keytip


    var uniqueKeytip = this._getUniqueKtp(props); // Add to array


    persisted ? this.persistedKeytips.push(uniqueKeytip) : this.keytips.push(uniqueKeytip);
    var event = persisted ? _KeytipConstants.KeytipEvents.PERSISTED_KEYTIP_ADDED : _KeytipConstants.KeytipEvents.KEYTIP_ADDED;

    _Utilities.EventGroup.raise(this, event, {
      keytip: props,
      uniqueID: uniqueKeytip.uniqueID
    });

    return uniqueKeytip.uniqueID;
  };
  /**
   * Update a keytip
   *
   * @param keytipProps - Keytip to update
   * @param uniqueID - Unique ID of this keytip
   */


  KeytipManager.prototype.update = function (keytipProps, uniqueID) {
    var newKeytipProps = this.addParentOverflow(keytipProps);

    var uniqueKeytip = this._getUniqueKtp(newKeytipProps, uniqueID);

    var keytipIndex = (0, _Utilities.findIndex)(this.keytips, function (ktp) {
      return ktp.uniqueID === uniqueID;
    });

    if (keytipIndex >= 0) {
      // Update everything except 'visible'
      uniqueKeytip.keytip.visible = this.keytips[keytipIndex].keytip.visible; // Update keytip in this.keytips

      this.keytips = (0, _Utilities.replaceElement)(this.keytips, uniqueKeytip, keytipIndex); // Raise event

      _Utilities.EventGroup.raise(this, _KeytipConstants.KeytipEvents.KEYTIP_UPDATED, {
        keytip: uniqueKeytip.keytip,
        uniqueID: uniqueKeytip.uniqueID
      });
    }
  };
  /**
   * Unregisters a keytip
   *
   * @param keytipToRemove - IKeytipProps of the keytip to remove
   * @param uniqueID - Unique ID of this keytip
   * @param persisted - T/F if this keytip should be persisted, default is false
   */


  KeytipManager.prototype.unregister = function (keytipToRemove, uniqueID, persisted) {
    if (persisted === void 0) {
      persisted = false;
    }

    if (persisted) {
      // Remove keytip from this.persistedKeytips
      this.persistedKeytips = this.persistedKeytips.filter(function (uniqueKtp) {
        return uniqueKtp.uniqueID !== uniqueID;
      });
    } else {
      // Remove keytip from this.keytips
      this.keytips = this.keytips.filter(function (uniqueKtp) {
        return uniqueKtp.uniqueID !== uniqueID;
      });
    }

    var event = persisted ? _KeytipConstants.KeytipEvents.PERSISTED_KEYTIP_REMOVED : _KeytipConstants.KeytipEvents.KEYTIP_REMOVED;

    _Utilities.EventGroup.raise(this, event, {
      keytip: keytipToRemove,
      uniqueID: uniqueID
    });
  };
  /**
   * Manual call to enter keytip mode
   */


  KeytipManager.prototype.enterKeytipMode = function () {
    _Utilities.EventGroup.raise(this, _KeytipConstants.KeytipEvents.ENTER_KEYTIP_MODE);
  };
  /**
   * Manual call to exit keytip mode
   */


  KeytipManager.prototype.exitKeytipMode = function () {
    _Utilities.EventGroup.raise(this, _KeytipConstants.KeytipEvents.EXIT_KEYTIP_MODE);
  };
  /**
   * Gets all IKeytipProps from this.keytips
   *
   * @returns {IKeytipProps[]} All keytips stored in the manager
   */


  KeytipManager.prototype.getKeytips = function () {
    return this.keytips.map(function (uniqueKeytip) {
      return uniqueKeytip.keytip;
    });
  };
  /**
   * Adds the overflowSetSequence to the keytipProps if its parent keytip also has it
   *
   * @param keytipProps - Keytip props to add overflowSetSequence to if necessary
   * @returns {IKeytipProps} - Modified keytip props, if needed to be modified
   */


  KeytipManager.prototype.addParentOverflow = function (keytipProps) {
    var fullSequence = keytipProps.keySequences.slice();
    fullSequence.pop();

    if (fullSequence.length !== 0) {
      var parentKeytip = (0, _Utilities.find)(this.getKeytips(), function (keytip) {
        return (0, _Utilities.arraysEqual)(fullSequence, keytip.keySequences);
      });

      if (parentKeytip && parentKeytip.overflowSetSequence) {
        return tslib_1.__assign({}, keytipProps, {
          overflowSetSequence: parentKeytip.overflowSetSequence
        });
      }
    }

    return keytipProps;
  };
  /**
   * Public function to bind for overflow items that have a submenu
   *
   * @param overflowButtonSequences
   * @param keytipSequences
   */


  KeytipManager.prototype.menuExecute = function (overflowButtonSequences, keytipSequences) {
    _Utilities.EventGroup.raise(this, _KeytipConstants.KeytipEvents.PERSISTED_KEYTIP_EXECUTE, {
      overflowButtonSequences: overflowButtonSequences,
      keytipSequences: keytipSequences
    });
  };
  /**
   * Creates an IUniqueKeytip object
   *
   * @param keytipProps - IKeytipProps
   * @param uniqueID - Unique ID, will default to the next unique ID if not passed
   * @returns {IUniqueKeytip} IUniqueKeytip object
   */


  KeytipManager.prototype._getUniqueKtp = function (keytipProps, uniqueID) {
    if (uniqueID === void 0) {
      uniqueID = (0, _Utilities.getId)();
    }

    return {
      keytip: tslib_1.__assign({}, keytipProps),
      uniqueID: uniqueID
    };
  };

  KeytipManager._instance = new KeytipManager();
  return KeytipManager;
}();

exports.KeytipManager = KeytipManager;
},{"tslib":"xgwM","../../Utilities":"B5nc","../../utilities/keytips/KeytipConstants":"P6ki"}],"LjLQ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.sequencesToID = sequencesToID;
exports.mergeOverflows = mergeOverflows;
exports.ktpTargetFromSequences = ktpTargetFromSequences;
exports.ktpTargetFromId = ktpTargetFromId;
exports.getAriaDescribedBy = getAriaDescribedBy;

var _KeytipConstants = require("./KeytipConstants");

var _Utilities = require("../../Utilities");

/**
 * Converts a whole set of KeySequences into one keytip ID, which will be the ID for the last keytip sequence specified
 * keySequences should not include the initial keytip 'start' sequence.
 *
 * @param keySequences - Full path of IKeySequences for one keytip.
 * @returns {string} String to use for the keytip ID.
 */
function sequencesToID(keySequences) {
  return keySequences.reduce(function (prevValue, keySequence) {
    return prevValue + _KeytipConstants.KTP_SEPARATOR + keySequence.split('').join(_KeytipConstants.KTP_SEPARATOR);
  }, _KeytipConstants.KTP_PREFIX);
}
/**
 * Merges an overflow sequence with a key sequence.
 *
 * @param keySequences - Full sequence for one keytip.
 * @param overflowKeySequences - Full overflow keytip sequence.
 * @returns {string[]} Sequence that will be used by the keytip when in the overflow.
 */


function mergeOverflows(keySequences, overflowKeySequences) {
  var overflowSequenceLen = overflowKeySequences.length;
  var overflowSequence = overflowKeySequences.slice().pop();
  var newKeySequences = keySequences.slice();
  return (0, _Utilities.addElementAtIndex)(newKeySequences, overflowSequenceLen - 1, overflowSequence);
}
/**
 * Constructs the data-ktp-target attribute selector from a full key sequence.
 *
 * @param keySequences - Full string[] for a Keytip.
 * @returns {string} String selector to use to query for the keytip target.
 */


function ktpTargetFromSequences(keySequences) {
  return '[' + _KeytipConstants.DATAKTP_TARGET + '="' + sequencesToID(keySequences) + '"]';
}
/**
 * Constructs the data-ktp-execute-target attribute selector from a keytip ID.
 *
 * @param keytipId - ID of the Keytip.
 * @returns {string} String selector to use to query for the keytip execute target.
 */


function ktpTargetFromId(keytipId) {
  return '[' + _KeytipConstants.DATAKTP_EXECUTE_TARGET + '="' + keytipId + '"]';
}
/**
 * Gets the aria-describedby value to put on the component with this keytip.
 *
 * @param keySequences - KeySequences of the keytip.
 * @returns {string} The aria-describedby value to set on the component with this keytip.
 */


function getAriaDescribedBy(keySequences) {
  var describedby = ' ' + _KeytipConstants.KTP_LAYER_ID;

  if (!keySequences.length) {
    // Return just the layer ID
    return describedby;
  }

  return describedby + ' ' + sequencesToID(keySequences);
}
},{"./KeytipConstants":"P6ki","../../Utilities":"B5nc"}],"Q16k":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.KeytipData = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Utilities = require("../../Utilities");

var _KeytipManager = require("../../utilities/keytips/KeytipManager");

var _KeytipUtils = require("../../utilities/keytips/KeytipUtils");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * A small element to help the target component correctly read out its aria-describedby for its Keytip
 * {@docCategory Keytips}
 */
var KeytipData =
/** @class */
function (_super) {
  tslib_1.__extends(KeytipData, _super);

  function KeytipData() {
    var _this = _super !== null && _super.apply(this, arguments) || this;

    _this._keytipManager = _KeytipManager.KeytipManager.getInstance();
    return _this;
  }

  KeytipData.prototype.componentDidMount = function () {
    // Register Keytip in KeytipManager
    if (this.props.keytipProps) {
      this._uniqueId = this._keytipManager.register(this._getKtpProps());
    }
  };

  KeytipData.prototype.componentWillUnmount = function () {
    // Unregister Keytip in KeytipManager
    this.props.keytipProps && this._keytipManager.unregister(this._getKtpProps(), this._uniqueId);
  };

  KeytipData.prototype.componentDidUpdate = function () {
    // Update Keytip in KeytipManager
    this.props.keytipProps && this._keytipManager.update(this._getKtpProps(), this._uniqueId);
  };

  KeytipData.prototype.render = function () {
    var _a = this.props,
        children = _a.children,
        keytipProps = _a.keytipProps,
        ariaDescribedBy = _a.ariaDescribedBy;
    var nativeKeytipProps = {};

    if (keytipProps) {
      nativeKeytipProps = this._getKtpAttrs(keytipProps, ariaDescribedBy);
    }

    return children(nativeKeytipProps);
  };

  KeytipData.prototype._getKtpProps = function () {
    return tslib_1.__assign({
      disabled: this.props.disabled
    }, this.props.keytipProps);
  };
  /**
   * Gets the aria- and data- attributes to attach to the component
   * @param keytipProps - props for Keytip
   * @param describedByPrepend - ariaDescribedBy value to prepend
   */


  KeytipData.prototype._getKtpAttrs = function (keytipProps, describedByPrepend) {
    if (keytipProps) {
      // Add the parent overflow sequence if necessary
      var newKeytipProps = this._keytipManager.addParentOverflow(keytipProps); // Construct aria-describedby and data-ktp-id attributes and return


      var ariaDescribedBy = (0, _KeytipUtils.getAriaDescribedBy)(newKeytipProps.keySequences);
      var keySequences = newKeytipProps.keySequences.slice();

      if (newKeytipProps.overflowSetSequence) {
        keySequences = (0, _KeytipUtils.mergeOverflows)(keySequences, newKeytipProps.overflowSetSequence);
      }

      var ktpId = (0, _KeytipUtils.sequencesToID)(keySequences);
      return {
        'aria-describedby': (0, _Utilities.mergeAriaAttributeValues)(describedByPrepend, ariaDescribedBy),
        'data-ktp-target': ktpId,
        'data-ktp-execute-target': ktpId
      };
    }

    return undefined;
  };

  return KeytipData;
}(React.Component);

exports.KeytipData = KeytipData;
},{"tslib":"xgwM","react":"mpTF","../../Utilities":"B5nc","../../utilities/keytips/KeytipManager":"qsTL","../../utilities/keytips/KeytipUtils":"LjLQ"}],"VbLW":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _KeytipData = require("./KeytipData");

Object.keys(_KeytipData).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _KeytipData[key];
    }
  });
});
},{"./KeytipData":"Q16k"}],"ltoP":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _index = require("./components/KeytipData/index");

Object.keys(_index).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index[key];
    }
  });
});
},{"./components/KeytipData/index":"VbLW"}],"JDgG":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ContextualMenuAnchor = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Utilities = require("../../../Utilities");

var _ContextualMenuItemWrapper = require("./ContextualMenuItemWrapper");

var _KeytipData = require("../../../KeytipData");

var _index = require("../../../utilities/contextualMenu/index");

var _ContextualMenuItem = require("../ContextualMenuItem");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var ContextualMenuAnchor =
/** @class */
function (_super) {
  tslib_1.__extends(ContextualMenuAnchor, _super);

  function ContextualMenuAnchor() {
    var _this = _super !== null && _super.apply(this, arguments) || this;

    _this._anchor = React.createRef();

    _this._getSubmenuTarget = function () {
      return _this._anchor.current ? _this._anchor.current : undefined;
    };

    _this._onItemClick = function (ev) {
      var _a = _this.props,
          item = _a.item,
          onItemClick = _a.onItemClick;

      if (onItemClick) {
        onItemClick(item, ev);
      }
    };

    return _this;
  }

  ContextualMenuAnchor.prototype.render = function () {
    var _this = this;

    var _a = this.props,
        item = _a.item,
        classNames = _a.classNames,
        index = _a.index,
        focusableElementIndex = _a.focusableElementIndex,
        totalItemCount = _a.totalItemCount,
        hasCheckmarks = _a.hasCheckmarks,
        hasIcons = _a.hasIcons,
        _b = _a.contextualMenuItemAs,
        ChildrenRenderer = _b === void 0 ? _ContextualMenuItem.ContextualMenuItem : _b,
        expandedMenuItemKey = _a.expandedMenuItemKey,
        onItemClick = _a.onItemClick,
        openSubMenu = _a.openSubMenu,
        dismissSubMenu = _a.dismissSubMenu,
        dismissMenu = _a.dismissMenu;
    var anchorRel = item.rel;

    if (item.target && item.target.toLowerCase() === '_blank') {
      anchorRel = anchorRel ? anchorRel : 'nofollow noopener noreferrer'; // Safe default to prevent tabjacking
    }

    var subMenuId = this._getSubMenuId(item);

    var itemHasSubmenu = (0, _index.hasSubmenu)(item);
    var nativeProps = (0, _Utilities.getNativeProps)(item, _Utilities.anchorProperties);
    var disabled = (0, _index.isItemDisabled)(item);
    var itemProps = item.itemProps;
    var keytipProps = item.keytipProps;

    if (keytipProps && itemHasSubmenu) {
      keytipProps = tslib_1.__assign({}, keytipProps, {
        hasMenu: true
      });
    }

    return React.createElement("div", null, React.createElement(_KeytipData.KeytipData, {
      keytipProps: item.keytipProps,
      ariaDescribedBy: nativeProps['aria-describedby'],
      disabled: disabled
    }, function (keytipAttributes) {
      return React.createElement("a", tslib_1.__assign({}, nativeProps, keytipAttributes, {
        ref: _this._anchor,
        href: item.href,
        target: item.target,
        rel: anchorRel,
        className: classNames.root,
        role: "menuitem",
        "aria-owns": item.key === expandedMenuItemKey ? subMenuId : undefined,
        "aria-haspopup": itemHasSubmenu || undefined,
        "aria-expanded": itemHasSubmenu ? item.key === expandedMenuItemKey : undefined,
        "aria-posinset": focusableElementIndex + 1,
        "aria-setsize": totalItemCount,
        "aria-disabled": (0, _index.isItemDisabled)(item),
        style: item.style,
        onClick: _this._onItemClick,
        onMouseEnter: _this._onItemMouseEnter,
        onMouseLeave: _this._onItemMouseLeave,
        onMouseMove: _this._onItemMouseMove,
        onKeyDown: itemHasSubmenu ? _this._onItemKeyDown : undefined
      }), React.createElement(ChildrenRenderer, tslib_1.__assign({
        componentRef: item.componentRef,
        item: item,
        classNames: classNames,
        index: index,
        onCheckmarkClick: hasCheckmarks && onItemClick ? onItemClick : undefined,
        hasIcons: hasIcons,
        openSubMenu: openSubMenu,
        dismissSubMenu: dismissSubMenu,
        dismissMenu: dismissMenu,
        getSubmenuTarget: _this._getSubmenuTarget
      }, itemProps)));
    }));
  };

  return ContextualMenuAnchor;
}(_ContextualMenuItemWrapper.ContextualMenuItemWrapper);

exports.ContextualMenuAnchor = ContextualMenuAnchor;
},{"tslib":"xgwM","react":"mpTF","../../../Utilities":"B5nc","./ContextualMenuItemWrapper":"PKWX","../../../KeytipData":"ltoP","../../../utilities/contextualMenu/index":"Q6fV","../ContextualMenuItem":"Px7u"}],"f7Km":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ContextualMenuButton = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Utilities = require("../../../Utilities");

var _ContextualMenuItemWrapper = require("./ContextualMenuItemWrapper");

var _KeytipData = require("../../../KeytipData");

var _index = require("../../../utilities/contextualMenu/index");

var _ContextualMenuItem = require("../ContextualMenuItem");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var ContextualMenuButton =
/** @class */
function (_super) {
  tslib_1.__extends(ContextualMenuButton, _super);

  function ContextualMenuButton() {
    var _this = _super !== null && _super.apply(this, arguments) || this;

    _this._btn = React.createRef();

    _this._getSubmenuTarget = function () {
      return _this._btn.current ? _this._btn.current : undefined;
    };

    return _this;
  }

  ContextualMenuButton.prototype.render = function () {
    var _this = this;

    var _a = this.props,
        item = _a.item,
        classNames = _a.classNames,
        index = _a.index,
        focusableElementIndex = _a.focusableElementIndex,
        totalItemCount = _a.totalItemCount,
        hasCheckmarks = _a.hasCheckmarks,
        hasIcons = _a.hasIcons,
        _b = _a.contextualMenuItemAs,
        ChildrenRenderer = _b === void 0 ? _ContextualMenuItem.ContextualMenuItem : _b,
        expandedMenuItemKey = _a.expandedMenuItemKey,
        onItemMouseDown = _a.onItemMouseDown,
        onItemClick = _a.onItemClick,
        openSubMenu = _a.openSubMenu,
        dismissSubMenu = _a.dismissSubMenu,
        dismissMenu = _a.dismissMenu;

    var subMenuId = this._getSubMenuId(item);

    var isChecked = (0, _index.getIsChecked)(item);
    var canCheck = isChecked !== null;
    var defaultRole = canCheck ? 'menuitemcheckbox' : 'menuitem';
    var itemHasSubmenu = (0, _index.hasSubmenu)(item);
    var itemProps = item.itemProps,
        ariaLabel = item.ariaLabel;
    var buttonNativeProperties = (0, _Utilities.getNativeProps)(item, _Utilities.buttonProperties); // Do not add the disabled attribute to the button so that it is focusable

    delete buttonNativeProperties.disabled;
    var itemButtonProperties = {
      className: classNames.root,
      onClick: this._onItemClick,
      onKeyDown: itemHasSubmenu ? this._onItemKeyDown : undefined,
      onMouseEnter: this._onItemMouseEnter,
      onMouseLeave: this._onItemMouseLeave,
      onMouseDown: function (ev) {
        return onItemMouseDown ? onItemMouseDown(item, ev) : undefined;
      },
      onMouseMove: this._onItemMouseMove,
      href: item.href,
      title: item.title,
      'aria-label': ariaLabel,
      'aria-haspopup': itemHasSubmenu || undefined,
      'aria-owns': item.key === expandedMenuItemKey ? subMenuId : undefined,
      'aria-expanded': itemHasSubmenu ? item.key === expandedMenuItemKey : undefined,
      'aria-checked': canCheck ? !!isChecked : undefined,
      'aria-posinset': focusableElementIndex + 1,
      'aria-setsize': totalItemCount,
      'aria-disabled': (0, _index.isItemDisabled)(item),
      role: item.role || defaultRole,
      style: item.style
    };
    var keytipProps = item.keytipProps;

    if (keytipProps && itemHasSubmenu) {
      keytipProps = tslib_1.__assign({}, keytipProps, {
        hasMenu: true
      });
    }

    return React.createElement(_KeytipData.KeytipData, {
      keytipProps: keytipProps,
      ariaDescribedBy: buttonNativeProperties['aria-describedby'],
      disabled: (0, _index.isItemDisabled)(item)
    }, function (keytipAttributes) {
      return React.createElement("button", tslib_1.__assign({
        ref: _this._btn
      }, buttonNativeProperties, itemButtonProperties, keytipAttributes), React.createElement(ChildrenRenderer, tslib_1.__assign({
        componentRef: item.componentRef,
        item: item,
        classNames: classNames,
        index: index,
        onCheckmarkClick: hasCheckmarks && onItemClick ? onItemClick : undefined,
        hasIcons: hasIcons,
        openSubMenu: openSubMenu,
        dismissSubMenu: dismissSubMenu,
        dismissMenu: dismissMenu,
        getSubmenuTarget: _this._getSubmenuTarget
      }, itemProps)));
    });
  };

  return ContextualMenuButton;
}(_ContextualMenuItemWrapper.ContextualMenuItemWrapper);

exports.ContextualMenuButton = ContextualMenuButton;
},{"tslib":"xgwM","react":"mpTF","../../../Utilities":"B5nc","./ContextualMenuItemWrapper":"PKWX","../../../KeytipData":"ltoP","../../../utilities/contextualMenu/index":"Q6fV","../ContextualMenuItem":"Px7u"}],"K5tx":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = void 0;

var getStyles = function (props) {
  var theme = props.theme,
      getClassNames = props.getClassNames,
      className = props.className;

  if (!theme) {
    throw new Error('Theme is undefined or null.');
  }

  if (getClassNames) {
    var names = getClassNames(theme);
    return {
      wrapper: [names.wrapper],
      divider: [names.divider]
    };
  }

  return {
    wrapper: [{
      display: 'inline-flex',
      height: '100%',
      alignItems: 'center'
    }, className],
    divider: [{
      width: 1,
      height: '100%',
      backgroundColor: theme.palette.neutralTertiaryAlt
    }]
  };
};

exports.getStyles = getStyles;
},{}],"Rlqd":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.VerticalDividerBase = void 0;

var React = _interopRequireWildcard(require("react"));

var _Utilities = require("../../Utilities");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var getClassNames = (0, _Utilities.classNamesFunction)();

var VerticalDividerBase = function (props) {
  var styles = props.styles,
      theme = props.theme,
      deprecatedGetClassNames = props.getClassNames,
      className = props.className;
  var classNames = getClassNames(styles, {
    theme: theme,
    getClassNames: deprecatedGetClassNames,
    className: className
  });
  return React.createElement("span", {
    className: classNames.wrapper
  }, React.createElement("span", {
    className: classNames.divider
  }));
};

exports.VerticalDividerBase = VerticalDividerBase;
},{"react":"mpTF","../../Utilities":"B5nc"}],"kyAk":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.VerticalDivider = void 0;

var _VerticalDivider = require("./VerticalDivider.styles");

var _VerticalDivider2 = require("./VerticalDivider.base");

var _Utilities = require("../../Utilities");

var VerticalDivider = (0, _Utilities.styled)(_VerticalDivider2.VerticalDividerBase, _VerticalDivider.getStyles, undefined, {
  scope: 'VerticalDivider'
});
exports.VerticalDivider = VerticalDivider;
},{"./VerticalDivider.styles":"K5tx","./VerticalDivider.base":"Rlqd","../../Utilities":"B5nc"}],"l1ZX":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _VerticalDivider = require("./VerticalDivider");

Object.keys(_VerticalDivider).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _VerticalDivider[key];
    }
  });
});
},{"./VerticalDivider":"kyAk"}],"guH9":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _index = require("./components/Divider/index");

Object.keys(_index).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index[key];
    }
  });
});
},{"./components/Divider/index":"l1ZX"}],"dUrU":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ContextualMenuSplitButton = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Utilities = require("../../../Utilities");

var _ContextualMenuItem = require("../ContextualMenuItem");

var _ContextualMenu = require("../ContextualMenu.classNames");

var _KeytipData = require("../../../KeytipData");

var _index = require("../../../utilities/contextualMenu/index");

var _Divider = require("../../../Divider");

var _ContextualMenuItemWrapper = require("./ContextualMenuItemWrapper");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var TouchIdleDelay = 500;
/* ms */

var ContextualMenuSplitButton =
/** @class */
function (_super) {
  tslib_1.__extends(ContextualMenuSplitButton, _super);

  function ContextualMenuSplitButton() {
    var _this = _super !== null && _super.apply(this, arguments) || this;

    _this._onItemKeyDown = function (ev) {
      var _a = _this.props,
          item = _a.item,
          onItemKeyDown = _a.onItemKeyDown;

      if (ev.which === _Utilities.KeyCodes.enter) {
        _this._executeItemClick(ev);

        ev.preventDefault();
        ev.stopPropagation();
      } else if (onItemKeyDown) {
        onItemKeyDown(item, ev);
      }
    };

    _this._getSubmenuTarget = function () {
      return _this._splitButton;
    };

    _this._onItemMouseEnterPrimary = function (ev) {
      var _a = _this.props,
          item = _a.item,
          onItemMouseEnter = _a.onItemMouseEnter;

      if (onItemMouseEnter) {
        onItemMouseEnter(tslib_1.__assign({}, item, {
          subMenuProps: undefined,
          items: undefined
        }), ev, _this._splitButton);
      }
    };

    _this._onItemMouseEnterIcon = function (ev) {
      var _a = _this.props,
          item = _a.item,
          onItemMouseEnter = _a.onItemMouseEnter;

      if (onItemMouseEnter) {
        onItemMouseEnter(item, ev, _this._splitButton);
      }
    };

    _this._onItemMouseMovePrimary = function (ev) {
      var _a = _this.props,
          item = _a.item,
          onItemMouseMove = _a.onItemMouseMove;

      if (onItemMouseMove) {
        onItemMouseMove(tslib_1.__assign({}, item, {
          subMenuProps: undefined,
          items: undefined
        }), ev, _this._splitButton);
      }
    };

    _this._onItemMouseMoveIcon = function (ev) {
      var _a = _this.props,
          item = _a.item,
          onItemMouseMove = _a.onItemMouseMove;

      if (onItemMouseMove) {
        onItemMouseMove(item, ev, _this._splitButton);
      }
    };

    _this._onIconItemClick = function (ev) {
      var _a = _this.props,
          item = _a.item,
          onItemClickBase = _a.onItemClickBase;

      if (onItemClickBase) {
        onItemClickBase(item, ev, _this._splitButton ? _this._splitButton : ev.currentTarget);
      }
    };

    _this._executeItemClick = function (ev) {
      var _a = _this.props,
          item = _a.item,
          executeItemClick = _a.executeItemClick,
          onItemClick = _a.onItemClick;

      if (item.disabled || item.isDisabled) {
        return;
      }

      if (_this._processingTouch && onItemClick) {
        return onItemClick(item, ev);
      }

      if (executeItemClick) {
        executeItemClick(item, ev);
      }
    };

    _this._onTouchStart = function (ev) {
      if (_this._splitButton && !('onpointerdown' in _this._splitButton)) {
        _this._handleTouchAndPointerEvent(ev);
      }
    };

    _this._onPointerDown = function (ev) {
      if (ev.pointerType === 'touch') {
        _this._handleTouchAndPointerEvent(ev);

        ev.preventDefault();
        ev.stopImmediatePropagation();
      }
    };

    return _this;
  }

  ContextualMenuSplitButton.prototype.componentDidMount = function () {
    if (this._splitButton && 'onpointerdown' in this._splitButton) {
      this._events.on(this._splitButton, 'pointerdown', this._onPointerDown, true);
    }
  };

  ContextualMenuSplitButton.prototype.render = function () {
    var _this = this;

    var _a = this.props,
        item = _a.item,
        classNames = _a.classNames,
        index = _a.index,
        focusableElementIndex = _a.focusableElementIndex,
        totalItemCount = _a.totalItemCount,
        hasCheckmarks = _a.hasCheckmarks,
        hasIcons = _a.hasIcons,
        onItemMouseLeave = _a.onItemMouseLeave,
        expandedMenuItemKey = _a.expandedMenuItemKey;
    var itemHasSubmenu = (0, _index.hasSubmenu)(item);
    var keytipProps = item.keytipProps;

    if (keytipProps) {
      keytipProps = tslib_1.__assign({}, keytipProps, {
        hasMenu: true
      });
    }

    return React.createElement(_KeytipData.KeytipData, {
      keytipProps: keytipProps,
      disabled: (0, _index.isItemDisabled)(item)
    }, function (keytipAttributes) {
      return React.createElement("div", {
        "data-ktp-target": keytipAttributes['data-ktp-target'],
        ref: function (splitButton) {
          return _this._splitButton = splitButton;
        },
        role: 'menuitem',
        "aria-label": item.ariaLabel,
        className: classNames.splitContainer,
        "aria-disabled": (0, _index.isItemDisabled)(item),
        "aria-expanded": itemHasSubmenu ? item.key === expandedMenuItemKey : undefined,
        "aria-haspopup": true,
        "aria-describedby": (0, _Utilities.mergeAriaAttributeValues)(item.ariaDescription, keytipAttributes['aria-describedby']),
        "aria-checked": item.isChecked || item.checked,
        "aria-posinset": focusableElementIndex + 1,
        "aria-setsize": totalItemCount,
        onMouseEnter: _this._onItemMouseEnterPrimary,
        onMouseLeave: onItemMouseLeave ? onItemMouseLeave.bind(_this, tslib_1.__assign({}, item, {
          subMenuProps: null,
          items: null
        })) : undefined,
        onMouseMove: _this._onItemMouseMovePrimary,
        onKeyDown: _this._onItemKeyDown,
        onClick: _this._executeItemClick,
        onTouchStart: _this._onTouchStart,
        tabIndex: 0,
        "data-is-focusable": true,
        "aria-roledescription": item['aria-roledescription']
      }, _this._renderSplitPrimaryButton(item, classNames, index, hasCheckmarks, hasIcons), _this._renderSplitDivider(item), _this._renderSplitIconButton(item, classNames, index, keytipAttributes));
    });
  };

  ContextualMenuSplitButton.prototype._renderSplitPrimaryButton = function (item, classNames, index, hasCheckmarks, hasIcons) {
    var _a = this.props,
        _b = _a.contextualMenuItemAs,
        ChildrenRenderer = _b === void 0 ? _ContextualMenuItem.ContextualMenuItem : _b,
        onItemClick = _a.onItemClick;
    var itemProps = {
      key: item.key,
      disabled: (0, _index.isItemDisabled)(item) || item.primaryDisabled,
      name: item.name,
      text: item.text || item.name,
      className: classNames.splitPrimary,
      canCheck: item.canCheck,
      isChecked: item.isChecked,
      checked: item.checked,
      iconProps: item.iconProps,
      'data-is-focusable': false,
      'aria-hidden': true
    };
    var itemComponentProps = item.itemProps;
    return React.createElement("button", tslib_1.__assign({}, (0, _Utilities.getNativeProps)(itemProps, _Utilities.buttonProperties)), React.createElement(ChildrenRenderer, tslib_1.__assign({
      "data-is-focusable": false,
      item: itemProps,
      classNames: classNames,
      index: index,
      onCheckmarkClick: hasCheckmarks && onItemClick ? onItemClick : undefined,
      hasIcons: hasIcons
    }, itemComponentProps)));
  };

  ContextualMenuSplitButton.prototype._renderSplitDivider = function (item) {
    var getDividerClassNames = item.getSplitButtonVerticalDividerClassNames || _ContextualMenu.getSplitButtonVerticalDividerClassNames;
    return React.createElement(_Divider.VerticalDivider, {
      getClassNames: getDividerClassNames
    });
  };

  ContextualMenuSplitButton.prototype._renderSplitIconButton = function (item, classNames, index, keytipAttributes) {
    var _a = this.props,
        _b = _a.contextualMenuItemAs,
        ChildrenRenderer = _b === void 0 ? _ContextualMenuItem.ContextualMenuItem : _b,
        onItemMouseLeave = _a.onItemMouseLeave,
        onItemMouseDown = _a.onItemMouseDown,
        openSubMenu = _a.openSubMenu,
        dismissSubMenu = _a.dismissSubMenu,
        dismissMenu = _a.dismissMenu;
    var itemProps = {
      onClick: this._onIconItemClick,
      disabled: (0, _index.isItemDisabled)(item),
      className: classNames.splitMenu,
      subMenuProps: item.subMenuProps,
      submenuIconProps: item.submenuIconProps,
      split: true,
      key: item.key
    };

    var buttonProps = tslib_1.__assign({}, (0, _Utilities.getNativeProps)(itemProps, _Utilities.buttonProperties), {
      onMouseEnter: this._onItemMouseEnterIcon,
      onMouseLeave: onItemMouseLeave ? onItemMouseLeave.bind(this, item) : undefined,
      onMouseDown: function (ev) {
        return onItemMouseDown ? onItemMouseDown(item, ev) : undefined;
      },
      onMouseMove: this._onItemMouseMoveIcon,
      'data-is-focusable': false,
      'data-ktp-execute-target': keytipAttributes['data-ktp-execute-target'],
      'aria-hidden': true
    });

    var itemComponentProps = item.itemProps;
    return React.createElement("button", tslib_1.__assign({}, buttonProps), React.createElement(ChildrenRenderer, tslib_1.__assign({
      componentRef: item.componentRef,
      item: itemProps,
      classNames: classNames,
      index: index,
      hasIcons: false,
      openSubMenu: openSubMenu,
      dismissSubMenu: dismissSubMenu,
      dismissMenu: dismissMenu,
      getSubmenuTarget: this._getSubmenuTarget
    }, itemComponentProps)));
  };

  ContextualMenuSplitButton.prototype._handleTouchAndPointerEvent = function (ev) {
    var _this = this;

    var onTap = this.props.onTap;

    if (onTap) {
      onTap(ev);
    } // If we already have an existing timeout from a previous touch/pointer event
    // cancel that timeout so we can set a new one.


    if (this._lastTouchTimeoutId) {
      this._async.clearTimeout(this._lastTouchTimeoutId);

      this._lastTouchTimeoutId = undefined;
    }

    this._processingTouch = true;
    this._lastTouchTimeoutId = this._async.setTimeout(function () {
      _this._processingTouch = false;
      _this._lastTouchTimeoutId = undefined;
    }, TouchIdleDelay);
  };

  return ContextualMenuSplitButton;
}(_ContextualMenuItemWrapper.ContextualMenuItemWrapper);

exports.ContextualMenuSplitButton = ContextualMenuSplitButton;
},{"tslib":"xgwM","react":"mpTF","../../../Utilities":"B5nc","../ContextualMenuItem":"Px7u","../ContextualMenu.classNames":"rug5","../../../KeytipData":"ltoP","../../../utilities/contextualMenu/index":"Q6fV","../../../Divider":"guH9","./ContextualMenuItemWrapper":"PKWX"}],"gavO":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _ContextualMenuAnchor = require("./ContextualMenuAnchor");

Object.keys(_ContextualMenuAnchor).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _ContextualMenuAnchor[key];
    }
  });
});

var _ContextualMenuButton = require("./ContextualMenuButton");

Object.keys(_ContextualMenuButton).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _ContextualMenuButton[key];
    }
  });
});

var _ContextualMenuSplitButton = require("./ContextualMenuSplitButton");

Object.keys(_ContextualMenuSplitButton).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _ContextualMenuSplitButton[key];
    }
  });
});

var _ContextualMenuItemWrapper = require("./ContextualMenuItemWrapper");

Object.keys(_ContextualMenuItemWrapper).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _ContextualMenuItemWrapper[key];
    }
  });
});
},{"./ContextualMenuAnchor":"JDgG","./ContextualMenuButton":"f7Km","./ContextualMenuSplitButton":"dUrU","./ContextualMenuItemWrapper":"PKWX"}],"ByN5":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getSubmenuItems = getSubmenuItems;
exports.canAnyMenuItemsCheck = canAnyMenuItemsCheck;
exports.ContextualMenuBase = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _ContextualMenu = require("./ContextualMenu.types");

var _DirectionalHint = require("../../common/DirectionalHint");

var _FocusZone = require("../../FocusZone");

var _Utilities = require("../../Utilities");

var _index = require("../../utilities/contextualMenu/index");

var _withResponsiveMode = require("../../utilities/decorators/withResponsiveMode");

var _Callout = require("../../Callout");

var _ContextualMenuItem = require("./ContextualMenuItem");

var _index2 = require("./ContextualMenuItemWrapper/index");

var _Styling = require("../../Styling");

var _ContextualMenu2 = require("./ContextualMenu.classNames");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var getClassNames = (0, _Utilities.classNamesFunction)({
  disableCaching: true
});
var getContextualMenuItemClassNames = (0, _Utilities.classNamesFunction)({
  disableCaching: true
});

function getSubmenuItems(item) {
  return item.subMenuProps ? item.subMenuProps.items : item.items;
}
/**
 * Returns true if a list of menu items can contain a checkbox
 */


function canAnyMenuItemsCheck(items) {
  return items.some(function (item) {
    if (item.canCheck) {
      return true;
    } // If the item is a section, check if any of the items in the section can check.


    if (item.sectionProps && item.sectionProps.items.some(function (submenuItem) {
      return submenuItem.canCheck === true;
    })) {
      return true;
    }

    return false;
  });
}

var NavigationIdleDelay = 250
/* ms */
;

var ContextualMenuBase =
/** @class */
function (_super) {
  tslib_1.__extends(ContextualMenuBase, _super);

  function ContextualMenuBase(props) {
    var _this = _super.call(this, props) || this;

    _this._mounted = false;

    _this.dismiss = function (ev, dismissAll) {
      var onDismiss = _this.props.onDismiss;

      if (onDismiss) {
        onDismiss(ev, dismissAll);
      }
    };

    _this._onRenderMenuList = function (menuListProps, defaultRender) {
      var indexCorrection = 0;
      return React.createElement("ul", {
        className: _this._classNames.list,
        onKeyDown: _this._onKeyDown,
        onKeyUp: _this._onKeyUp,
        role: "menu"
      }, menuListProps.items.map(function (item, index) {
        var menuItem = _this._renderMenuItem(item, index, indexCorrection, menuListProps.totalItemCount, menuListProps.hasCheckmarks, menuListProps.hasIcons);

        if (item.itemType !== _ContextualMenu.ContextualMenuItemType.Divider && item.itemType !== _ContextualMenu.ContextualMenuItemType.Header) {
          var indexIncrease = item.customOnRenderListLength ? item.customOnRenderListLength : 1;
          indexCorrection += indexIncrease;
        }

        return menuItem;
      }));
    };

    _this._onKeyDown = function (ev) {
      // Take note if we are processing an alt (option) or meta (command) keydown.
      // See comment in _shouldHandleKeyUp for reasoning.
      _this._lastKeyDownWasAltOrMeta = _this._isAltOrMeta(ev); // On Mac, pressing escape dismisses all levels of native context menus

      var dismissAllMenus = ev.which === _Utilities.KeyCodes.escape && ((0, _Utilities.isMac)() || (0, _Utilities.isIOS)());
      return _this._keyHandler(ev, _this._shouldHandleKeyDown, dismissAllMenus);
    };

    _this._shouldHandleKeyDown = function (ev) {
      return ev.which === _Utilities.KeyCodes.escape || _this._shouldCloseSubMenu(ev) || ev.which === _Utilities.KeyCodes.up && (ev.altKey || ev.metaKey);
    };

    _this._onMenuFocusCapture = function (ev) {
      if (_this.props.delayUpdateFocusOnHover) {
        _this._shouldUpdateFocusOnMouseEvent = true;
      }
    };

    _this._onKeyUp = function (ev) {
      return _this._keyHandler(ev, _this._shouldHandleKeyUp, true
      /* dismissAllMenus */
      );
    };
    /**
     * We close the menu on key up only if ALL of the following are true:
     * - Most recent key down was alt or meta (command)
     * - The alt/meta key down was NOT followed by some other key (such as down/up arrow to
     *   expand/collapse the menu)
     * - We're not on a Mac (or iOS)
     *
     * This is because on Windows, pressing alt moves focus to the application menu bar or similar,
     * closing any open context menus. There is not a similar behavior on Macs.
     */


    _this._shouldHandleKeyUp = function (ev) {
      var keyPressIsAltOrMetaAlone = _this._lastKeyDownWasAltOrMeta && _this._isAltOrMeta(ev);

      _this._lastKeyDownWasAltOrMeta = false;
      return !!keyPressIsAltOrMetaAlone && !((0, _Utilities.isIOS)() || (0, _Utilities.isMac)());
    };
    /**
     * Calls `shouldHandleKey` to determine whether the keyboard event should be handled;
     * if so, stops event propagation and dismisses menu(s).
     * @param ev - The keyboard event.
     * @param shouldHandleKey - Returns whether we should handle this keyboard event.
     * @param dismissAllMenus - If true, dismiss all menus. Otherwise, dismiss only the current menu.
     * Only does anything if `shouldHandleKey` returns true.
     * @returns Whether the event was handled.
     */


    _this._keyHandler = function (ev, shouldHandleKey, dismissAllMenus) {
      var handled = false;

      if (shouldHandleKey(ev)) {
        _this._isFocusingPreviousElement = true;
        ev.preventDefault();
        ev.stopPropagation();

        _this.dismiss(ev, dismissAllMenus);

        handled = true;
      }

      return handled;
    };
    /**
     * Checks if the submenu should be closed
     */


    _this._shouldCloseSubMenu = function (ev) {
      var submenuCloseKey = (0, _Utilities.getRTL)() ? _Utilities.KeyCodes.right : _Utilities.KeyCodes.left;

      if (ev.which !== submenuCloseKey || !_this.props.isSubMenu) {
        return false;
      }

      return _this._adjustedFocusZoneProps.direction === _FocusZone.FocusZoneDirection.vertical || !!_this._adjustedFocusZoneProps.checkForNoWrap && !(0, _Utilities.shouldWrapFocus)(ev.target, 'data-no-horizontal-wrap');
    };

    _this._onMenuKeyDown = function (ev) {
      // Mark as handled if onKeyDown returns true (for handling collapse cases)
      // or if we are attempting to expand a submenu
      var handled = _this._onKeyDown(ev);

      if (handled || !_this._host) {
        return;
      } // If we have a modifier key being pressed, we do not want to move focus.
      // Otherwise, handle up and down keys.


      var hasModifier = !!(ev.altKey || ev.metaKey);
      var isUp = ev.which === _Utilities.KeyCodes.up;
      var isDown = ev.which === _Utilities.KeyCodes.down;

      if (!hasModifier && (isUp || isDown)) {
        var elementToFocus = isUp ? (0, _Utilities.getLastFocusable)(_this._host, _this._host.lastChild, true) : (0, _Utilities.getFirstFocusable)(_this._host, _this._host.firstChild, true);

        if (elementToFocus) {
          elementToFocus.focus();
          ev.preventDefault();
          ev.stopPropagation();
        }
      }
    };
    /**
     * Scroll handler for the callout to make sure the mouse events
     * for updating focus are not interacting during scroll
     */


    _this._onScroll = function () {
      if (!_this._isScrollIdle && _this._scrollIdleTimeoutId !== undefined) {
        _this._async.clearTimeout(_this._scrollIdleTimeoutId);

        _this._scrollIdleTimeoutId = undefined;
      } else {
        _this._isScrollIdle = false;
      }

      _this._scrollIdleTimeoutId = _this._async.setTimeout(function () {
        _this._isScrollIdle = true;
      }, NavigationIdleDelay);
    };

    _this._onItemMouseEnterBase = function (item, ev, target) {
      if (_this._shouldIgnoreMouseEvent()) {
        return;
      }

      _this._updateFocusOnMouseEvent(item, ev, target);
    };

    _this._onItemMouseMoveBase = function (item, ev, target) {
      var targetElement = ev.currentTarget; // Always do this check to make sure we record a mouseMove if needed (even if we are timed out)

      if (_this._shouldUpdateFocusOnMouseEvent) {
        _this._gotMouseMove = true;
      } else {
        return;
      }

      if (!_this._isScrollIdle || _this._enterTimerId !== undefined || targetElement === _this._targetWindow.document.activeElement) {
        return;
      }

      _this._updateFocusOnMouseEvent(item, ev, target);
    };

    _this._onMouseItemLeave = function (item, ev) {
      if (_this._shouldIgnoreMouseEvent()) {
        return;
      }

      if (_this._enterTimerId !== undefined) {
        _this._async.clearTimeout(_this._enterTimerId);

        _this._enterTimerId = undefined;
      }

      if (_this.state.expandedMenuItemKey !== undefined) {
        return;
      }
      /**
       * IE11 focus() method forces parents to scroll to top of element.
       * Edge and IE expose a setActive() function for focusable divs that
       * sets the page focus but does not scroll the parent element.
       */


      if (_this._host.setActive) {
        try {
          _this._host.setActive();
        } catch (e) {
          /* no-op */
        }
      } else {
        _this._host.focus();
      }
    };

    _this._onItemMouseDown = function (item, ev) {
      if (item.onMouseDown) {
        item.onMouseDown(item, ev);
      }
    };

    _this._onItemClick = function (item, ev) {
      _this._onItemClickBase(item, ev, ev.currentTarget);
    };

    _this._onItemClickBase = function (item, ev, target) {
      var items = getSubmenuItems(item); // Cancel a async menu item hover timeout action from being taken and instead
      // just trigger the click event instead.

      _this._cancelSubMenuTimer();

      if (!(0, _index.hasSubmenu)(item) && (!items || !items.length)) {
        // This is an item without a menu. Click it.
        _this._executeItemClick(item, ev);
      } else {
        if (item.key !== _this.state.expandedMenuItemKey) {
          // This has a collapsed sub menu. Expand it.
          _this.setState({
            // When Edge + Narrator are used together (regardless of if the button is in a form or not), pressing
            // "Enter" fires this method and not _onMenuKeyDown. Checking ev.nativeEvent.detail differentiates
            // between a real click event and a keypress event (detail should be the number of mouse clicks).
            // ...Plot twist! For a real click event in IE 11, detail is always 0 (Edge sets it properly to 1).
            // So we also check the pointerType property, which both Edge and IE set to "mouse" for real clicks
            // and "" for pressing "Enter" with Narrator on.
            expandedByMouseClick: ev.nativeEvent.detail !== 0 || ev.nativeEvent.pointerType === 'mouse'
          });

          _this._onItemSubMenuExpand(item, target);
        }
      }

      ev.stopPropagation();
      ev.preventDefault();
    };

    _this._onAnchorClick = function (item, ev) {
      _this._executeItemClick(item, ev);

      ev.stopPropagation();
    };

    _this._executeItemClick = function (item, ev) {
      if (item.disabled || item.isDisabled) {
        return;
      }

      var dismiss = false;

      if (item.onClick) {
        dismiss = !!item.onClick(ev, item);
      } else if (_this.props.onItemClick) {
        dismiss = !!_this.props.onItemClick(ev, item);
      }

      (dismiss || !ev.defaultPrevented) && _this.dismiss(ev, true);
    };

    _this._onItemKeyDown = function (item, ev) {
      var openKey = (0, _Utilities.getRTL)() ? _Utilities.KeyCodes.left : _Utilities.KeyCodes.right;

      if (!item.disabled && (ev.which === openKey || ev.which === _Utilities.KeyCodes.enter || ev.which === _Utilities.KeyCodes.down && (ev.altKey || ev.metaKey))) {
        _this.setState({
          expandedByMouseClick: false
        });

        _this._onItemSubMenuExpand(item, ev.currentTarget);

        ev.preventDefault();
      }
    }; // Cancel a async menu item hover timeout action from being taken and instead
    // do new upcoming behavior


    _this._cancelSubMenuTimer = function () {
      if (_this._enterTimerId !== undefined) {
        _this._async.clearTimeout(_this._enterTimerId);

        _this._enterTimerId = undefined;
      }
    };

    _this._onItemSubMenuExpand = function (item, target) {
      if (_this.state.expandedMenuItemKey !== item.key) {
        if (_this.state.expandedMenuItemKey) {
          _this._onSubMenuDismiss();
        } // Focus the target to ensure when we close it, we're focusing on the correct element.


        target.focus();

        _this.setState({
          expandedMenuItemKey: item.key,
          submenuTarget: target
        });
      }
    };
    /**
     * This function is called ASYNCHRONOUSLY, and so there is a chance it is called
     * after the component is unmounted. The _mounted property is added to prevent
     * from calling setState() after unmount. Do NOT copy this pattern in synchronous
     * code.
     */


    _this._onSubMenuDismiss = function (ev, dismissAll) {
      if (dismissAll) {
        _this.dismiss(ev, dismissAll);
      } else if (_this._mounted) {
        _this.setState({
          dismissedMenuItemKey: _this.state.expandedMenuItemKey,
          expandedMenuItemKey: undefined,
          submenuTarget: undefined
        });
      }
    };

    _this._getSubMenuId = function (item) {
      var subMenuId = _this.state.subMenuId;

      if (item.subMenuProps && item.subMenuProps.id) {
        subMenuId = item.subMenuProps.id;
      }

      return subMenuId;
    };

    _this._onPointerAndTouchEvent = function (ev) {
      _this._cancelSubMenuTimer();
    };

    _this.state = {
      contextualMenuItems: undefined,
      subMenuId: (0, _Utilities.getId)('ContextualMenu')
    };

    _this._warnDeprecations({
      getMenuClassNames: 'styles'
    });

    _this._isFocusingPreviousElement = false;
    _this._isScrollIdle = true;
    _this._shouldUpdateFocusOnMouseEvent = !_this.props.delayUpdateFocusOnHover;
    _this._gotMouseMove = false;
    return _this;
  }

  ContextualMenuBase.prototype.shouldComponentUpdate = function (newProps, newState) {
    if (this.props.hidden && newProps.hidden) {
      // Do not update when hidden.
      return false;
    }

    return !(0, _Utilities.shallowCompare)(this.props, newProps) || !(0, _Utilities.shallowCompare)(this.state, newState);
  };

  ContextualMenuBase.prototype.componentWillUpdate = function (newProps) {
    if (newProps.target !== this.props.target) {
      var newTarget = newProps.target;

      this._setTargetWindowAndElement(newTarget);
    }

    if (newProps.hidden !== this.props.hidden) {
      if (newProps.hidden) {
        this._onMenuClosed();
      } else {
        this._onMenuOpened();

        this._previousActiveElement = this._targetWindow ? this._targetWindow.document.activeElement : null;
      }
    }

    if (newProps.delayUpdateFocusOnHover !== this.props.delayUpdateFocusOnHover) {
      // update shouldUpdateFocusOnMouseEvent to follow what was passed in
      this._shouldUpdateFocusOnMouseEvent = !newProps.delayUpdateFocusOnHover; // If shouldUpdateFocusOnMouseEvent is false, we need to reset gotMouseMove to false

      this._gotMouseMove = this._shouldUpdateFocusOnMouseEvent && this._gotMouseMove;
    }
  }; // Invoked once, both on the client and server, immediately before the initial rendering occurs.


  ContextualMenuBase.prototype.componentWillMount = function () {
    var target = this.props.target;

    this._setTargetWindowAndElement(target);

    if (!this.props.hidden) {
      this._previousActiveElement = this._targetWindow ? this._targetWindow.document.activeElement : null;
    }
  }; // Invoked once, only on the client (not on the server), immediately after the initial rendering occurs.


  ContextualMenuBase.prototype.componentDidMount = function () {
    if (!this.props.hidden) {
      this._onMenuOpened();
    }

    this._mounted = true;
  }; // Invoked immediately before a component is unmounted from the DOM.


  ContextualMenuBase.prototype.componentWillUnmount = function () {
    this._tryFocusPreviousActiveElement();

    if (this.props.onMenuDismissed) {
      this.props.onMenuDismissed(this.props);
    }

    this._events.dispose();

    this._async.dispose();

    this._mounted = false;
  };

  ContextualMenuBase.prototype.render = function () {
    var _this = this;

    var isBeakVisible = this.props.isBeakVisible;
    var _a = this.props,
        items = _a.items,
        labelElementId = _a.labelElementId,
        id = _a.id,
        className = _a.className,
        beakWidth = _a.beakWidth,
        directionalHint = _a.directionalHint,
        directionalHintForRTL = _a.directionalHintForRTL,
        alignTargetEdge = _a.alignTargetEdge,
        gapSpace = _a.gapSpace,
        coverTarget = _a.coverTarget,
        ariaLabel = _a.ariaLabel,
        doNotLayer = _a.doNotLayer,
        target = _a.target,
        bounds = _a.bounds,
        useTargetWidth = _a.useTargetWidth,
        useTargetAsMinWidth = _a.useTargetAsMinWidth,
        directionalHintFixed = _a.directionalHintFixed,
        shouldFocusOnMount = _a.shouldFocusOnMount,
        shouldFocusOnContainer = _a.shouldFocusOnContainer,
        title = _a.title,
        styles = _a.styles,
        theme = _a.theme,
        calloutProps = _a.calloutProps,
        _b = _a.onRenderSubMenu,
        onRenderSubMenu = _b === void 0 ? this._onRenderSubMenu : _b,
        _c = _a.onRenderMenuList,
        onRenderMenuList = _c === void 0 ? this._onRenderMenuList : _c,
        focusZoneProps = _a.focusZoneProps,
        getMenuClassNames = _a.getMenuClassNames;
    this._classNames = getMenuClassNames ? getMenuClassNames(theme, className) : getClassNames(styles, {
      theme: theme,
      className: className
    });
    var hasIcons = itemsHaveIcons(items);

    function itemsHaveIcons(contextualMenuItems) {
      for (var _i = 0, contextualMenuItems_1 = contextualMenuItems; _i < contextualMenuItems_1.length; _i++) {
        var item = contextualMenuItems_1[_i];

        if (!!item.iconProps) {
          return true;
        }

        if (item.itemType === _ContextualMenu.ContextualMenuItemType.Section && item.sectionProps && itemsHaveIcons(item.sectionProps.items)) {
          return true;
        }
      }

      return false;
    }

    this._adjustedFocusZoneProps = tslib_1.__assign({}, focusZoneProps, {
      direction: this._getFocusZoneDirection()
    });
    var hasCheckmarks = canAnyMenuItemsCheck(items);
    var submenuProps = this.state.expandedMenuItemKey && this.props.hidden !== true ? this._getSubmenuProps() : null;
    isBeakVisible = isBeakVisible === undefined ? this.props.responsiveMode <= _withResponsiveMode.ResponsiveMode.medium : isBeakVisible;
    /**
     * When useTargetWidth is true, get the width of the target element and apply it for the context menu container
     */

    var contextMenuStyle;
    var targetAsHtmlElement = this._target;

    if ((useTargetWidth || useTargetAsMinWidth) && targetAsHtmlElement && targetAsHtmlElement.offsetWidth) {
      var targetBoundingRect = targetAsHtmlElement.getBoundingClientRect();
      var targetWidth = targetBoundingRect.width - 2
      /* Accounts for 1px border */
      ;

      if (useTargetWidth) {
        contextMenuStyle = {
          width: targetWidth
        };
      } else if (useTargetAsMinWidth) {
        contextMenuStyle = {
          minWidth: targetWidth
        };
      }
    } // The menu should only return if items were provided, if no items were provided then it should not appear.


    if (items && items.length > 0) {
      var totalItemCount = 0;

      for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
        var item = items_1[_i];

        if (item.itemType !== _ContextualMenu.ContextualMenuItemType.Divider && item.itemType !== _ContextualMenu.ContextualMenuItemType.Header) {
          var itemCount = item.customOnRenderListLength ? item.customOnRenderListLength : 1;
          totalItemCount += itemCount;
        }
      }

      var calloutStyles = !getMenuClassNames && this._classNames.subComponentStyles ? this._classNames.subComponentStyles.callout : undefined;
      return React.createElement(_Callout.Callout, tslib_1.__assign({
        styles: calloutStyles
      }, calloutProps, {
        target: target,
        isBeakVisible: isBeakVisible,
        beakWidth: beakWidth,
        directionalHint: directionalHint,
        directionalHintForRTL: directionalHintForRTL,
        gapSpace: gapSpace,
        coverTarget: coverTarget,
        doNotLayer: doNotLayer,
        className: (0, _Utilities.css)('ms-ContextualMenu-Callout', calloutProps && calloutProps.className),
        setInitialFocus: shouldFocusOnMount,
        onDismiss: this.props.onDismiss,
        onScroll: this._onScroll,
        bounds: bounds,
        directionalHintFixed: directionalHintFixed,
        alignTargetEdge: alignTargetEdge,
        hidden: this.props.hidden
      }), React.createElement("div", {
        "aria-label": ariaLabel,
        "aria-labelledby": labelElementId,
        style: contextMenuStyle,
        ref: function (host) {
          return _this._host = host;
        },
        id: id,
        className: this._classNames.container,
        tabIndex: shouldFocusOnContainer ? 0 : -1,
        onKeyDown: this._onMenuKeyDown,
        onKeyUp: this._onKeyUp,
        onFocusCapture: this._onMenuFocusCapture
      }, title && React.createElement("div", {
        className: this._classNames.title
      }, " ", title, " "), items && items.length ? React.createElement(_FocusZone.FocusZone, tslib_1.__assign({}, this._adjustedFocusZoneProps, {
        className: this._classNames.root,
        isCircularNavigation: true,
        handleTabKey: _FocusZone.FocusZoneTabbableElements.all
      }), onRenderMenuList({
        items: items,
        totalItemCount: totalItemCount,
        hasCheckmarks: hasCheckmarks,
        hasIcons: hasIcons
      }, this._onRenderMenuList)) : null, submenuProps && onRenderSubMenu(submenuProps, this._onRenderSubMenu)));
    } else {
      return null;
    }
  };

  ContextualMenuBase.prototype._onMenuOpened = function () {
    this._events.on(this._targetWindow, 'resize', this.dismiss);

    this._shouldUpdateFocusOnMouseEvent = !this.props.delayUpdateFocusOnHover;
    this._gotMouseMove = false;
    this.props.onMenuOpened && this.props.onMenuOpened(this.props);
  };

  ContextualMenuBase.prototype._onMenuClosed = function () {
    this._events.off(this._targetWindow, 'resize', this.dismiss);

    this._tryFocusPreviousActiveElement();

    if (this.props.onMenuDismissed) {
      this.props.onMenuDismissed(this.props);
    }

    this._shouldUpdateFocusOnMouseEvent = !this.props.delayUpdateFocusOnHover; // We need to dismiss any submenu related state properties,
    // so that when the menu is shown again, the submenu is collapsed

    this.setState({
      expandedByMouseClick: undefined,
      dismissedMenuItemKey: undefined,
      expandedMenuItemKey: undefined,
      submenuTarget: undefined
    });
  };

  ContextualMenuBase.prototype._tryFocusPreviousActiveElement = function () {
    var _this = this;

    if (this._isFocusingPreviousElement && this._previousActiveElement) {
      // This slight delay is required so that we can unwind the stack, const react try to mess with focus, and then
      // apply the correct focus. Without the setTimeout, we end up focusing the correct thing, and then React wants
      // to reset the focus back to the thing it thinks should have been focused.
      // Note: Cannot be replaced by this._async.setTimout because those will be removed by the time this is called.
      setTimeout(function () {
        _this._previousActiveElement && _this._previousActiveElement.focus();
      }, 0);
    }
  };
  /**
   * Gets the focusZoneDirection by using the arrowDirection if specified,
   * the direction specificed in the focusZoneProps, or defaults to FocusZoneDirection.vertical
   */


  ContextualMenuBase.prototype._getFocusZoneDirection = function () {
    var focusZoneProps = this.props.focusZoneProps;
    return focusZoneProps && focusZoneProps.direction !== undefined ? focusZoneProps.direction : _FocusZone.FocusZoneDirection.vertical;
  };

  ContextualMenuBase.prototype._onRenderSubMenu = function (subMenuProps, defaultRender) {
    throw Error('ContextualMenuBase: onRenderSubMenu callback is null or undefined. ' + 'Please ensure to set `onRenderSubMenu` property either manually or with `styled` helper.');
  };

  ContextualMenuBase.prototype._renderMenuItem = function (item, index, focusableElementIndex, totalItemCount, hasCheckmarks, hasIcons) {
    var renderedItems = [];
    var iconProps = item.iconProps || {
      iconName: 'None'
    };
    var getItemClassNames = item.getItemClassNames,
        itemProps = item.itemProps;
    var styles = itemProps ? itemProps.styles : undefined; // We only send a dividerClassName when the item to be rendered is a divider. For all other cases, the default divider style is used.

    var dividerClassName = item.itemType === _ContextualMenu.ContextualMenuItemType.Divider ? item.className : undefined;
    var subMenuIconClassName = item.submenuIconProps ? item.submenuIconProps.className : '';
    var itemClassNames; // IContextualMenuItem#getItemClassNames for backwards compatibility
    // otherwise uses mergeStyles for class names.

    if (getItemClassNames) {
      itemClassNames = getItemClassNames(this.props.theme, (0, _index.isItemDisabled)(item), this.state.expandedMenuItemKey === item.key, !!(0, _index.getIsChecked)(item), !!item.href, iconProps.iconName !== 'None', item.className, dividerClassName, iconProps.className, subMenuIconClassName, item.primaryDisabled);
    } else {
      var itemStyleProps = {
        theme: this.props.theme,
        disabled: (0, _index.isItemDisabled)(item),
        expanded: this.state.expandedMenuItemKey === item.key,
        checked: !!(0, _index.getIsChecked)(item),
        isAnchorLink: !!item.href,
        knownIcon: iconProps.iconName !== 'None',
        itemClassName: item.className,
        dividerClassName: dividerClassName,
        iconClassName: iconProps.className,
        subMenuClassName: subMenuIconClassName,
        primaryDisabled: item.primaryDisabled
      };
      var menuItemStyles = this._classNames.subComponentStyles ? this._classNames.subComponentStyles.menuItem : undefined; // We need to generate default styles then override if styles are provided
      // since the ContextualMenu currently handles item classNames.

      itemClassNames = (0, _Styling.mergeStyleSets)(getContextualMenuItemClassNames(_ContextualMenu2.getItemStyles, itemStyleProps), getContextualMenuItemClassNames(menuItemStyles, itemStyleProps), getContextualMenuItemClassNames(styles, itemStyleProps));
    }

    if (item.text === '-' || item.name === '-') {
      item.itemType = _ContextualMenu.ContextualMenuItemType.Divider;
    }

    switch (item.itemType) {
      case _ContextualMenu.ContextualMenuItemType.Divider:
        renderedItems.push(this._renderSeparator(index, itemClassNames));
        break;

      case _ContextualMenu.ContextualMenuItemType.Header:
        renderedItems.push(this._renderSeparator(index, itemClassNames));

        var headerItem = this._renderHeaderMenuItem(item, itemClassNames, index, hasCheckmarks, hasIcons);

        renderedItems.push(this._renderListItem(headerItem, item.key || index, itemClassNames, item.title));
        break;

      case _ContextualMenu.ContextualMenuItemType.Section:
        renderedItems.push(this._renderSectionItem(item, itemClassNames, index, hasCheckmarks, hasIcons));
        break;

      default:
        var menuItem = this._renderNormalItem(item, itemClassNames, index, focusableElementIndex, totalItemCount, hasCheckmarks, hasIcons);

        renderedItems.push(this._renderListItem(menuItem, item.key || index, itemClassNames, item.title));
        break;
    }

    return renderedItems;
  };

  ContextualMenuBase.prototype._renderSectionItem = function (sectionItem, menuClassNames, index, hasCheckmarks, hasIcons) {
    var _this = this;

    var sectionProps = sectionItem.sectionProps;

    if (!sectionProps) {
      return;
    }

    var headerItem;

    if (sectionProps.title) {
      var headerContextualMenuItem = {
        key: "section-" + sectionProps.title + "-title",
        itemType: _ContextualMenu.ContextualMenuItemType.Header,
        text: sectionProps.title
      };
      headerItem = this._renderHeaderMenuItem(headerContextualMenuItem, menuClassNames, index, hasCheckmarks, hasIcons);
    }

    if (sectionProps.items && sectionProps.items.length > 0) {
      return React.createElement("li", {
        role: "presentation",
        key: sectionProps.key || sectionItem.key || "section-" + index
      }, React.createElement("div", {
        role: "group"
      }, React.createElement("ul", {
        className: this._classNames.list
      }, sectionProps.topDivider && this._renderSeparator(index, menuClassNames, true, true), headerItem && this._renderListItem(headerItem, sectionItem.key || index, menuClassNames, sectionItem.title), sectionProps.items.map(function (contextualMenuItem, itemsIndex) {
        return _this._renderMenuItem(contextualMenuItem, itemsIndex, itemsIndex, sectionProps.items.length, hasCheckmarks, hasIcons);
      }), sectionProps.bottomDivider && this._renderSeparator(index, menuClassNames, false, true))));
    }
  };

  ContextualMenuBase.prototype._renderListItem = function (content, key, classNames, title) {
    return React.createElement("li", {
      role: "presentation",
      title: title,
      key: key,
      className: classNames.item
    }, content);
  };

  ContextualMenuBase.prototype._renderSeparator = function (index, classNames, top, fromSection) {
    if (fromSection || index > 0) {
      return React.createElement("li", {
        role: "separator",
        key: 'separator-' + index + (top === undefined ? '' : top ? '-top' : '-bottom'),
        className: classNames.divider,
        "aria-hidden": "true"
      });
    }

    return null;
  };

  ContextualMenuBase.prototype._renderNormalItem = function (item, classNames, index, focusableElementIndex, totalItemCount, hasCheckmarks, hasIcons) {
    if (item.onRender) {
      return item.onRender(tslib_1.__assign({
        'aria-posinset': focusableElementIndex + 1,
        'aria-setsize': totalItemCount
      }, item), this.dismiss);
    }

    if (item.href) {
      return this._renderAnchorMenuItem(item, classNames, index, focusableElementIndex, totalItemCount, hasCheckmarks, hasIcons);
    }

    if (item.split && (0, _index.hasSubmenu)(item)) {
      return this._renderSplitButton(item, classNames, index, focusableElementIndex, totalItemCount, hasCheckmarks, hasIcons);
    }

    return this._renderButtonItem(item, classNames, index, focusableElementIndex, totalItemCount, hasCheckmarks, hasIcons);
  };

  ContextualMenuBase.prototype._renderHeaderMenuItem = function (item, classNames, index, hasCheckmarks, hasIcons) {
    var _a = this.props.contextualMenuItemAs,
        ChildrenRenderer = _a === void 0 ? _ContextualMenuItem.ContextualMenuItem : _a;
    var itemProps = item.itemProps;
    var divHtmlProperties = itemProps && (0, _Utilities.getNativeProps)(itemProps, _Utilities.divProperties);
    return React.createElement("div", tslib_1.__assign({
      className: this._classNames.header
    }, divHtmlProperties, {
      style: item.style
    }), React.createElement(ChildrenRenderer, tslib_1.__assign({
      item: item,
      classNames: classNames,
      index: index,
      onCheckmarkClick: hasCheckmarks ? this._onItemClick : undefined,
      hasIcons: hasIcons
    }, itemProps)));
  };

  ContextualMenuBase.prototype._renderAnchorMenuItem = function (item, classNames, index, focusableElementIndex, totalItemCount, hasCheckmarks, hasIcons) {
    var contextualMenuItemAs = this.props.contextualMenuItemAs;
    var expandedMenuItemKey = this.state.expandedMenuItemKey;
    return React.createElement(_index2.ContextualMenuAnchor, {
      item: item,
      classNames: classNames,
      index: index,
      focusableElementIndex: focusableElementIndex,
      totalItemCount: totalItemCount,
      hasCheckmarks: hasCheckmarks,
      hasIcons: hasIcons,
      contextualMenuItemAs: contextualMenuItemAs,
      onItemMouseEnter: this._onItemMouseEnterBase,
      onItemMouseLeave: this._onMouseItemLeave,
      onItemMouseMove: this._onItemMouseMoveBase,
      onItemMouseDown: this._onItemMouseDown,
      executeItemClick: this._executeItemClick,
      onItemClick: this._onAnchorClick,
      onItemKeyDown: this._onItemKeyDown,
      getSubMenuId: this._getSubMenuId,
      expandedMenuItemKey: expandedMenuItemKey,
      openSubMenu: this._onItemSubMenuExpand,
      dismissSubMenu: this._onSubMenuDismiss,
      dismissMenu: this.dismiss
    });
  };

  ContextualMenuBase.prototype._renderButtonItem = function (item, classNames, index, focusableElementIndex, totalItemCount, hasCheckmarks, hasIcons) {
    var contextualMenuItemAs = this.props.contextualMenuItemAs;
    var expandedMenuItemKey = this.state.expandedMenuItemKey;
    return React.createElement(_index2.ContextualMenuButton, {
      item: item,
      classNames: classNames,
      index: index,
      focusableElementIndex: focusableElementIndex,
      totalItemCount: totalItemCount,
      hasCheckmarks: hasCheckmarks,
      hasIcons: hasIcons,
      contextualMenuItemAs: contextualMenuItemAs,
      onItemMouseEnter: this._onItemMouseEnterBase,
      onItemMouseLeave: this._onMouseItemLeave,
      onItemMouseMove: this._onItemMouseMoveBase,
      onItemMouseDown: this._onItemMouseDown,
      executeItemClick: this._executeItemClick,
      onItemClick: this._onItemClick,
      onItemClickBase: this._onItemClickBase,
      onItemKeyDown: this._onItemKeyDown,
      getSubMenuId: this._getSubMenuId,
      expandedMenuItemKey: expandedMenuItemKey,
      openSubMenu: this._onItemSubMenuExpand,
      dismissSubMenu: this._onSubMenuDismiss,
      dismissMenu: this.dismiss
    });
  };

  ContextualMenuBase.prototype._renderSplitButton = function (item, classNames, index, focusableElementIndex, totalItemCount, hasCheckmarks, hasIcons) {
    var contextualMenuItemAs = this.props.contextualMenuItemAs;
    var expandedMenuItemKey = this.state.expandedMenuItemKey;
    return React.createElement(_index2.ContextualMenuSplitButton, {
      item: item,
      classNames: classNames,
      index: index,
      focusableElementIndex: focusableElementIndex,
      totalItemCount: totalItemCount,
      hasCheckmarks: hasCheckmarks,
      hasIcons: hasIcons,
      contextualMenuItemAs: contextualMenuItemAs,
      onItemMouseEnter: this._onItemMouseEnterBase,
      onItemMouseLeave: this._onMouseItemLeave,
      onItemMouseMove: this._onItemMouseMoveBase,
      onItemMouseDown: this._onItemMouseDown,
      executeItemClick: this._executeItemClick,
      onItemClick: this._onItemClick,
      onItemClickBase: this._onItemClickBase,
      onItemKeyDown: this._onItemKeyDown,
      openSubMenu: this._onItemSubMenuExpand,
      dismissSubMenu: this._onSubMenuDismiss,
      dismissMenu: this.dismiss,
      expandedMenuItemKey: expandedMenuItemKey,
      onTap: this._onPointerAndTouchEvent
    });
  };
  /**
   * Returns true if the key for the event is alt (Mac option) or meta (Mac command).
   */


  ContextualMenuBase.prototype._isAltOrMeta = function (ev) {
    return ev.which === _Utilities.KeyCodes.alt || ev.key === 'Meta';
  };

  ContextualMenuBase.prototype._shouldIgnoreMouseEvent = function () {
    return !this._isScrollIdle || !this._gotMouseMove;
  };
  /**
   * Handles updating focus when mouseEnter or mouseMove fire.
   * As part of updating focus, This function will also update
   * the expand/collapse state accordingly.
   */


  ContextualMenuBase.prototype._updateFocusOnMouseEvent = function (item, ev, target) {
    var _this = this;

    var targetElement = target ? target : ev.currentTarget;
    var _a = this.props.subMenuHoverDelay,
        timeoutDuration = _a === void 0 ? NavigationIdleDelay : _a;

    if (item.key === this.state.expandedMenuItemKey) {
      return;
    }

    if (this._enterTimerId !== undefined) {
      this._async.clearTimeout(this._enterTimerId);

      this._enterTimerId = undefined;
    } // If the menu is not expanded we can update focus without any delay


    if (this.state.expandedMenuItemKey === undefined) {
      targetElement.focus();
    } // Delay updating expanding/dismissing the submenu
    // and only set focus if we have not already done so


    if ((0, _index.hasSubmenu)(item)) {
      ev.stopPropagation();
      this._enterTimerId = this._async.setTimeout(function () {
        targetElement.focus();

        _this.setState({
          expandedByMouseClick: true
        });

        _this._onItemSubMenuExpand(item, targetElement);

        _this._enterTimerId = undefined;
      }, timeoutDuration);
    } else {
      this._enterTimerId = this._async.setTimeout(function () {
        _this._onSubMenuDismiss(ev);

        targetElement.focus();
        _this._enterTimerId = undefined;
      }, timeoutDuration);
    }
  };

  ContextualMenuBase.prototype._getSubmenuProps = function () {
    var _a = this.state,
        submenuTarget = _a.submenuTarget,
        expandedMenuItemKey = _a.expandedMenuItemKey;

    var item = this._findItemByKey(expandedMenuItemKey);

    var submenuProps = null;

    if (item) {
      submenuProps = {
        items: getSubmenuItems(item),
        target: submenuTarget,
        onDismiss: this._onSubMenuDismiss,
        isSubMenu: true,
        id: this.state.subMenuId,
        shouldFocusOnMount: true,
        shouldFocusOnContainer: this.state.expandedByMouseClick,
        directionalHint: (0, _Utilities.getRTL)() ? _DirectionalHint.DirectionalHint.leftTopEdge : _DirectionalHint.DirectionalHint.rightTopEdge,
        className: this.props.className,
        gapSpace: 0,
        isBeakVisible: false
      };

      if (item.subMenuProps) {
        (0, _Utilities.assign)(submenuProps, item.subMenuProps);
      }
    }

    return submenuProps;
  };

  ContextualMenuBase.prototype._findItemByKey = function (key) {
    var items = this.props.items;
    return this._findItemByKeyFromItems(key, items);
  };
  /**
   * Returns the item that mathes a given key if any.
   * @param key - The key of the item to match
   * @param items - The items to look for the key
   */


  ContextualMenuBase.prototype._findItemByKeyFromItems = function (key, items) {
    for (var _i = 0, items_2 = items; _i < items_2.length; _i++) {
      var item = items_2[_i];

      if (item.itemType === _ContextualMenu.ContextualMenuItemType.Section && item.sectionProps) {
        var match = this._findItemByKeyFromItems(key, item.sectionProps.items);

        if (match) {
          return match;
        }
      } else if (item.key && item.key === key) {
        return item;
      }
    }
  };

  ContextualMenuBase.prototype._setTargetWindowAndElement = function (target) {
    if (target) {
      if (typeof target === 'string') {
        var currentDoc = (0, _Utilities.getDocument)();
        this._target = currentDoc ? currentDoc.querySelector(target) : null;
        this._targetWindow = (0, _Utilities.getWindow)();
      } else if (target.stopPropagation) {
        this._targetWindow = (0, _Utilities.getWindow)(target.toElement);
        this._target = target;
      } else if (target.x !== undefined && target.y !== undefined) {
        this._targetWindow = (0, _Utilities.getWindow)();
        this._target = target;
      } else {
        var targetElement = target;
        this._targetWindow = (0, _Utilities.getWindow)(targetElement);
        this._target = target;
      }
    } else {
      this._targetWindow = (0, _Utilities.getWindow)();
    }
  }; // The default ContextualMenu properties have no items and beak, the default submenu direction is right and top.


  ContextualMenuBase.defaultProps = {
    items: [],
    shouldFocusOnMount: true,
    gapSpace: 0,
    directionalHint: _DirectionalHint.DirectionalHint.bottomAutoEdge,
    beakWidth: 16
  };
  ContextualMenuBase = tslib_1.__decorate([_withResponsiveMode.withResponsiveMode], ContextualMenuBase);
  return ContextualMenuBase;
}(_Utilities.BaseComponent);

exports.ContextualMenuBase = ContextualMenuBase;
},{"tslib":"xgwM","react":"mpTF","./ContextualMenu.types":"H7D9","../../common/DirectionalHint":"uAUO","../../FocusZone":"v3nN","../../Utilities":"B5nc","../../utilities/contextualMenu/index":"Q6fV","../../utilities/decorators/withResponsiveMode":"Q4um","../../Callout":"jp3a","./ContextualMenuItem":"Px7u","./ContextualMenuItemWrapper/index":"gavO","../../Styling":"AHeq","./ContextualMenu.classNames":"rug5"}],"IvD4":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = void 0;

var _Styling = require("../../Styling");

var _ContextualMenu = require("./ContextualMenu.cnstyles");

var GlobalClassNames = {
  root: 'ms-ContextualMenu',
  container: 'ms-ContextualMenu-container',
  list: 'ms-ContextualMenu-list',
  header: 'ms-ContextualMenu-header',
  title: 'ms-ContextualMenu-title',
  isopen: 'is-open'
};

var getStyles = function (props) {
  var className = props.className,
      theme = props.theme;
  var classNames = (0, _Styling.getGlobalClassNames)(GlobalClassNames, theme);
  var palette = theme.palette,
      fonts = theme.fonts,
      semanticColors = theme.semanticColors;
  return {
    root: [theme.fonts.medium, classNames.root, classNames.isopen, {
      backgroundColor: semanticColors.bodyBackground,
      minWidth: '180px'
    }, className],
    container: [classNames.container, {
      selectors: {
        ':focus': {
          outline: 0
        }
      }
    }],
    list: [classNames.list, classNames.isopen, {
      listStyleType: 'none',
      margin: '0',
      padding: '0'
    }],
    header: [classNames.header, fonts.small, {
      fontWeight: _Styling.FontWeights.semibold,
      color: semanticColors.menuHeader,
      background: 'none',
      backgroundColor: 'transparent',
      border: 'none',
      height: _ContextualMenu.CONTEXTUAL_MENU_ITEM_HEIGHT,
      lineHeight: _ContextualMenu.CONTEXTUAL_MENU_ITEM_HEIGHT,
      cursor: 'default',
      padding: '0px 6px',
      userSelect: 'none',
      textAlign: 'left'
    }],
    title: [classNames.title, {
      fontSize: '16px',
      paddingRight: '14px',
      paddingLeft: '14px',
      paddingBottom: '5px',
      paddingTop: '5px',
      backgroundColor: palette.neutralLight
    }],
    subComponentStyles: {
      callout: {},
      menuItem: {}
    }
  };
};

exports.getStyles = getStyles;
},{"../../Styling":"AHeq","./ContextualMenu.cnstyles":"h4LR"}],"r4tJ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ContextualMenu = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Utilities = require("../../Utilities");

var _ContextualMenu = require("./ContextualMenu.base");

var _ContextualMenu2 = require("./ContextualMenu.styles");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// This is to prevent cyclic import with ContextualMenu.base.tsx.
var LocalContextualMenu;

function onRenderSubMenu(subMenuProps) {
  return React.createElement(LocalContextualMenu, tslib_1.__assign({}, subMenuProps));
}

LocalContextualMenu = (0, _Utilities.styled)(_ContextualMenu.ContextualMenuBase, _ContextualMenu2.getStyles, function () {
  return {
    onRenderSubMenu: onRenderSubMenu
  };
}, {
  scope: 'ContextualMenu'
});
/**
 * ContextualMenu description
 */

var ContextualMenu = LocalContextualMenu;
exports.ContextualMenu = ContextualMenu;
},{"tslib":"xgwM","react":"mpTF","../../Utilities":"B5nc","./ContextualMenu.base":"ByN5","./ContextualMenu.styles":"IvD4"}],"NBX4":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _ContextualMenu = require("./ContextualMenu");

Object.keys(_ContextualMenu).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _ContextualMenu[key];
    }
  });
});

var _ContextualMenu2 = require("./ContextualMenu.base");

Object.keys(_ContextualMenu2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _ContextualMenu2[key];
    }
  });
});

var _ContextualMenu3 = require("./ContextualMenu.types");

Object.keys(_ContextualMenu3).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _ContextualMenu3[key];
    }
  });
});

var _ContextualMenuItem = require("./ContextualMenuItem");

Object.keys(_ContextualMenuItem).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _ContextualMenuItem[key];
    }
  });
});

var _ContextualMenuItem2 = require("./ContextualMenuItem.base");

Object.keys(_ContextualMenuItem2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _ContextualMenuItem2[key];
    }
  });
});
},{"./ContextualMenu":"r4tJ","./ContextualMenu.base":"ByN5","./ContextualMenu.types":"H7D9","./ContextualMenuItem":"Px7u","./ContextualMenuItem.base":"Vibn"}],"W3sW":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _index = require("./components/ContextualMenu/index");

Object.keys(_index).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index[key];
    }
  });
});
},{"./components/ContextualMenu/index":"NBX4"}],"TcmQ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getBaseButtonClassNames = exports.ButtonGlobalClassNames = void 0;

var _Utilities = require("../../Utilities");

var _Styling = require("../../Styling");

var ButtonGlobalClassNames = {
  msButton: 'ms-Button',
  msButtonIcon: 'ms-Button-icon',
  msButtonMenuIcon: 'ms-Button-menuIcon',
  msButtonLabel: 'ms-Button-label',
  msButtonDescription: 'ms-Button-description',
  msButtonScreenReaderText: 'ms-Button-screenReaderText',
  msButtonFlexContainer: 'ms-Button-flexContainer',
  msButtonTextContainer: 'ms-Button-textContainer'
};
exports.ButtonGlobalClassNames = ButtonGlobalClassNames;
var getBaseButtonClassNames = (0, _Utilities.memoizeFunction)(function (theme, styles, className, variantClassName, iconClassName, menuIconClassName, disabled, checked, expanded, isSplit) {
  var classNames = (0, _Styling.getGlobalClassNames)(ButtonGlobalClassNames, theme || {});
  var isExpanded = expanded && !isSplit;
  return (0, _Styling.mergeStyleSets)({
    root: [classNames.msButton, styles.root, variantClassName, checked && ['is-checked', styles.rootChecked], isExpanded && ['is-expanded', styles.rootExpanded, {
      selectors: (_a = {}, _a[":hover ." + classNames.msButtonIcon] = styles.iconExpandedHovered, // menuIcon falls back to rootExpandedHovered to support original behavior
      _a[":hover ." + classNames.msButtonMenuIcon] = styles.menuIconExpandedHovered || styles.rootExpandedHovered, _a[':hover'] = styles.rootExpandedHovered, _a)
    }], disabled && ['is-disabled', styles.rootDisabled], !disabled && !isExpanded && !checked && {
      selectors: (_b = {
        ':hover': styles.rootHovered
      }, _b[":hover ." + classNames.msButtonLabel] = styles.labelHovered, _b[":hover ." + classNames.msButtonIcon] = styles.iconHovered, _b[":hover ." + classNames.msButtonDescription] = styles.descriptionHovered, _b[":hover ." + classNames.msButtonMenuIcon] = styles.menuIconHovered, _b[':focus'] = styles.rootFocused, _b[':active'] = styles.rootPressed, _b[":active ." + classNames.msButtonIcon] = styles.iconPressed, _b[":active ." + classNames.msButtonDescription] = styles.descriptionPressed, _b[":active ." + classNames.msButtonMenuIcon] = styles.menuIconPressed, _b)
    }, disabled && checked && [styles.rootCheckedDisabled], !disabled && checked && {
      selectors: {
        ':hover': styles.rootCheckedHovered,
        ':active': styles.rootCheckedPressed
      }
    }, className],
    flexContainer: [classNames.msButtonFlexContainer, styles.flexContainer],
    textContainer: [classNames.msButtonTextContainer, styles.textContainer],
    icon: [classNames.msButtonIcon, iconClassName, styles.icon, isExpanded && styles.iconExpanded, checked && styles.iconChecked, disabled && styles.iconDisabled],
    label: [classNames.msButtonLabel, styles.label, checked && styles.labelChecked, disabled && styles.labelDisabled],
    menuIcon: [classNames.msButtonMenuIcon, menuIconClassName, styles.menuIcon, checked && styles.menuIconChecked, disabled && !isSplit && styles.menuIconDisabled, !disabled && !isExpanded && !checked && {
      selectors: {
        ':hover': styles.menuIconHovered,
        ':active': styles.menuIconPressed
      }
    }, isExpanded && ['is-expanded', styles.menuIconExpanded]],
    description: [classNames.msButtonDescription, styles.description, checked && styles.descriptionChecked, disabled && styles.descriptionDisabled],
    screenReaderText: [classNames.msButtonScreenReaderText, styles.screenReaderText]
  });

  var _a, _b;
});
exports.getBaseButtonClassNames = getBaseButtonClassNames;
},{"../../Utilities":"B5nc","../../Styling":"AHeq"}],"l9vM":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getClassNames = void 0;

var _Utilities = require("../../../Utilities");

var _Styling = require("../../../Styling");

var getClassNames = (0, _Utilities.memoizeFunction)(function (styles, disabled, expanded, checked, primaryDisabled) {
  return {
    root: (0, _Styling.mergeStyles)(styles.splitButtonMenuButton, expanded && [styles.splitButtonMenuButtonExpanded], disabled && [styles.splitButtonMenuButtonDisabled], checked && !disabled && [styles.splitButtonMenuButtonChecked]),
    splitButtonContainer: (0, _Styling.mergeStyles)(styles.splitButtonContainer, checked && !disabled && [styles.splitButtonContainerChecked, {
      selectors: {
        ':hover': styles.splitButtonContainerCheckedHovered
      }
    }], !disabled && !checked && [{
      selectors: {
        ':hover': styles.splitButtonContainerHovered,
        ':focus': styles.splitButtonContainerFocused
      }
    }], disabled && styles.splitButtonContainerDisabled),
    icon: (0, _Styling.mergeStyles)(styles.splitButtonMenuIcon, disabled && styles.splitButtonMenuIconDisabled, !disabled && primaryDisabled && styles.splitButtonMenuIcon),
    flexContainer: (0, _Styling.mergeStyles)(styles.splitButtonFlexContainer),
    divider: (0, _Styling.mergeStyles)(styles.splitButtonDivider, (primaryDisabled || disabled) && styles.splitButtonDividerDisabled)
  };
});
exports.getClassNames = getClassNames;
},{"../../../Utilities":"B5nc","../../../Styling":"AHeq"}],"P2YX":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.BaseButton = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Utilities = require("../../Utilities");

var _Icon = require("../../Icon");

var _DirectionalHint = require("../../common/DirectionalHint");

var _ContextualMenu = require("../../ContextualMenu");

var _BaseButton = require("./BaseButton.classNames");

var _SplitButton = require("./SplitButton/SplitButton.classNames");

var _KeytipData = require("../../KeytipData");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var TouchIdleDelay = 500;
/* ms */

/**
 * {@docCategory Button}
 */

var BaseButton =
/** @class */
function (_super) {
  tslib_1.__extends(BaseButton, _super);

  function BaseButton(props, rootClassName) {
    var _this = _super.call(this, props) || this;

    _this._buttonElement = React.createRef();
    _this._splitButtonContainer = React.createRef();
    _this._renderedPersistentMenu = false;

    _this._onRenderIcon = function (buttonProps, defaultRender) {
      var iconProps = _this.props.iconProps;

      if (iconProps && (iconProps.iconName !== undefined || iconProps.imageProps)) {
        var className = iconProps.className,
            rest = tslib_1.__rest(iconProps, ["className"]);

        return React.createElement(_Icon.Icon, tslib_1.__assign({
          className: (0, _Utilities.css)(_this._classNames.icon, className)
        }, rest));
      }

      return null;
    };

    _this._onRenderTextContents = function () {
      var _a = _this.props,
          text = _a.text,
          children = _a.children,
          _b = _a.secondaryText,
          secondaryText = _b === void 0 ? _this.props.description : _b,
          _c = _a.onRenderText,
          onRenderText = _c === void 0 ? _this._onRenderText : _c,
          _d = _a.onRenderDescription,
          onRenderDescription = _d === void 0 ? _this._onRenderDescription : _d;

      if (text || typeof children === 'string' || secondaryText) {
        return React.createElement("div", {
          className: _this._classNames.textContainer
        }, onRenderText(_this.props, _this._onRenderText), onRenderDescription(_this.props, _this._onRenderDescription));
      }

      return [onRenderText(_this.props, _this._onRenderText), onRenderDescription(_this.props, _this._onRenderDescription)];
    };

    _this._onRenderText = function () {
      var text = _this.props.text;
      var children = _this.props.children; // For backwards compat, we should continue to take in the text content from children.

      if (text === undefined && typeof children === 'string') {
        text = children;
      }

      if (_this._hasText()) {
        return React.createElement("div", {
          key: _this._labelId,
          className: _this._classNames.label,
          id: _this._labelId
        }, text);
      }

      return null;
    };

    _this._onRenderChildren = function () {
      var children = _this.props.children; // If children is just a string, either it or the text will be rendered via onRenderLabel
      // If children is another component, it will be rendered after text

      if (typeof children === 'string') {
        return null;
      }

      return children;
    };

    _this._onRenderDescription = function (props) {
      var _a = props.secondaryText,
          secondaryText = _a === void 0 ? _this.props.description : _a; // ms-Button-description is only shown when the button type is compound.
      // In other cases it will not be displayed.

      return secondaryText ? React.createElement("div", {
        key: _this._descriptionId,
        className: _this._classNames.description,
        id: _this._descriptionId
      }, secondaryText) : null;
    };

    _this._onRenderAriaDescription = function () {
      var ariaDescription = _this.props.ariaDescription; // If ariaDescription is given, descriptionId will be assigned to ariaDescriptionSpan,
      // otherwise it will be assigned to descriptionSpan.

      return ariaDescription ? React.createElement("span", {
        className: _this._classNames.screenReaderText,
        id: _this._ariaDescriptionId
      }, ariaDescription) : null;
    };

    _this._onRenderMenuIcon = function (props) {
      var menuIconProps = _this.props.menuIconProps;
      return React.createElement(_Icon.Icon, tslib_1.__assign({
        iconName: "ChevronDown"
      }, menuIconProps, {
        className: _this._classNames.menuIcon
      }));
    };

    _this._onRenderMenu = function (menuProps) {
      var _a = menuProps.onDismiss,
          onDismiss = _a === void 0 ? _this._dismissMenu : _a;
      var MenuType = _this.props.menuAs || _ContextualMenu.ContextualMenu; // the accessible menu label (accessible name) has a relationship to the button.
      // If the menu props do not specify an explicit value for aria-label or aria-labelledBy,
      // AND the button has text, we'll set the menu aria-labelledBy to the text element id.

      if (!menuProps.ariaLabel && !menuProps.labelElementId && _this._hasText()) {
        menuProps = tslib_1.__assign({}, menuProps, {
          labelElementId: _this._labelId
        });
      }

      return React.createElement(MenuType, tslib_1.__assign({
        id: _this._labelId + '-menu',
        directionalHint: _DirectionalHint.DirectionalHint.bottomLeftEdge
      }, menuProps, {
        shouldFocusOnContainer: _this.state.menuProps ? _this.state.menuProps.shouldFocusOnContainer : undefined,
        shouldFocusOnMount: _this.state.menuProps ? _this.state.menuProps.shouldFocusOnMount : undefined,
        hidden: _this.state.menuProps ? _this.state.menuProps.hidden : undefined,
        className: (0, _Utilities.css)('ms-BaseButton-menuhost', menuProps.className),
        target: _this._isSplitButton ? _this._splitButtonContainer.current : _this._buttonElement.current,
        onDismiss: onDismiss
      }));
    };

    _this._dismissMenu = function () {
      var menuProps = null;

      if (_this.props.persistMenu && _this.state.menuProps) {
        // Create a new object to trigger componentDidUpdate
        menuProps = tslib_1.__assign({}, _this.state.menuProps, {
          hidden: true
        });
      }

      _this.setState({
        menuProps: menuProps
      });
    };

    _this._openMenu = function (shouldFocusOnContainer, shouldFocusOnMount) {
      if (shouldFocusOnMount === void 0) {
        shouldFocusOnMount = true;
      }

      if (_this.props.menuProps) {
        var menuProps = tslib_1.__assign({}, _this.props.menuProps, {
          shouldFocusOnContainer: shouldFocusOnContainer,
          shouldFocusOnMount: shouldFocusOnMount
        });

        if (_this.props.persistMenu) {
          _this._renderedPersistentMenu = true;
          menuProps.hidden = false;
        }

        _this.setState({
          menuProps: menuProps
        });
      }
    };

    _this._onToggleMenu = function (shouldFocusOnContainer) {
      var currentMenuProps = _this.state.menuProps;
      var shouldFocusOnMount = true;

      if (_this.props.menuProps && _this.props.menuProps.shouldFocusOnMount === false) {
        shouldFocusOnMount = false;
      }

      if (_this.props.persistMenu) {
        // _renderedPersistentMenu ensures that the first rendering of
        // the menu happens on-screen, as edge's scrollbar calcuations are off if done while hidden.
        !_this._renderedPersistentMenu || currentMenuProps && currentMenuProps.hidden ? _this._openMenu(shouldFocusOnContainer, shouldFocusOnMount) : _this._dismissMenu();
      } else {
        currentMenuProps ? _this._dismissMenu() : _this._openMenu(shouldFocusOnContainer, shouldFocusOnMount);
      }
    };

    _this._onSplitContainerFocusCapture = function (ev) {
      var container = _this._splitButtonContainer.current; // If the target is coming from the portal we do not need to set focus on the container.

      if (!container || ev.target && (0, _Utilities.portalContainsElement)(ev.target, container)) {
        return;
      } // We should never be able to focus the individual buttons in a split button. Focus
      // should always remain on the container.


      container.focus();
    };

    _this._onSplitButtonPrimaryClick = function (ev) {
      if (_this._isExpanded) {
        _this._dismissMenu();
      }

      if (!_this._processingTouch && _this.props.onClick) {
        _this.props.onClick(ev);
      } else if (_this._processingTouch) {
        _this._onMenuClick(ev);
      }
    };

    _this._onKeyDown = function (ev) {
      // explicity cancelling event so click won't fire after this
      if (_this.props.disabled && (ev.which === _Utilities.KeyCodes.enter || ev.which === _Utilities.KeyCodes.space)) {
        ev.preventDefault();
        ev.stopPropagation();
      } else if (!_this.props.disabled) {
        if (_this.props.menuProps) {
          _this._onMenuKeyDown(ev);
        } else if (_this.props.onKeyDown !== undefined) {
          _this.props.onKeyDown(ev); // not cancelling event because it's not disabled

        }
      }
    };

    _this._onKeyUp = function (ev) {
      if (!_this.props.disabled && _this.props.onKeyUp !== undefined) {
        _this.props.onKeyUp(ev); // not cancelling event because it's not disabled

      }
    };

    _this._onKeyPress = function (ev) {
      if (!_this.props.disabled && _this.props.onKeyPress !== undefined) {
        _this.props.onKeyPress(ev); // not cancelling event because it's not disabled

      }
    };

    _this._onMouseUp = function (ev) {
      if (!_this.props.disabled && _this.props.onMouseUp !== undefined) {
        _this.props.onMouseUp(ev); // not cancelling event because it's not disabled

      }
    };

    _this._onMouseDown = function (ev) {
      if (!_this.props.disabled && _this.props.onMouseDown !== undefined) {
        _this.props.onMouseDown(ev); // not cancelling event because it's not disabled

      }
    };

    _this._onClick = function (ev) {
      if (!_this.props.disabled) {
        if (_this.props.menuProps) {
          _this._onMenuClick(ev);
        } else if (_this.props.onClick !== undefined) {
          _this.props.onClick(ev); // not cancelling event because it's not disabled

        }
      }
    };

    _this._onSplitButtonContainerKeyDown = function (ev) {
      if (ev.which === _Utilities.KeyCodes.enter) {
        if (_this._buttonElement.current) {
          _this._buttonElement.current.click();

          ev.preventDefault();
          ev.stopPropagation();
        }
      } else {
        _this._onMenuKeyDown(ev);
      }
    };

    _this._onMenuKeyDown = function (ev) {
      if (_this.props.disabled) {
        return;
      }

      if (_this.props.onKeyDown) {
        _this.props.onKeyDown(ev);
      }

      var isUp = ev.which === _Utilities.KeyCodes.up;
      var isDown = ev.which === _Utilities.KeyCodes.down;

      if (!ev.defaultPrevented && _this._isValidMenuOpenKey(ev)) {
        var onMenuClick = _this.props.onMenuClick;

        if (onMenuClick) {
          onMenuClick(ev, _this);
        }

        _this._onToggleMenu(false);

        ev.preventDefault();
        ev.stopPropagation();
      }

      if (!(ev.altKey || ev.metaKey) && (isUp || isDown)) {
        _this.setState(function (state) {
          if (state.menuProps && !state.menuProps.shouldFocusOnMount) {
            return {
              menuProps: tslib_1.__assign({}, state.menuProps, {
                shouldFocusOnMount: true
              })
            };
          }

          return state;
        }); // This should be done in the setStateCallback but because preventDefault
        // needs to be called, we have to evaluate the current state, even though
        // it might not be 100% accurate;


        if (_this.state.menuProps && !_this.state.menuProps.shouldFocusOnMount) {
          ev.preventDefault();
          ev.stopPropagation();
        }
      }
    };

    _this._onTouchStart = function () {
      if (_this._isSplitButton && _this._splitButtonContainer.current && !('onpointerdown' in _this._splitButtonContainer.current)) {
        _this._handleTouchAndPointerEvent();
      }
    };

    _this._onMenuClick = function (ev) {
      var onMenuClick = _this.props.onMenuClick;

      if (onMenuClick) {
        onMenuClick(ev, _this);
      }

      if (!ev.defaultPrevented) {
        // When Edge + Narrator are used together (regardless of if the button is in a form or not), pressing
        // "Enter" fires this method and not _onMenuKeyDown. Checking ev.nativeEvent.detail differentiates
        // between a real click event and a keypress event (detail should be the number of mouse clicks).
        // ...Plot twist! For a real click event in IE 11, detail is always 0 (Edge sets it properly to 1).
        // So we also check the pointerType property, which both Edge and IE set to "mouse" for real clicks
        // and "" for pressing "Enter" with Narrator on.
        var shouldFocusOnContainer = ev.nativeEvent.detail !== 0 || ev.nativeEvent.pointerType === 'mouse';

        _this._onToggleMenu(shouldFocusOnContainer);

        ev.preventDefault();
        ev.stopPropagation();
      }
    };

    _this._warnConditionallyRequiredProps(['menuProps', 'onClick'], 'split', _this.props.split);

    _this._warnDeprecations({
      rootProps: undefined,
      description: 'secondaryText',
      toggled: 'checked'
    });

    _this._labelId = (0, _Utilities.getId)();
    _this._descriptionId = (0, _Utilities.getId)();
    _this._ariaDescriptionId = (0, _Utilities.getId)();
    _this.state = {
      menuProps: null
    };
    return _this;
  }

  Object.defineProperty(BaseButton.prototype, "_isSplitButton", {
    get: function () {
      return !!this.props.menuProps && !!this.props.onClick && this.props.split === true;
    },
    enumerable: true,
    configurable: true
  });
  Object.defineProperty(BaseButton.prototype, "_isExpanded", {
    get: function () {
      var menuProps = this.state.menuProps;

      if (this.props.persistMenu) {
        return !!menuProps && !menuProps.hidden;
      }

      return !!menuProps;
    },
    enumerable: true,
    configurable: true
  });

  BaseButton.prototype.render = function () {
    var _a = this.props,
        ariaDescription = _a.ariaDescription,
        ariaLabel = _a.ariaLabel,
        ariaHidden = _a.ariaHidden,
        className = _a.className,
        disabled = _a.disabled,
        allowDisabledFocus = _a.allowDisabledFocus,
        primaryDisabled = _a.primaryDisabled,
        _b = _a.secondaryText,
        secondaryText = _b === void 0 ? this.props.description : _b,
        href = _a.href,
        iconProps = _a.iconProps,
        menuIconProps = _a.menuIconProps,
        styles = _a.styles,
        checked = _a.checked,
        variantClassName = _a.variantClassName,
        theme = _a.theme,
        toggle = _a.toggle,
        getClassNames = _a.getClassNames; // Button is disabled if the whole button (in case of splitbutton is disabled) or if the primary action is disabled

    var isPrimaryButtonDisabled = disabled || primaryDisabled;
    this._classNames = getClassNames ? getClassNames(theme, className, variantClassName, iconProps && iconProps.className, menuIconProps && menuIconProps.className, isPrimaryButtonDisabled, checked, this._isExpanded, this.props.split, !!allowDisabledFocus) : (0, _BaseButton.getBaseButtonClassNames)(theme, styles, className, variantClassName, iconProps && iconProps.className, menuIconProps && menuIconProps.className, isPrimaryButtonDisabled, checked, this._isExpanded, this.props.split);

    var _c = this,
        _ariaDescriptionId = _c._ariaDescriptionId,
        _labelId = _c._labelId,
        _descriptionId = _c._descriptionId; // Anchor tag cannot be disabled hence in disabled state rendering
    // anchor button as normal button


    var renderAsAnchor = !isPrimaryButtonDisabled && !!href;
    var tag = renderAsAnchor ? 'a' : 'button';
    var nativeProps = (0, _Utilities.getNativeProps)((0, _Utilities.assign)(renderAsAnchor ? {} : {
      type: 'button'
    }, this.props.rootProps, this.props), renderAsAnchor ? _Utilities.anchorProperties : _Utilities.buttonProperties, ['disabled' // let disabled buttons be focused and styled as disabled.
    ]); // Check for ariaLabel passed in via Button props, and fall back to aria-label passed in via native props

    var resolvedAriaLabel = ariaLabel || nativeProps['aria-label']; // Check for ariaDescription, secondaryText or aria-describedby in the native props to determine source of aria-describedby
    // otherwise default to undefined so property does not appear in output.

    var ariaDescribedBy = undefined;

    if (ariaDescription) {
      ariaDescribedBy = _ariaDescriptionId;
    } else if (secondaryText) {
      ariaDescribedBy = _descriptionId;
    } else if (nativeProps['aria-describedby']) {
      ariaDescribedBy = nativeProps['aria-describedby'];
    } // If an explicit ariaLabel is given, use that as the label and we're done.
    // If an explicit aria-labelledby is given, use that and we're done.
    // If any kind of description is given (which will end up as an aria-describedby attribute),
    // set the labelledby element. Otherwise, the button is labeled implicitly by the descendent
    // text on the button (if it exists). Never set both aria-label and aria-labelledby.


    var ariaLabelledBy = undefined;

    if (!resolvedAriaLabel) {
      if (nativeProps['aria-labelledby']) {
        ariaLabelledBy = nativeProps['aria-labelledby'];
      } else if (ariaDescribedBy) {
        ariaLabelledBy = this._hasText() ? _labelId : undefined;
      }
    }

    var dataIsFocusable = this.props['data-is-focusable'] === false || disabled && !allowDisabledFocus || this._isSplitButton ? false : true;
    var buttonProps = (0, _Utilities.assign)(nativeProps, {
      className: this._classNames.root,
      ref: this._buttonElement,
      disabled: isPrimaryButtonDisabled && !allowDisabledFocus,
      onKeyDown: this._onKeyDown,
      onKeyPress: this._onKeyPress,
      onKeyUp: this._onKeyUp,
      onMouseDown: this._onMouseDown,
      onMouseUp: this._onMouseUp,
      onClick: this._onClick,
      'aria-label': resolvedAriaLabel,
      'aria-labelledby': ariaLabelledBy,
      'aria-describedby': ariaDescribedBy,
      'aria-disabled': isPrimaryButtonDisabled,
      'data-is-focusable': dataIsFocusable,
      'aria-pressed': toggle ? !!checked : undefined // aria-pressed attribute should only be present for toggle buttons

    });

    if (ariaHidden) {
      buttonProps['aria-hidden'] = true;
    }

    if (this._isSplitButton) {
      return this._onRenderSplitButtonContent(tag, buttonProps);
    } else if (this.props.menuProps) {
      (0, _Utilities.assign)(buttonProps, {
        'aria-expanded': this._isExpanded,
        'aria-owns': this.state.menuProps ? this._labelId + '-menu' : null,
        'aria-haspopup': true
      });
    }

    return this._onRenderContent(tag, buttonProps);
  };

  BaseButton.prototype.componentDidMount = function () {
    // For split buttons, touching anywhere in the button should drop the dropdown, which should contain the primary action.
    // This gives more hit target space for touch environments. We're setting the onpointerdown here, because React
    // does not support Pointer events yet.
    if (this._isSplitButton && this._splitButtonContainer.current && 'onpointerdown' in this._splitButtonContainer.current) {
      this._events.on(this._splitButtonContainer.current, 'pointerdown', this._onPointerDown, true);
    }
  };

  BaseButton.prototype.componentDidUpdate = function (prevProps, prevState) {
    // If Button's menu was closed, run onAfterMenuDismiss. If the menu is being persisted
    // this condition is tested by checking on a change on the menuProps hidden value.
    if (this.props.onAfterMenuDismiss && prevState.menuProps) {
      if (!this.state.menuProps || this.props.persistMenu && !prevState.menuProps.hidden && this.state.menuProps.hidden) {
        this.props.onAfterMenuDismiss();
      }
    }
  };

  BaseButton.prototype.focus = function () {
    if (this._isSplitButton && this._splitButtonContainer.current) {
      this._splitButtonContainer.current.focus();
    } else if (this._buttonElement.current) {
      this._buttonElement.current.focus();
    }
  };

  BaseButton.prototype.dismissMenu = function () {
    this._dismissMenu();
  };

  BaseButton.prototype.openMenu = function (shouldFocusOnContainer, shouldFocusOnMount) {
    this._openMenu(shouldFocusOnContainer, shouldFocusOnMount);
  };

  BaseButton.prototype._onRenderContent = function (tag, buttonProps) {
    var _this = this;

    var props = this.props;
    var Tag = tag;
    var menuIconProps = props.menuIconProps,
        menuProps = props.menuProps,
        _a = props.onRenderIcon,
        onRenderIcon = _a === void 0 ? this._onRenderIcon : _a,
        _b = props.onRenderAriaDescription,
        onRenderAriaDescription = _b === void 0 ? this._onRenderAriaDescription : _b,
        _c = props.onRenderChildren,
        onRenderChildren = _c === void 0 ? this._onRenderChildren : _c,
        _d = props.onRenderMenu,
        onRenderMenu = _d === void 0 ? this._onRenderMenu : _d,
        _e = props.onRenderMenuIcon,
        onRenderMenuIcon = _e === void 0 ? this._onRenderMenuIcon : _e,
        disabled = props.disabled;
    var keytipProps = props.keytipProps;

    if (keytipProps && menuProps) {
      keytipProps = tslib_1.__assign({}, keytipProps, {
        hasMenu: true
      });
    }

    var Content = // If we're making a split button, we won't put the keytip here
    React.createElement(_KeytipData.KeytipData, {
      keytipProps: !this._isSplitButton ? keytipProps : undefined,
      ariaDescribedBy: buttonProps['aria-describedby'],
      disabled: disabled
    }, function (keytipAttributes) {
      return React.createElement(Tag, tslib_1.__assign({}, buttonProps, keytipAttributes), React.createElement("div", {
        className: _this._classNames.flexContainer
      }, onRenderIcon(props, _this._onRenderIcon), _this._onRenderTextContents(), onRenderAriaDescription(props, _this._onRenderAriaDescription), onRenderChildren(props, _this._onRenderChildren), !_this._isSplitButton && (menuProps || menuIconProps || _this.props.onRenderMenuIcon) && onRenderMenuIcon(_this.props, _this._onRenderMenuIcon), _this.state.menuProps && !_this.state.menuProps.doNotLayer && onRenderMenu(menuProps, _this._onRenderMenu)));
    });

    if (menuProps && menuProps.doNotLayer) {
      return React.createElement("div", {
        style: {
          display: 'inline-block'
        }
      }, Content, this.state.menuProps && onRenderMenu(menuProps, this._onRenderMenu));
    }

    return Content;
  };

  BaseButton.prototype._hasText = function () {
    // _onRenderTextContents and _onRenderText do not perform the same checks. Below is parity with what _onRenderText used to have
    // before the refactor that introduced this function. _onRenderTextContents does not require props.text to be undefined in order
    // for props.children to be used as a fallback. Purely a code maintainability/reuse issue, but logged as Issue #4979
    return this.props.text !== null && (this.props.text !== undefined || typeof this.props.children === 'string');
  };

  BaseButton.prototype._onRenderSplitButtonContent = function (tag, buttonProps) {
    var _this = this;

    var _a = this.props,
        _b = _a.styles,
        styles = _b === void 0 ? {} : _b,
        disabled = _a.disabled,
        allowDisabledFocus = _a.allowDisabledFocus,
        checked = _a.checked,
        getSplitButtonClassNames = _a.getSplitButtonClassNames,
        primaryDisabled = _a.primaryDisabled,
        menuProps = _a.menuProps,
        toggle = _a.toggle;
    var keytipProps = this.props.keytipProps;
    var classNames = getSplitButtonClassNames ? getSplitButtonClassNames(!!disabled, this._isExpanded, !!checked, !!allowDisabledFocus) : styles && (0, _SplitButton.getClassNames)(styles, !!disabled, this._isExpanded, !!checked, !!primaryDisabled);
    (0, _Utilities.assign)(buttonProps, {
      onClick: undefined,
      tabIndex: -1,
      'data-is-focusable': false
    });
    var ariaDescribedBy = buttonProps.ariaDescription;

    if (keytipProps && menuProps) {
      keytipProps = tslib_1.__assign({}, keytipProps, {
        hasMenu: true
      });
    }

    var containerProps = (0, _Utilities.getNativeProps)(buttonProps, [], ['disabled']);
    return React.createElement(_KeytipData.KeytipData, {
      keytipProps: keytipProps,
      disabled: disabled
    }, function (keytipAttributes) {
      return React.createElement("div", tslib_1.__assign({}, containerProps, {
        "data-ktp-target": keytipAttributes['data-ktp-target'],
        role: 'button',
        "aria-disabled": disabled,
        "aria-haspopup": true,
        "aria-expanded": _this._isExpanded,
        "aria-pressed": toggle ? !!checked : undefined,
        "aria-describedby": (0, _Utilities.mergeAriaAttributeValues)(ariaDescribedBy, keytipAttributes['aria-describedby']),
        className: classNames && classNames.splitButtonContainer,
        onKeyDown: _this._onSplitButtonContainerKeyDown,
        onTouchStart: _this._onTouchStart,
        ref: _this._splitButtonContainer,
        "data-is-focusable": true,
        onClick: !disabled && !primaryDisabled ? _this._onSplitButtonPrimaryClick : undefined,
        tabIndex: !disabled || allowDisabledFocus ? 0 : undefined,
        "aria-roledescription": buttonProps['aria-roledescription'],
        onFocusCapture: _this._onSplitContainerFocusCapture
      }), React.createElement("span", {
        style: {
          display: 'flex'
        }
      }, _this._onRenderContent(tag, buttonProps), _this._onRenderSplitButtonMenuButton(classNames, keytipAttributes), _this._onRenderSplitButtonDivider(classNames)));
    });
  };

  BaseButton.prototype._onRenderSplitButtonDivider = function (classNames) {
    if (classNames && classNames.divider) {
      return React.createElement("span", {
        className: classNames.divider,
        "aria-hidden": true
      });
    }

    return null;
  };

  BaseButton.prototype._onRenderSplitButtonMenuButton = function (classNames, keytipAttributes) {
    var _a = this.props,
        allowDisabledFocus = _a.allowDisabledFocus,
        checked = _a.checked,
        disabled = _a.disabled;
    var menuIconProps = this.props.menuIconProps;
    var splitButtonAriaLabel = this.props.splitButtonAriaLabel;

    if (menuIconProps === undefined) {
      menuIconProps = {
        iconName: 'ChevronDown'
      };
    }

    var splitButtonProps = {
      styles: classNames,
      checked: checked,
      disabled: disabled,
      allowDisabledFocus: allowDisabledFocus,
      onClick: this._onMenuClick,
      menuProps: undefined,
      iconProps: tslib_1.__assign({}, menuIconProps, {
        className: this._classNames.menuIcon
      }),
      ariaLabel: splitButtonAriaLabel,
      'aria-haspopup': true,
      'aria-expanded': this._isExpanded,
      'data-is-focusable': false
    }; // Add data-ktp-execute-target to the split button if the keytip is defined

    return React.createElement(BaseButton, tslib_1.__assign({}, splitButtonProps, {
      "data-ktp-execute-target": keytipAttributes['data-ktp-execute-target'],
      onMouseDown: this._onMouseDown,
      tabIndex: -1
    }));
  };

  BaseButton.prototype._onPointerDown = function (ev) {
    if (ev.pointerType === 'touch') {
      this._handleTouchAndPointerEvent();

      ev.preventDefault();
      ev.stopImmediatePropagation();
    }
  };

  BaseButton.prototype._handleTouchAndPointerEvent = function () {
    var _this = this; // If we already have an existing timeeout from a previous touch and pointer event
    // cancel that timeout so we can set a nwe one.


    if (this._lastTouchTimeoutId !== undefined) {
      this._async.clearTimeout(this._lastTouchTimeoutId);

      this._lastTouchTimeoutId = undefined;
    }

    this._processingTouch = true;
    this._lastTouchTimeoutId = this._async.setTimeout(function () {
      _this._processingTouch = false;
      _this._lastTouchTimeoutId = undefined;
    }, TouchIdleDelay);
  };
  /**
   * Returns if the user hits a valid keyboard key to open the menu
   * @param ev - the keyboard event
   * @returns True if user clicks on custom trigger key if enabled or alt + down arrow if not. False otherwise.
   */


  BaseButton.prototype._isValidMenuOpenKey = function (ev) {
    if (this.props.menuTriggerKeyCode) {
      return ev.which === this.props.menuTriggerKeyCode;
    } else if (this.props.menuProps) {
      return ev.which === _Utilities.KeyCodes.down && (ev.altKey || ev.metaKey);
    } // Note: When enter is pressed, we will let the event continue to propagate
    // to trigger the onClick event on the button


    return false;
  };

  BaseButton.defaultProps = {
    baseClassName: 'ms-Button',
    styles: {},
    split: false
  };
  return BaseButton;
}(_Utilities.BaseComponent);

exports.BaseButton = BaseButton;
},{"tslib":"xgwM","react":"mpTF","../../Utilities":"B5nc","../../Icon":"s5pL","../../common/DirectionalHint":"uAUO","../../ContextualMenu":"W3sW","./BaseButton.classNames":"TcmQ","./SplitButton/SplitButton.classNames":"l9vM","../../KeytipData":"ltoP"}],"I0pk":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ButtonType = exports.ElementType = void 0;

/**
 * {@docCategory Button}
 */
var ElementType;
exports.ElementType = ElementType;

(function (ElementType) {
  /** <button> element. */
  ElementType[ElementType["button"] = 0] = "button";
  /** <a> element. */

  ElementType[ElementType["anchor"] = 1] = "anchor";
})(ElementType || (exports.ElementType = ElementType = {}));
/**
 * {@docCategory Button}
 */


var ButtonType;
exports.ButtonType = ButtonType;

(function (ButtonType) {
  ButtonType[ButtonType["normal"] = 0] = "normal";
  ButtonType[ButtonType["primary"] = 1] = "primary";
  ButtonType[ButtonType["hero"] = 2] = "hero";
  ButtonType[ButtonType["compound"] = 3] = "compound";
  ButtonType[ButtonType["command"] = 4] = "command";
  ButtonType[ButtonType["icon"] = 5] = "icon";
  ButtonType[ButtonType["default"] = 6] = "default";
})(ButtonType || (exports.ButtonType = ButtonType = {}));
},{}],"i4XP":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = void 0;

var _Utilities = require("../../Utilities");

var _Styling = require("../../Styling");

var noOutline = {
  outline: 0
};
var iconStyle = {
  fontSize: _Styling.FontSizes.icon,
  margin: '0 4px',
  height: '16px',
  lineHeight: '16px',
  textAlign: 'center',
  verticalAlign: 'middle',
  flexShrink: 0
};
/**
 * Gets the base button styles. Note: because it is a base class to be used with the `mergeRules`
 * helper, it should have values for all class names in the interface. This let `mergeRules` optimize
 * mixing class names together.
 */

var getStyles = (0, _Utilities.memoizeFunction)(function (theme) {
  var semanticColors = theme.semanticColors;
  var border = semanticColors.buttonBorder;
  var disabledBackground = semanticColors.disabledBackground;
  var disabledText = semanticColors.disabledText;
  var buttonHighContrastFocus = {
    left: -2,
    top: -2,
    bottom: -2,
    right: -2,
    border: 'none',
    outlineColor: 'ButtonText'
  };
  return {
    root: [(0, _Styling.getFocusStyle)(theme, {
      inset: -1,
      highContrastStyle: buttonHighContrastFocus
    }), theme.fonts.medium, {
      boxSizing: 'border-box',
      border: '1px solid ' + border,
      userSelect: 'none',
      display: 'inline-block',
      textDecoration: 'none',
      textAlign: 'center',
      cursor: 'pointer',
      verticalAlign: 'top',
      padding: '0 16px',
      borderRadius: 0,
      margin: 0,
      selectors: {
        // IE11 workaround for preventing shift of child elements of a button when active.
        ':active > *': {
          position: 'relative',
          left: 0,
          top: 0
        }
      }
    }],
    rootDisabled: [(0, _Styling.getFocusStyle)(theme, {
      inset: -1,
      highContrastStyle: buttonHighContrastFocus
    }), {
      backgroundColor: disabledBackground,
      color: disabledText,
      cursor: 'default',
      pointerEvents: 'none',
      selectors: (_a = {
        ':hover': noOutline,
        ':focus': noOutline
      }, _a[_Styling.HighContrastSelector] = {
        color: 'grayText',
        bordercolor: 'grayText'
      }, _a)
    }],
    iconDisabled: {
      color: disabledText
    },
    menuIconDisabled: {
      color: disabledText
    },
    flexContainer: {
      display: 'flex',
      height: '100%',
      flexWrap: 'nowrap',
      justifyContent: 'center',
      alignItems: 'center'
    },
    textContainer: {
      flexGrow: 1
    },
    icon: iconStyle,
    menuIcon: [iconStyle, {
      fontSize: _Styling.FontSizes.small
    }],
    label: {
      margin: '0 4px',
      lineHeight: '100%'
    },
    screenReaderText: _Styling.hiddenContentStyle
  };

  var _a;
});
exports.getStyles = getStyles;
},{"../../Utilities":"B5nc","../../Styling":"AHeq"}],"Zgnh":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = void 0;

var _Styling = require("../../../Styling");

var _Utilities = require("../../../Utilities");

var getStyles = (0, _Utilities.memoizeFunction)(function (theme, customStyles) {
  var buttonHighContrastFocus = {
    left: -2,
    top: -2,
    bottom: -2,
    right: -2,
    border: 'none'
  };
  var splitButtonDivider = {
    position: 'absolute',
    width: 1,
    right: 31,
    top: 8,
    bottom: 8
  };
  var splitButtonStyles = {
    splitButtonContainer: [(0, _Styling.getFocusStyle)(theme, {
      highContrastStyle: buttonHighContrastFocus
    }), {
      display: 'inline-flex'
    }],
    splitButtonContainerFocused: {
      outline: 'none!important'
    },
    splitButtonMenuButton: {
      padding: 6,
      height: 'auto',
      boxSizing: 'border-box',
      border: 0,
      borderRadius: 0,
      outline: 'transparent',
      userSelect: 'none',
      display: 'inline-block',
      textDecoration: 'none',
      textAlign: 'center',
      cursor: 'pointer',
      verticalAlign: 'top',
      width: 32,
      marginLeft: -1,
      marginTop: 0,
      marginRight: 0,
      marginBottom: 0
    },
    splitButtonDivider: splitButtonDivider,
    splitButtonDividerDisabled: splitButtonDivider,
    splitButtonMenuButtonDisabled: {
      pointerEvents: 'none',
      selectors: {
        ':hover': {
          cursor: 'default'
        }
      }
    },
    splitButtonFlexContainer: {
      display: 'flex',
      height: '100%',
      flexWrap: 'nowrap',
      justifyContent: 'center',
      alignItems: 'center'
    },
    splitButtonContainerDisabled: {
      outline: 'none',
      border: 'none'
    }
  };
  return (0, _Styling.concatStyleSets)(splitButtonStyles, customStyles);
});
exports.getStyles = getStyles;
},{"../../../Styling":"AHeq","../../../Utilities":"B5nc"}],"sfL3":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.standardStyles = standardStyles;
exports.primaryStyles = primaryStyles;

var _Styling = require("../../Styling");

function standardStyles(theme) {
  var s = theme.semanticColors;
  var buttonBackground = s.buttonBackground;
  var buttonBackgroundChecked = s.buttonBackgroundChecked;
  var buttonBackgroundHovered = s.buttonBackgroundHovered;
  var buttonText = s.buttonText;
  var buttonTextHovered = s.buttonTextHovered;
  var buttonTextChecked = s.buttonTextChecked;
  var buttonTextCheckedHovered = s.buttonTextCheckedHovered;
  return {
    root: {
      backgroundColor: buttonBackground,
      color: buttonText
    },
    rootHovered: {
      backgroundColor: buttonBackgroundHovered,
      color: buttonTextHovered,
      selectors: (_a = {}, _a[_Styling.HighContrastSelector] = {
        borderColor: 'Highlight',
        color: 'Highlight'
      }, _a)
    },
    rootPressed: {
      backgroundColor: buttonBackgroundChecked,
      color: buttonTextChecked
    },
    rootExpanded: {
      backgroundColor: buttonBackgroundChecked,
      color: buttonTextChecked
    },
    rootChecked: {
      backgroundColor: buttonBackgroundChecked,
      color: buttonTextChecked
    },
    rootCheckedHovered: {
      backgroundColor: theme.palette.neutralLight,
      color: buttonTextCheckedHovered
    },
    // Split button styles
    splitButtonContainer: {
      selectors: (_b = {}, _b[_Styling.HighContrastSelector] = {
        border: 'none'
      }, _b)
    },
    splitButtonMenuButton: {
      color: theme.palette.white,
      backgroundColor: theme.palette.neutralLighter,
      selectors: {
        ':hover': {
          backgroundColor: theme.palette.neutralLight,
          selectors: (_c = {}, _c[_Styling.HighContrastSelector] = {
            color: 'Highlight'
          }, _c)
        }
      }
    },
    splitButtonMenuButtonDisabled: {
      backgroundColor: theme.palette.neutralLighter,
      selectors: {
        ':hover': {
          backgroundColor: theme.palette.neutralLighter
        }
      }
    },
    splitButtonDivider: {
      backgroundColor: theme.palette.neutralTertiaryAlt
    },
    splitButtonDividerDisabled: {
      backgroundColor: theme.palette.neutralTertiaryAlt
    },
    splitButtonMenuButtonChecked: {
      backgroundColor: theme.palette.themePrimary
    },
    splitButtonMenuButtonExpanded: {
      backgroundColor: theme.palette.neutralLight
    },
    splitButtonMenuIcon: {
      color: theme.palette.neutralPrimary
    },
    splitButtonMenuIconDisabled: {
      color: theme.palette.neutralTertiary
    }
  };

  var _a, _b, _c;
}

function primaryStyles(theme) {
  return {
    root: {
      backgroundColor: theme.palette.themePrimary,
      color: theme.palette.white,
      selectors: (_a = {}, _a[_Styling.HighContrastSelector] = {
        color: 'Window',
        backgroundColor: 'WindowText',
        MsHighContrastAdjust: 'none'
      }, _a)
    },
    rootHovered: {
      backgroundColor: theme.palette.themeDarkAlt,
      color: theme.palette.white,
      selectors: (_b = {}, _b[_Styling.HighContrastSelector] = {
        color: 'Window',
        backgroundColor: 'Highlight'
      }, _b)
    },
    rootPressed: {
      backgroundColor: theme.palette.themeDark,
      color: theme.palette.white,
      selectors: (_c = {}, _c[_Styling.HighContrastSelector] = {
        color: 'Window',
        backgroundColor: 'WindowText',
        MsHighContrastAdjust: 'none'
      }, _c)
    },
    rootExpanded: {
      backgroundColor: theme.palette.themeDark,
      color: theme.palette.white
    },
    rootChecked: {
      backgroundColor: theme.palette.themeDark,
      color: theme.palette.white
    },
    rootCheckedHovered: {
      backgroundColor: theme.palette.themePrimary,
      color: theme.palette.white
    },
    rootDisabled: {
      selectors: (_d = {}, _d[_Styling.HighContrastSelector] = {
        color: 'GrayText',
        borderColor: 'GrayText',
        backgroundColor: 'Window'
      }, _d)
    },
    // Split button styles
    splitButtonContainer: {
      selectors: (_e = {}, _e[_Styling.HighContrastSelector] = {
        border: 'none'
      }, _e)
    },
    splitButtonDivider: {
      backgroundColor: theme.palette.white
    },
    splitButtonDividerDisabled: {
      backgroundColor: theme.palette.neutralTertiaryAlt
    },
    splitButtonMenuButton: {
      backgroundColor: theme.palette.themePrimary,
      color: theme.palette.white,
      selectors: {
        ':hover': {
          backgroundColor: theme.palette.themeDark,
          selectors: (_f = {}, _f[_Styling.HighContrastSelector] = {
            color: 'Highlight'
          }, _f)
        }
      }
    },
    splitButtonMenuButtonDisabled: {
      backgroundColor: theme.palette.neutralLighter,
      selectors: {
        ':hover': {
          backgroundColor: theme.palette.neutralLighter
        }
      }
    },
    splitButtonMenuButtonChecked: {
      backgroundColor: theme.palette.themeDark
    },
    splitButtonMenuButtonExpanded: {
      backgroundColor: theme.palette.themeDark
    },
    splitButtonMenuIcon: {
      color: theme.palette.white
    },
    splitButtonMenuIconDisabled: {
      color: theme.palette.neutralTertiary
    }
  };

  var _a, _b, _c, _d, _e, _f;
}
},{"../../Styling":"AHeq"}],"xYqR":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = void 0;

var _Styling = require("../../../Styling");

var _Utilities = require("../../../Utilities");

var _BaseButton = require("../BaseButton.styles");

var _SplitButton = require("../SplitButton/SplitButton.styles");

var _ButtonThemes = require("../ButtonThemes");

var DEFAULT_BUTTON_HEIGHT = '32px';
var DEFAULT_BUTTON_MINWIDTH = '80px';
var getStyles = (0, _Utilities.memoizeFunction)(function (theme, customStyles, primary) {
  var baseButtonStyles = (0, _BaseButton.getStyles)(theme);
  var splitButtonStyles = (0, _SplitButton.getStyles)(theme);
  var defaultButtonStyles = {
    root: {
      minWidth: DEFAULT_BUTTON_MINWIDTH,
      height: DEFAULT_BUTTON_HEIGHT
    },
    label: {
      fontWeight: _Styling.FontWeights.semibold
    }
  };
  return (0, _Styling.concatStyleSets)(baseButtonStyles, defaultButtonStyles, primary ? (0, _ButtonThemes.primaryStyles)(theme) : (0, _ButtonThemes.standardStyles)(theme), splitButtonStyles, customStyles);
});
exports.getStyles = getStyles;
},{"../../../Styling":"AHeq","../../../Utilities":"B5nc","../BaseButton.styles":"i4XP","../SplitButton/SplitButton.styles":"Zgnh","../ButtonThemes":"sfL3"}],"GBGS":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.DefaultButton = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _BaseButton = require("../BaseButton");

var _Utilities = require("../../../Utilities");

var _DefaultButton = require("./DefaultButton.styles");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * {@docCategory Button}
 */
var DefaultButton =
/** @class */
function (_super) {
  tslib_1.__extends(DefaultButton, _super);

  function DefaultButton() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    /**
     * Tell BaseComponent to bypass resolution of componentRef.
     */


    _this._skipComponentRefResolution = true;
    return _this;
  }

  DefaultButton.prototype.render = function () {
    var _a = this.props,
        _b = _a.primary,
        primary = _b === void 0 ? false : _b,
        styles = _a.styles,
        theme = _a.theme;
    return React.createElement(_BaseButton.BaseButton, tslib_1.__assign({}, this.props, {
      variantClassName: primary ? 'ms-Button--primary' : 'ms-Button--default',
      styles: (0, _DefaultButton.getStyles)(theme, styles, primary),
      onRenderDescription: _Utilities.nullRender
    }));
  };

  DefaultButton = tslib_1.__decorate([(0, _Utilities.customizable)('DefaultButton', ['theme', 'styles'], true)], DefaultButton);
  return DefaultButton;
}(_Utilities.BaseComponent);

exports.DefaultButton = DefaultButton;
},{"tslib":"xgwM","react":"mpTF","../BaseButton":"P2YX","../../../Utilities":"B5nc","./DefaultButton.styles":"xYqR"}],"s2DG":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = void 0;

var _Styling = require("../../../Styling");

var _Utilities = require("../../../Utilities");

var _BaseButton = require("../BaseButton.styles");

var DEFAULT_BUTTON_HEIGHT = '40px';
var DEFAULT_PADDING = '0 4px';
var getStyles = (0, _Utilities.memoizeFunction)(function (theme, customStyles) {
  var baseButtonStyles = (0, _BaseButton.getStyles)(theme);
  var actionButtonStyles = {
    root: {
      padding: DEFAULT_PADDING,
      height: DEFAULT_BUTTON_HEIGHT,
      color: theme.palette.neutralPrimary,
      backgroundColor: 'transparent',
      border: '1px solid transparent'
    },
    rootHovered: {
      color: theme.palette.themePrimary,
      selectors: (_a = {}, _a[_Styling.HighContrastSelector] = {
        borderColor: 'Highlight',
        color: 'Highlight'
      }, _a)
    },
    iconHovered: {
      color: theme.palette.themePrimary
    },
    rootPressed: {
      color: theme.palette.black
    },
    rootExpanded: {
      color: theme.palette.themePrimary
    },
    iconPressed: {
      color: theme.palette.themeDarker
    },
    rootDisabled: {
      color: theme.palette.neutralTertiary,
      backgroundColor: 'transparent'
    },
    rootChecked: {
      color: theme.palette.black
    },
    iconChecked: {
      color: theme.palette.themeDarker
    },
    flexContainer: {
      justifyContent: 'flex-start'
    },
    icon: {
      color: theme.palette.themeDarkAlt
    },
    iconDisabled: {
      color: 'inherit'
    },
    menuIcon: {
      color: theme.palette.neutralSecondary
    },
    textContainer: {
      flexGrow: 0
    }
  };
  return (0, _Styling.concatStyleSets)(baseButtonStyles, actionButtonStyles, customStyles);

  var _a;
});
exports.getStyles = getStyles;
},{"../../../Styling":"AHeq","../../../Utilities":"B5nc","../BaseButton.styles":"i4XP"}],"ix0o":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ActionButton = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _BaseButton = require("../BaseButton");

var _Utilities = require("../../../Utilities");

var _ActionButton = require("./ActionButton.styles");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * {@docCategory Button}
 */
var ActionButton =
/** @class */
function (_super) {
  tslib_1.__extends(ActionButton, _super);

  function ActionButton() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    /**
     * Tell BaseComponent to bypass resolution of componentRef.
     */


    _this._skipComponentRefResolution = true;
    return _this;
  }

  ActionButton.prototype.render = function () {
    var _a = this.props,
        styles = _a.styles,
        theme = _a.theme;
    return React.createElement(_BaseButton.BaseButton, tslib_1.__assign({}, this.props, {
      variantClassName: "ms-Button--action ms-Button--command",
      styles: (0, _ActionButton.getStyles)(theme, styles),
      onRenderDescription: _Utilities.nullRender
    }));
  };

  ActionButton = tslib_1.__decorate([(0, _Utilities.customizable)('ActionButton', ['theme', 'styles'], true)], ActionButton);
  return ActionButton;
}(_Utilities.BaseComponent);

exports.ActionButton = ActionButton;
},{"tslib":"xgwM","react":"mpTF","../BaseButton":"P2YX","../../../Utilities":"B5nc","./ActionButton.styles":"s2DG"}],"BbFm":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = void 0;

var _Styling = require("../../../Styling");

var _Utilities = require("../../../Utilities");

var _BaseButton = require("../BaseButton.styles");

var _SplitButton = require("../SplitButton/SplitButton.styles");

var _ButtonThemes = require("../ButtonThemes");

var getStyles = (0, _Utilities.memoizeFunction)(function (theme, customStyles, primary) {
  var baseButtonStyles = (0, _BaseButton.getStyles)(theme);
  var splitButtonStyles = (0, _SplitButton.getStyles)(theme);
  var compoundButtonStyles = {
    root: {
      maxWidth: '280px',
      minHeight: '72px',
      height: 'auto',
      padding: '20px'
    },
    flexContainer: {
      flexDirection: 'row',
      alignItems: 'flex-start',
      minWidth: '100%',
      margin: ''
    },
    textContainer: {
      textAlign: 'left'
    },
    icon: {
      fontSize: '2em',
      lineHeight: '1em',
      height: '1em',
      margin: '0px 8px 0px 0px',
      flexBasis: '1em',
      flexShrink: '0'
    },
    label: {
      margin: '0 0 5px',
      lineHeight: '100%',
      fontWeight: _Styling.FontWeights.semibold
    },
    description: [theme.fonts.small, {
      lineHeight: '100%'
    }]
  };
  var standardCompoundTheme = {
    description: {
      color: theme.palette.neutralSecondary
    },
    descriptionHovered: {
      color: theme.palette.neutralDark
    },
    descriptionPressed: {
      color: 'inherit'
    },
    descriptionChecked: {
      color: 'inherit'
    },
    descriptionDisabled: {
      color: 'inherit'
    }
  };
  var primaryCompoundTheme = {
    description: {
      color: theme.palette.white,
      selectors: (_a = {}, _a[_Styling.HighContrastSelector] = {
        color: 'Window',
        backgroundColor: 'WindowText',
        MsHighContrastAdjust: 'none'
      }, _a)
    },
    descriptionHovered: {
      color: theme.palette.white,
      selectors: (_b = {}, _b[_Styling.HighContrastSelector] = {
        color: 'Window',
        backgroundColor: 'Highlight',
        MsHighContrastAdjust: 'none'
      }, _b)
    },
    descriptionPressed: {
      color: 'inherit'
    },
    descriptionChecked: {
      color: 'inherit'
    },
    descriptionDisabled: {
      color: 'inherit',
      selectors: (_c = {}, _c[_Styling.HighContrastSelector] = {
        color: 'inherit'
      }, _c)
    }
  };
  return (0, _Styling.concatStyleSets)(baseButtonStyles, compoundButtonStyles, primary ? (0, _ButtonThemes.primaryStyles)(theme) : (0, _ButtonThemes.standardStyles)(theme), primary ? primaryCompoundTheme : standardCompoundTheme, splitButtonStyles, customStyles);

  var _a, _b, _c;
});
exports.getStyles = getStyles;
},{"../../../Styling":"AHeq","../../../Utilities":"B5nc","../BaseButton.styles":"i4XP","../SplitButton/SplitButton.styles":"Zgnh","../ButtonThemes":"sfL3"}],"fezX":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.CompoundButton = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _BaseButton = require("../BaseButton");

var _Utilities = require("../../../Utilities");

var _CompoundButton = require("./CompoundButton.styles");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * {@docCategory Button}
 */
var CompoundButton =
/** @class */
function (_super) {
  tslib_1.__extends(CompoundButton, _super);

  function CompoundButton() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    /**
     * Tell BaseComponent to bypass resolution of componentRef.
     */


    _this._skipComponentRefResolution = true;
    return _this;
  }

  CompoundButton.prototype.render = function () {
    var _a = this.props,
        _b = _a.primary,
        primary = _b === void 0 ? false : _b,
        styles = _a.styles,
        theme = _a.theme;
    return React.createElement(_BaseButton.BaseButton, tslib_1.__assign({}, this.props, {
      variantClassName: primary ? 'ms-Button--compoundPrimary' : 'ms-Button--compound',
      styles: (0, _CompoundButton.getStyles)(theme, styles, primary)
    }));
  };

  CompoundButton = tslib_1.__decorate([(0, _Utilities.customizable)('CompoundButton', ['theme', 'styles'], true)], CompoundButton);
  return CompoundButton;
}(_Utilities.BaseComponent);

exports.CompoundButton = CompoundButton;
},{"tslib":"xgwM","react":"mpTF","../BaseButton":"P2YX","../../../Utilities":"B5nc","./CompoundButton.styles":"BbFm"}],"IGnS":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = void 0;

var _Styling = require("../../../Styling");

var _Utilities = require("../../../Utilities");

var _BaseButton = require("../BaseButton.styles");

var _SplitButton = require("../SplitButton/SplitButton.styles");

var getStyles = (0, _Utilities.memoizeFunction)(function (theme, customStyles) {
  var baseButtonStyles = (0, _BaseButton.getStyles)(theme);
  var splitButtonStyles = (0, _SplitButton.getStyles)(theme);
  var palette = theme.palette,
      semanticColors = theme.semanticColors;
  var iconButtonStyles = {
    root: {
      padding: '0 4px',
      width: '32px',
      height: '32px',
      backgroundColor: 'transparent',
      border: 'none',
      color: semanticColors.actionLink
    },
    rootHovered: {
      color: semanticColors.actionLinkHovered,
      selectors: (_a = {}, _a[_Styling.HighContrastSelector] = {
        borderColor: 'Highlight',
        color: 'Highlight'
      }, _a)
    },
    rootPressed: {
      color: palette.themePrimary
    },
    rootExpanded: {
      color: palette.themePrimary
    },
    rootChecked: {
      backgroundColor: semanticColors.buttonBackgroundChecked
    },
    rootCheckedHovered: {
      backgroundColor: semanticColors.buttonBackgroundHovered
    },
    rootDisabled: {
      color: semanticColors.disabledText
    }
  };
  return (0, _Styling.concatStyleSets)(baseButtonStyles, iconButtonStyles, splitButtonStyles, customStyles);

  var _a;
});
exports.getStyles = getStyles;
},{"../../../Styling":"AHeq","../../../Utilities":"B5nc","../BaseButton.styles":"i4XP","../SplitButton/SplitButton.styles":"Zgnh"}],"b0RM":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.IconButton = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _BaseButton = require("../BaseButton");

var _Utilities = require("../../../Utilities");

var _IconButton = require("./IconButton.styles");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * {@docCategory Button}
 */
var IconButton =
/** @class */
function (_super) {
  tslib_1.__extends(IconButton, _super);

  function IconButton() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    /**
     * Tell BaseComponent to bypass resolution of componentRef.
     */


    _this._skipComponentRefResolution = true;
    return _this;
  }

  IconButton.prototype.render = function () {
    var _a = this.props,
        styles = _a.styles,
        theme = _a.theme;
    return React.createElement(_BaseButton.BaseButton, tslib_1.__assign({}, this.props, {
      variantClassName: "ms-Button--icon",
      styles: (0, _IconButton.getStyles)(theme, styles),
      onRenderText: _Utilities.nullRender,
      onRenderDescription: _Utilities.nullRender
    }));
  };

  IconButton = tslib_1.__decorate([(0, _Utilities.customizable)('IconButton', ['theme', 'styles'], true)], IconButton);
  return IconButton;
}(_Utilities.BaseComponent);

exports.IconButton = IconButton;
},{"tslib":"xgwM","react":"mpTF","../BaseButton":"P2YX","../../../Utilities":"B5nc","./IconButton.styles":"IGnS"}],"qU98":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.PrimaryButton = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Utilities = require("../../../Utilities");

var _DefaultButton = require("../DefaultButton/DefaultButton");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * {@docCategory Button}
 */
var PrimaryButton =
/** @class */
function (_super) {
  tslib_1.__extends(PrimaryButton, _super);

  function PrimaryButton() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    /**
     * Set this BaseComponent._skipComponentRefResolution to true, bypassing resolution of componentRef.
     */


    _this._skipComponentRefResolution = true;
    return _this;
  }

  PrimaryButton.prototype.render = function () {
    return React.createElement(_DefaultButton.DefaultButton, tslib_1.__assign({}, this.props, {
      primary: true,
      onRenderDescription: _Utilities.nullRender
    }));
  };

  PrimaryButton = tslib_1.__decorate([(0, _Utilities.customizable)('PrimaryButton', ['theme', 'styles'], true)], PrimaryButton);
  return PrimaryButton;
}(_Utilities.BaseComponent);

exports.PrimaryButton = PrimaryButton;
},{"tslib":"xgwM","react":"mpTF","../../../Utilities":"B5nc","../DefaultButton/DefaultButton":"GBGS"}],"A0Mc":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Button = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Utilities = require("../../Utilities");

var _Button = require("./Button.types");

var _DefaultButton = require("./DefaultButton/DefaultButton");

var _ActionButton = require("./ActionButton/ActionButton");

var _CompoundButton = require("./CompoundButton/CompoundButton");

var _IconButton = require("./IconButton/IconButton");

var _PrimaryButton = require("./PrimaryButton/PrimaryButton");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * This class is deprecated. Use the individual *Button components instead.
 * @deprecated Use the individual *Button components instead.
 * {@docCategory Button}
 */
var Button =
/** @class */
function (_super) {
  tslib_1.__extends(Button, _super);

  function Button(props) {
    var _this = _super.call(this, props) || this;
    /**
     * Set this BaseComponent._skipComponentRefResolution to true, bypassing resolution of componentRef.
     */


    _this._skipComponentRefResolution = true;
    (0, _Utilities.warn)("The Button component has been deprecated. Use specific variants instead. " + "(PrimaryButton, DefaultButton, IconButton, ActionButton, etc.)");
    return _this;
  }

  Button.prototype.render = function () {
    var props = this.props;

    switch (props.buttonType) {
      case _Button.ButtonType.command:
        return React.createElement(_ActionButton.ActionButton, tslib_1.__assign({}, props));

      case _Button.ButtonType.compound:
        return React.createElement(_CompoundButton.CompoundButton, tslib_1.__assign({}, props));

      case _Button.ButtonType.icon:
        return React.createElement(_IconButton.IconButton, tslib_1.__assign({}, props));

      case _Button.ButtonType.primary:
        return React.createElement(_PrimaryButton.PrimaryButton, tslib_1.__assign({}, props));

      default:
        return React.createElement(_DefaultButton.DefaultButton, tslib_1.__assign({}, props));
    }
  };

  return Button;
}(_Utilities.BaseComponent);

exports.Button = Button;
},{"tslib":"xgwM","react":"mpTF","../../Utilities":"B5nc","./Button.types":"I0pk","./DefaultButton/DefaultButton":"GBGS","./ActionButton/ActionButton":"ix0o","./CompoundButton/CompoundButton":"fezX","./IconButton/IconButton":"b0RM","./PrimaryButton/PrimaryButton":"qU98"}],"eJ1E":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = void 0;

var _Styling = require("../../../Styling");

var _Utilities = require("../../../Utilities");

var _BaseButton = require("../BaseButton.styles");

var _SplitButton = require("../SplitButton/SplitButton.styles");

var getStyles = (0, _Utilities.memoizeFunction)(function (theme, customStyles, focusInset, focusColor) {
  var baseButtonStyles = (0, _BaseButton.getStyles)(theme);
  var baseSplitButtonStyles = (0, _SplitButton.getStyles)(theme);
  var commandButtonHighContrastFocus = {
    left: 4,
    top: 4,
    bottom: 4,
    right: 4,
    border: 'none'
  };
  var commandButtonStyles = {
    root: [(0, _Styling.getFocusStyle)(theme, {
      inset: -1,
      highContrastStyle: commandButtonHighContrastFocus
    }), theme.fonts.medium, {
      minWidth: '40px',
      backgroundColor: theme.palette.neutralLighter,
      color: theme.palette.neutralPrimary,
      padding: '0 4px',
      selectors: (_a = {}, _a[_Styling.HighContrastSelector] = {
        border: 'none'
      }, _a)
    }],
    rootHovered: {
      backgroundColor: theme.palette.neutralLight,
      color: theme.palette.neutralDark,
      selectors: (_b = {}, _b[_Styling.HighContrastSelector] = {
        color: 'Highlight'
      }, _b)
    },
    rootPressed: {
      backgroundColor: theme.palette.neutralQuaternaryAlt,
      color: theme.palette.black
    },
    rootChecked: {
      backgroundColor: theme.palette.neutralQuaternaryAlt,
      color: theme.palette.black
    },
    rootExpanded: {
      backgroundColor: theme.palette.neutralQuaternaryAlt,
      color: theme.palette.black
    },
    rootCheckedHovered: {
      backgroundColor: theme.palette.neutralQuaternary,
      color: theme.palette.black
    },
    // Split button styles
    splitButtonContainer: {
      selectors: (_c = {}, _c[_Styling.HighContrastSelector] = {
        border: 'none'
      }, _c)
    },
    splitButtonDivider: {
      backgroundColor: theme.palette.neutralTertiaryAlt,
      marginTop: 4,
      marginBottom: 4
    },
    splitButtonMenuButton: {
      backgroundColor: theme.palette.neutralLighter,
      color: theme.palette.neutralPrimary,
      selectors: {
        ':hover': {
          backgroundColor: theme.palette.neutralLight,
          color: theme.palette.neutralDark,
          selectors: (_d = {}, _d[_Styling.HighContrastSelector] = {
            color: 'Highlight'
          }, _d)
        }
      }
    },
    splitButtonMenuButtonDisabled: {
      backgroundColor: theme.palette.neutralLighter,
      selectors: {
        ':hover': {
          backgroundColor: theme.palette.neutralLighter
        }
      }
    },
    splitButtonMenuButtonChecked: {
      backgroundColor: theme.palette.neutralQuaternaryAlt,
      color: theme.palette.black,
      selectors: {
        ':hover': {
          backgroundColor: theme.palette.neutralQuaternaryAlt
        }
      }
    },
    splitButtonMenuButtonExpanded: {
      backgroundColor: theme.palette.neutralQuaternaryAlt,
      color: theme.palette.black,
      selectors: {
        ':hover': {
          backgroundColor: theme.palette.neutralQuaternaryAlt
        }
      }
    },
    splitButtonMenuIcon: {
      color: theme.palette.neutralPrimary
    },
    splitButtonMenuIconDisabled: {
      color: theme.palette.neutralTertiary
    },
    label: {
      fontWeight: 'normal' // theme.fontWeights.semibold,

    },
    icon: {
      color: theme.palette.themeDarkAlt
    },
    menuIcon: {
      color: theme.palette.neutralSecondary
    }
  };
  return (0, _Styling.concatStyleSets)(baseButtonStyles, commandButtonStyles, baseSplitButtonStyles, customStyles);

  var _a, _b, _c, _d;
});
exports.getStyles = getStyles;
},{"../../../Styling":"AHeq","../../../Utilities":"B5nc","../BaseButton.styles":"i4XP","../SplitButton/SplitButton.styles":"Zgnh"}],"TUJe":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.CommandBarButton = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _BaseButton = require("../BaseButton");

var _Utilities = require("../../../Utilities");

var _CommandBarButton = require("./CommandBarButton.styles");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * {@docCategory Button}
 */
var CommandBarButton =
/** @class */
function (_super) {
  tslib_1.__extends(CommandBarButton, _super);

  function CommandBarButton() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    /**
     * Tell BaseComponent to bypass resolution of componentRef.
     */


    _this._skipComponentRefResolution = true;
    return _this;
  }

  CommandBarButton.prototype.render = function () {
    var _a = this.props,
        styles = _a.styles,
        theme = _a.theme;
    return React.createElement(_BaseButton.BaseButton, tslib_1.__assign({}, this.props, {
      variantClassName: "ms-Button--commandBar",
      styles: (0, _CommandBarButton.getStyles)(theme, styles),
      onRenderDescription: _Utilities.nullRender
    }));
  };

  CommandBarButton = tslib_1.__decorate([(0, _Utilities.customizable)('CommandBarButton', ['theme', 'styles'], true)], CommandBarButton);
  return CommandBarButton;
}(_Utilities.BaseComponent);

exports.CommandBarButton = CommandBarButton;
},{"tslib":"xgwM","react":"mpTF","../BaseButton":"P2YX","../../../Utilities":"B5nc","./CommandBarButton.styles":"eJ1E"}],"kSwC":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.CommandButton = void 0;

var _ActionButton = require("../ActionButton/ActionButton");

/**
 * {@docCategory Button}
 */
var CommandButton = _ActionButton.ActionButton;
exports.CommandButton = CommandButton;
},{"../ActionButton/ActionButton":"ix0o"}],"d2p7":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = void 0;

var _Styling = require("../../../Styling");

var _Utilities = require("../../../Utilities");

var _BaseButton = require("../BaseButton.styles");

var getStyles = (0, _Utilities.memoizeFunction)(function (theme, customStyles, focusInset, focusColor) {
  var baseButtonStyles = (0, _BaseButton.getStyles)(theme);
  var messageBarButtonStyles = {
    root: [(0, _Styling.getFocusStyle)(theme, {
      inset: 1,
      highContrastStyle: {
        outlineOffset: '-4px',
        outlineColor: 'ActiveBorder'
      },
      borderColor: 'transparent'
    }), {
      backgroundColor: theme.palette.neutralQuaternaryAlt,
      color: theme.palette.neutralPrimary
    }],
    rootHovered: {
      backgroundColor: theme.palette.neutralTertiaryAlt,
      color: theme.palette.neutralDark
    },
    rootPressed: {
      backgroundColor: theme.palette.neutralTertiary,
      color: theme.palette.neutralDark
    }
  };
  return (0, _Styling.concatStyleSets)(baseButtonStyles, messageBarButtonStyles, customStyles);
});
exports.getStyles = getStyles;
},{"../../../Styling":"AHeq","../../../Utilities":"B5nc","../BaseButton.styles":"i4XP"}],"bPTU":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.MessageBarButton = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _DefaultButton = require("../DefaultButton/DefaultButton");

var _Utilities = require("../../../Utilities");

var _MessageBarButton = require("./MessageBarButton.styles");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * {@docCategory MessageBar}
 */
var MessageBarButton =
/** @class */
function (_super) {
  tslib_1.__extends(MessageBarButton, _super);

  function MessageBarButton() {
    return _super !== null && _super.apply(this, arguments) || this;
  }

  MessageBarButton.prototype.render = function () {
    var _a = this.props,
        styles = _a.styles,
        theme = _a.theme;
    return React.createElement(_DefaultButton.DefaultButton, tslib_1.__assign({}, this.props, {
      styles: (0, _MessageBarButton.getStyles)(theme, styles),
      onRenderDescription: _Utilities.nullRender
    }));
  };

  MessageBarButton = tslib_1.__decorate([(0, _Utilities.customizable)('MessageBarButton', ['theme', 'styles'], true)], MessageBarButton);
  return MessageBarButton;
}(_Utilities.BaseComponent);

exports.MessageBarButton = MessageBarButton;
},{"tslib":"xgwM","react":"mpTF","../DefaultButton/DefaultButton":"GBGS","../../../Utilities":"B5nc","./MessageBarButton.styles":"d2p7"}],"EFSA":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _BaseButton = require("./BaseButton");

Object.keys(_BaseButton).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _BaseButton[key];
    }
  });
});

var _Button = require("./Button.types");

Object.keys(_Button).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Button[key];
    }
  });
});

var _Button2 = require("./Button");

Object.keys(_Button2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Button2[key];
    }
  });
});

var _ActionButton = require("./ActionButton/ActionButton");

Object.keys(_ActionButton).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _ActionButton[key];
    }
  });
});

var _CommandBarButton = require("./CommandBarButton/CommandBarButton");

Object.keys(_CommandBarButton).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _CommandBarButton[key];
    }
  });
});

var _CommandButton = require("./CommandButton/CommandButton");

Object.keys(_CommandButton).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _CommandButton[key];
    }
  });
});

var _CompoundButton = require("./CompoundButton/CompoundButton");

Object.keys(_CompoundButton).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _CompoundButton[key];
    }
  });
});

var _DefaultButton = require("./DefaultButton/DefaultButton");

Object.keys(_DefaultButton).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _DefaultButton[key];
    }
  });
});

var _MessageBarButton = require("./MessageBarButton/MessageBarButton");

Object.keys(_MessageBarButton).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _MessageBarButton[key];
    }
  });
});

var _PrimaryButton = require("./PrimaryButton/PrimaryButton");

Object.keys(_PrimaryButton).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _PrimaryButton[key];
    }
  });
});

var _IconButton = require("./IconButton/IconButton");

Object.keys(_IconButton).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _IconButton[key];
    }
  });
});
},{"./BaseButton":"P2YX","./Button.types":"I0pk","./Button":"A0Mc","./ActionButton/ActionButton":"ix0o","./CommandBarButton/CommandBarButton":"TUJe","./CommandButton/CommandButton":"kSwC","./CompoundButton/CompoundButton":"fezX","./DefaultButton/DefaultButton":"GBGS","./MessageBarButton/MessageBarButton":"bPTU","./PrimaryButton/PrimaryButton":"qU98","./IconButton/IconButton":"b0RM"}],"PAcS":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.LabelBase = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Utilities = require("../../Utilities");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var getClassNames = (0, _Utilities.classNamesFunction)({
  disableCaching: true
});

var LabelBase =
/** @class */
function (_super) {
  tslib_1.__extends(LabelBase, _super);

  function LabelBase() {
    return _super !== null && _super.apply(this, arguments) || this;
  }

  LabelBase.prototype.render = function () {
    var _a = this.props,
        _b = _a.as,
        RootType = _b === void 0 ? 'label' : _b,
        children = _a.children,
        className = _a.className,
        disabled = _a.disabled,
        styles = _a.styles,
        required = _a.required,
        theme = _a.theme;
    var classNames = getClassNames(styles, {
      className: className,
      disabled: disabled,
      required: required,
      theme: theme
    });
    return React.createElement(RootType, tslib_1.__assign({}, (0, _Utilities.getNativeProps)(this.props, _Utilities.divProperties), {
      className: classNames.root
    }), children);
  };

  return LabelBase;
}(React.Component);

exports.LabelBase = LabelBase;
},{"tslib":"xgwM","react":"mpTF","../../Utilities":"B5nc"}],"X9oH":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = void 0;

var _Styling = require("../../Styling");

var getStyles = function (props) {
  var theme = props.theme,
      className = props.className,
      disabled = props.disabled,
      required = props.required;
  return {
    root: ['ms-Label', theme.fonts.medium, {
      color: theme.semanticColors.bodyText,
      boxSizing: 'border-box',
      boxShadow: 'none',
      margin: 0,
      display: 'block',
      padding: '5px 0',
      wordWrap: 'break-word',
      overflowWrap: 'break-word'
    }, disabled && {
      color: theme.semanticColors.disabledBodyText,
      selectors: (_a = {}, _a[_Styling.HighContrastSelector] = {
        color: 'GrayText'
      }, _a)
    }, required && {
      selectors: {
        '::after': {
          content: "' *'",
          color: theme.semanticColors.errorText,
          paddingRight: 12
        }
      }
    }, className]
  };

  var _a;
};

exports.getStyles = getStyles;
},{"../../Styling":"AHeq"}],"keTR":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Label = void 0;

var _Utilities = require("../../Utilities");

var _Label = require("./Label.base");

var _Label2 = require("./Label.styles");

var Label = (0, _Utilities.styled)(_Label.LabelBase, _Label2.getStyles, undefined, {
  scope: 'Label'
});
exports.Label = Label;
},{"../../Utilities":"B5nc","./Label.base":"PAcS","./Label.styles":"X9oH"}],"MYw9":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _Label = require("./Label.base");

Object.keys(_Label).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Label[key];
    }
  });
});

var _Label2 = require("./Label");

Object.keys(_Label2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Label2[key];
    }
  });
});
},{"./Label.base":"PAcS","./Label":"keTR"}],"RcoC":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _index = require("./components/Label/index");

Object.keys(_index).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index[key];
    }
  });
});
},{"./components/Label/index":"MYw9"}],"nFNq":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _Image = require("./Image");

Object.keys(_Image).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Image[key];
    }
  });
});

var _Image2 = require("./Image.base");

Object.keys(_Image2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Image2[key];
    }
  });
});

var _Image3 = require("./Image.types");

Object.keys(_Image3).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Image3[key];
    }
  });
});
},{"./Image":"NS74","./Image.base":"uqL9","./Image.types":"BxHs"}],"tPXr":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _index = require("./components/Image/index");

Object.keys(_index).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index[key];
    }
  });
});
},{"./components/Image/index":"nFNq"}],"j934":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ChoiceGroupOptionBase = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Image = require("../../../Image");

var _Icon = require("../../../Icon");

var _Utilities = require("../../../Utilities");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var getClassNames = (0, _Utilities.classNamesFunction)();
/**
 * {@docCategory ChoiceGroup}
 */

var ChoiceGroupOptionBase =
/** @class */
function (_super) {
  tslib_1.__extends(ChoiceGroupOptionBase, _super);

  function ChoiceGroupOptionBase() {
    var _this = _super !== null && _super.apply(this, arguments) || this;

    _this._inputElement = React.createRef();

    _this._onRenderField = function (props) {
      var _a = props.onRenderLabel,
          onRenderLabel = _a === void 0 ? _this._onRenderLabel : _a,
          id = props.id,
          imageSrc = props.imageSrc,
          imageAlt = props.imageAlt,
          selectedImageSrc = props.selectedImageSrc,
          iconProps = props.iconProps;
      var imageSize = props.imageSize ? props.imageSize : {
        width: 32,
        height: 32
      };
      return React.createElement("label", {
        htmlFor: id,
        className: _this._classNames.field
      }, imageSrc && React.createElement("div", {
        className: _this._classNames.innerField,
        style: {
          height: imageSize.height,
          width: imageSize.width
        }
      }, React.createElement("div", {
        className: _this._classNames.imageWrapper
      }, React.createElement(_Image.Image, {
        src: imageSrc,
        alt: imageAlt ? imageAlt : '',
        width: imageSize.width,
        height: imageSize.height
      })), React.createElement("div", {
        className: _this._classNames.selectedImageWrapper
      }, React.createElement(_Image.Image, {
        src: selectedImageSrc,
        alt: imageAlt ? imageAlt : '',
        width: imageSize.width,
        height: imageSize.height
      }))), iconProps ? React.createElement("div", {
        className: _this._classNames.innerField
      }, React.createElement("div", {
        className: _this._classNames.iconWrapper
      }, React.createElement(_Icon.Icon, tslib_1.__assign({}, iconProps)))) : null, imageSrc || iconProps ? React.createElement("div", {
        className: _this._classNames.labelWrapper,
        style: {
          maxWidth: imageSize.width * 2
        }
      }, onRenderLabel(props)) : onRenderLabel(props));
    };

    _this._onRenderLabel = function (props) {
      return React.createElement("span", {
        id: props.labelId,
        className: "ms-ChoiceFieldLabel"
      }, props.text);
    };

    return _this;
  }

  ChoiceGroupOptionBase.prototype.render = function () {
    var _a = this.props,
        ariaLabel = _a.ariaLabel,
        focused = _a.focused,
        required = _a.required,
        theme = _a.theme,
        iconProps = _a.iconProps,
        imageSrc = _a.imageSrc,
        _b = _a.imageSize,
        imageSize = _b === void 0 ? {
      width: 32,
      height: 32
    } : _b,
        disabled = _a.disabled,
        checked = _a.checked,
        id = _a.id,
        styles = _a.styles,
        name = _a.name,
        _c = _a.onRenderField,
        onRenderField = _c === void 0 ? this._onRenderField : _c,
        rest = tslib_1.__rest(_a, ["ariaLabel", "focused", "required", "theme", "iconProps", "imageSrc", "imageSize", "disabled", "checked", "id", "styles", "name", "onRenderField"]);

    this._classNames = getClassNames(styles, {
      theme: theme,
      hasIcon: !!iconProps,
      hasImage: !!imageSrc,
      checked: checked,
      disabled: disabled,
      imageIsLarge: !!imageSrc && (imageSize.width > 71 || imageSize.height > 71),
      focused: focused
    });

    var _d = (0, _Utilities.getNativeProps)(rest, _Utilities.inputProperties),
        className = _d.className,
        nativeProps = tslib_1.__rest(_d, ["className"]);

    return React.createElement("div", {
      className: this._classNames.root
    }, React.createElement("div", {
      className: this._classNames.choiceFieldWrapper
    }, React.createElement("input", tslib_1.__assign({
      "aria-label": ariaLabel ? ariaLabel : undefined,
      ref: this._inputElement,
      id: id,
      className: (0, _Utilities.css)(this._classNames.input, className),
      type: "radio",
      name: name,
      disabled: disabled,
      checked: checked,
      required: required,
      onChange: this._onChange.bind(this, this.props),
      onFocus: this._onFocus.bind(this, this.props),
      onBlur: this._onBlur.bind(this, this.props)
    }, nativeProps)), onRenderField(this.props, this._onRenderField)));
  };

  ChoiceGroupOptionBase.prototype._onChange = function (props, evt) {
    var onChange = props.onChange;

    if (onChange) {
      onChange(evt, props);
    }
  };

  ChoiceGroupOptionBase.prototype._onBlur = function (props, evt) {
    var onBlur = props.onBlur;

    if (onBlur) {
      onBlur(evt, props);
    }
  };

  ChoiceGroupOptionBase.prototype._onFocus = function (props, evt) {
    var onFocus = props.onFocus;

    if (onFocus) {
      onFocus(evt, props);
    }
  };

  return ChoiceGroupOptionBase;
}(React.Component);

exports.ChoiceGroupOptionBase = ChoiceGroupOptionBase;
},{"tslib":"xgwM","react":"mpTF","../../../Image":"tPXr","../../../Icon":"s5pL","../../../Utilities":"B5nc"}],"n3y2":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = void 0;

var _Styling = require("../../../Styling");

var _Utilities = require("../../../Utilities");

var GlobalClassNames = {
  root: 'ms-ChoiceField',
  choiceFieldWrapper: 'ms-ChoiceField-wrapper',
  input: 'ms-ChoiceField-input',
  field: 'ms-ChoiceField-field',
  innerField: 'ms-ChoiceField-innerField',
  imageWrapper: 'ms-ChoiceField-imageWrapper',
  iconWrapper: 'ms-ChoiceField-iconWrapper',
  labelWrapper: 'ms-ChoiceField-labelWrapper',
  checked: 'is-checked'
};
var labelWrapperLineHeight = 15;
var iconSize = 32;
var choiceFieldSize = 20;
var choiceFieldTransitionDuration = '200ms';
var choiceFieldTransitionTiming = 'cubic-bezier(.4, 0, .23, 1)';
var radioButtonSpacing = 3;
var radioButtonInnerSize = 5;

function getChoiceGroupFocusStyle(palette, hasIconOrImage) {
  return ['is-inFocus', {
    selectors: (_a = {}, _a["." + _Utilities.IsFocusVisibleClassName + " &"] = {
      position: 'relative',
      outline: 'transparent',
      selectors: {
        '::-moz-focus-inner': {
          border: 0
        },
        ':after': {
          content: '""',
          top: -2,
          right: -2,
          bottom: -2,
          left: -2,
          pointerEvents: 'none',
          border: '1px solid ' + (hasIconOrImage ? palette.neutralSecondary : palette.neutralPrimary),
          position: 'absolute',
          selectors: (_b = {}, _b[_Styling.HighContrastSelector] = {
            borderColor: 'WindowText',
            borderWidth: hasIconOrImage ? 1 : 2
          }, _b)
        }
      }
    }, _a)
  }];

  var _a, _b;
}

function getImageWrapperStyle(isSelectedImageWrapper, className, checked) {
  return [className, {
    paddingBottom: 2,
    transitionProperty: 'opacity',
    transitionDuration: choiceFieldTransitionDuration,
    transitionTimingFunction: 'ease',
    selectors: {
      '.ms-Image': {
        display: 'inline-block',
        borderStyle: 'none'
      }
    }
  }, (checked ? !isSelectedImageWrapper : isSelectedImageWrapper) && ['is-hidden', {
    position: 'absolute',
    left: 0,
    top: 0,
    width: '100%',
    height: '100%',
    overflow: 'hidden',
    opacity: 0
  }]];
}

var getStyles = function (props) {
  var theme = props.theme,
      hasIcon = props.hasIcon,
      hasImage = props.hasImage,
      checked = props.checked,
      disabled = props.disabled,
      imageIsLarge = props.imageIsLarge,
      focused = props.focused;
  var palette = theme.palette,
      semanticColors = theme.semanticColors;
  var classNames = (0, _Styling.getGlobalClassNames)(GlobalClassNames, theme);
  var fieldHoverOrFocusProperties = {
    selectors: {
      '.ms-ChoiceFieldLabel': {
        color: semanticColors.bodyTextChecked
      },
      ':before': {
        borderColor: checked ? semanticColors.inputBackgroundCheckedHovered : semanticColors.inputBorderHovered
      }
    }
  };
  var enabledFieldWithImageHoverOrFocusProperties = {
    borderColor: checked ? palette.themeDark : palette.neutralTertiaryAlt,
    selectors: {
      ':before': {
        opacity: 1,
        borderColor: checked ? palette.themeDark : semanticColors.inputBorderHovered
      }
    }
  };
  var circleAreaProperties = [{
    content: '""',
    display: 'inline-block',
    backgroundColor: semanticColors.bodyBackground,
    borderWidth: 1,
    borderStyle: 'solid',
    borderColor: semanticColors.smallInputBorder,
    width: choiceFieldSize,
    height: choiceFieldSize,
    fontWeight: 'normal',
    position: 'absolute',
    top: 0,
    left: 0,
    boxSizing: 'border-box',
    transitionProperty: 'border-color',
    transitionDuration: choiceFieldTransitionDuration,
    transitionTimingFunction: choiceFieldTransitionTiming,
    borderRadius: '50%'
  }, disabled && {
    backgroundColor: checked ? semanticColors.bodyBackground : semanticColors.disabledText,
    borderColor: semanticColors.disabledText,
    selectors: (_a = {}, _a[_Styling.HighContrastSelector] = {
      color: 'GrayText'
    }, _a)
  }, checked && {
    borderWidth: 1,
    borderStyle: 'solid',
    borderColor: disabled ? semanticColors.disabledText : semanticColors.inputBackgroundChecked,
    selectors: (_b = {}, _b[_Styling.HighContrastSelector] = {
      borderColor: 'Highlight'
    }, _b)
  }, (hasIcon || hasImage) && {
    top: radioButtonSpacing,
    right: radioButtonSpacing,
    left: 'auto',
    opacity: !disabled && checked ? 1 : 0
  }];
  var dotAreaProperties = [{
    content: '""',
    width: 0,
    height: 0,
    borderRadius: '50%',
    position: 'absolute',
    left: choiceFieldSize / 2,
    right: 0,
    transitionProperty: 'border-width',
    transitionDuration: choiceFieldTransitionDuration,
    transitionTimingFunction: choiceFieldTransitionTiming,
    boxSizing: 'border-box'
  }, checked && {
    borderWidth: 5,
    borderStyle: 'solid',
    borderColor: disabled ? semanticColors.disabledText : semanticColors.inputBackgroundChecked,
    left: 5,
    top: 5,
    width: 10,
    height: 10,
    selectors: (_c = {}, _c[_Styling.HighContrastSelector] = {
      borderColor: 'Highlight'
    }, _c)
  }, checked && (hasIcon || hasImage) && {
    top: radioButtonSpacing + radioButtonInnerSize,
    right: radioButtonSpacing + radioButtonInnerSize,
    left: 'auto' // To reset the value of 'left' to its default value, so that 'right' works

  }];
  return {
    root: [classNames.root, theme.fonts.medium, {
      display: 'flex',
      alignItems: 'center',
      boxSizing: 'border-box',
      color: semanticColors.bodyText,
      fontSize: _Styling.FontSizes.medium,
      fontWeight: _Styling.FontWeights.regular,
      minHeight: 26,
      border: 'none',
      position: 'relative',
      marginTop: 8,
      selectors: {
        '.ms-ChoiceFieldLabel': {
          fontSize: _Styling.FontSizes.medium,
          display: 'inline-block'
        }
      }
    }, !hasIcon && !hasImage && {
      selectors: {
        '.ms-ChoiceFieldLabel': {
          paddingLeft: '26px'
        }
      }
    }, hasImage && 'ms-ChoiceField--image', hasIcon && 'ms-ChoiceField--icon', (hasIcon || hasImage) && {
      display: 'inline-flex',
      fontSize: 0,
      margin: '0 4px 4px 0',
      paddingLeft: 0,
      backgroundColor: palette.neutralLighter,
      height: '100%'
    }],
    choiceFieldWrapper: [classNames.choiceFieldWrapper, focused && getChoiceGroupFocusStyle(palette, hasIcon || hasImage)],
    // The hidden input
    input: [classNames.input, {
      position: 'absolute',
      opacity: 0,
      top: 0,
      right: 0,
      width: '100%',
      height: '100%',
      margin: 0
    }],
    field: [classNames.field, checked && classNames.checked, {
      display: 'inline-block',
      cursor: 'pointer',
      marginTop: 0,
      position: 'relative',
      verticalAlign: 'top',
      userSelect: 'none',
      minHeight: 20,
      selectors: {
        ':hover': !disabled && fieldHoverOrFocusProperties,
        ':focus': !disabled && fieldHoverOrFocusProperties,
        // The circle
        ':before': circleAreaProperties,
        // The dot
        ':after': dotAreaProperties
      }
    }, hasIcon && 'ms-ChoiceField--icon', hasImage && 'ms-ChoiceField-field--image', (hasIcon || hasImage) && {
      boxSizing: 'content-box',
      cursor: 'pointer',
      paddingTop: 22,
      margin: 0,
      textAlign: 'center',
      transitionProperty: 'all',
      transitionDuration: choiceFieldTransitionDuration,
      transitionTimingFunction: 'ease',
      border: '2px solid transparent',
      justifyContent: 'center',
      alignItems: 'center',
      display: 'flex',
      flexDirection: 'column'
    }, checked && {
      borderColor: palette.themePrimary
    }, (hasIcon || hasImage) && !disabled && {
      selectors: {
        ':hover': enabledFieldWithImageHoverOrFocusProperties,
        ':focus': enabledFieldWithImageHoverOrFocusProperties
      }
    }, disabled && {
      cursor: 'default',
      selectors: (_d = {
        '.ms-ChoiceFieldLabel': {
          color: semanticColors.disabledBodyText
        }
      }, _d[_Styling.HighContrastSelector] = {
        color: 'GrayText'
      }, _d)
    }],
    innerField: [classNames.innerField, (hasIcon || hasImage) && {
      position: 'relative',
      display: 'inline-block',
      paddingLeft: 30,
      paddingRight: 30
    }, (hasIcon || hasImage) && imageIsLarge && {
      paddingLeft: 24,
      paddingRight: 24
    }, (hasIcon || hasImage) && disabled && {
      opacity: 0.25,
      selectors: (_e = {}, _e[_Styling.HighContrastSelector] = {
        color: 'GrayText',
        opacity: 1
      }, _e)
    }],
    imageWrapper: getImageWrapperStyle(false, classNames.imageWrapper, checked),
    selectedImageWrapper: getImageWrapperStyle(true, classNames.imageWrapper, checked),
    iconWrapper: [classNames.iconWrapper, {
      fontSize: iconSize,
      lineHeight: iconSize,
      height: iconSize
    }],
    labelWrapper: [classNames.labelWrapper, (hasIcon || hasImage) && {
      display: 'block',
      position: 'relative',
      margin: '4px 8px',
      height: labelWrapperLineHeight * 2,
      lineHeight: labelWrapperLineHeight,
      overflow: 'hidden',
      whiteSpace: 'pre-wrap',
      textOverflow: 'ellipsis',
      fontSize: _Styling.FontSizes.medium,
      fontWeight: _Styling.FontWeights.regular
    }]
  };

  var _a, _b, _c, _d, _e;
};

exports.getStyles = getStyles;
},{"../../../Styling":"AHeq","../../../Utilities":"B5nc"}],"bWUu":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ChoiceGroupOption = void 0;

var _Utilities = require("../../../Utilities");

var _ChoiceGroupOption = require("./ChoiceGroupOption.base");

var _ChoiceGroupOption2 = require("./ChoiceGroupOption.styles");

var ChoiceGroupOption = (0, _Utilities.styled)(_ChoiceGroupOption.ChoiceGroupOptionBase, _ChoiceGroupOption2.getStyles, undefined, {
  scope: 'ChoiceGroupOption'
});
exports.ChoiceGroupOption = ChoiceGroupOption;
},{"../../../Utilities":"B5nc","./ChoiceGroupOption.base":"j934","./ChoiceGroupOption.styles":"n3y2"}],"akuc":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _ChoiceGroupOption = require("./ChoiceGroupOption");

Object.keys(_ChoiceGroupOption).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _ChoiceGroupOption[key];
    }
  });
});
},{"./ChoiceGroupOption":"bWUu"}],"qJ3F":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ChoiceGroupBase = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Label = require("../../Label");

var _Utilities = require("../../Utilities");

var _index = require("./ChoiceGroupOption/index");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var getClassNames = (0, _Utilities.classNamesFunction)();
/**
 * {@docCategory ChoiceGroup}
 */

var ChoiceGroupBase =
/** @class */
function (_super) {
  tslib_1.__extends(ChoiceGroupBase, _super);

  function ChoiceGroupBase(props) {
    var _this = _super.call(this, props) || this;

    _this._inputElement = React.createRef();
    _this.focusedVars = {};
    _this.changedVars = {};

    _this._onFocus = function (key) {
      return _this.focusedVars[key] ? _this.focusedVars[key] : _this.focusedVars[key] = function (ev, option) {
        _this.setState({
          keyFocused: key,
          keyChecked: _this.state.keyChecked
        });
      };
    };

    _this._onBlur = function (ev, option) {
      _this.setState({
        keyFocused: undefined,
        keyChecked: _this.state.keyChecked
      });
    };

    _this._onChange = function (key) {
      return _this.changedVars[key] ? _this.changedVars[key] : _this.changedVars[key] = function (evt, option) {
        var _a = _this.props,
            onChanged = _a.onChanged,
            onChange = _a.onChange,
            selectedKey = _a.selectedKey,
            _b = _a.options,
            options = _b === void 0 ? [] : _b; // Only manage state in uncontrolled scenarios.

        if (selectedKey === undefined) {
          _this.setState({
            keyChecked: key
          });
        }

        var originalOption = (0, _Utilities.find)(options, function (value) {
          return value.key === key;
        }); // TODO: onChanged deprecated, remove else if after 07/17/2017 when onChanged has been removed.

        if (onChange) {
          onChange(evt, originalOption);
        } else if (onChanged) {
          onChanged(originalOption);
        }
      };
    };

    (0, _Utilities.initializeComponentRef)(_this);

    if ("production" !== 'production') {
      (0, _Utilities.warnDeprecations)('ChoiceGroup', props, {
        onChanged: 'onChange'
      });
      (0, _Utilities.warnMutuallyExclusive)('ChoiceGroup', props, {
        selectedKey: 'defaultSelectedKey'
      });
    }

    var validDefaultSelectedKey = !!props.options && props.options.some(function (option) {
      return option.key === props.defaultSelectedKey;
    });
    _this.state = {
      keyChecked: props.defaultSelectedKey === undefined || !validDefaultSelectedKey ? _this._getKeyChecked(props) : props.defaultSelectedKey,
      keyFocused: undefined
    };
    _this._id = (0, _Utilities.getId)('ChoiceGroup');
    _this._labelId = (0, _Utilities.getId)('ChoiceGroupLabel');
    return _this;
  }

  Object.defineProperty(ChoiceGroupBase.prototype, "checkedOption", {
    /**
     * Gets the current checked option.
     */
    get: function () {
      var _a = this.props.options,
          options = _a === void 0 ? [] : _a;
      var key = this.state.keyChecked;
      return (0, _Utilities.find)(options, function (value) {
        return value.key === key;
      });
    },
    enumerable: true,
    configurable: true
  });

  ChoiceGroupBase.prototype.componentWillReceiveProps = function (newProps) {
    var newKeyChecked = this._getKeyChecked(newProps);

    var oldKeyChecked = this._getKeyChecked(this.props);

    if (newKeyChecked !== oldKeyChecked) {
      this.setState({
        keyChecked: newKeyChecked
      });
    }
  };

  ChoiceGroupBase.prototype.render = function () {
    var _this = this;

    var _a = this.props,
        className = _a.className,
        theme = _a.theme,
        styles = _a.styles,
        options = _a.options,
        label = _a.label,
        required = _a.required,
        disabled = _a.disabled,
        name = _a.name,
        role = _a.role;
    var _b = this.state,
        keyChecked = _b.keyChecked,
        keyFocused = _b.keyFocused;
    var divProps = (0, _Utilities.getNativeProps)(this.props, _Utilities.divProperties, ['onChange', 'className', 'required']);
    var classNames = getClassNames(styles, {
      theme: theme,
      className: className,
      optionsContainIconOrImage: options.some(function (option) {
        return Boolean(option.iconProps || option.imageSrc);
      })
    });
    var ariaLabelledBy = this.props.ariaLabelledBy ? this.props.ariaLabelledBy : label ? this._id + '-label' : this.props['aria-labelledby'];
    return React.createElement("div", tslib_1.__assign({
      role: role,
      className: classNames.applicationRole
    }, divProps), React.createElement("div", tslib_1.__assign({
      className: classNames.root,
      role: "radiogroup"
    }, ariaLabelledBy && {
      'aria-labelledby': ariaLabelledBy
    }), label && React.createElement(_Label.Label, {
      className: classNames.label,
      required: required,
      id: this._id + '-label'
    }, label), React.createElement("div", {
      className: classNames.flexContainer
    }, options.map(function (option) {
      var innerOptionProps = tslib_1.__assign({}, option, {
        focused: option.key === keyFocused,
        checked: option.key === keyChecked,
        disabled: option.disabled || disabled,
        id: _this._id + "-" + option.key,
        labelId: _this._labelId + "-" + option.key,
        name: name || _this._id,
        required: required
      });

      return React.createElement(_index.ChoiceGroupOption, tslib_1.__assign({
        key: option.key,
        onBlur: _this._onBlur,
        onFocus: _this._onFocus(option.key),
        onChange: _this._onChange(option.key)
      }, innerOptionProps));
    }))));
  };

  ChoiceGroupBase.prototype.focus = function () {
    var options = this.props.options;

    if (options) {
      for (var _i = 0, options_1 = options; _i < options_1.length; _i++) {
        var option = options_1[_i];
        var elementToFocus = document.getElementById(this._id + "-" + option.key);

        if (elementToFocus && elementToFocus.getAttribute('data-is-focusable') === 'true') {
          elementToFocus.focus(); // focus on checked or default focusable key

          return;
        }
      }
    }

    if (this._inputElement.current) {
      this._inputElement.current.focus();
    }
  };

  ChoiceGroupBase.prototype._getKeyChecked = function (props) {
    if (props.selectedKey !== undefined) {
      return props.selectedKey;
    }

    var _a = props.options,
        options = _a === void 0 ? [] : _a;
    var optionsChecked = options.filter(function (option) {
      return option.checked;
    });

    if (optionsChecked.length === 0) {
      return undefined;
    } else {
      return optionsChecked[0].key;
    }
  };

  ChoiceGroupBase.defaultProps = {
    options: []
  };
  return ChoiceGroupBase;
}(React.Component);

exports.ChoiceGroupBase = ChoiceGroupBase;
},{"tslib":"xgwM","react":"mpTF","../../Label":"RcoC","../../Utilities":"B5nc","./ChoiceGroupOption/index":"akuc"}],"QO5L":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = void 0;

var _Styling = require("../../Styling");

var GlobalClassNames = {
  root: 'ms-ChoiceFieldGroup',
  flexContainer: 'ms-ChoiceFieldGroup-flexContainer'
};

var getStyles = function (props) {
  var className = props.className,
      optionsContainIconOrImage = props.optionsContainIconOrImage,
      theme = props.theme;
  var classNames = (0, _Styling.getGlobalClassNames)(GlobalClassNames, theme);
  return {
    applicationRole: className,
    root: [classNames.root, theme.fonts.medium, {
      display: 'block'
    }],
    flexContainer: [classNames.flexContainer, optionsContainIconOrImage && {
      display: 'flex',
      flexDirection: 'row',
      flexWrap: 'wrap'
    }]
  };
};

exports.getStyles = getStyles;
},{"../../Styling":"AHeq"}],"GJxX":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ChoiceGroup = void 0;

var _Utilities = require("../../Utilities");

var _ChoiceGroup = require("./ChoiceGroup.base");

var _ChoiceGroup2 = require("./ChoiceGroup.styles");

var ChoiceGroup = (0, _Utilities.styled)(_ChoiceGroup.ChoiceGroupBase, _ChoiceGroup2.getStyles, undefined, {
  scope: 'ChoiceGroup'
});
exports.ChoiceGroup = ChoiceGroup;
},{"../../Utilities":"B5nc","./ChoiceGroup.base":"qJ3F","./ChoiceGroup.styles":"QO5L"}],"Tgfa":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _ChoiceGroup = require("./ChoiceGroup");

Object.keys(_ChoiceGroup).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _ChoiceGroup[key];
    }
  });
});

var _ChoiceGroup2 = require("./ChoiceGroup.base");

Object.keys(_ChoiceGroup2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _ChoiceGroup2[key];
    }
  });
});

var _index = require("./ChoiceGroupOption/index");

Object.keys(_index).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index[key];
    }
  });
});
},{"./ChoiceGroup":"GJxX","./ChoiceGroup.base":"qJ3F","./ChoiceGroupOption/index":"akuc"}],"UZTq":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _index = require("./components/ChoiceGroup/index");

Object.keys(_index).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index[key];
    }
  });
});
},{"./components/ChoiceGroup/index":"Tgfa"}],"yh6c":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.SelectableOptionMenuItemType = void 0;
var SelectableOptionMenuItemType;
exports.SelectableOptionMenuItemType = SelectableOptionMenuItemType;

(function (SelectableOptionMenuItemType) {
  SelectableOptionMenuItemType[SelectableOptionMenuItemType["Normal"] = 0] = "Normal";
  SelectableOptionMenuItemType[SelectableOptionMenuItemType["Divider"] = 1] = "Divider";
  SelectableOptionMenuItemType[SelectableOptionMenuItemType["Header"] = 2] = "Header";
})(SelectableOptionMenuItemType || (exports.SelectableOptionMenuItemType = SelectableOptionMenuItemType = {}));
},{}],"fwVR":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.BaseAutoFill = exports.Autofill = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Utilities = require("../../Utilities");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var SELECTION_FORWARD = 'forward';
var SELECTION_BACKWARD = 'backward';
/**
 * {@docCategory Autofill}
 */

var Autofill =
/** @class */
function (_super) {
  tslib_1.__extends(Autofill, _super);

  function Autofill(props) {
    var _this = _super.call(this, props) || this;

    _this._inputElement = React.createRef();
    _this._autoFillEnabled = true; // Composition events are used when the character/text requires several keystrokes to be completed.
    // Some examples of this are mobile text input and languages like Japanese or Arabic.
    // Find out more at https://developer.mozilla.org/en-US/docs/Web/Events/compositionstart

    _this._onCompositionStart = function (ev) {
      _this._autoFillEnabled = false;
    }; // Composition events are used when the character/text requires several keystrokes to be completed.
    // Some examples of this are mobile text input and languages like Japanese or Arabic.
    // Find out more at https://developer.mozilla.org/en-US/docs/Web/Events/compositionstart


    _this._onCompositionEnd = function (ev) {
      var inputValue = _this._getCurrentInputValue();

      _this._tryEnableAutofill(inputValue, _this.value, false, true); // Korean characters typing issue has been addressed in React 16.5
      // TODO: revert back below lines when we upgrade to React 16.5
      // Find out at https://github.com/facebook/react/pull/12563/commits/06524c6c542c571705c0fd7df61ac48f3d5ce244


      var isKorean = ev.nativeEvent.locale === 'ko'; // Due to timing, this needs to be async, otherwise no text will be selected.

      _this._async.setTimeout(function () {
        // Call getCurrentInputValue here again since there can be a race condition where this value has changed during the async call
        var updatedInputValue = isKorean ? _this.value : _this._getCurrentInputValue();

        _this._updateValue(updatedInputValue);
      }, 0);
    };

    _this._onClick = function () {
      if (_this._value && _this._value !== '' && _this._autoFillEnabled) {
        _this._autoFillEnabled = false;
      }
    };

    _this._onKeyDown = function (ev) {
      if (_this.props.onKeyDown) {
        _this.props.onKeyDown(ev);
      } // If the event is actively being composed, then don't alert autofill.
      // Right now typing does not have isComposing, once that has been fixed any should be removed.


      if (!ev.nativeEvent.isComposing) {
        switch (ev.which) {
          case _Utilities.KeyCodes.backspace:
            _this._autoFillEnabled = false;
            break;

          case _Utilities.KeyCodes.left:
          case _Utilities.KeyCodes.right:
            if (_this._autoFillEnabled) {
              _this._value = _this.state.displayValue;
              _this._autoFillEnabled = false;
            }

            break;

          default:
            if (!_this._autoFillEnabled) {
              if (_this.props.enableAutofillOnKeyPress.indexOf(ev.which) !== -1) {
                _this._autoFillEnabled = true;
              }
            }

            break;
        }
      }
    };

    _this._onInputChanged = function (ev) {
      var value = _this._getCurrentInputValue(ev); // Right now typing does not have isComposing, once that has been fixed any should be removed.


      _this._tryEnableAutofill(value, _this._value, ev.nativeEvent.isComposing);

      _this._updateValue(value);
    };

    _this._onChanged = function () {
      // Swallow this event, we don't care about it
      // We must provide it because React PropTypes marks it as required, but onInput serves the correct purpose
      return;
    };
    /**
     * Updates the current input value as well as getting a new display value.
     * @param newValue - The new value from the input
     */


    _this._updateValue = function (newValue) {
      // Only proceed if the value is nonempty and is different from the old value
      // This is to work around the fact that, in IE 11, inputs with a placeholder fire an onInput event on focus
      if (!newValue && newValue === _this._value) {
        return;
      }

      _this._value = _this.props.onInputChange ? _this.props.onInputChange(newValue) : newValue;

      _this.setState({
        displayValue: _this._getDisplayValue(_this._value, _this.props.suggestedDisplayValue)
      }, function () {
        return _this._notifyInputChange(_this._value);
      });
    };

    _this._value = props.defaultVisibleValue || '';
    _this.state = {
      displayValue: props.defaultVisibleValue || ''
    };
    return _this;
  }

  Object.defineProperty(Autofill.prototype, "cursorLocation", {
    get: function () {
      if (this._inputElement.current) {
        var inputElement = this._inputElement.current;

        if (inputElement.selectionDirection !== SELECTION_FORWARD) {
          return inputElement.selectionEnd;
        } else {
          return inputElement.selectionStart;
        }
      } else {
        return -1;
      }
    },
    enumerable: true,
    configurable: true
  });
  Object.defineProperty(Autofill.prototype, "isValueSelected", {
    get: function () {
      return Boolean(this.inputElement && this.inputElement.selectionStart !== this.inputElement.selectionEnd);
    },
    enumerable: true,
    configurable: true
  });
  Object.defineProperty(Autofill.prototype, "value", {
    get: function () {
      return this._value;
    },
    enumerable: true,
    configurable: true
  });
  Object.defineProperty(Autofill.prototype, "selectionStart", {
    get: function () {
      return this._inputElement.current ? this._inputElement.current.selectionStart : -1;
    },
    enumerable: true,
    configurable: true
  });
  Object.defineProperty(Autofill.prototype, "selectionEnd", {
    get: function () {
      return this._inputElement.current ? this._inputElement.current.selectionEnd : -1;
    },
    enumerable: true,
    configurable: true
  });
  Object.defineProperty(Autofill.prototype, "inputElement", {
    get: function () {
      return this._inputElement.current;
    },
    enumerable: true,
    configurable: true
  });

  Autofill.prototype.componentWillReceiveProps = function (nextProps) {
    var newValue;

    if (this.props.updateValueInWillReceiveProps) {
      newValue = this.props.updateValueInWillReceiveProps();
    }

    newValue = this._getDisplayValue(newValue ? newValue : this._value, nextProps.suggestedDisplayValue);

    if (typeof newValue === 'string') {
      this.setState({
        displayValue: newValue
      });
    }
  };

  Autofill.prototype.componentDidUpdate = function () {
    var value = this._value;
    var _a = this.props,
        suggestedDisplayValue = _a.suggestedDisplayValue,
        shouldSelectFullInputValueInComponentDidUpdate = _a.shouldSelectFullInputValueInComponentDidUpdate,
        preventValueSelection = _a.preventValueSelection;
    var differenceIndex = 0;

    if (preventValueSelection) {
      return;
    }

    if (this._autoFillEnabled && value && suggestedDisplayValue && this._doesTextStartWith(suggestedDisplayValue, value)) {
      var shouldSelectFullRange = false;

      if (shouldSelectFullInputValueInComponentDidUpdate) {
        shouldSelectFullRange = shouldSelectFullInputValueInComponentDidUpdate();
      }

      if (shouldSelectFullRange && this._inputElement.current) {
        this._inputElement.current.setSelectionRange(0, suggestedDisplayValue.length, SELECTION_BACKWARD);
      } else {
        while (differenceIndex < value.length && value[differenceIndex].toLocaleLowerCase() === suggestedDisplayValue[differenceIndex].toLocaleLowerCase()) {
          differenceIndex++;
        }

        if (differenceIndex > 0 && this._inputElement.current) {
          this._inputElement.current.setSelectionRange(differenceIndex, suggestedDisplayValue.length, SELECTION_BACKWARD);
        }
      }
    }
  };

  Autofill.prototype.render = function () {
    var displayValue = this.state.displayValue;
    var nativeProps = (0, _Utilities.getNativeProps)(this.props, _Utilities.inputProperties);
    return React.createElement("input", tslib_1.__assign({}, nativeProps, {
      ref: this._inputElement,
      value: displayValue,
      autoCapitalize: 'off',
      autoComplete: 'off',
      onCompositionStart: this._onCompositionStart,
      onCompositionEnd: this._onCompositionEnd,
      onChange: this._onChanged,
      onInput: this._onInputChanged,
      onKeyDown: this._onKeyDown,
      onClick: this.props.onClick ? this.props.onClick : this._onClick,
      "data-lpignore": true
    }));
  };

  Autofill.prototype.focus = function () {
    this._inputElement.current && this._inputElement.current.focus();
  };

  Autofill.prototype.clear = function () {
    this._autoFillEnabled = true;

    this._updateValue('');

    this._inputElement.current && this._inputElement.current.setSelectionRange(0, 0);
  };

  Autofill.prototype._getCurrentInputValue = function (ev) {
    if (ev && ev.target && ev.target.value) {
      return ev.target.value;
    } else if (this.inputElement && this.inputElement.value) {
      return this.inputElement.value;
    } else {
      return '';
    }
  };
  /**
   * Attempts to enable autofill. Whether or not autofill is enabled depends on the input value,
   * whether or not any text is selected, and only if the new input value is longer than the old input value.
   * Autofill should never be set to true if the value is composing. Once compositionEnd is called, then
   * it should be completed.
   * See https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent for more information on composition.
   * @param newValue - new input value
   * @param oldValue - old input value
   * @param isComposing - if true then the text is actively being composed and it has not completed.
   * @param isComposed - if the text is a composed text value.
   */


  Autofill.prototype._tryEnableAutofill = function (newValue, oldValue, isComposing, isComposed) {
    if (!isComposing && newValue && this._inputElement.current && this._inputElement.current.selectionStart === newValue.length && !this._autoFillEnabled && (newValue.length > oldValue.length || isComposed)) {
      this._autoFillEnabled = true;
    }
  };

  Autofill.prototype._notifyInputChange = function (newValue) {
    if (this.props.onInputValueChange) {
      this.props.onInputValueChange(newValue);
    }
  };
  /**
   * Returns a string that should be used as the display value.
   * It evaluates this based on whether or not the suggested value starts with the input value
   * and whether or not autofill is enabled.
   * @param inputValue - the value that the input currently has.
   * @param suggestedDisplayValue - the possible full value
   */


  Autofill.prototype._getDisplayValue = function (inputValue, suggestedDisplayValue) {
    var displayValue = inputValue;

    if (suggestedDisplayValue && inputValue && this._doesTextStartWith(suggestedDisplayValue, displayValue) && this._autoFillEnabled) {
      displayValue = suggestedDisplayValue;
    }

    return displayValue;
  };

  Autofill.prototype._doesTextStartWith = function (text, startWith) {
    if (!text || !startWith) {
      return false;
    }

    return text.toLocaleLowerCase().indexOf(startWith.toLocaleLowerCase()) === 0;
  };

  Autofill.defaultProps = {
    enableAutofillOnKeyPress: [_Utilities.KeyCodes.down, _Utilities.KeyCodes.up]
  };
  return Autofill;
}(_Utilities.BaseComponent);

exports.Autofill = Autofill;

/**
 *  @deprecated do not use.
 * {@docCategory Autofill}
 */
var BaseAutoFill =
/** @class */
function (_super) {
  tslib_1.__extends(BaseAutoFill, _super);

  function BaseAutoFill() {
    return _super !== null && _super.apply(this, arguments) || this;
  }

  return BaseAutoFill;
}(Autofill);

exports.BaseAutoFill = BaseAutoFill;
},{"tslib":"xgwM","react":"mpTF","../../Utilities":"B5nc"}],"LWui":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _Autofill = require("./Autofill");

Object.keys(_Autofill).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Autofill[key];
    }
  });
});
},{"./Autofill":"fwVR"}],"QEqz":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.CheckboxBase = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Utilities = require("../../Utilities");

var _Icon = require("../../Icon");

var _KeytipData = require("../../KeytipData");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var getClassNames = (0, _Utilities.classNamesFunction)();

var CheckboxBase =
/** @class */
function (_super) {
  tslib_1.__extends(CheckboxBase, _super);
  /**
   * Initialize a new instance of the Checkbox
   * @param props - Props for the component
   * @param context - Context or initial state for the base component.
   */


  function CheckboxBase(props, context) {
    var _this = _super.call(this, props, context) || this;

    _this._checkBox = React.createRef();

    _this._onFocus = function (ev) {
      var inputProps = _this.props.inputProps;

      if (inputProps && inputProps.onFocus) {
        inputProps.onFocus(ev);
      }
    };

    _this._onBlur = function (ev) {
      var inputProps = _this.props.inputProps;

      if (inputProps && inputProps.onBlur) {
        inputProps.onBlur(ev);
      }
    };

    _this._onChange = function (ev) {
      var _a = _this.props,
          disabled = _a.disabled,
          onChange = _a.onChange;
      var isChecked = _this.state.isChecked;

      if (!disabled) {
        if (onChange) {
          onChange(ev, !isChecked);
        }

        if (_this.props.checked === undefined) {
          _this.setState({
            isChecked: !isChecked
          });
        }
      }
    };

    _this._onRenderLabel = function (props) {
      var label = props.label;
      return label ? React.createElement("span", {
        "aria-hidden": "true",
        className: _this._classNames.text
      }, label) : null;
    };

    (0, _Utilities.initializeComponentRef)(_this);

    if ("production" !== 'production') {
      (0, _Utilities.warnMutuallyExclusive)('Checkbox', props, {
        checked: 'defaultChecked'
      });
    }

    _this._id = _this.props.id || (0, _Utilities.getId)('checkbox-');
    _this.state = {
      isChecked: !!(props.checked !== undefined ? props.checked : props.defaultChecked)
    };
    (0, _Utilities.initializeFocusRects)();
    return _this;
  }

  CheckboxBase.prototype.componentWillReceiveProps = function (newProps) {
    if (newProps.checked !== undefined) {
      this.setState({
        isChecked: !!newProps.checked // convert null to false

      });
    }
  };
  /**
   * Render the Checkbox based on passed props
   */


  CheckboxBase.prototype.render = function () {
    var _this = this;

    var _a = this.props,
        checked = _a.checked,
        className = _a.className,
        defaultChecked = _a.defaultChecked,
        disabled = _a.disabled,
        inputProps = _a.inputProps,
        name = _a.name,
        boxSide = _a.boxSide,
        theme = _a.theme,
        ariaLabel = _a.ariaLabel,
        ariaLabelledBy = _a.ariaLabelledBy,
        ariaDescribedBy = _a.ariaDescribedBy,
        styles = _a.styles,
        _b = _a.onRenderLabel,
        onRenderLabel = _b === void 0 ? this._onRenderLabel : _b,
        checkmarkIconProps = _a.checkmarkIconProps,
        ariaPositionInSet = _a.ariaPositionInSet,
        ariaSetSize = _a.ariaSetSize,
        keytipProps = _a.keytipProps,
        title = _a.title,
        label = _a.label;
    var isChecked = checked === undefined ? this.state.isChecked : checked;
    var isReversed = boxSide !== 'start' ? true : false;
    this._classNames = getClassNames(styles, {
      theme: theme,
      className: className,
      disabled: disabled,
      checked: isChecked,
      reversed: isReversed,
      isUsingCustomLabelRender: onRenderLabel !== this._onRenderLabel
    });
    return React.createElement(_KeytipData.KeytipData, {
      keytipProps: keytipProps,
      disabled: disabled
    }, function (keytipAttributes) {
      return React.createElement("div", {
        className: _this._classNames.root
      }, React.createElement("input", tslib_1.__assign({
        type: "checkbox"
      }, inputProps, {
        "data-ktp-execute-target": keytipAttributes['data-ktp-execute-target']
      }, checked !== undefined && {
        checked: checked
      }, defaultChecked !== undefined && {
        defaultChecked: defaultChecked
      }, {
        disabled: disabled,
        className: _this._classNames.input,
        ref: _this._checkBox,
        name: name,
        id: _this._id,
        title: title,
        onChange: _this._onChange,
        onFocus: _this._onFocus,
        onBlur: _this._onBlur,
        "aria-disabled": disabled,
        "aria-label": ariaLabel || label,
        "aria-labelledby": ariaLabelledBy,
        "aria-describedby": (0, _Utilities.mergeAriaAttributeValues)(ariaDescribedBy, keytipAttributes['aria-describedby']),
        "aria-posinset": ariaPositionInSet,
        "aria-setsize": ariaSetSize
      })), React.createElement("label", {
        className: _this._classNames.label,
        htmlFor: _this._id
      }, React.createElement("div", {
        className: _this._classNames.checkbox,
        "data-ktp-target": keytipAttributes['data-ktp-target']
      }, React.createElement(_Icon.Icon, tslib_1.__assign({
        iconName: "CheckMark"
      }, checkmarkIconProps, {
        className: _this._classNames.checkmark
      }))), onRenderLabel(_this.props, _this._onRenderLabel)));
    });
  };

  Object.defineProperty(CheckboxBase.prototype, "checked", {
    get: function () {
      return this.state.isChecked;
    },
    enumerable: true,
    configurable: true
  });

  CheckboxBase.prototype.focus = function () {
    if (this._checkBox.current) {
      this._checkBox.current.focus();
    }
  };

  CheckboxBase.defaultProps = {
    boxSide: 'start'
  };
  return CheckboxBase;
}(React.Component);

exports.CheckboxBase = CheckboxBase;
},{"tslib":"xgwM","react":"mpTF","../../Utilities":"B5nc","../../Icon":"s5pL","../../KeytipData":"ltoP"}],"FqBF":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = void 0;

var _Styling = require("../../Styling");

var _Utilities = require("../../Utilities");

var MS_CHECKBOX_LABEL_SIZE = '20px';
var MS_CHECKBOX_TRANSITION_DURATION = '200ms';
var MS_CHECKBOX_TRANSITION_TIMING = 'cubic-bezier(.4, 0, .23, 1)';

var getStyles = function (props) {
  var className = props.className,
      theme = props.theme,
      reversed = props.reversed,
      checked = props.checked,
      disabled = props.disabled,
      isUsingCustomLabelRender = props.isUsingCustomLabelRender;
  var semanticColors = theme.semanticColors;
  var checkmarkFontColor = semanticColors.inputForegroundChecked;
  var checkmarkFontColorCheckedDisabled = semanticColors.disabledBackground;
  var checkmarkFontColorHovered = semanticColors.inputBorder;
  var checkboxBorderColor = semanticColors.smallInputBorder;
  var checkboxBorderColorChecked = semanticColors.inputBackgroundChecked;
  var checkboxBorderColorDisabled = semanticColors.disabledBodySubtext;
  var checkboxBorderHoveredColor = semanticColors.inputBorderHovered;
  var checkboxBackgroundChecked = semanticColors.inputBackgroundChecked;
  var checkboxBackgroundCheckedHovered = semanticColors.inputBackgroundCheckedHovered;
  var checkboxBorderColorCheckedHovered = semanticColors.inputBackgroundCheckedHovered;
  var checkboxHoveredTextColor = semanticColors.bodyText;
  var checkboxBackgroundDisabledChecked = semanticColors.disabledBodySubtext;
  var checkboxTextColor = semanticColors.bodyText;
  var checkboxTextColorDisabled = semanticColors.disabledText;
  return {
    root: ['ms-Checkbox', {
      position: 'relative',
      display: 'flex'
    }, reversed && 'reversed', checked && 'is-checked', !disabled && 'is-enabled', disabled && 'is-disabled', className],
    input: [{
      position: 'absolute',
      background: 'none',
      opacity: 0,
      selectors: (_a = {}, _a["." + _Utilities.IsFocusVisibleClassName + " &:focus + label"] = {
        outline: '1px solid ' + theme.palette.neutralSecondary,
        outlineOffset: '2px',
        selectors: (_b = {}, _b[_Styling.HighContrastSelector] = {
          outline: '1px solid ActiveBorder'
        }, _b)
      }, _a)
    }],
    label: ['ms-Checkbox-label', theme.fonts.medium, {
      display: 'flex',
      alignItems: isUsingCustomLabelRender ? 'center' : 'flex-start',
      cursor: disabled ? 'default' : 'pointer',
      position: 'relative',
      userSelect: 'none',
      textAlign: 'left'
    }, reversed && {
      flexDirection: 'row-reverse',
      justifyContent: 'flex-end'
    }, !disabled && [!checked && {
      selectors: {
        ':hover .ms-Checkbox-checkbox': {
          borderColor: checkboxBorderHoveredColor,
          selectors: (_c = {}, _c[_Styling.HighContrastSelector] = {
            borderColor: 'Highlight'
          }, _c)
        },
        ':focus .ms-Checkbox-checkbox': {
          borderColor: checkboxBorderHoveredColor
        },
        ':hover .ms-Checkbox-checkmark': {
          color: checkmarkFontColorHovered,
          opacity: '1',
          selectors: (_d = {}, _d[_Styling.HighContrastSelector] = {
            color: 'Highlight'
          }, _d)
        }
      }
    }, checked && {
      selectors: (_e = {
        ':hover .ms-Checkbox-checkbox': {
          background: checkboxBackgroundCheckedHovered,
          borderColor: checkboxBorderColorCheckedHovered
        },
        ':focus .ms-Checkbox-checkbox': {
          background: checkboxBackgroundCheckedHovered,
          borderColor: checkboxBorderColorCheckedHovered
        }
      }, _e[_Styling.HighContrastSelector] = {
        selectors: {
          ':hover .ms-Checkbox-checkbox': {
            background: 'Window',
            borderColor: 'Highlight'
          },
          ':focus .ms-Checkbox-checkbox': {
            background: 'Highlight'
          },
          ':focus:hover .ms-Checkbox-checkbox': {
            background: 'Highlight'
          },
          ':focus:hover .ms-Checkbox-checkmark': {
            color: 'Window'
          },
          ':hover .ms-Checkbox-checkmark': {
            color: 'Highlight'
          }
        }
      }, _e)
    }, {
      selectors: {
        ':hover .ms-Checkbox-text': {
          color: checkboxHoveredTextColor
        },
        ':focus .ms-Checkbox-text': {
          color: checkboxHoveredTextColor
        }
      }
    }]],
    checkbox: ['ms-Checkbox-checkbox', {
      display: 'flex',
      flexShrink: 0,
      alignItems: 'center',
      justifyContent: 'center',
      height: MS_CHECKBOX_LABEL_SIZE,
      width: MS_CHECKBOX_LABEL_SIZE,
      borderWidth: '1px',
      borderStyle: 'solid',
      borderColor: checkboxBorderColor,
      boxSizing: 'border-box',
      transitionProperty: 'background, border, border-color',
      transitionDuration: MS_CHECKBOX_TRANSITION_DURATION,
      transitionTimingFunction: MS_CHECKBOX_TRANSITION_TIMING,

      /* in case the icon is bigger than the box */
      overflow: 'hidden'
    }, !reversed ? // this margin on the checkbox is for backwards compat.
    // notably it has the effect where a customRender is used, there will be only a 4px margin from checkbox to label.
    // the label by default would have another 4px margin for a total of 8px margin between checkbox and label.
    // we don't combine the two (and move it into the text) to not incur a breaking change for everyone using custom render atm.
    {
      marginRight: 4
    } : {
      marginLeft: 4
    }, !disabled && checked && {
      background: checkboxBackgroundChecked,
      borderColor: checkboxBorderColorChecked,
      selectors: (_f = {}, _f[_Styling.HighContrastSelector] = {
        background: 'Highlight',
        borderColor: 'Highlight'
      }, _f)
    }, disabled && {
      borderColor: checkboxBorderColorDisabled,
      selectors: (_g = {}, _g[_Styling.HighContrastSelector] = {
        borderColor: 'InactiveBorder'
      }, _g)
    }, checked && disabled && {
      background: checkboxBackgroundDisabledChecked,
      borderColor: checkboxBorderColorDisabled
    }],
    checkmark: ['ms-Checkbox-checkmark', {
      opacity: checked ? '1' : '0',
      color: checked && disabled ? checkmarkFontColorCheckedDisabled : checkmarkFontColor,
      selectors: (_h = {}, _h[_Styling.HighContrastSelector] = {
        color: disabled ? 'InactiveBorder' : 'Window',
        MsHighContrastAdjust: 'none'
      }, _h)
    }],
    text: ['ms-Checkbox-text', {
      color: disabled ? checkboxTextColorDisabled : checkboxTextColor,
      fontSize: _Styling.FontSizes.medium,
      lineHeight: '20px'
    }, !reversed ? {
      marginLeft: 4
    } : {
      marginRight: 4
    }, disabled && {
      selectors: (_j = {}, _j[_Styling.HighContrastSelector] = {
        // backwards compat for the color of the text when the checkbox was rendered
        // using a Button.
        color: 'InactiveBorder'
      }, _j)
    }]
  };

  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
};

exports.getStyles = getStyles;
},{"../../Styling":"AHeq","../../Utilities":"B5nc"}],"IGTW":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Checkbox = void 0;

var _Utilities = require("../../Utilities");

var _Checkbox = require("./Checkbox.base");

var _Checkbox2 = require("./Checkbox.styles");

var Checkbox = (0, _Utilities.styled)(_Checkbox.CheckboxBase, _Checkbox2.getStyles, undefined, {
  scope: 'Checkbox'
});
exports.Checkbox = Checkbox;
},{"../../Utilities":"B5nc","./Checkbox.base":"QEqz","./Checkbox.styles":"FqBF"}],"QrfQ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _Checkbox = require("./Checkbox");

Object.keys(_Checkbox).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Checkbox[key];
    }
  });
});

var _Checkbox2 = require("./Checkbox.base");

Object.keys(_Checkbox2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Checkbox2[key];
    }
  });
});
},{"./Checkbox":"IGTW","./Checkbox.base":"QEqz"}],"OuLn":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _index = require("./components/Checkbox/index");

Object.keys(_index).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index[key];
    }
  });
});
},{"./components/Checkbox/index":"QrfQ"}],"XfLs":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _index = require("./components/Button/index");

Object.keys(_index).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index[key];
    }
  });
});
},{"./components/Button/index":"EFSA"}],"Bp32":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = exports.getCaretDownButtonStyles = exports.getOptionStyles = void 0;

var _Styling = require("../../Styling");

var _Utilities = require("../../Utilities");

var ComboBoxHeight = '32px';
var ComboBoxLineHeight = '30px';
var ComboxBoxCaretDownWidth = '32px';
var ComboBoxOptionHeight = '32px';
var getDisabledStyles = (0, _Utilities.memoizeFunction)(function (theme) {
  var semanticColors = theme.semanticColors;
  return {
    backgroundColor: semanticColors.disabledBackground,
    borderColor: semanticColors.disabledBackground,
    color: semanticColors.disabledText,
    cursor: 'default',
    selectors: (_a = {}, _a[_Styling.HighContrastSelector] = {
      borderColor: 'GrayText',
      color: 'GrayText'
    }, _a)
  };

  var _a;
});
var getListOptionHighContrastStyles = (0, _Utilities.memoizeFunction)(function (theme) {
  return {
    selectors: (_a = {}, _a[_Styling.HighContrastSelector] = {
      backgroundColor: 'Highlight',
      borderColor: 'Highlight',
      color: 'HighlightText',
      MsHighContrastAdjust: 'none'
    }, _a)
  };

  var _a;
});
var getOptionStyles = (0, _Utilities.memoizeFunction)(function (theme, customStylesForAllOptions, customOptionStylesForCurrentOption, isPending, isHidden) {
  var semanticColors = theme.semanticColors,
      palette = theme.palette;
  var ComboBoxOptionBackgroundHovered = semanticColors.menuItemBackgroundHovered;
  var ComboBoxOptionTextColorHovered = semanticColors.bodyText;
  var ComboBoxOptionTextColorSelected = palette.black;
  var ComboBoxOptionTextColorDisabled = semanticColors.disabledText;
  var ComboBoxOptionBackgroundDisabled = semanticColors.bodyBackground;
  var optionStyles = {
    root: [theme.fonts.medium, {
      backgroundColor: isPending ? ComboBoxOptionBackgroundHovered : 'transparent',
      boxSizing: 'border-box',
      cursor: 'pointer',
      display: isHidden ? 'none' : 'block',
      width: '100%',
      height: 'auto',
      minHeight: ComboBoxOptionHeight,
      lineHeight: '20px',
      padding: '5px 16px',
      position: 'relative',
      borderWidth: '1px',
      borderStyle: 'solid',
      borderColor: 'transparent',
      wordWrap: 'break-word',
      overflowWrap: 'break-word',
      textAlign: 'left',
      selectors: (_a = {}, _a[_Styling.HighContrastSelector] = {
        borderColor: 'Background'
      }, _a)
    }],
    rootHovered: {
      backgroundColor: ComboBoxOptionBackgroundHovered,
      color: ComboBoxOptionTextColorHovered
    },
    rootFocused: {
      backgroundColor: ComboBoxOptionBackgroundHovered
    },
    rootChecked: [{
      backgroundColor: ComboBoxOptionBackgroundHovered,
      color: ComboBoxOptionTextColorSelected
    }, (0, _Styling.getFocusStyle)(theme, {
      isFocusedOnly: false
    }), getListOptionHighContrastStyles(theme)],
    rootDisabled: {
      backgroundColor: ComboBoxOptionBackgroundDisabled,
      color: ComboBoxOptionTextColorDisabled,
      cursor: 'default',
      selectors: {
        '& .ms-Button-flexContainer': {
          justifyContent: 'flex-start'
        }
      }
    },
    optionText: {
      overflow: 'hidden',
      whiteSpace: 'nowrap',
      textOverflow: 'ellipsis',
      minWidth: '0px',
      maxWidth: '100%',
      wordWrap: 'break-word',
      overflowWrap: 'break-word',
      margin: '1px',
      display: 'inline-block'
    },
    optionTextWrapper: {
      maxWidth: '100%'
    }
  };
  return (0, _Styling.concatStyleSets)(optionStyles, customStylesForAllOptions, customOptionStylesForCurrentOption);

  var _a;
});
exports.getOptionStyles = getOptionStyles;
var getCaretDownButtonStyles = (0, _Utilities.memoizeFunction)(function (theme, customStyles) {
  var semanticColors = theme.semanticColors;
  var caretButtonTextColor = semanticColors.bodySubtext;
  var caretButtonTextColorHoveredChecked = semanticColors.buttonTextChecked;
  var caretButtonBackgroundHovered = semanticColors.listItemBackgroundHovered;
  var caretButtonBackgroundChecked = semanticColors.listItemBackgroundChecked;
  var caretButtonBackgroundCheckedHovered = semanticColors.listItemBackgroundCheckedHovered;
  var styles = {
    root: {
      color: caretButtonTextColor,
      fontSize: _Styling.FontSizes.small,
      position: 'absolute',
      // The negative positioning accounts for the 1px root border now that box-sizing is border-box
      top: '-1px',
      right: '-1px',
      height: ComboBoxHeight,
      lineHeight: ComboBoxLineHeight,
      width: ComboxBoxCaretDownWidth,
      textAlign: 'center',
      cursor: 'default',
      selectors: (_a = {}, _a[_Styling.HighContrastSelector] = {
        backgroundColor: 'ButtonFace',
        borderColor: 'ButtonText',
        color: 'ButtonText',
        MsHighContrastAdjust: 'none'
      }, _a)
    },
    icon: {
      fontSize: _Styling.FontSizes.small
    },
    rootHovered: {
      backgroundColor: caretButtonBackgroundHovered,
      color: caretButtonTextColorHoveredChecked,
      cursor: 'pointer'
    },
    rootPressed: {
      backgroundColor: caretButtonBackgroundChecked,
      color: caretButtonTextColorHoveredChecked
    },
    rootChecked: {
      backgroundColor: caretButtonBackgroundChecked,
      color: caretButtonTextColorHoveredChecked
    },
    rootCheckedHovered: {
      backgroundColor: caretButtonBackgroundCheckedHovered,
      color: caretButtonTextColorHoveredChecked
    },
    rootDisabled: getDisabledStyles(theme)
  };
  return (0, _Styling.concatStyleSets)(styles, customStyles);

  var _a;
});
exports.getCaretDownButtonStyles = getCaretDownButtonStyles;
var getStyles = (0, _Utilities.memoizeFunction)(function (theme, customStyles, comboBoxOptionWidth) {
  var semanticColors = theme.semanticColors,
      fonts = theme.fonts,
      palette = theme.palette;
  var ComboBoxRootBackground = semanticColors.bodyBackground;
  var ComboBoxRootTextColor = semanticColors.bodyText;
  var ComboBoxRootBorderColor = semanticColors.inputBorder;
  var ComboBoxRootBorderColorHovered = semanticColors.inputBorderHovered;
  var ComboBoxRootBorderColorFocused = semanticColors.inputFocusBorderAlt;
  var ComboBoxRootColorErrored = semanticColors.errorText;
  var ComboBoxCalloutBorderColor = palette.neutralLight;
  var ComboBoxOptionHeaderTextColor = semanticColors.menuHeader;
  var ComboBoxOptionDividerBorderColor = semanticColors.bodyDivider; // placeholder style variables

  var placeholderStyles = {
    color: semanticColors.inputPlaceholderText
  };
  var hoverPlaceholderStyles = {
    color: palette.neutralPrimary
  };
  var disabledPlaceholderStyles = {
    color: semanticColors.disabledText
  };
  var ComboBoxRootHighContrastFocused = {
    color: 'HighlightText',
    borderColor: 'Highlight',
    backgroundColor: 'Window',
    borderWidth: '2px',
    MsHighContrastAdjust: 'none',
    paddingLeft: '11px',
    paddingTop: '0',
    paddingBottom: '0',
    selectors: {
      '.ms-ComboBox-CaretDown-button': {
        // Negative positioning to account for the 2px border
        right: '-2px',
        top: '-2px'
      }
    }
  };
  var styles = {
    container: {},
    label: {},
    labelDisabled: {},
    root: [theme.fonts.medium, {
      boxShadow: 'none',
      marginLeft: '0',
      paddingTop: '1px',
      paddingBottom: '1px',
      paddingRight: ComboxBoxCaretDownWidth,
      paddingLeft: '12px',
      color: ComboBoxRootTextColor,
      position: 'relative',
      outline: '0',
      userSelect: 'none',
      backgroundColor: ComboBoxRootBackground,
      borderWidth: '1px',
      borderStyle: 'solid',
      borderColor: ComboBoxRootBorderColor,
      cursor: 'text',
      display: 'block',
      height: ComboBoxHeight,
      overflow: 'hidden',
      whiteSpace: 'nowrap',
      textOverflow: 'ellipsis',
      boxSizing: 'border-box',
      selectors: {
        '.ms-Label': {
          display: 'inline-block',
          marginBottom: '8px'
        },
        '&.is-open': {
          borderColor: ComboBoxRootBorderColorFocused,
          selectors: (_a = {}, _a[_Styling.HighContrastSelector] = ComboBoxRootHighContrastFocused, _a)
        }
      }
    }],
    rootHovered: {
      borderColor: ComboBoxRootBorderColorHovered,
      selectors: (_b = {
        '.ms-ComboBox-Input': [{
          color: palette.neutralDark
        }, (0, _Styling.getPlaceholderStyles)(hoverPlaceholderStyles)]
      }, _b[_Styling.HighContrastSelector] = {
        color: 'HighlightText',
        borderColor: 'Highlight',
        backgroundColor: 'Window',
        MsHighContrastAdjust: 'none'
      }, _b)
    },
    rootPressed: {
      borderColor: ComboBoxRootBorderColorFocused,
      selectors: (_c = {}, _c[_Styling.HighContrastSelector] = ComboBoxRootHighContrastFocused, _c)
    },
    rootFocused: {
      borderColor: ComboBoxRootBorderColorFocused,
      selectors: (_d = {}, _d[_Styling.HighContrastSelector] = ComboBoxRootHighContrastFocused, _d)
    },
    rootDisabled: getDisabledStyles(theme),
    rootError: {
      borderColor: ComboBoxRootColorErrored,
      marginBottom: '5px'
    },
    rootDisallowFreeForm: {},
    input: [(0, _Styling.getPlaceholderStyles)(placeholderStyles), {
      backgroundColor: ComboBoxRootBackground,
      color: ComboBoxRootTextColor,
      boxSizing: 'border-box',
      width: '100%',
      height: '28px',
      borderStyle: 'none',
      outline: 'none',
      font: 'inherit',
      textOverflow: 'ellipsis',
      padding: '0',
      selectors: {
        '::-ms-clear': {
          display: 'none'
        }
      }
    }],
    inputDisabled: [getDisabledStyles(theme), (0, _Styling.getPlaceholderStyles)(disabledPlaceholderStyles)],
    errorMessage: {
      color: ComboBoxRootColorErrored
    },
    callout: {
      boxShadow: '0 0px 5px 0px rgba(0, 0, 0, 0.4)',
      borderWidth: '1px',
      borderStyle: 'solid',
      borderColor: ComboBoxCalloutBorderColor
    },
    optionsContainerWrapper: {
      width: comboBoxOptionWidth
    },
    optionsContainer: {
      display: 'block'
    },
    header: [fonts.medium, {
      fontWeight: _Styling.FontWeights.semibold,
      color: ComboBoxOptionHeaderTextColor,
      backgroundColor: 'none',
      borderStyle: 'none',
      height: ComboBoxOptionHeight,
      lineHeight: ComboBoxOptionHeight,
      cursor: 'default',
      padding: '0px 16px',
      userSelect: 'none',
      textAlign: 'left'
    }],
    divider: {
      borderWidth: '1px',
      borderStyle: 'solid',
      borderColor: ComboBoxOptionDividerBorderColor
    }
  };
  return (0, _Styling.concatStyleSets)(styles, customStyles);

  var _a, _b, _c, _d;
});
exports.getStyles = getStyles;
},{"../../Styling":"AHeq","../../Utilities":"B5nc"}],"dZt7":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getComboBoxOptionClassNames = exports.getClassNames = void 0;

var _Utilities = require("../../Utilities");

var _Styling = require("../../Styling");

var getClassNames = (0, _Utilities.memoizeFunction)(function (styles, className, isOpen, disabled, required, focused, allowFreeForm, hasErrorMessage) {
  return {
    container: (0, _Styling.mergeStyles)('ms-ComboBox-container', className, styles.container),
    label: (0, _Styling.mergeStyles)(styles.label, disabled && styles.labelDisabled),
    root: (0, _Styling.mergeStyles)('ms-ComboBox', hasErrorMessage ? styles.rootError : isOpen && 'is-open', required && 'is-required', styles.root, !allowFreeForm && styles.rootDisallowFreeForm, hasErrorMessage ? styles.rootError : !disabled && focused && styles.rootFocused, !disabled && {
      selectors: {
        ':hover': hasErrorMessage ? styles.rootError : !isOpen && !focused && styles.rootHovered,
        ':active': hasErrorMessage ? styles.rootError : styles.rootPressed,
        ':focus': hasErrorMessage ? styles.rootError : styles.rootFocused
      }
    }, disabled && ['is-disabled', styles.rootDisabled]),
    input: (0, _Styling.mergeStyles)('ms-ComboBox-Input', styles.input, disabled && styles.inputDisabled),
    errorMessage: (0, _Styling.mergeStyles)(styles.errorMessage),
    callout: (0, _Styling.mergeStyles)('ms-ComboBox-callout', styles.callout),
    optionsContainerWrapper: (0, _Styling.mergeStyles)('ms-ComboBox-optionsContainerWrapper', styles.optionsContainerWrapper),
    optionsContainer: (0, _Styling.mergeStyles)('ms-ComboBox-optionsContainer', styles.optionsContainer),
    header: (0, _Styling.mergeStyles)('ms-ComboBox-header', styles.header),
    divider: (0, _Styling.mergeStyles)('ms-ComboBox-divider', styles.divider)
  };
});
exports.getClassNames = getClassNames;
var getComboBoxOptionClassNames = (0, _Utilities.memoizeFunction)(function (styles) {
  return {
    optionText: (0, _Styling.mergeStyles)('ms-ComboBox-optionText', styles.optionText),
    root: (0, _Styling.mergeStyles)('ms-ComboBox-option', styles.root, {
      selectors: {
        ':hover': styles.rootHovered,
        ':focus': styles.rootFocused,
        ':active': styles.rootPressed
      }
    }),
    optionTextWrapper: (0, _Styling.mergeStyles)(styles.optionTextWrapper)
  };
});
exports.getComboBoxOptionClassNames = getComboBoxOptionClassNames;
},{"../../Utilities":"B5nc","../../Styling":"AHeq"}],"GJ0J":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getAllSelectedOptions = getAllSelectedOptions;

function getAllSelectedOptions(options, selectedIndices) {
  var selectedOptions = [];

  for (var _i = 0, selectedIndices_1 = selectedIndices; _i < selectedIndices_1.length; _i++) {
    var index = selectedIndices_1[_i];
    var option = options[index];

    if (option) {
      selectedOptions.push(option);
    }
  }

  return selectedOptions;
}
},{}],"unBv":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _SelectableOption = require("./SelectableOption");

Object.keys(_SelectableOption).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _SelectableOption[key];
    }
  });
});

var _SelectableOption2 = require("./SelectableOption.types");

Object.keys(_SelectableOption2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _SelectableOption2[key];
    }
  });
});
},{"./SelectableOption":"GJ0J","./SelectableOption.types":"yh6c"}],"HxzL":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ComboBox = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _index = require("../Autofill/index");

var _Utilities = require("../../Utilities");

var _Callout = require("../../Callout");

var _Checkbox = require("../../Checkbox");

var _Button = require("../../Button");

var _DirectionalHint = require("../../common/DirectionalHint");

var _ComboBox = require("./ComboBox.styles");

var _ComboBox2 = require("./ComboBox.classNames");

var _KeytipData = require("../../KeytipData");

var _Label = require("../../Label");

var _index2 = require("../../utilities/selectableOption/index");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var SearchDirection;

(function (SearchDirection) {
  SearchDirection[SearchDirection["backward"] = -1] = "backward";
  SearchDirection[SearchDirection["none"] = 0] = "none";
  SearchDirection[SearchDirection["forward"] = 1] = "forward";
})(SearchDirection || (SearchDirection = {}));

var HoverStatus;

(function (HoverStatus) {
  /** Used when the user was hovering and has since moused out of the menu items */
  HoverStatus[HoverStatus["clearAll"] = -2] = "clearAll";
  /** Default "normal" state, when no hover has happened or a hover is in progress */

  HoverStatus[HoverStatus["default"] = -1] = "default";
})(HoverStatus || (HoverStatus = {}));

var ScrollIdleDelay = 250
/* ms */
;
var TouchIdleDelay = 500;
/* ms */

/**
 * This is used to clear any pending autocomplete text (used when autocomplete is true and
 * allowFreeform is false)
 */

var ReadOnlyPendingAutoCompleteTimeout = 1000
/* ms */
;
/**
 * Internal class that is used to wrap all ComboBox options.
 * This is used to customize when we want to rerender components,
 * so we don't rerender every option every time render is executed.
 */

var ComboBoxOptionWrapper =
/** @class */
function (_super) {
  tslib_1.__extends(ComboBoxOptionWrapper, _super);

  function ComboBoxOptionWrapper() {
    return _super !== null && _super.apply(this, arguments) || this;
  }

  ComboBoxOptionWrapper.prototype.render = function () {
    return this.props.render();
  };

  ComboBoxOptionWrapper.prototype.shouldComponentUpdate = function (newProps) {
    // The render function will always be different, so we ignore that prop
    return !(0, _Utilities.shallowCompare)(tslib_1.__assign({}, this.props, {
      render: undefined
    }), tslib_1.__assign({}, newProps, {
      render: undefined
    }));
  };

  return ComboBoxOptionWrapper;
}(React.Component);

var ComboBox =
/** @class */
function (_super) {
  tslib_1.__extends(ComboBox, _super);

  function ComboBox(props) {
    var _this = _super.call(this, props) || this;

    _this._root = React.createRef();
    /** The input aspect of the comboBox */

    _this._autofill = React.createRef();
    /** The wrapping div of the input and button */

    _this._comboBoxWrapper = React.createRef();
    /** The callout element */

    _this._comboBoxMenu = React.createRef();
    /** The menu item element that is currently selected */

    _this._selectedElement = React.createRef();
    /**
     * {@inheritdoc}
     */

    _this.focus = function (shouldOpenOnFocus, useFocusAsync) {
      if (_this._autofill.current) {
        if (useFocusAsync) {
          (0, _Utilities.focusAsync)(_this._autofill.current);
        } else {
          _this._autofill.current.focus();
        }

        if (shouldOpenOnFocus) {
          _this.setState({
            isOpen: true
          });
        }
      }
    };
    /**
     * Close menu callout if it is open
     */


    _this.dismissMenu = function () {
      var isOpen = _this.state.isOpen;
      isOpen && _this.setState({
        isOpen: false
      });
    };
    /**
     * componentWillReceiveProps handler for the auto fill component
     * Checks/updates the iput value to set, if needed
     * @param defaultVisibleValue - the defaultVisibleValue that got passed
     *  in to the auto fill's componentWillReceiveProps
     * @returns - the updated value to set, if needed
     */


    _this._onUpdateValueInAutofillWillReceiveProps = function () {
      var comboBox = _this._autofill.current;

      if (!comboBox) {
        return null;
      }

      if (comboBox.value === null || comboBox.value === undefined) {
        return null;
      }

      var visibleValue = _this._normalizeToString(_this._currentVisibleValue);

      if (comboBox.value !== visibleValue) {
        // If visibleValue is empty, make it a zero width space.
        // If we did not do that, the empty string would not get used
        // potentially resulting in an unexpected value being used
        return visibleValue || '​';
      }

      return comboBox.value;
    };
    /**
     * componentDidUpdate handler for the auto fill component
     *
     * @param defaultVisibleValue - the current defaultVisibleValue in the auto fill's componentDidUpdate
     * @param suggestedDisplayValue - the current suggestedDisplayValue in the auto fill's componentDidUpdate
     * @returns - should the full value of the input be selected?
     * True if the defaultVisibleValue equals the suggestedDisplayValue, false otherwise
     */


    _this._onShouldSelectFullInputValueInAutofillComponentDidUpdate = function () {
      return _this._currentVisibleValue === _this.state.suggestedDisplayValue;
    };
    /**
     * Get the correct value to pass to the input
     * to show to the user based off of the current props and state
     * @returns the value to pass to the input
     */


    _this._getVisibleValue = function () {
      var _a = _this.props,
          text = _a.text,
          value = _a.value,
          allowFreeform = _a.allowFreeform,
          autoComplete = _a.autoComplete;
      var _b = _this.state,
          selectedIndices = _b.selectedIndices,
          currentPendingValueValidIndex = _b.currentPendingValueValidIndex,
          currentOptions = _b.currentOptions,
          currentPendingValue = _b.currentPendingValue,
          suggestedDisplayValue = _b.suggestedDisplayValue,
          isOpen = _b.isOpen,
          focused = _b.focused;

      var currentPendingIndexValid = _this._indexWithinBounds(currentOptions, currentPendingValueValidIndex); // If the user passed is a value prop, use that
      // unless we are open and have a valid current pending index


      if (!(isOpen && currentPendingIndexValid) && text && (currentPendingValue === null || currentPendingValue === undefined)) {
        return text;
      }

      if (!(isOpen && currentPendingIndexValid) && value && (currentPendingValue === null || currentPendingValue === undefined)) {
        return value;
      } // Values to display in the BaseAutoFill area


      var displayValues = [];

      if (_this.props.multiSelect) {
        // Multi-select
        if (focused) {
          var index = -1;

          if (autoComplete === 'on' && currentPendingIndexValid) {
            index = currentPendingValueValidIndex;
          }

          displayValues.push(currentPendingValue !== null && currentPendingValue !== undefined ? currentPendingValue : _this._indexWithinBounds(currentOptions, index) ? currentOptions[index].text : '');
        } else {
          for (var idx = 0; selectedIndices && idx < selectedIndices.length; idx++) {
            var index = selectedIndices[idx];
            displayValues.push(_this._indexWithinBounds(currentOptions, index) ? currentOptions[index].text : _this._normalizeToString(suggestedDisplayValue));
          }
        }
      } else {
        // Single-select
        var index = _this._getFirstSelectedIndex();

        if (allowFreeform) {
          // If we are allowing freeform and autocomplete is also true
          // and we've got a pending value that matches an option, remember
          // the matched option's index
          if (autoComplete === 'on' && currentPendingIndexValid) {
            index = currentPendingValueValidIndex;
          } // Since we are allowing freeform, if there is currently a pending value, use that
          // otherwise use the index determined above (falling back to '' if we did not get a valid index)


          displayValues.push(currentPendingValue !== null && currentPendingValue !== undefined ? currentPendingValue : _this._indexWithinBounds(currentOptions, index) ? currentOptions[index].text : '');
        } else {
          // If we are not allowing freeform and have a
          // valid index that matches the pending value,
          // we know we will need some version of the pending value
          if (currentPendingIndexValid && autoComplete === 'on') {
            // If autoComplete is on, return the
            // raw pending value, otherwise remember
            // the matched option's index
            index = currentPendingValueValidIndex;
            displayValues.push(_this._normalizeToString(currentPendingValue));
          } else {
            displayValues.push(_this._indexWithinBounds(currentOptions, index) ? currentOptions[index].text : _this._normalizeToString(suggestedDisplayValue));
          }
        }
      } // If we have a valid index then return the text value of that option,
      // otherwise return the suggestedDisplayValue


      var displayString = '';

      for (var idx = 0; idx < displayValues.length; idx++) {
        if (idx > 0) {
          displayString += ', ';
        }

        displayString += displayValues[idx];
      }

      return displayString;
    };
    /**
     * Handler for typing changes on the input
     * @param updatedValue - the newly changed value
     */


    _this._onInputChange = function (updatedValue) {
      if (_this.props.disabled) {
        _this._handleInputWhenDisabled(null
        /* event */
        );

        return;
      }

      _this.props.allowFreeform ? _this._processInputChangeWithFreeform(updatedValue) : _this._processInputChangeWithoutFreeform(updatedValue);
    };
    /**
     * Focus (and select) the content of the input
     * and set the focused state
     */


    _this._select = function () {
      if (_this._autofill.current && _this._autofill.current.inputElement) {
        _this._autofill.current.inputElement.select();
      }

      if (!_this.state.focused) {
        var state = {
          focused: true
        };

        if (_this.props.openOnKeyboardFocus && !_this.state.isOpen && !_this.props.disabled) {
          state.isOpen = true;
        }

        _this.setState(state);
      }
    };
    /**
     * Callback issued when the options should be resolved, if they have been updated or
     * if they need to be passed in the first time. This only does work if an onResolveOptions
     * callback was passed in
     */


    _this._onResolveOptions = function () {
      if (_this.props.onResolveOptions) {
        // get the options
        var newOptions = _this.props.onResolveOptions(_this.state.currentOptions.slice()); // Check to see if the returned value is an array, if it is update the state
        // If the returned value is not an array then check to see if it's a promise or PromiseLike. If it is then resolve it asynchronously.


        if (Array.isArray(newOptions)) {
          _this.setState({
            currentOptions: newOptions
          });
        } else if (newOptions && newOptions.then) {
          // Ensure that the promise will only use the callback if it was the most recent one
          // and update the state when the promise returns
          var promise_1 = _this._currentPromise = newOptions;
          promise_1.then(function (newOptionsFromPromise) {
            if (promise_1 === _this._currentPromise) {
              _this.setState({
                currentOptions: newOptionsFromPromise
              });
            }
          });
        }
      }
    };
    /**
     * OnBlur handler. Set the focused state to false
     * and submit any pending value
     */


    _this._onBlur = function (event) {
      // Do nothing if the blur is coming from something
      // inside the comboBox root or the comboBox menu since
      // it we are not really bluring from the whole comboBox
      var relatedTarget = event.relatedTarget;

      if (event.relatedTarget === null) {
        // In IE11, due to lack of support, event.relatedTarget is always
        // null making every onBlur call to be "outside" of the ComboBox
        // even when it's not. Using document.activeElement is another way
        // for us to be able to get what the relatedTarget without relying
        // on the event
        relatedTarget = document.activeElement;
      }

      if (relatedTarget && ( // when event coming from withing the comboBox title
      _this._root.current && _this._root.current.contains(relatedTarget) || // when event coming from within the comboBox list menu
      _this._comboBoxMenu.current && (_this._comboBoxMenu.current.contains(relatedTarget) || // when event coming from the callout containing the comboBox list menu (ex: when scrollBar of the Callout clicked)
      // checks if the relatedTarget is a parent of _comboBoxMenu
      (0, _Utilities.findElementRecursive)(_this._comboBoxMenu.current, function (element) {
        return element === relatedTarget;
      })))) {
        event.preventDefault();
        event.stopPropagation();
        return;
      }

      if (_this.state.focused) {
        _this.setState({
          focused: false
        });

        if (!_this.props.multiSelect || _this.props.allowFreeform) {
          _this._submitPendingValue(event);
        }
      }
    }; // Render Callout container and pass in list


    _this._onRenderContainer = function (props) {
      var onRenderList = props.onRenderList,
          calloutProps = props.calloutProps,
          dropdownWidth = props.dropdownWidth,
          dropdownMaxWidth = props.dropdownMaxWidth,
          _a = props.onRenderLowerContent,
          onRenderLowerContent = _a === void 0 ? _this._onRenderLowerContent : _a,
          useComboBoxAsMenuWidth = props.useComboBoxAsMenuWidth,
          persistMenu = props.persistMenu,
          _b = props.shouldRestoreFocus,
          shouldRestoreFocus = _b === void 0 ? true : _b;
      var isOpen = _this.state.isOpen;
      var comboBoxMenuWidth = useComboBoxAsMenuWidth && _this._comboBoxWrapper.current ? _this._comboBoxWrapper.current.clientWidth + 2 : undefined;
      return React.createElement(_Callout.Callout, tslib_1.__assign({
        isBeakVisible: false,
        gapSpace: 0,
        doNotLayer: false,
        directionalHint: _DirectionalHint.DirectionalHint.bottomLeftEdge,
        directionalHintFixed: false
      }, calloutProps, {
        onLayerMounted: _this._onLayerMounted,
        className: (0, _Utilities.css)(_this._classNames.callout, calloutProps ? calloutProps.className : undefined),
        target: _this._comboBoxWrapper.current,
        onDismiss: _this._onDismiss,
        onScroll: _this._onScroll,
        setInitialFocus: false,
        calloutWidth: useComboBoxAsMenuWidth && _this._comboBoxWrapper.current ? comboBoxMenuWidth && comboBoxMenuWidth : dropdownWidth,
        calloutMaxWidth: dropdownMaxWidth ? dropdownMaxWidth : comboBoxMenuWidth,
        hidden: persistMenu ? !isOpen : undefined,
        shouldRestoreFocus: shouldRestoreFocus
      }), React.createElement("div", {
        className: _this._classNames.optionsContainerWrapper,
        ref: _this._comboBoxMenu
      }, onRenderList(tslib_1.__assign({}, props), _this._onRenderList)), onRenderLowerContent(_this.props, _this._onRenderLowerContent));
    };

    _this._onLayerMounted = function () {
      _this._onCalloutLayerMounted();

      if (_this.props.calloutProps && _this.props.calloutProps.onLayerMounted) {
        _this.props.calloutProps.onLayerMounted();
      }
    }; // Render List of items


    _this._onRenderList = function (props) {
      var onRenderItem = props.onRenderItem,
          options = props.options;
      var id = _this._id;
      return React.createElement("div", {
        id: id + '-list',
        className: _this._classNames.optionsContainer,
        "aria-labelledby": id + '-label',
        role: "listbox"
      }, options.map(function (item) {
        return onRenderItem(item, _this._onRenderItem);
      }));
    }; // Render items


    _this._onRenderItem = function (item) {
      switch (item.itemType) {
        case _index2.SelectableOptionMenuItemType.Divider:
          return _this._renderSeparator(item);

        case _index2.SelectableOptionMenuItemType.Header:
          return _this._renderHeader(item);

        default:
          return _this._renderOption(item);
      }
    }; // Default _onRenderLowerContent function returns nothing


    _this._onRenderLowerContent = function () {
      return null;
    };

    _this._renderOption = function (item) {
      var _a = _this.props.onRenderOption,
          onRenderOption = _a === void 0 ? _this._onRenderOptionContent : _a;
      var id = _this._id;

      var isSelected = _this._isOptionSelected(item.index);

      var optionStyles = _this._getCurrentOptionStyles(item);

      var optionClassNames = (0, _ComboBox2.getComboBoxOptionClassNames)(_this._getCurrentOptionStyles(item));

      var checkboxStyles = function () {
        return optionStyles;
      };

      var title = _this._getPreviewText(item);

      var getOptionComponent = function () {
        return !_this.props.multiSelect ? React.createElement(_Button.CommandButton, {
          id: id + '-list' + item.index,
          key: item.key,
          "data-index": item.index,
          styles: _this._getCurrentOptionStyles(item),
          checked: isSelected,
          className: 'ms-ComboBox-option',
          onClick: _this._onItemClick(item),
          onMouseEnter: _this._onOptionMouseEnter.bind(_this, item.index),
          onMouseMove: _this._onOptionMouseMove.bind(_this, item.index),
          onMouseLeave: _this._onOptionMouseLeave,
          role: "option",
          "aria-selected": isSelected ? 'true' : 'false',
          ariaLabel: _this._getPreviewText(item),
          disabled: item.disabled,
          title: title
        }, ' ', React.createElement("span", {
          className: optionClassNames.optionTextWrapper,
          ref: isSelected ? _this._selectedElement : undefined
        }, onRenderOption(item, _this._onRenderOptionContent))) : React.createElement(_Checkbox.Checkbox, {
          id: id + '-list' + item.index,
          ariaLabel: _this._getPreviewText(item),
          key: item.key,
          "data-index": item.index,
          styles: checkboxStyles,
          className: 'ms-ComboBox-option',
          "data-is-focusable": true,
          onChange: _this._onItemClick(item),
          label: item.text,
          role: "option",
          "aria-selected": isSelected ? 'true' : 'false',
          checked: isSelected,
          title: title
        }, onRenderOption(item, _this._onRenderOptionContent));
      };

      return React.createElement(ComboBoxOptionWrapper, {
        key: item.key,
        index: item.index,
        disabled: item.disabled,
        isSelected: isSelected,
        text: item.text,
        render: getOptionComponent,
        data: item.data
      });
    };
    /**
     * Scroll handler for the callout to make sure the mouse events
     * for updating focus are not interacting during scroll
     */


    _this._onScroll = function () {
      if (!_this._isScrollIdle && _this._scrollIdleTimeoutId !== undefined) {
        _this._async.clearTimeout(_this._scrollIdleTimeoutId);

        _this._scrollIdleTimeoutId = undefined;
      } else {
        _this._isScrollIdle = false;
      }

      _this._scrollIdleTimeoutId = _this._async.setTimeout(function () {
        _this._isScrollIdle = true;
      }, ScrollIdleDelay);
    };

    _this._onRenderOptionContent = function (item) {
      var optionClassNames = (0, _ComboBox2.getComboBoxOptionClassNames)(_this._getCurrentOptionStyles(item));
      return React.createElement("span", {
        className: optionClassNames.optionText
      }, item.text);
    };
    /**
     * Handles dismissing (cancelling) the menu
     */


    _this._onDismiss = function () {
      var onMenuDismiss = _this.props.onMenuDismiss;

      if (onMenuDismiss) {
        onMenuDismiss();
      } // In persistMode we need to simulate callout layer mount
      // since that only happens once. We do it on dismiss since
      // it works either way.


      if (_this.props.persistMenu) {
        _this._onCalloutLayerMounted();
      } // close the menu


      _this._setOpenStateAndFocusOnClose(false
      /* isOpen */
      , false
      /* focusInputAfterClose */
      ); // reset the selected index
      // to the last value state


      _this._resetSelectedIndex();
    };

    _this._onAfterClearPendingInfo = function () {
      _this._processingClearPendingInfo = false;
    };
    /**
     * Handle keydown on the input
     * @param ev - The keyboard event that was fired
     */


    _this._onInputKeyDown = function (ev) {
      var _a = _this.props,
          disabled = _a.disabled,
          allowFreeform = _a.allowFreeform,
          autoComplete = _a.autoComplete;
      var _b = _this.state,
          isOpen = _b.isOpen,
          currentOptions = _b.currentOptions,
          currentPendingValueValidIndexOnHover = _b.currentPendingValueValidIndexOnHover; // Take note if we are processing an alt (option) or meta (command) keydown.
      // See comment in _onInputKeyUp for reasoning.

      _this._lastKeyDownWasAltOrMeta = _this._isAltOrMeta(ev);

      if (disabled) {
        _this._handleInputWhenDisabled(ev);

        return;
      }

      var index = _this._getPendingSelectedIndex(false
      /* includeCurrentPendingValue */
      );

      switch (ev.which) {
        case _Utilities.KeyCodes.enter:
          if (_this._autofill.current && _this._autofill.current.inputElement) {
            _this._autofill.current.inputElement.select();
          }

          _this._submitPendingValue(ev);

          if (_this.props.multiSelect && isOpen) {
            _this.setState({
              currentPendingValueValidIndex: index
            });
          } else {
            // On enter submit the pending value
            if (isOpen || (!allowFreeform || _this.state.currentPendingValue === undefined || _this.state.currentPendingValue === null || _this.state.currentPendingValue.length <= 0) && _this.state.currentPendingValueValidIndex < 0) {
              // if we are open or
              // if we are not allowing freeform or
              // our we have no pending value
              // and no valid pending index
              // flip the open state
              _this.setState({
                isOpen: !isOpen
              });
            }
          }

          break;

        case _Utilities.KeyCodes.tab:
          // On enter submit the pending value
          if (!_this.props.multiSelect) {
            _this._submitPendingValue(ev);
          } // If we are not allowing freeform
          // or the comboBox is open, flip the open state


          if (isOpen) {
            _this._setOpenStateAndFocusOnClose(!isOpen, false
            /* focusInputAfterClose */
            );
          } // Allow TAB to propigate


          return;

        case _Utilities.KeyCodes.escape:
          // reset the selected index
          _this._resetSelectedIndex(); // Close the menu if opened


          if (isOpen) {
            _this.setState({
              isOpen: false
            });
          } else {
            return;
          }

          break;

        case _Utilities.KeyCodes.up:
          // if we are in clearAll state (e.g. the user as hovering
          // and has since mousedOut of the menu items),
          // go to the last index
          if (currentPendingValueValidIndexOnHover === HoverStatus.clearAll) {
            index = _this.state.currentOptions.length;
          }

          if (ev.altKey || ev.metaKey) {
            // Close the menu if it is open and break so
            // that the event get stopPropagation and prevent default.
            // Otherwise, we need to let the event continue to propagate
            if (isOpen) {
              _this._setOpenStateAndFocusOnClose(!isOpen, true
              /* focusInputAfterClose */
              );

              break;
            }

            return;
          } // Go to the previous option


          _this._setPendingInfoFromIndexAndDirection(index, SearchDirection.backward);

          break;

        case _Utilities.KeyCodes.down:
          // Expand the comboBox on ALT + DownArrow
          if (ev.altKey || ev.metaKey) {
            _this._setOpenStateAndFocusOnClose(true
            /* isOpen */
            , true
            /* focusInputAfterClose */
            );
          } else {
            // if we are in clearAll state (e.g. the user as hovering
            // and has since mousedOut of the menu items),
            // go to the first index
            if (currentPendingValueValidIndexOnHover === HoverStatus.clearAll) {
              index = -1;
            } // Got to the next option


            _this._setPendingInfoFromIndexAndDirection(index, SearchDirection.forward);
          }

          break;

        case _Utilities.KeyCodes.home:
        case _Utilities.KeyCodes.end:
          if (allowFreeform) {
            return;
          } // Set the initial values to respond to HOME
          // which goes to the first selectable option


          index = -1;
          var directionToSearch = SearchDirection.forward; // If end, update the values to respond to END
          // which goes to the last selectable option

          if (ev.which === _Utilities.KeyCodes.end) {
            index = currentOptions.length;
            directionToSearch = SearchDirection.backward;
          }

          _this._setPendingInfoFromIndexAndDirection(index, directionToSearch);

          break;

        case _Utilities.KeyCodes.space:
          // event handled in _onComboBoxKeyUp
          if (!allowFreeform && autoComplete === 'off') {
            break;
          }

        default:
          // are we processing a function key? if so bail out
          if (ev.which >= 112
          /* F1 */
          && ev.which <= 123
          /* F12 */
          ) {
              return;
            } // If we get here and we got either and ALT key
          // or meta key, let the event propagate


          if (ev.keyCode === _Utilities.KeyCodes.alt || ev.key === 'Meta'
          /* && isOpen */
          ) {
              return;
            } // If we are not allowing freeform and
          // allowing autoComplete, handle the input here
          // since we have marked the input as readonly


          if (!allowFreeform && autoComplete === 'on') {
            _this._onInputChange(String.fromCharCode(ev.which));

            break;
          } // allow the key to propagate by default


          return;
      }

      ev.stopPropagation();
      ev.preventDefault();
    };
    /**
     * Handle keyup on the input
     * @param ev - the keyboard event that was fired
     */


    _this._onInputKeyUp = function (ev) {
      var _a = _this.props,
          disabled = _a.disabled,
          allowFreeform = _a.allowFreeform,
          autoComplete = _a.autoComplete;
      var isOpen = _this.state.isOpen; // We close the menu on key up only if ALL of the following are true:
      // - Most recent key down was alt or meta (command)
      // - The alt/meta key down was NOT followed by some other key (such as down/up arrow to
      //   expand/collapse the menu)
      // - We're not on a Mac (or iOS)
      // This is because on Windows, pressing alt moves focus to the application menu bar or similar,
      // closing any open context menus. There is not a similar behavior on Macs.

      var keyPressIsAltOrMetaAlone = _this._lastKeyDownWasAltOrMeta && _this._isAltOrMeta(ev);

      _this._lastKeyDownWasAltOrMeta = false;
      var shouldHandleKey = keyPressIsAltOrMetaAlone && !((0, _Utilities.isMac)() || (0, _Utilities.isIOS)());

      if (disabled) {
        _this._handleInputWhenDisabled(ev);

        return;
      }

      switch (ev.which) {
        case _Utilities.KeyCodes.space:
          // If we are not allowing freeform and are not autoComplete
          // make space expand/collapse the comboBox
          // and allow the event to propagate
          if (!allowFreeform && autoComplete === 'off') {
            _this._setOpenStateAndFocusOnClose(!isOpen, !!isOpen);

            return;
          }

          break;

        default:
          if (shouldHandleKey && isOpen) {
            _this._setOpenStateAndFocusOnClose(!isOpen, true
            /* focusInputAfterClose */
            );
          }

          return;
      }

      ev.stopPropagation();
      ev.preventDefault();
    };

    _this._onOptionMouseLeave = function () {
      if (_this._shouldIgnoreMouseEvent()) {
        return;
      } // Ignore the event in persistMenu mode if the callout has
      // closed. This is to avoid clearing the visuals on item click.


      if (_this.props.persistMenu && !_this.state.isOpen) {
        return;
      }

      _this.setState({
        currentPendingValueValidIndexOnHover: HoverStatus.clearAll
      });
    };
    /**
     * Click handler for the button of the comboBox
     * and the input when not allowing freeform. This
     * toggles the expand/collapse state of the comboBox (if enbled)
     */


    _this._onComboBoxClick = function () {
      var disabled = _this.props.disabled;
      var isOpen = _this.state.isOpen;

      if (!disabled) {
        _this._setOpenStateAndFocusOnClose(!isOpen, false
        /* focusInputAfterClose */
        );

        _this.setState({
          focused: true
        });
      }
    };
    /**
     * Click handler for the autofill.
     */


    _this._onAutofillClick = function () {
      if (_this.props.allowFreeform) {
        _this.focus(_this.state.isOpen || _this._processingTouch);
      } else {
        _this._onComboBoxClick();
      }
    };

    _this._onTouchStart = function () {
      if (_this._comboBoxWrapper.current && !('onpointerdown' in _this._comboBoxWrapper)) {
        _this._handleTouchAndPointerEvent();
      }
    };

    _this._onPointerDown = function (ev) {
      if (ev.pointerType === 'touch') {
        _this._handleTouchAndPointerEvent();

        ev.preventDefault();
        ev.stopImmediatePropagation();
      }
    };

    _this._warnMutuallyExclusive({
      defaultSelectedKey: 'selectedKey',
      text: 'defaultSelectedKey',
      value: 'defaultSelectedKey',
      selectedKey: 'value',
      dropdownWidth: 'useComboBoxAsMenuWidth'
    });

    _this._warnDeprecations({
      value: 'text',
      onChanged: 'onChange'
    });

    _this._id = props.id || (0, _Utilities.getId)('ComboBox');

    var selectedKeys = _this._buildDefaultSelectedKeys(props.defaultSelectedKey, props.selectedKey);

    _this._isScrollIdle = true;
    _this._processingTouch = false;
    _this._gotMouseMove = false;
    _this._processingClearPendingInfo = false;

    var initialSelectedIndices = _this._getSelectedIndices(props.options, selectedKeys);

    _this.state = {
      isOpen: false,
      selectedIndices: initialSelectedIndices,
      focused: false,
      suggestedDisplayValue: undefined,
      currentOptions: _this.props.options,
      currentPendingValueValidIndex: -1,
      currentPendingValue: undefined,
      currentPendingValueValidIndexOnHover: HoverStatus.default
    };
    return _this;
  }

  Object.defineProperty(ComboBox.prototype, "selectedOptions", {
    /**
     * All selected options
     */
    get: function () {
      var _a = this.state,
          currentOptions = _a.currentOptions,
          selectedIndices = _a.selectedIndices;
      return (0, _index2.getAllSelectedOptions)(currentOptions, selectedIndices);
    },
    enumerable: true,
    configurable: true
  });

  ComboBox.prototype.componentDidMount = function () {
    if (this._comboBoxWrapper.current) {
      // hook up resolving the options if needed on focus
      this._events.on(this._comboBoxWrapper.current, 'focus', this._onResolveOptions, true);

      if ('onpointerdown' in this._comboBoxWrapper.current) {
        // For ComboBoxes, touching anywhere in the combo box should drop the dropdown, including the input element.
        // This gives more hit target space for touch environments. We're setting the onpointerdown here, because React
        // does not support Pointer events yet.
        this._events.on(this._comboBoxWrapper.current, 'pointerdown', this._onPointerDown, true);
      }
    }
  };

  ComboBox.prototype.componentWillReceiveProps = function (newProps) {
    // Update the selectedIndex and currentOptions state if
    // the selectedKey, value, or options have changed
    if (newProps.selectedKey !== this.props.selectedKey || newProps.text !== this.props.text || newProps.value !== this.props.value || newProps.options !== this.props.options) {
      var selectedKeys = this._buildSelectedKeys(newProps.selectedKey);

      var indices = this._getSelectedIndices(newProps.options, selectedKeys);

      this.setState({
        selectedIndices: indices,
        currentOptions: newProps.options
      });
    }
  };

  ComboBox.prototype.componentDidUpdate = function (prevProps, prevState) {
    var _this = this;

    var _a = this.props,
        allowFreeform = _a.allowFreeform,
        text = _a.text,
        value = _a.value,
        onMenuOpen = _a.onMenuOpen,
        onMenuDismissed = _a.onMenuDismissed;
    var _b = this.state,
        isOpen = _b.isOpen,
        focused = _b.focused,
        selectedIndices = _b.selectedIndices,
        currentPendingValueValidIndex = _b.currentPendingValueValidIndex; // If we are newly open or are open and the pending valid index changed,
    // make sure the currently selected/pending option is scrolled into view

    if (isOpen && (!prevState.isOpen || prevState.currentPendingValueValidIndex !== currentPendingValueValidIndex)) {
      // Need this timeout so that the selectedElement ref is correctly updated
      this._async.setTimeout(function () {
        return _this._scrollIntoView();
      }, 0);
    } // if an action is taken that put focus in the ComboBox
    // and If we are open or we are just closed, shouldFocusAfterClose is set,
    // but we are not the activeElement set focus on the input


    if (focused && (isOpen || prevState.isOpen && !isOpen && this._focusInputAfterClose && this._autofill.current && document.activeElement !== this._autofill.current.inputElement)) {
      this.focus(undefined
      /*shouldOpenOnFocus*/
      , true
      /*useFocusAsync*/
      );
    } // If we should focusAfterClose AND
    //   just opened/closed the menu OR
    //   are focused AND
    //     updated the selectedIndex with the menu closed OR
    //     are not allowing freeform OR
    //     the value changed
    // we need to set selection


    if (this._focusInputAfterClose && (prevState.isOpen && !isOpen || focused && (!isOpen && !this.props.multiSelect && prevState.selectedIndices && selectedIndices && prevState.selectedIndices[0] !== selectedIndices[0] || !allowFreeform || text !== prevProps.text || value !== prevProps.value))) {
      this._select();
    }

    this._notifyPendingValueChanged(prevState);

    if (isOpen && !prevState.isOpen && onMenuOpen) {
      onMenuOpen();
    }

    if (!isOpen && prevState.isOpen && onMenuDismissed) {
      onMenuDismissed();
    }
  };

  ComboBox.prototype.componentWillUnmount = function () {
    _super.prototype.componentWillUnmount.call(this); // remove the eventHanlder that was added in componentDidMount


    this._events.off(this._comboBoxWrapper.current);
  }; // Primary Render


  ComboBox.prototype.render = function () {
    var _this = this;

    var id = this._id;
    var _a = this.props,
        className = _a.className,
        label = _a.label,
        disabled = _a.disabled,
        ariaLabel = _a.ariaLabel,
        ariaDescribedBy = _a.ariaDescribedBy,
        required = _a.required,
        errorMessage = _a.errorMessage,
        _b = _a.onRenderContainer,
        onRenderContainer = _b === void 0 ? this._onRenderContainer : _b,
        _c = _a.onRenderList,
        onRenderList = _c === void 0 ? this._onRenderList : _c,
        _d = _a.onRenderItem,
        onRenderItem = _d === void 0 ? this._onRenderItem : _d,
        _e = _a.onRenderOption,
        onRenderOption = _e === void 0 ? this._onRenderOptionContent : _e,
        allowFreeform = _a.allowFreeform,
        buttonIconProps = _a.buttonIconProps,
        _f = _a.isButtonAriaHidden,
        isButtonAriaHidden = _f === void 0 ? true : _f,
        customStyles = _a.styles,
        theme = _a.theme,
        title = _a.title,
        keytipProps = _a.keytipProps,
        placeholder = _a.placeholder,
        tabIndex = _a.tabIndex,
        autofill = _a.autofill,
        persistMenu = _a.persistMenu;
    var _g = this.state,
        isOpen = _g.isOpen,
        focused = _g.focused,
        suggestedDisplayValue = _g.suggestedDisplayValue;
    this._currentVisibleValue = this._getVisibleValue();
    var divProps = (0, _Utilities.getNativeProps)(this.props, _Utilities.divProperties, ['onChange', 'value']);
    var hasErrorMessage = errorMessage && errorMessage.length > 0 ? true : false;
    this._classNames = this.props.getClassNames ? this.props.getClassNames(theme, !!isOpen, !!disabled, !!required, !!focused, !!allowFreeform, !!hasErrorMessage, className) : (0, _ComboBox2.getClassNames)((0, _ComboBox.getStyles)(theme, customStyles), className, !!isOpen, !!disabled, !!required, !!focused, !!allowFreeform, !!hasErrorMessage);
    return React.createElement("div", tslib_1.__assign({}, divProps, {
      ref: this._root,
      className: this._classNames.container
    }), label && React.createElement(_Label.Label, {
      id: id + '-label',
      disabled: disabled,
      required: required,
      htmlFor: id + '-input',
      className: this._classNames.label
    }, label), React.createElement(_KeytipData.KeytipData, {
      keytipProps: keytipProps,
      disabled: disabled
    }, function (keytipAttributes) {
      return React.createElement("div", {
        "data-ktp-target": keytipAttributes['data-ktp-target'],
        ref: _this._comboBoxWrapper,
        id: id + 'wrapper',
        className: _this._classNames.root
      }, React.createElement(_index.Autofill, tslib_1.__assign({
        "data-ktp-execute-target": keytipAttributes['data-ktp-execute-target'],
        "data-is-interactable": !disabled,
        componentRef: _this._autofill,
        id: id + '-input',
        className: _this._classNames.input,
        type: "text",
        onFocus: _this._select,
        onBlur: _this._onBlur,
        onKeyDown: _this._onInputKeyDown,
        onKeyUp: _this._onInputKeyUp,
        onClick: _this._onAutofillClick,
        onTouchStart: _this._onTouchStart,
        onInputValueChange: _this._onInputChange,
        "aria-expanded": isOpen,
        "aria-autocomplete": _this._getAriaAutoCompleteValue(),
        role: "combobox",
        readOnly: disabled || !allowFreeform,
        "aria-labelledby": label && id + '-label',
        "aria-label": ariaLabel && !label ? ariaLabel : undefined,
        "aria-describedby": (0, _Utilities.mergeAriaAttributeValues)(ariaDescribedBy, keytipAttributes['aria-describedby']),
        "aria-activedescendant": _this._getAriaActiveDescentValue(),
        "aria-required": required,
        "aria-disabled": disabled,
        "aria-owns": isOpen ? id + '-list' : undefined,
        spellCheck: false,
        defaultVisibleValue: _this._currentVisibleValue,
        suggestedDisplayValue: suggestedDisplayValue,
        updateValueInWillReceiveProps: _this._onUpdateValueInAutofillWillReceiveProps,
        shouldSelectFullInputValueInComponentDidUpdate: _this._onShouldSelectFullInputValueInAutofillComponentDidUpdate,
        title: title,
        preventValueSelection: !focused,
        placeholder: placeholder,
        tabIndex: tabIndex
      }, autofill)), React.createElement(_Button.IconButton, {
        className: 'ms-ComboBox-CaretDown-button',
        styles: _this._getCaretButtonStyles(),
        role: "presentation",
        "aria-hidden": isButtonAriaHidden,
        "data-is-focusable": false,
        tabIndex: -1,
        onClick: _this._onComboBoxClick,
        onBlur: _this._onBlur,
        iconProps: buttonIconProps,
        disabled: disabled,
        checked: isOpen
      }));
    }), (persistMenu || isOpen) && onRenderContainer(tslib_1.__assign({}, this.props, {
      onRenderList: onRenderList,
      onRenderItem: onRenderItem,
      onRenderOption: onRenderOption,
      options: this.state.currentOptions.map(function (item, index) {
        return tslib_1.__assign({}, item, {
          index: index
        });
      })
    }), this._onRenderContainer), errorMessage && React.createElement("div", {
      className: this._classNames.errorMessage
    }, errorMessage));
  };
  /**
   * Is the index within the bounds of the array?
   * @param options - options to check if the index is valid for
   * @param index - the index to check
   * @returns - true if the index is valid for the given options, false otherwise
   */


  ComboBox.prototype._indexWithinBounds = function (options, index) {
    if (!options) {
      return false;
    }

    return index >= 0 && index < options.length;
  };
  /**
   * Process the new input's new value when the comboBox
   * allows freeform entry
   * @param updatedValue - the input's newly changed value
   */


  ComboBox.prototype._processInputChangeWithFreeform = function (updatedValue) {
    var _this = this;

    var currentOptions = this.state.currentOptions;
    updatedValue = this._removeZeroWidthSpaces(updatedValue);
    var newCurrentPendingValueValidIndex = -1; // if the new value is empty, see if we have an exact match
    // and then set the pending info

    if (updatedValue === '') {
      var items = currentOptions.map(function (item, index) {
        return tslib_1.__assign({}, item, {
          index: index
        });
      }).filter(function (option) {
        return option.itemType !== _index2.SelectableOptionMenuItemType.Header && option.itemType !== _index2.SelectableOptionMenuItemType.Divider;
      }).filter(function (option) {
        return _this._getPreviewText(option) === updatedValue;
      }); // if we found a match remember the index

      if (items.length === 1) {
        newCurrentPendingValueValidIndex = items[0].index;
      }

      this._setPendingInfo(updatedValue, newCurrentPendingValueValidIndex, updatedValue);

      return;
    } // Remember the original value and then,
    // make the value lowercase for comparison


    var originalUpdatedValue = updatedValue;
    updatedValue = updatedValue.toLocaleLowerCase();
    var newSuggestedDisplayValue = ''; // If autoComplete is on, attempt to find a match from the available options

    if (this.props.autoComplete === 'on') {
      // If autoComplete is on, attempt to find a match where the text of an option starts with the updated value
      var items = currentOptions.map(function (item, index) {
        return tslib_1.__assign({}, item, {
          index: index
        });
      }).filter(function (option) {
        return option.itemType !== _index2.SelectableOptionMenuItemType.Header && option.itemType !== _index2.SelectableOptionMenuItemType.Divider;
      }).filter(function (option) {
        return _this._getPreviewText(option).toLocaleLowerCase().indexOf(updatedValue) === 0;
      });

      if (items.length > 0) {
        // use ariaLabel as the value when the option is set
        var text = this._getPreviewText(items[0]); // If the user typed out the complete option text, we don't need any suggested display text anymore


        newSuggestedDisplayValue = text.toLocaleLowerCase() !== updatedValue ? text : ''; // remember the index of the match we found

        newCurrentPendingValueValidIndex = items[0].index;
      }
    } else {
      // If autoComplete is off, attempt to find a match only when the value is exactly equal to the text of an option
      var items = currentOptions.map(function (item, index) {
        return tslib_1.__assign({}, item, {
          index: index
        });
      }).filter(function (option) {
        return option.itemType !== _index2.SelectableOptionMenuItemType.Header && option.itemType !== _index2.SelectableOptionMenuItemType.Divider;
      }).filter(function (option) {
        return _this._getPreviewText(option).toLocaleLowerCase() === updatedValue;
      }); // if we found a match remember the index

      if (items.length === 1) {
        newCurrentPendingValueValidIndex = items[0].index;
      }
    } // Set the updated state


    this._setPendingInfo(originalUpdatedValue, newCurrentPendingValueValidIndex, newSuggestedDisplayValue);
  };
  /**
   * Process the new input's new value when the comboBox
   * does not allow freeform entry
   * @param updatedValue - the input's newly changed value
   */


  ComboBox.prototype._processInputChangeWithoutFreeform = function (updatedValue) {
    var _this = this;

    var _a = this.state,
        currentPendingValue = _a.currentPendingValue,
        currentPendingValueValidIndex = _a.currentPendingValueValidIndex,
        currentOptions = _a.currentOptions;
    updatedValue = this._removeZeroWidthSpaces(updatedValue);

    if (this.props.autoComplete === 'on') {
      // If autoComplete is on while allow freeform is off,
      // we will remember the keypresses and build up a string to attempt to match
      // as long as characters are typed within a the timeout span of each other,
      // otherwise we will clear the string and start building a new one on the next keypress.
      // Also, only do this processing if we have a non-empty value
      if (updatedValue !== '') {
        // If we have a pending autocomplete clearing task,
        // we know that the user is typing with keypresses happening
        // within the timeout of each other so remove the clearing task
        // and continue building the pending value with the udpated value
        if (this._lastReadOnlyAutoCompleteChangeTimeoutId !== undefined) {
          this._async.clearTimeout(this._lastReadOnlyAutoCompleteChangeTimeoutId);

          this._lastReadOnlyAutoCompleteChangeTimeoutId = undefined;
          updatedValue = this._normalizeToString(currentPendingValue) + updatedValue;
        }

        var originalUpdatedValue = updatedValue;
        updatedValue = updatedValue.toLocaleLowerCase(); // If autoComplete is on, attempt to find a match where the text of an option starts with the updated value

        var items = currentOptions.map(function (item, i) {
          return tslib_1.__assign({}, item, {
            index: i
          });
        }).filter(function (option) {
          return option.itemType !== _index2.SelectableOptionMenuItemType.Header && option.itemType !== _index2.SelectableOptionMenuItemType.Divider;
        }).filter(function (option) {
          return option.text.toLocaleLowerCase().indexOf(updatedValue) === 0;
        }); // If we found a match, udpdate the state

        if (items.length > 0) {
          this._setPendingInfo(originalUpdatedValue, items[0].index, this._getPreviewText(items[0]));
        } // Schedule a timeout to clear the pending value after the timeout span


        this._lastReadOnlyAutoCompleteChangeTimeoutId = this._async.setTimeout(function () {
          _this._lastReadOnlyAutoCompleteChangeTimeoutId = undefined;
        }, ReadOnlyPendingAutoCompleteTimeout);
        return;
      }
    } // If we get here, either autoComplete is on or we did not find a match with autoComplete on.
    // Remember we are not allowing freeform, so at this point, if we have a pending valid value index
    // use that; otherwise use the selectedIndex


    var index = currentPendingValueValidIndex >= 0 ? currentPendingValueValidIndex : this._getFirstSelectedIndex(); // Since we are not allowing freeform, we need to
    // set both the pending and suggested values/index
    // to allow us to select all content in the input to
    // give the illusion that we are readonly (e.g. freeform off)

    this._setPendingInfoFromIndex(index);
  };

  ComboBox.prototype._getFirstSelectedIndex = function () {
    return this.state.selectedIndices && this.state.selectedIndices.length > 0 ? this.state.selectedIndices[0] : -1;
  };
  /**
   * Walk along the options starting at the index, stepping by the delta (positive or negative)
   * looking for the next valid selectable index (e.g. skipping headings and dividers)
   * @param index - the index to get the next selectable index from
   * @param delta - optional delta to step by when finding the next index, defaults to 0
   * @returns - the next valid selectable index. If the new index is outside of the bounds,
   * it will snap to the edge of the options array. If delta == 0 and the given index is not selectable
   */


  ComboBox.prototype._getNextSelectableIndex = function (index, searchDirection) {
    var currentOptions = this.state.currentOptions;
    var newIndex = index + searchDirection;
    newIndex = Math.max(0, Math.min(currentOptions.length - 1, newIndex));

    if (!this._indexWithinBounds(currentOptions, newIndex)) {
      return -1;
    }

    var option = currentOptions[newIndex]; // attempt to skip headers and dividers

    if (option.itemType === _index2.SelectableOptionMenuItemType.Header || option.itemType === _index2.SelectableOptionMenuItemType.Divider) {
      // Should we continue looking for an index to select?
      if (searchDirection !== SearchDirection.none && (newIndex > 0 && searchDirection < SearchDirection.none || newIndex >= 0 && newIndex < currentOptions.length && searchDirection > SearchDirection.none)) {
        newIndex = this._getNextSelectableIndex(newIndex, searchDirection);
      } else {
        // If we cannot perform a useful search just return the index we were given
        return index;
      }
    } // We have the next valid selectable index, return it


    return newIndex;
  };
  /**
   * Set the selected index. Note, this is
   * the "real" selected index, not the pending selected index
   * @param index - the index to set (or the index to set from if a search direction is provided)
   * @param searchDirection - the direction to search along the options from the given index
   */


  ComboBox.prototype._setSelectedIndex = function (index, submitPendingValueEvent, searchDirection) {
    var _this = this;

    if (searchDirection === void 0) {
      searchDirection = SearchDirection.none;
    }

    var _a = this.props,
        onChange = _a.onChange,
        onChanged = _a.onChanged,
        onPendingValueChanged = _a.onPendingValueChanged;
    var currentOptions = this.state.currentOptions;
    var selectedIndices = this.state.selectedIndices;

    if (!selectedIndices) {
      selectedIndices = [];
    } // Find the next selectable index, if searchDirection is none
    // we will get our starting index back


    index = this._getNextSelectableIndex(index, searchDirection);

    if (!this._indexWithinBounds(currentOptions, index)) {
      return;
    } // Are we at a new index? If so, update the state, otherwise
    // there is nothing to do


    if (this.props.multiSelect || selectedIndices.length < 1 || selectedIndices.length === 1 && selectedIndices[0] !== index) {
      var option_1 = currentOptions[index];

      if (!option_1) {
        return;
      }

      if (this.props.multiSelect) {
        // Setting the initial state of option.selected in Multi-select combobox by checking the
        // selectedIndices array and overriding the undefined issue
        option_1.selected = option_1.selected !== undefined ? !option_1.selected : selectedIndices.indexOf(index) < 0;

        if (option_1.selected && selectedIndices.indexOf(index) < 0) {
          selectedIndices.push(index);
        } else if (!option_1.selected && selectedIndices.indexOf(index) >= 0) {
          selectedIndices = selectedIndices.filter(function (value) {
            return value !== index;
          });
        }
      } else {
        selectedIndices[0] = index;
      }

      submitPendingValueEvent.persist(); // Call onChange after state is updated

      this.setState({
        selectedIndices: selectedIndices
      }, function () {
        // If ComboBox value is changed, revert preview first
        if (_this._hasPendingValue && onPendingValueChanged) {
          onPendingValueChanged();
          _this._hasPendingValue = false;
        }

        if (onChange) {
          onChange(submitPendingValueEvent, option_1, index, undefined);
        }

        if (onChanged) {
          onChanged(option_1, index, undefined, submitPendingValueEvent);
        }
      });
    } // clear all of the pending info


    this._clearPendingInfo();
  };
  /**
   * Submit a pending value if there is one
   */


  ComboBox.prototype._submitPendingValue = function (submitPendingValueEvent) {
    var _a = this.props,
        onChange = _a.onChange,
        onChanged = _a.onChanged,
        allowFreeform = _a.allowFreeform,
        autoComplete = _a.autoComplete;
    var _b = this.state,
        currentPendingValue = _b.currentPendingValue,
        currentPendingValueValidIndex = _b.currentPendingValueValidIndex,
        currentOptions = _b.currentOptions,
        currentPendingValueValidIndexOnHover = _b.currentPendingValueValidIndexOnHover;
    var selectedIndices = this.state.selectedIndices; // Do not submit any pending value if we
    // have already initiated clearing the pending info

    if (this._processingClearPendingInfo) {
      return;
    } // If we allow freeform we need to handle that


    if (allowFreeform) {
      // if currentPendingValue is null or undefined the user did not submit anything
      // (not even empty because we would have stored that as the pending value)
      if (currentPendingValue === null || currentPendingValue === undefined) {
        // if a user did not type anything they may just hovered over an item
        if (currentPendingValueValidIndexOnHover >= 0) {
          this._setSelectedIndex(currentPendingValueValidIndexOnHover, submitPendingValueEvent);

          this._clearPendingInfo();
        }

        return;
      } // Check to see if the user typed an exact match


      if (this._indexWithinBounds(currentOptions, currentPendingValueValidIndex)) {
        var pendingOptionText = this._getPreviewText(currentOptions[currentPendingValueValidIndex]).toLocaleLowerCase(); // By exact match, that means: our pending value is the same as the the pending option text OR
        // the pending option starts with the pending value and we have an "autoComplete" selection
        // where the total length is equal to pending option length OR
        // the live value in the underlying input matches the pending option; update the state


        if (currentPendingValue.toLocaleLowerCase() === pendingOptionText || autoComplete && pendingOptionText.indexOf(currentPendingValue.toLocaleLowerCase()) === 0 && this._autofill.current && this._autofill.current.isValueSelected && currentPendingValue.length + (this._autofill.current.selectionEnd - this._autofill.current.selectionStart) === pendingOptionText.length || this._autofill.current && this._autofill.current.inputElement && this._autofill.current.inputElement.value.toLocaleLowerCase() === pendingOptionText) {
          this._setSelectedIndex(currentPendingValueValidIndex, submitPendingValueEvent);

          this._clearPendingInfo();

          return;
        }
      }

      if (onChange || onChanged) {
        if (onChange) {
          // trigger onChange to clear value
          onChange(submitPendingValueEvent, undefined, undefined, currentPendingValue);
        }

        if (onChanged) {
          // trigger onChanged to clear value
          onChanged(undefined, undefined, currentPendingValue, submitPendingValueEvent);
        }
      } else {
        // If we are not controlled, create a new option
        var newOption = {
          key: currentPendingValue || (0, _Utilities.getId)(),
          text: this._normalizeToString(currentPendingValue)
        };
        var newOptions = currentOptions.concat([newOption]);

        if (selectedIndices) {
          if (!this.props.multiSelect) {
            selectedIndices = [];
          }

          selectedIndices.push(newOptions.length - 1);
        }

        this.setState({
          currentOptions: newOptions,
          selectedIndices: selectedIndices
        });
      }
    } else if (currentPendingValueValidIndex >= 0) {
      // Since we are not allowing freeform, we must have a matching
      // to be able to update state
      this._setSelectedIndex(currentPendingValueValidIndex, submitPendingValueEvent);
    } else if (currentPendingValueValidIndexOnHover >= 0) {
      // If all else failed and we were hovering over an item, select it
      this._setSelectedIndex(currentPendingValueValidIndexOnHover, submitPendingValueEvent);
    } // Finally, clear the pending info


    this._clearPendingInfo();
  };

  ComboBox.prototype._onCalloutLayerMounted = function () {
    // In persistMenu mode _onLayerMounted is only called once for the lifetime
    // of the component. Any functionality required for callout "on mount" can
    // go here so that we can also call it again during callout dismissal to reset
    // object state.
    this._gotMouseMove = false;
  }; // Render separator


  ComboBox.prototype._renderSeparator = function (item) {
    var index = item.index,
        key = item.key;

    if (index && index > 0) {
      return React.createElement("div", {
        role: "separator",
        key: key,
        className: this._classNames.divider
      });
    }

    return null;
  };

  ComboBox.prototype._renderHeader = function (item) {
    var _a = this.props.onRenderOption,
        onRenderOption = _a === void 0 ? this._onRenderOptionContent : _a;
    return React.createElement("div", {
      key: item.key,
      className: this._classNames.header
    }, onRenderOption(item, this._onRenderOptionContent));
  };
  /**
   * If we are coming from a mouseOut:
   * there is no visible selected option.
   *
   * Else if We are hovering over an item:
   * that gets the selected look.
   *
   * Else:
   * Use the current valid pending index if it exists OR
   * we do not have a valid index and we currently have a pending input value,
   * otherwise use the selected index
   * */


  ComboBox.prototype._isOptionSelected = function (index) {
    var currentPendingValueValidIndexOnHover = this.state.currentPendingValueValidIndexOnHover; // If the hover state is set to clearAll, don't show a selected index.
    // Note, this happens when the user moused out of the menu items

    if (currentPendingValueValidIndexOnHover === HoverStatus.clearAll) {
      return false;
    }

    if (!this.props.multiSelect && this._getPendingSelectedIndex(true
    /* includePendingValue */
    ) === index) {
      return true;
    }

    var idxOfSelectedIndex = -1;

    if (this.props.multiSelect && index !== undefined && this.state.selectedIndices) {
      idxOfSelectedIndex = this.state.selectedIndices.indexOf(index);
    }

    return idxOfSelectedIndex >= 0;
  };
  /**
   * Gets the pending selected index taking into account hover, valueValidIndex, and selectedIndex
   * @param includeCurrentPendingValue - Should we include the currentPendingValue when
   * finding the index
   */


  ComboBox.prototype._getPendingSelectedIndex = function (includeCurrentPendingValue) {
    var _a = this.state,
        currentPendingValueValidIndexOnHover = _a.currentPendingValueValidIndexOnHover,
        currentPendingValueValidIndex = _a.currentPendingValueValidIndex,
        currentPendingValue = _a.currentPendingValue;
    return currentPendingValueValidIndexOnHover >= 0 ? currentPendingValueValidIndexOnHover : currentPendingValueValidIndex >= 0 || includeCurrentPendingValue && currentPendingValue !== null && currentPendingValue !== undefined ? currentPendingValueValidIndex : this.props.multiSelect ? 0 : this._getFirstSelectedIndex();
  };
  /**
   * Scroll the selected element into view
   */


  ComboBox.prototype._scrollIntoView = function () {
    var _a = this.props,
        onScrollToItem = _a.onScrollToItem,
        scrollSelectedToTop = _a.scrollSelectedToTop;
    var _b = this.state,
        currentPendingValueValidIndex = _b.currentPendingValueValidIndex,
        currentPendingValue = _b.currentPendingValue;

    if (onScrollToItem) {
      // Use the custom scroll handler
      onScrollToItem(currentPendingValueValidIndex >= 0 || currentPendingValue !== '' ? currentPendingValueValidIndex : this._getFirstSelectedIndex());
    } else if (this._selectedElement.current && this._selectedElement.current.offsetParent) {
      // We are using refs, scroll the ref into view
      if (scrollSelectedToTop) {
        this._selectedElement.current.offsetParent.scrollIntoView(true);
      } else {
        var alignToTop = true;

        if (this._comboBoxMenu.current && this._comboBoxMenu.current.offsetParent) {
          var scrollableParentRect = this._comboBoxMenu.current.offsetParent.getBoundingClientRect();

          var selectedElementRect = this._selectedElement.current.offsetParent.getBoundingClientRect(); // If we are completely in view then we do not need to scroll


          if (scrollableParentRect.top <= selectedElementRect.top && scrollableParentRect.top + scrollableParentRect.height >= selectedElementRect.top + selectedElementRect.height) {
            return;
          } // If we are lower than the scrollable parent viewport then we should align to the bottom


          if (scrollableParentRect.top + scrollableParentRect.height <= selectedElementRect.top + selectedElementRect.height) {
            alignToTop = false;
          }
        }

        this._selectedElement.current.offsetParent.scrollIntoView(alignToTop);
      }
    }
  };
  /**
   * Click handler for the menu items
   * to select the item and also close the menu
   * @param index - the index of the item that was clicked
   */


  ComboBox.prototype._onItemClick = function (item) {
    var _this = this;

    var onItemClick = this.props.onItemClick;
    var index = item.index;
    return function (ev) {
      onItemClick && onItemClick(ev, item, index);

      _this._setSelectedIndex(index, ev);

      if (!_this.props.multiSelect) {
        // only close the callout when it's in single-select mode
        _this.setState({
          isOpen: false
        });
      }
    };
  };
  /**
   * Get the indices of the options that are marked as selected
   * @param options - the comboBox options
   * @param selectedKeys - the known selected keys to find
   * @returns - an array of the indices of the selected options, empty array if nothing is selected
   */


  ComboBox.prototype._getSelectedIndices = function (options, selectedKeys) {
    if (!options || !selectedKeys) {
      return [];
    }

    var selectedIndices = {};
    options.forEach(function (option, index) {
      if (option.selected) {
        selectedIndices[index] = true;
      }
    });

    var _loop_1 = function (selectedKey) {
      var index = (0, _Utilities.findIndex)(options, function (option) {
        return option.key === selectedKey;
      });

      if (index > -1) {
        selectedIndices[index] = true;
      }
    };

    for (var _i = 0, selectedKeys_1 = selectedKeys; _i < selectedKeys_1.length; _i++) {
      var selectedKey = selectedKeys_1[_i];

      _loop_1(selectedKey);
    }

    return Object.keys(selectedIndices).map(Number).sort();
  };
  /**
   * Reset the selected index by clearing the
   * input (of any pending text), clearing the pending state,
   * and setting the suggested display value to the last
   * selected state text
   */


  ComboBox.prototype._resetSelectedIndex = function () {
    var currentOptions = this.state.currentOptions;

    this._clearPendingInfo();

    var selectedIndex = this._getFirstSelectedIndex();

    if (selectedIndex > 0 && selectedIndex < currentOptions.length) {
      this.setState({
        suggestedDisplayValue: currentOptions[selectedIndex].text
      });
    } else if (this.props.text || this.props.value) {
      // If we had a value initially, restore it
      this.setState({
        suggestedDisplayValue: this.props.text || this.props.value
      });
    }
  };
  /**
   * Clears the pending info state
   */


  ComboBox.prototype._clearPendingInfo = function () {
    this._processingClearPendingInfo = true;
    this.setState({
      currentPendingValue: undefined,
      currentPendingValueValidIndex: -1,
      suggestedDisplayValue: undefined,
      currentPendingValueValidIndexOnHover: HoverStatus.default
    }, this._onAfterClearPendingInfo);
  };
  /**
   * Set the pending info
   * @param currentPendingValue - new pending value to set
   * @param currentPendingValueValidIndex - new pending value index to set
   * @param suggestedDisplayValue - new suggest display value to set
   */


  ComboBox.prototype._setPendingInfo = function (currentPendingValue, currentPendingValueValidIndex, suggestedDisplayValue) {
    if (currentPendingValueValidIndex === void 0) {
      currentPendingValueValidIndex = -1;
    }

    if (this._processingClearPendingInfo) {
      return;
    }

    this.setState({
      currentPendingValue: currentPendingValue && this._removeZeroWidthSpaces(currentPendingValue),
      currentPendingValueValidIndex: currentPendingValueValidIndex,
      suggestedDisplayValue: suggestedDisplayValue,
      currentPendingValueValidIndexOnHover: HoverStatus.default
    });
  };
  /**
   * Set the pending info from the given index
   * @param index - the index to set the pending info from
   */


  ComboBox.prototype._setPendingInfoFromIndex = function (index) {
    var currentOptions = this.state.currentOptions;

    if (index >= 0 && index < currentOptions.length) {
      var option = currentOptions[index];

      this._setPendingInfo(this._getPreviewText(option), index, this._getPreviewText(option));
    } else {
      this._clearPendingInfo();
    }
  };
  /**
   * Sets the pending info for the comboBox
   * @param index - the index to search from
   * @param searchDirection - the direction to search
   */


  ComboBox.prototype._setPendingInfoFromIndexAndDirection = function (index, searchDirection) {
    var currentOptions = this.state.currentOptions; // update index to allow content to wrap

    if (searchDirection === SearchDirection.forward && index >= currentOptions.length - 1) {
      index = -1;
    } else if (searchDirection === SearchDirection.backward && index <= 0) {
      index = currentOptions.length;
    } // get the next "valid" index


    var indexUpdate = this._getNextSelectableIndex(index, searchDirection); // if the two indicies are equal we didn't move and
    // we should attempt to get  get the first/last "valid" index to use
    // (Note, this takes care of the potential cases where the first/last
    // item is not focusable), otherwise use the updated index


    if (index === indexUpdate) {
      if (searchDirection === SearchDirection.forward) {
        index = this._getNextSelectableIndex(-1, searchDirection);
      } else if (searchDirection === SearchDirection.backward) {
        index = this._getNextSelectableIndex(currentOptions.length, searchDirection);
      }
    } else {
      index = indexUpdate;
    }

    if (this._indexWithinBounds(currentOptions, index)) {
      this._setPendingInfoFromIndex(index);
    }
  };

  ComboBox.prototype._notifyPendingValueChanged = function (prevState) {
    var onPendingValueChanged = this.props.onPendingValueChanged;

    if (!onPendingValueChanged) {
      return;
    }

    var _a = this.state,
        currentPendingValue = _a.currentPendingValue,
        currentOptions = _a.currentOptions,
        currentPendingValueValidIndex = _a.currentPendingValueValidIndex,
        currentPendingValueValidIndexOnHover = _a.currentPendingValueValidIndexOnHover;
    var newPendingIndex = undefined;
    var newPendingValue = undefined;

    if (currentPendingValueValidIndexOnHover !== prevState.currentPendingValueValidIndexOnHover && this._indexWithinBounds(currentOptions, currentPendingValueValidIndexOnHover)) {
      // Set new pending index if hover index was changed
      newPendingIndex = currentPendingValueValidIndexOnHover;
    } else if (currentPendingValueValidIndex !== prevState.currentPendingValueValidIndex && this._indexWithinBounds(currentOptions, currentPendingValueValidIndex)) {
      // Set new pending index if currentPendingValueValidIndex was changed
      newPendingIndex = currentPendingValueValidIndex;
    } else if (currentPendingValue !== prevState.currentPendingValue) {
      // Set pendingValue in the case it was changed and no index was changed
      newPendingValue = currentPendingValue;
    } // Notify when there is a new pending index/value. Also, if there is a pending value, it needs to send undefined.


    if (newPendingIndex !== undefined || newPendingValue !== undefined || this._hasPendingValue) {
      onPendingValueChanged(newPendingIndex !== undefined ? currentOptions[newPendingIndex] : undefined, newPendingIndex, newPendingValue);
      this._hasPendingValue = newPendingIndex !== undefined || newPendingValue !== undefined;
    }
  };
  /**
   * Sets the isOpen state and updates focusInputAfterClose
   */


  ComboBox.prototype._setOpenStateAndFocusOnClose = function (isOpen, focusInputAfterClose) {
    this._focusInputAfterClose = focusInputAfterClose;
    this.setState({
      isOpen: isOpen
    });
  };
  /**
   * Returns true if the key for the event is alt (Mac option) or meta (Mac command).
   */


  ComboBox.prototype._isAltOrMeta = function (ev) {
    return ev.which === _Utilities.KeyCodes.alt || ev.key === 'Meta';
  };

  ComboBox.prototype._onOptionMouseEnter = function (index) {
    if (this._shouldIgnoreMouseEvent()) {
      return;
    }

    this.setState({
      currentPendingValueValidIndexOnHover: index
    });
  };

  ComboBox.prototype._onOptionMouseMove = function (index) {
    this._gotMouseMove = true;

    if (!this._isScrollIdle || this.state.currentPendingValueValidIndexOnHover === index) {
      return;
    }

    this.setState({
      currentPendingValueValidIndexOnHover: index
    });
  };

  ComboBox.prototype._shouldIgnoreMouseEvent = function () {
    return !this._isScrollIdle || !this._gotMouseMove;
  };
  /**
   * Handle dismissing the menu and
   * eating the required key event when disabled
   * @param ev - the keyboard event that was fired
   */


  ComboBox.prototype._handleInputWhenDisabled = function (ev) {
    // If we are disabled, close the menu (if needed)
    // and eat all keystokes other than TAB or ESC
    if (this.props.disabled) {
      if (this.state.isOpen) {
        this.setState({
          isOpen: false
        });
      } // When disabled stop propagation and prevent default
      // of the event unless we have a tab, escape, or function key


      if (ev !== null && ev.which !== _Utilities.KeyCodes.tab && ev.which !== _Utilities.KeyCodes.escape && (ev.which < 112
      /* F1 */
      || ev.which > 123)
      /* F12 */
      ) {
          ev.stopPropagation();
          ev.preventDefault();
        }
    }
  };

  ComboBox.prototype._handleTouchAndPointerEvent = function () {
    var _this = this; // If we already have an existing timeeout from a previous touch and pointer event
    // cancel that timeout so we can set a nwe one.


    if (this._lastTouchTimeoutId !== undefined) {
      this._async.clearTimeout(this._lastTouchTimeoutId);

      this._lastTouchTimeoutId = undefined;
    }

    this._processingTouch = true;
    this._lastTouchTimeoutId = this._async.setTimeout(function () {
      _this._processingTouch = false;
      _this._lastTouchTimeoutId = undefined;
    }, TouchIdleDelay);
  };
  /**
   * Get the styles for the current option.
   * @param item - Item props for the current option
   */


  ComboBox.prototype._getCaretButtonStyles = function () {
    var customCaretDownButtonStyles = this.props.caretDownButtonStyles;
    return (0, _ComboBox.getCaretDownButtonStyles)(this.props.theme, customCaretDownButtonStyles);
  };
  /**
   * Get the styles for the current option.
   * @param item - Item props for the current option
   */


  ComboBox.prototype._getCurrentOptionStyles = function (item) {
    var customStylesForAllOptions = this.props.comboBoxOptionStyles;
    var customStylesForCurrentOption = item.styles;
    return (0, _ComboBox.getOptionStyles)(this.props.theme, customStylesForAllOptions, customStylesForCurrentOption, this._isPendingOption(item), item.hidden);
  };
  /**
   * Get the aria-activedescendant value for the comboxbox.
   * @returns the id of the current focused combo item, otherwise the id of the currently selected element, null otherwise
   */


  ComboBox.prototype._getAriaActiveDescentValue = function () {
    var descendantText = this.state.isOpen && this.state.selectedIndices && this.state.selectedIndices.length >= 0 ? this._id + '-list' + this.state.selectedIndices[0] : undefined;

    if (this.state.isOpen && this.state.focused && this.state.currentPendingValueValidIndex !== -1) {
      descendantText = this._id + '-list' + this.state.currentPendingValueValidIndex;
    }

    return descendantText;
  };
  /**
   * Get the aria autocomplete value for the Combobox
   * @returns 'inline' if auto-complete automatically dynamic, 'both' if we have a list of possible values to pick from and can
   * dynamically populate input, and 'none' if auto-complete is not enabled as we can't give user inputs.
   */


  ComboBox.prototype._getAriaAutoCompleteValue = function () {
    var autoComplete = !this.props.disabled && this.props.autoComplete === 'on';
    return autoComplete ? this.props.allowFreeform ? 'inline' : 'both' : 'none';
  };

  ComboBox.prototype._isPendingOption = function (item) {
    return item && item.index === this.state.currentPendingValueValidIndex;
  };
  /**
   * Given default selected key(s) and selected key(s), return the selected keys(s).
   * When default selected key(s) are available, they take precedence and return them instead of selected key(s).
   *
   * @returns No matter what specific types the input parameters are, always return an array of
   *  either strings or numbers instead of premitive type.  This normlization makes caller's logic easier.
   */


  ComboBox.prototype._buildDefaultSelectedKeys = function (defaultSelectedKey, selectedKey) {
    var selectedKeys = this._buildSelectedKeys(defaultSelectedKey);

    if (selectedKeys.length) {
      return selectedKeys;
    }

    return this._buildSelectedKeys(selectedKey);
  };

  ComboBox.prototype._buildSelectedKeys = function (selectedKey) {
    if (selectedKey === undefined) {
      return [];
    } // need to cast here so typescript does not complain


    return selectedKey instanceof Array ? selectedKey : [selectedKey];
  }; // For scenarios where the option's text prop contains embedded styles, we use the option's
  // ariaLabel value as the text in the input and for autocomplete matching. We know to use this
  // when the useAriaLabelAsText prop is set to true


  ComboBox.prototype._getPreviewText = function (item) {
    return item.useAriaLabelAsText && item.ariaLabel ? item.ariaLabel : item.text;
  };

  ComboBox.prototype._normalizeToString = function (value) {
    return value || '';
  };

  ComboBox.prototype._removeZeroWidthSpaces = function (value) {
    // remove any zero width space characters
    return value.replace(RegExp('​', 'g'), '');
  };

  ComboBox.defaultProps = {
    options: [],
    allowFreeform: false,
    autoComplete: 'on',
    buttonIconProps: {
      iconName: 'ChevronDown'
    }
  };
  ComboBox = tslib_1.__decorate([(0, _Utilities.customizable)('ComboBox', ['theme', 'styles'], true)], ComboBox);
  return ComboBox;
}(_Utilities.BaseComponent);

exports.ComboBox = ComboBox;
},{"tslib":"xgwM","react":"mpTF","../Autofill/index":"LWui","../../Utilities":"B5nc","../../Callout":"jp3a","../../Checkbox":"OuLn","../../Button":"XfLs","../../common/DirectionalHint":"uAUO","./ComboBox.styles":"Bp32","./ComboBox.classNames":"dZt7","../../KeytipData":"ltoP","../../Label":"RcoC","../../utilities/selectableOption/index":"unBv"}],"tbtk":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ScrollToMode = void 0;

/**
 * {@docCategory List}
 */
var ScrollToMode = {
  /**
   * Does not make any consideration to where in the viewport the item should align to.
   */
  auto: 0,

  /**
   * Attempts to scroll the list so the top of the desired item is aligned with the top of the viewport.
   */
  top: 1,

  /**
   * Attempts to scroll the list so the bottom of the desired item is aligned with the bottom of the viewport.
   */
  bottom: 2,

  /**
   * Attempts to scroll the list so the desired item is in the exact center of the viewport.
   */
  center: 3
};
exports.ScrollToMode = ScrollToMode;
},{}],"QwPG":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.List = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Utilities = require("../../Utilities");

var _List = require("./List.types");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var RESIZE_DELAY = 16;
var MIN_SCROLL_UPDATE_DELAY = 100;
var MAX_SCROLL_UPDATE_DELAY = 500;
var IDLE_DEBOUNCE_DELAY = 200; // The amount of time to wait before declaring that the list isn't scrolling

var DONE_SCROLLING_WAIT = 500;
var DEFAULT_ITEMS_PER_PAGE = 10;
var DEFAULT_PAGE_HEIGHT = 30;
var DEFAULT_RENDERED_WINDOWS_BEHIND = 2;
var DEFAULT_RENDERED_WINDOWS_AHEAD = 2;
var PAGE_KEY_PREFIX = 'page-';
var SPACER_KEY_PREFIX = 'spacer-';
var EMPTY_RECT = {
  top: -1,
  bottom: -1,
  left: -1,
  right: -1,
  width: 0,
  height: 0
}; // Naming expensive measures so that they're named in profiles.

var _measurePageRect = function (element) {
  return element.getBoundingClientRect();
};

var _measureSurfaceRect = _measurePageRect;
var _measureScrollRect = _measurePageRect;
/**
 * The List renders virtualized pages of items. Each page's item count is determined by the getItemCountForPage callback if
 * provided by the caller, or 10 as default. Each page's height is determined by the getPageHeight callback if provided by
 * the caller, or by cached measurements if available, or by a running average, or a default fallback.
 *
 * The algorithm for rendering pages works like this:
 *
 * 1. Predict visible pages based on "current measure data" (page heights, surface position, visible window)
 * 2. If changes are necessary, apply changes (add/remove pages)
 * 3. For pages that are added, measure the page heights if we need to using getBoundingClientRect
 * 4. If measurements don't match predictions, update measure data and goto step 1 asynchronously
 *
 * Measuring too frequently can pull performance down significantly. To compensate, we cache measured values so that
 * we can avoid re-measuring during operations that should not alter heights, like scrolling.
 *
 * To optimize glass rendering performance, onShouldVirtualize can be set. When onShouldVirtualize return false,
 * List will run in fast mode (not virtualized) to render all items without any measurements to improve page load time. And we
 * start doing measurements and rendering in virtualized mode when items grows larger than this threshold.
 *
 * However, certain operations can make measure data stale. For example, resizing the list, or passing in new props,
 * or forcing an update change cause pages to shrink/grow. When these operations occur, we increment a measureVersion
 * number, which we associate with cached measurements and use to determine if a remeasure should occur.
 */

var List =
/** @class */
function (_super) {
  tslib_1.__extends(List, _super);

  function List(props) {
    var _this = _super.call(this, props) || this;

    _this._root = React.createRef();
    _this._surface = React.createRef();

    _this._onRenderPage = function (pageProps, defaultRender) {
      var _a = _this.props,
          onRenderCell = _a.onRenderCell,
          role = _a.role;

      var _b = pageProps.page,
          _c = _b.items,
          items = _c === void 0 ? [] : _c,
          startIndex = _b.startIndex,
          divProps = tslib_1.__rest(pageProps, ["page"]); // only assign list item role if no role is assigned


      var cellRole = role === undefined ? 'listitem' : 'presentation';
      var cells = [];

      for (var i = 0; i < items.length; i++) {
        var index = startIndex + i;
        var item = items[i];
        var itemKey = _this.props.getKey ? _this.props.getKey(item, index) : item && item.key;

        if (itemKey === null || itemKey === undefined) {
          itemKey = index;
        }

        cells.push(React.createElement("div", {
          role: cellRole,
          className: 'ms-List-cell',
          key: itemKey,
          "data-list-index": index,
          "data-automationid": "ListCell"
        }, onRenderCell && onRenderCell(item, index, _this.state.isScrolling)));
      }

      return React.createElement("div", tslib_1.__assign({}, divProps), cells);
    };

    _this.state = {
      pages: [],
      isScrolling: false
    };
    _this._estimatedPageHeight = 0;
    _this._totalEstimates = 0;
    _this._requiredWindowsAhead = 0;
    _this._requiredWindowsBehind = 0; // Track the measure version for everything.

    _this._measureVersion = 0; // Ensure that scrolls are lazy updated.

    _this._onAsyncScroll = _this._async.debounce(_this._onAsyncScroll, MIN_SCROLL_UPDATE_DELAY, {
      leading: false,
      maxWait: MAX_SCROLL_UPDATE_DELAY
    });
    _this._onAsyncIdle = _this._async.debounce(_this._onAsyncIdle, IDLE_DEBOUNCE_DELAY, {
      leading: false
    });
    _this._onAsyncResize = _this._async.debounce(_this._onAsyncResize, RESIZE_DELAY, {
      leading: false
    });
    _this._onScrollingDone = _this._async.debounce(_this._onScrollingDone, DONE_SCROLLING_WAIT, {
      leading: false
    });
    _this._cachedPageHeights = {};
    _this._estimatedPageHeight = 0;
    _this._focusedIndex = -1;
    _this._pageCache = {};
    return _this;
  }
  /**
   * Scroll to the given index. By default will bring the page the specified item is on into the view. If a callback
   * to measure the height of an individual item is specified, will only scroll to bring the specific item into view.
   *
   * Note: with items of variable height and no passed in `getPageHeight` method, the list might jump after scrolling
   * when windows before/ahead are being rendered, and the estimated height is replaced using actual elements.
   *
   * @param index - Index of item to scroll to
   * @param measureItem - Optional callback to measure the height of an individual item
   * @param scrollToMode - Optional defines where in the window the item should be positioned to when scrolling
   */


  List.prototype.scrollToIndex = function (index, measureItem, scrollToMode) {
    if (scrollToMode === void 0) {
      scrollToMode = _List.ScrollToMode.auto;
    }

    var startIndex = this.props.startIndex;

    var renderCount = this._getRenderCount();

    var endIndex = startIndex + renderCount;
    var allowedRect = this._allowedRect;
    var scrollTop = 0;
    var itemsPerPage = 1;

    for (var itemIndex = startIndex; itemIndex < endIndex; itemIndex += itemsPerPage) {
      var pageSpecification = this._getPageSpecification(itemIndex, allowedRect);

      var pageHeight = pageSpecification.height;
      itemsPerPage = pageSpecification.itemCount;
      var requestedIndexIsInPage = itemIndex <= index && itemIndex + itemsPerPage > index;

      if (requestedIndexIsInPage) {
        // We have found the page. If the user provided a way to measure an individual item, we will try to scroll in just
        // the given item, otherwise we'll only bring the page into view
        if (measureItem && this._scrollElement) {
          var scrollRect = _measureScrollRect(this._scrollElement);

          var scrollWindow = {
            top: this._scrollElement.scrollTop,
            bottom: this._scrollElement.scrollTop + scrollRect.height
          }; // Adjust for actual item position within page

          var itemPositionWithinPage = index - itemIndex;

          for (var itemIndexInPage = 0; itemIndexInPage < itemPositionWithinPage; ++itemIndexInPage) {
            scrollTop += measureItem(itemIndex + itemIndexInPage);
          }

          var scrollBottom = scrollTop + measureItem(index); // If scrollToMode is set to something other than auto, we always want to
          // scroll the item into a specific position on the page.

          switch (scrollToMode) {
            case _List.ScrollToMode.top:
              this._scrollElement.scrollTop = scrollTop;
              return;

            case _List.ScrollToMode.bottom:
              this._scrollElement.scrollTop = scrollBottom - scrollRect.height;
              return;

            case _List.ScrollToMode.center:
              this._scrollElement.scrollTop = (scrollTop + scrollBottom - scrollRect.height) / 2;
              return;

            case _List.ScrollToMode.auto:
            default:
              break;
          }

          var itemIsFullyVisible = scrollTop >= scrollWindow.top && scrollBottom <= scrollWindow.bottom;

          if (itemIsFullyVisible) {
            // Item is already visible, do nothing.
            return;
          }

          var itemIsPartiallyAbove = scrollTop < scrollWindow.top;
          var itemIsPartiallyBelow = scrollBottom > scrollWindow.bottom;

          if (itemIsPartiallyAbove) {//  We will just scroll to 'scrollTop'
            //  .------.   - scrollTop
            //  |Item  |
            //  | .----|-. - scrollWindow.top
            //  '------' |
            //    |      |
            //    '------'
          } else if (itemIsPartiallyBelow) {
            //  Adjust scrollTop position to just bring in the element
            // .------.  - scrollTop
            // |      |
            // | .------.
            // '-|----' | - scrollWindow.bottom
            //   | Item |
            //   '------' - scrollBottom
            scrollTop = scrollBottom - scrollRect.height;
          }
        }

        this._scrollElement.scrollTop = scrollTop;
        return;
      }

      scrollTop += pageHeight;
    }
  };

  List.prototype.getStartItemIndexInView = function (measureItem) {
    var pages = this.state.pages || [];

    for (var _i = 0, pages_1 = pages; _i < pages_1.length; _i++) {
      var page = pages_1[_i];
      var isPageVisible = !page.isSpacer && (this._scrollTop || 0) >= page.top && (this._scrollTop || 0) <= page.top + page.height;

      if (isPageVisible) {
        if (!measureItem) {
          var rowHeight = Math.floor(page.height / page.itemCount);
          return page.startIndex + Math.floor((this._scrollTop - page.top) / rowHeight);
        } else {
          var totalRowHeight = 0;

          for (var itemIndex = page.startIndex; itemIndex < page.startIndex + page.itemCount; itemIndex++) {
            var rowHeight = measureItem(itemIndex);

            if (page.top + totalRowHeight <= this._scrollTop && this._scrollTop < page.top + totalRowHeight + rowHeight) {
              return itemIndex;
            } else {
              totalRowHeight += rowHeight;
            }
          }
        }
      }
    }

    return 0;
  };

  List.prototype.componentDidMount = function () {
    this._updatePages();

    this._measureVersion++;
    this._scrollElement = (0, _Utilities.findScrollableParent)(this._root.current);

    this._events.on(window, 'resize', this._onAsyncResize);

    if (this._root.current) {
      this._events.on(this._root.current, 'focus', this._onFocus, true);
    }

    if (this._scrollElement) {
      this._events.on(this._scrollElement, 'scroll', this._onScroll);

      this._events.on(this._scrollElement, 'scroll', this._onAsyncScroll);
    }
  };

  List.prototype.componentWillReceiveProps = function (newProps) {
    if (newProps.items !== this.props.items || newProps.renderCount !== this.props.renderCount || newProps.startIndex !== this.props.startIndex) {
      // We have received new items so we want to make sure that initially we only render a single window to
      // fill the currently visible rect, and then later render additional windows.
      this._resetRequiredWindows();

      this._requiredRect = null;
      this._measureVersion++;

      this._invalidatePageCache();

      this._updatePages(newProps);
    }
  };

  List.prototype.shouldComponentUpdate = function (newProps, newState) {
    var oldPages = this.state.pages;
    var newPages = newState.pages;
    var shouldComponentUpdate = false; // Update if the page stops scrolling

    if (!newState.isScrolling && this.state.isScrolling) {
      return true;
    }

    if (newProps.items === this.props.items && oldPages.length === newPages.length) {
      for (var i = 0; i < oldPages.length; i++) {
        var oldPage = oldPages[i];
        var newPage = newPages[i];

        if (oldPage.key !== newPage.key || oldPage.itemCount !== newPage.itemCount) {
          shouldComponentUpdate = true;
          break;
        }
      }
    } else {
      shouldComponentUpdate = true;
    }

    return shouldComponentUpdate;
  };

  List.prototype.forceUpdate = function () {
    this._invalidatePageCache(); // Ensure that when the list is force updated we update the pages first before render.


    this._updateRenderRects(this.props, true);

    this._updatePages();

    this._measureVersion++;

    _super.prototype.forceUpdate.call(this);
  };
  /**
   * Get the current height the list and it's pages.
   */


  List.prototype.getTotalListHeight = function () {
    return this._surfaceRect.height;
  };

  List.prototype.render = function () {
    var _a = this.props,
        className = _a.className,
        _b = _a.role,
        role = _b === void 0 ? 'list' : _b;
    var _c = this.state.pages,
        pages = _c === void 0 ? [] : _c;
    var pageElements = [];
    var divProps = (0, _Utilities.getNativeProps)(this.props, _Utilities.divProperties);

    for (var _i = 0, pages_2 = pages; _i < pages_2.length; _i++) {
      var page = pages_2[_i];
      pageElements.push(this._renderPage(page));
    }

    return React.createElement("div", tslib_1.__assign({
      ref: this._root
    }, divProps, {
      role: pageElements.length > 0 ? role : undefined,
      className: (0, _Utilities.css)('ms-List', className)
    }), React.createElement("div", {
      ref: this._surface,
      className: 'ms-List-surface',
      role: "presentation"
    }, pageElements));
  };

  List.prototype._shouldVirtualize = function (props) {
    if (props === void 0) {
      props = this.props;
    }

    var onShouldVirtualize = props.onShouldVirtualize;
    return !onShouldVirtualize || onShouldVirtualize(props);
  };
  /**
   * when props.items change or forceUpdate called, throw away cached pages
   */


  List.prototype._invalidatePageCache = function () {
    this._pageCache = {};
  };

  List.prototype._renderPage = function (page) {
    var usePageCache = this.props.usePageCache;
    var cachedPage; // if usePageCache is set and cached page element can be found, just return cached page

    if (usePageCache) {
      cachedPage = this._pageCache[page.key];

      if (cachedPage && cachedPage.pageElement) {
        return cachedPage.pageElement;
      }
    }

    var pageStyle = this._getPageStyle(page);

    var _a = this.props.onRenderPage,
        onRenderPage = _a === void 0 ? this._onRenderPage : _a;
    var pageElement = onRenderPage({
      page: page,
      className: 'ms-List-page',
      key: page.key,
      ref: page.key,
      style: pageStyle,
      role: 'presentation'
    }, this._onRenderPage); // cache the first page for now since it is re-rendered a lot times unnecessarily.
    // todo: a more aggresive caching mechanism is to cache pages constaining the items not changed.
    // now we re-render pages too frequently, for example, props.items increased from 30 to 60, although the
    // first 30 items did not change, we still re-rendered all of them in this props.items change.

    if (usePageCache && page.startIndex === 0) {
      this._pageCache[page.key] = {
        page: page,
        pageElement: pageElement
      };
    }

    return pageElement;
  };
  /** Generate the style object for the page. */


  List.prototype._getPageStyle = function (page) {
    var getPageStyle = this.props.getPageStyle;
    return tslib_1.__assign({}, getPageStyle ? getPageStyle(page) : {}, !page.items ? {
      height: page.height
    } : {});
  };
  /** Track the last item index focused so that we ensure we keep it rendered. */


  List.prototype._onFocus = function (ev) {
    var target = ev.target;

    while (target !== this._surface.current) {
      var indexString = target.getAttribute('data-list-index');

      if (indexString) {
        this._focusedIndex = Number(indexString);
        break;
      }

      target = (0, _Utilities.getParent)(target);
    }
  };
  /**
   * Called synchronously to reset the required render range to 0 on scrolling. After async scroll has executed,
   * we will call onAsyncIdle which will reset it back to it's correct value.
   */


  List.prototype._onScroll = function () {
    if (!this.state.isScrolling) {
      this.setState({
        isScrolling: true
      });
    }

    this._resetRequiredWindows();

    this._onScrollingDone();
  };

  List.prototype._resetRequiredWindows = function () {
    this._requiredWindowsAhead = 0;
    this._requiredWindowsBehind = 0;
  };
  /**
   * Debounced method to asynchronously update the visible region on a scroll event.
   */


  List.prototype._onAsyncScroll = function () {
    this._updateRenderRects(); // Only update pages when the visible rect falls outside of the materialized rect.


    if (!this._materializedRect || !_isContainedWithin(this._requiredRect, this._materializedRect)) {
      this._updatePages();
    } else {// console.log('requiredRect contained in materialized', this._requiredRect, this._materializedRect);
    }
  };
  /**
   * This is an async debounced method that will try and increment the windows we render. If we can increment
   * either, we increase the amount we render and re-evaluate.
   */


  List.prototype._onAsyncIdle = function () {
    var _a = this.props,
        renderedWindowsAhead = _a.renderedWindowsAhead,
        renderedWindowsBehind = _a.renderedWindowsBehind;

    var _b = this,
        requiredWindowsAhead = _b._requiredWindowsAhead,
        requiredWindowsBehind = _b._requiredWindowsBehind;

    var windowsAhead = Math.min(renderedWindowsAhead, requiredWindowsAhead + 1);
    var windowsBehind = Math.min(renderedWindowsBehind, requiredWindowsBehind + 1);

    if (windowsAhead !== requiredWindowsAhead || windowsBehind !== requiredWindowsBehind) {
      // console.log('idling', windowsBehind, windowsAhead);
      this._requiredWindowsAhead = windowsAhead;
      this._requiredWindowsBehind = windowsBehind;

      this._updateRenderRects();

      this._updatePages();
    }

    if (renderedWindowsAhead > windowsAhead || renderedWindowsBehind > windowsBehind) {
      // Async increment on next tick.
      this._onAsyncIdle();
    }
  };
  /**
   * Function to call when the list is done scrolling.
   * This function is debounced.
   */


  List.prototype._onScrollingDone = function () {
    this.setState({
      isScrolling: false
    });
  };

  List.prototype._onAsyncResize = function () {
    this.forceUpdate();
  };

  List.prototype._updatePages = function (props) {
    // console.log('updating pages');
    var _this = this;

    if (props === void 0) {
      props = this.props;
    }

    if (!this._requiredRect) {
      this._updateRenderRects(props);
    }

    var newListState = this._buildPages(props);

    var oldListPages = this.state.pages;

    this._notifyPageChanges(oldListPages, newListState.pages);

    this.setState(newListState, function () {
      // If we weren't provided with the page height, measure the pages
      if (!props.getPageHeight) {
        // If measured version is invalid since we've updated the DOM
        var heightsChanged = _this._updatePageMeasurements(newListState.pages); // On first render, we should re-measure so that we don't get a visual glitch.


        if (heightsChanged) {
          _this._materializedRect = null;

          if (!_this._hasCompletedFirstRender) {
            _this._hasCompletedFirstRender = true;

            _this._updatePages(props);
          } else {
            _this._onAsyncScroll();
          }
        } else {
          // Enqueue an idle bump.
          _this._onAsyncIdle();
        }
      } else {
        // Enqueue an idle bump
        _this._onAsyncIdle();
      } // Notify the caller that rendering the new pages has completed


      if (props.onPagesUpdated) {
        props.onPagesUpdated(_this.state.pages);
      }
    });
  };
  /**
   * Notify consumers that the rendered pages have changed
   * @param oldPages - The old pages
   * @param newPages - The new pages
   * @param props - The props to use
   */


  List.prototype._notifyPageChanges = function (oldPages, newPages, props) {
    if (props === void 0) {
      props = this.props;
    }

    var onPageAdded = props.onPageAdded,
        onPageRemoved = props.onPageRemoved;

    if (onPageAdded || onPageRemoved) {
      var renderedIndexes = {};

      for (var _i = 0, oldPages_1 = oldPages; _i < oldPages_1.length; _i++) {
        var page = oldPages_1[_i];

        if (page.items) {
          renderedIndexes[page.startIndex] = page;
        }
      }

      for (var _a = 0, newPages_1 = newPages; _a < newPages_1.length; _a++) {
        var page = newPages_1[_a];

        if (page.items) {
          if (!renderedIndexes[page.startIndex]) {
            this._onPageAdded(page);
          } else {
            delete renderedIndexes[page.startIndex];
          }
        }
      }

      for (var index in renderedIndexes) {
        if (renderedIndexes.hasOwnProperty(index)) {
          this._onPageRemoved(renderedIndexes[index]);
        }
      }
    }
  };

  List.prototype._updatePageMeasurements = function (pages) {
    var heightChanged = false; // when not in virtualize mode, we render all the items without page measurement

    if (!this._shouldVirtualize()) {
      return heightChanged;
    }

    for (var i = 0; i < pages.length; i++) {
      var page = pages[i];

      if (page.items) {
        heightChanged = this._measurePage(page) || heightChanged;
      }
    }

    return heightChanged;
  };
  /**
   * Given a page, measure its dimensions, update cache.
   * @returns True if the height has changed.
   */


  List.prototype._measurePage = function (page) {
    var hasChangedHeight = false;
    var pageElement = this.refs[page.key];
    var cachedHeight = this._cachedPageHeights[page.startIndex]; // console.log('   * measure attempt', page.startIndex, cachedHeight);

    if (pageElement && this._shouldVirtualize() && (!cachedHeight || cachedHeight.measureVersion !== this._measureVersion)) {
      var newClientRect = {
        width: pageElement.clientWidth,
        height: pageElement.clientHeight
      };

      if (newClientRect.height || newClientRect.width) {
        hasChangedHeight = page.height !== newClientRect.height; // console.warn(' *** expensive page measure', page.startIndex, page.height, newClientRect.height);

        page.height = newClientRect.height;
        this._cachedPageHeights[page.startIndex] = {
          height: newClientRect.height,
          measureVersion: this._measureVersion
        };
        this._estimatedPageHeight = Math.round((this._estimatedPageHeight * this._totalEstimates + newClientRect.height) / (this._totalEstimates + 1));
        this._totalEstimates++;
      }
    }

    return hasChangedHeight;
  };
  /** Called when a page has been added to the DOM. */


  List.prototype._onPageAdded = function (page) {
    var onPageAdded = this.props.onPageAdded; // console.log('page added', page.startIndex, this.state.pages.map(page => page.key).join(', '));

    if (onPageAdded) {
      onPageAdded(page);
    }
  };
  /** Called when a page has been removed from the DOM. */


  List.prototype._onPageRemoved = function (page) {
    var onPageRemoved = this.props.onPageRemoved; // console.log('  --- page removed', page.startIndex, this.state.pages.map(page => page.key).join(', '));

    if (onPageRemoved) {
      onPageRemoved(page);
    }
  };
  /** Build up the pages that should be rendered. */


  List.prototype._buildPages = function (props) {
    var renderCount = props.renderCount;
    var items = props.items,
        startIndex = props.startIndex,
        getPageHeight = props.getPageHeight;
    renderCount = this._getRenderCount(props);

    var materializedRect = tslib_1.__assign({}, EMPTY_RECT);

    var pages = [];
    var itemsPerPage = 1;
    var pageTop = 0;
    var currentSpacer = null;
    var focusedIndex = this._focusedIndex;
    var endIndex = startIndex + renderCount;

    var shouldVirtualize = this._shouldVirtualize(props); // First render is very important to track; when we render cells, we have no idea of estimated page height.
    // So we should default to rendering only the first page so that we can get information.
    // However if the user provides a measure function, let's just assume they know the right heights.


    var isFirstRender = this._estimatedPageHeight === 0 && !getPageHeight;
    var allowedRect = this._allowedRect;

    var _loop_1 = function (itemIndex) {
      var pageSpecification = this_1._getPageSpecification(itemIndex, allowedRect);

      var pageHeight = pageSpecification.height;
      var pageData = pageSpecification.data;
      var key = pageSpecification.key;
      itemsPerPage = pageSpecification.itemCount;
      var pageBottom = pageTop + pageHeight - 1;
      var isPageRendered = (0, _Utilities.findIndex)(this_1.state.pages, function (page) {
        return !!page.items && page.startIndex === itemIndex;
      }) > -1;
      var isPageInAllowedRange = !allowedRect || pageBottom >= allowedRect.top && pageTop <= allowedRect.bottom;
      var isPageInRequiredRange = !this_1._requiredRect || pageBottom >= this_1._requiredRect.top && pageTop <= this_1._requiredRect.bottom;
      var isPageVisible = !isFirstRender && (isPageInRequiredRange || isPageInAllowedRange && isPageRendered) || !shouldVirtualize;
      var isPageFocused = focusedIndex >= itemIndex && focusedIndex < itemIndex + itemsPerPage;
      var isFirstPage = itemIndex === startIndex; // console.log('building page', itemIndex, 'pageTop: ' + pageTop, 'inAllowed: ' +
      // isPageInAllowedRange, 'inRequired: ' + isPageInRequiredRange);
      // Only render whats visible, focused, or first page,
      // or when running in fast rendering mode (not in virtualized mode), we render all current items in pages

      if (isPageVisible || isPageFocused || isFirstPage) {
        if (currentSpacer) {
          pages.push(currentSpacer);
          currentSpacer = null;
        }

        var itemsInPage = Math.min(itemsPerPage, endIndex - itemIndex);

        var newPage = this_1._createPage(key, items.slice(itemIndex, itemIndex + itemsInPage), itemIndex, undefined, undefined, pageData);

        newPage.top = pageTop;
        newPage.height = pageHeight;

        if (this_1._visibleRect && this_1._visibleRect.bottom) {
          newPage.isVisible = pageBottom >= this_1._visibleRect.top && pageTop <= this_1._visibleRect.bottom;
        }

        pages.push(newPage);

        if (isPageInRequiredRange && this_1._allowedRect) {
          _mergeRect(materializedRect, {
            top: pageTop,
            bottom: pageBottom,
            height: pageHeight,
            left: allowedRect.left,
            right: allowedRect.right,
            width: allowedRect.width
          });
        }
      } else {
        if (!currentSpacer) {
          currentSpacer = this_1._createPage(SPACER_KEY_PREFIX + itemIndex, undefined, itemIndex, 0, undefined, pageData, true
          /*isSpacer*/
          );
        }

        currentSpacer.height = (currentSpacer.height || 0) + (pageBottom - pageTop) + 1;
        currentSpacer.itemCount += itemsPerPage;
      }

      pageTop += pageBottom - pageTop + 1; // in virtualized mode, we render need to render first page then break and measure,
      // otherwise, we render all items without measurement to make rendering fast

      if (isFirstRender && shouldVirtualize) {
        return "break";
      }
    };

    var this_1 = this;

    for (var itemIndex = startIndex; itemIndex < endIndex; itemIndex += itemsPerPage) {
      var state_1 = _loop_1(itemIndex);

      if (state_1 === "break") break;
    }

    if (currentSpacer) {
      currentSpacer.key = SPACER_KEY_PREFIX + 'end';
      pages.push(currentSpacer);
    }

    this._materializedRect = materializedRect; // console.log('materialized: ', materializedRect);

    return {
      pages: pages,
      measureVersion: this._measureVersion
    };
  };

  List.prototype._getPageSpecification = function (itemIndex, visibleRect) {
    var getPageSpecification = this.props.getPageSpecification;

    if (getPageSpecification) {
      var pageData = getPageSpecification(itemIndex, visibleRect);
      var _a = pageData.itemCount,
          itemCount = _a === void 0 ? this._getItemCountForPage(itemIndex, visibleRect) : _a;
      var _b = pageData.height,
          height = _b === void 0 ? this._getPageHeight(itemIndex, visibleRect, itemCount) : _b;
      return {
        itemCount: itemCount,
        height: height,
        data: pageData.data,
        key: pageData.key
      };
    } else {
      var itemCount = this._getItemCountForPage(itemIndex, visibleRect);

      return {
        itemCount: itemCount,
        height: this._getPageHeight(itemIndex, visibleRect, itemCount)
      };
    }
  };
  /**
   * Get the pixel height of a give page. Will use the props getPageHeight first, and if not provided, fallback to
   * cached height, or estimated page height, or default page height.
   */


  List.prototype._getPageHeight = function (itemIndex, visibleRect, itemsPerPage) {
    if (this.props.getPageHeight) {
      return this.props.getPageHeight(itemIndex, visibleRect, itemsPerPage);
    } else {
      var cachedHeight = this._cachedPageHeights[itemIndex];
      return cachedHeight ? cachedHeight.height : this._estimatedPageHeight || DEFAULT_PAGE_HEIGHT;
    }
  };

  List.prototype._getItemCountForPage = function (itemIndex, visibileRect) {
    var itemsPerPage = this.props.getItemCountForPage ? this.props.getItemCountForPage(itemIndex, visibileRect) : DEFAULT_ITEMS_PER_PAGE;
    return itemsPerPage ? itemsPerPage : DEFAULT_ITEMS_PER_PAGE;
  };

  List.prototype._createPage = function (pageKey, items, startIndex, count, style, data, isSpacer) {
    if (startIndex === void 0) {
      startIndex = -1;
    }

    if (count === void 0) {
      count = items ? items.length : 0;
    }

    if (style === void 0) {
      style = {};
    }

    pageKey = pageKey || PAGE_KEY_PREFIX + startIndex;
    var cachedPage = this._pageCache[pageKey];

    if (cachedPage && cachedPage.page) {
      return cachedPage.page;
    }

    return {
      key: pageKey,
      startIndex: startIndex,
      itemCount: count,
      items: items,
      style: style,
      top: 0,
      height: 0,
      data: data,
      isSpacer: isSpacer || false
    };
  };

  List.prototype._getRenderCount = function (props) {
    var _a = props || this.props,
        items = _a.items,
        startIndex = _a.startIndex,
        renderCount = _a.renderCount;

    return renderCount === undefined ? items ? items.length - startIndex : 0 : renderCount;
  };
  /** Calculate the visible rect within the list where top: 0 and left: 0 is the top/left of the list. */


  List.prototype._updateRenderRects = function (props, forceUpdate) {
    props = props || this.props;
    var renderedWindowsAhead = props.renderedWindowsAhead,
        renderedWindowsBehind = props.renderedWindowsBehind;
    var pages = this.state.pages; // when not in virtualize mode, we render all items without measurement to optimize page rendering perf

    if (!this._shouldVirtualize(props)) {
      return;
    }

    var surfaceRect = this._surfaceRect || tslib_1.__assign({}, EMPTY_RECT);

    var scrollHeight = this._scrollElement && this._scrollElement.scrollHeight;
    var scrollTop = this._scrollElement ? this._scrollElement.scrollTop : 0; // WARNING: EXPENSIVE CALL! We need to know the surface top relative to the window.
    // This needs to be called to recalculate when new pages should be loaded.
    // We check to see how far we've scrolled and if it's further than a third of a page we run it again.

    if (this._surface.current && (forceUpdate || !pages || !this._surfaceRect || !scrollHeight || scrollHeight !== this._scrollHeight || Math.abs(this._scrollTop - scrollTop) > this._estimatedPageHeight / 3)) {
      surfaceRect = this._surfaceRect = _measureSurfaceRect(this._surface.current);
      this._scrollTop = scrollTop;
    } // If the scroll height has changed, something in the container likely resized and
    // we should redo the page heights incase their content resized.


    if (forceUpdate || !scrollHeight || scrollHeight !== this._scrollHeight) {
      this._measureVersion++;
    }

    this._scrollHeight = scrollHeight; // If the surface is above the container top or below the container bottom, or if this is not the first
    // render return empty rect.
    // The first time the list gets rendered we need to calculate the rectangle. The width of the list is
    // used to calculate the width of the list items.

    var visibleTop = Math.max(0, -surfaceRect.top);
    var visibleRect = {
      top: visibleTop,
      left: surfaceRect.left,
      bottom: visibleTop + window.innerHeight,
      right: surfaceRect.right,
      width: surfaceRect.width,
      height: window.innerHeight
    }; // The required/allowed rects are adjusted versions of the visible rect.

    this._requiredRect = _expandRect(visibleRect, this._requiredWindowsBehind, this._requiredWindowsAhead);
    this._allowedRect = _expandRect(visibleRect, renderedWindowsBehind, renderedWindowsAhead); // store the visible rect for later use.

    this._visibleRect = visibleRect;
  };

  List.defaultProps = {
    startIndex: 0,
    onRenderCell: function (item, index, containsFocus) {
      return React.createElement(React.Fragment, null, item && item.name || '');
    },
    renderedWindowsAhead: DEFAULT_RENDERED_WINDOWS_AHEAD,
    renderedWindowsBehind: DEFAULT_RENDERED_WINDOWS_BEHIND
  };
  return List;
}(_Utilities.BaseComponent);

exports.List = List;

function _expandRect(rect, pagesBefore, pagesAfter) {
  var top = rect.top - pagesBefore * rect.height;
  var height = rect.height + (pagesBefore + pagesAfter) * rect.height;
  return {
    top: top,
    bottom: top + height,
    height: height,
    left: rect.left,
    right: rect.right,
    width: rect.width
  };
}

function _isContainedWithin(innerRect, outerRect) {
  return innerRect.top >= outerRect.top && innerRect.left >= outerRect.left && innerRect.bottom <= outerRect.bottom && innerRect.right <= outerRect.right;
}

function _mergeRect(targetRect, newRect) {
  targetRect.top = newRect.top < targetRect.top || targetRect.top === -1 ? newRect.top : targetRect.top;
  targetRect.left = newRect.left < targetRect.left || targetRect.left === -1 ? newRect.left : targetRect.left;
  targetRect.bottom = newRect.bottom > targetRect.bottom || targetRect.bottom === -1 ? newRect.bottom : targetRect.bottom;
  targetRect.right = newRect.right > targetRect.right || targetRect.right === -1 ? newRect.right : targetRect.right;
  targetRect.width = targetRect.right - targetRect.left + 1;
  targetRect.height = targetRect.bottom - targetRect.top + 1;
  return targetRect;
}
},{"tslib":"xgwM","react":"mpTF","../../Utilities":"B5nc","./List.types":"tbtk"}],"lHht":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _List = require("./List");

Object.keys(_List).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _List[key];
    }
  });
});

var _List2 = require("./List.types");

Object.keys(_List2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _List2[key];
    }
  });
});
},{"./List":"QwPG","./List.types":"tbtk"}],"ZTkW":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _index = require("./components/List/index");

Object.keys(_index).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index[key];
    }
  });
});
},{"./components/List/index":"lHht"}],"lSsP":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.VirtualizedComboBox = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Utilities = require("../../Utilities");

var _ComboBox = require("./ComboBox");

var _List = require("../../List");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var VirtualizedComboBox =
/** @class */
function (_super) {
  tslib_1.__extends(VirtualizedComboBox, _super);

  function VirtualizedComboBox() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    /** The combo box element */


    _this._comboBox = React.createRef();
    /** The virtualized list element */

    _this._list = React.createRef();

    _this._onRenderList = function (props) {
      var onRenderItem = props.onRenderItem; // Render virtualized list

      return React.createElement(_List.List, {
        componentRef: _this._list,
        role: "listbox",
        items: props.options,
        onRenderCell: onRenderItem ? function (item) {
          return onRenderItem(item);
        } : function () {
          return null;
        }
      });
    };

    _this._onScrollToItem = function (itemIndex) {
      // We are using the List component, call scrollToIndex
      _this._list.current && _this._list.current.scrollToIndex(itemIndex);
    };

    return _this;
  }

  Object.defineProperty(VirtualizedComboBox.prototype, "selectedOptions", {
    /**
     * All selected options
     */
    get: function () {
      if (this._comboBox.current) {
        return this._comboBox.current.selectedOptions;
      }

      return [];
    },
    enumerable: true,
    configurable: true
  });

  VirtualizedComboBox.prototype.dismissMenu = function () {
    if (this._comboBox.current) {
      return this._comboBox.current.dismissMenu();
    }
  };

  VirtualizedComboBox.prototype.focus = function () {
    if (this._comboBox.current) {
      this._comboBox.current.focus();

      return true;
    }

    return false;
  };

  VirtualizedComboBox.prototype.render = function () {
    return React.createElement(_ComboBox.ComboBox, tslib_1.__assign({}, this.props, {
      componentRef: this._comboBox,
      onRenderList: this._onRenderList,
      onScrollToItem: this._onScrollToItem
    }));
  };

  return VirtualizedComboBox;
}(_Utilities.BaseComponent);

exports.VirtualizedComboBox = VirtualizedComboBox;
},{"tslib":"xgwM","react":"mpTF","../../Utilities":"B5nc","./ComboBox":"HxzL","../../List":"ZTkW"}],"XlQ6":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
var _exportNames = {
  SelectableOptionMenuItemType: true
};
Object.defineProperty(exports, "SelectableOptionMenuItemType", {
  enumerable: true,
  get: function () {
    return _SelectableOption.SelectableOptionMenuItemType;
  }
});

var _SelectableOption = require("../../utilities/selectableOption/SelectableOption.types");

var _ComboBox = require("./ComboBox");

Object.keys(_ComboBox).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _ComboBox[key];
    }
  });
});

var _VirtualizedComboBox = require("./VirtualizedComboBox");

Object.keys(_VirtualizedComboBox).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _VirtualizedComboBox[key];
    }
  });
});
},{"../../utilities/selectableOption/SelectableOption.types":"yh6c","./ComboBox":"HxzL","./VirtualizedComboBox":"lSsP"}],"Z5Rd":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.OverflowSetBase = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _FocusZone = require("../../FocusZone");

var _Utilities = require("../../Utilities");

var _KeytipManager = require("../../utilities/keytips/KeytipManager");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var getClassNames = (0, _Utilities.classNamesFunction)();

var OverflowSetBase =
/** @class */
function (_super) {
  tslib_1.__extends(OverflowSetBase, _super);

  function OverflowSetBase(props) {
    var _this = _super.call(this, props) || this;

    _this._focusZone = React.createRef();
    _this._persistedKeytips = {};
    _this._keytipManager = _KeytipManager.KeytipManager.getInstance();
    _this._divContainer = React.createRef();

    _this._onRenderItems = function (items) {
      return items.map(function (item, i) {
        var wrapperDivProps = {
          className: _this._classNames.item
        };
        return React.createElement("div", tslib_1.__assign({
          key: item.key
        }, wrapperDivProps), _this.props.onRenderItem(item));
      });
    };

    _this._onRenderOverflowButtonWrapper = function (items) {
      var wrapperDivProps = {
        className: _this._classNames.overflowButton
      };
      var overflowKeytipSequences = _this.props.keytipSequences;
      var newOverflowItems = [];

      if (overflowKeytipSequences) {
        items.forEach(function (overflowItem) {
          var keytip = overflowItem.keytipProps;

          if (keytip) {
            // Create persisted keytip
            var persistedKeytip = {
              content: keytip.content,
              keySequences: keytip.keySequences,
              disabled: keytip.disabled || !!(overflowItem.disabled || overflowItem.isDisabled),
              hasDynamicChildren: keytip.hasDynamicChildren,
              hasMenu: keytip.hasMenu
            };

            if (keytip.hasDynamicChildren || _this._getSubMenuForItem(overflowItem)) {
              // If the keytip has a submenu or children nodes, change onExecute to persistedKeytipExecute
              persistedKeytip.onExecute = _this._keytipManager.menuExecute.bind(_this._keytipManager, overflowKeytipSequences, overflowItem.keytipProps.keySequences);
            } else {
              // If the keytip doesn't have a submenu, just execute the original function
              persistedKeytip.onExecute = keytip.onExecute;
            } // Add this persisted keytip to our internal list, use a temporary uniqueID (its content)
            // uniqueID will get updated on register


            _this._persistedKeytips[persistedKeytip.content] = persistedKeytip; // Add the overflow sequence to this item

            var newOverflowItem = tslib_1.__assign({}, overflowItem, {
              keytipProps: tslib_1.__assign({}, keytip, {
                overflowSetSequence: overflowKeytipSequences
              })
            });

            newOverflowItems.push(newOverflowItem);
          } else {
            // Nothing to change, add overflowItem to list
            newOverflowItems.push(overflowItem);
          }
        });
      } else {
        newOverflowItems = items;
      }

      return React.createElement("div", tslib_1.__assign({}, wrapperDivProps), _this.props.onRenderOverflowButton(newOverflowItems));
    };

    if (props.doNotContainWithinFocusZone) {
      _this._warnMutuallyExclusive({
        doNotContainWithinFocusZone: 'focusZoneProps'
      });
    }

    return _this;
  }

  OverflowSetBase.prototype.render = function () {
    var _a = this.props,
        items = _a.items,
        overflowItems = _a.overflowItems,
        className = _a.className,
        focusZoneProps = _a.focusZoneProps,
        styles = _a.styles,
        vertical = _a.vertical,
        role = _a.role,
        doNotContainWithinFocusZone = _a.doNotContainWithinFocusZone;
    this._classNames = getClassNames(styles, {
      className: className,
      vertical: vertical
    });
    var Tag;
    var uniqueComponentProps;

    if (doNotContainWithinFocusZone) {
      Tag = 'div';
      uniqueComponentProps = tslib_1.__assign({}, (0, _Utilities.getNativeProps)(this.props, _Utilities.divProperties), {
        ref: this._divContainer
      });
    } else {
      Tag = _FocusZone.FocusZone;
      uniqueComponentProps = tslib_1.__assign({}, (0, _Utilities.getNativeProps)(this.props, _Utilities.divProperties), focusZoneProps, {
        componentRef: this._focusZone,
        direction: vertical ? _FocusZone.FocusZoneDirection.vertical : _FocusZone.FocusZoneDirection.horizontal
      });
    }

    return React.createElement(Tag, tslib_1.__assign({}, uniqueComponentProps, {
      className: this._classNames.root,
      role: role
    }), items && this._onRenderItems(items), overflowItems && overflowItems.length > 0 && this._onRenderOverflowButtonWrapper(overflowItems));
  };
  /**
   * Sets focus to the first tabbable item in the OverflowSet.
   * @param forceIntoFirstElement - If true, focus will be forced into the first element,
   * even if focus is already in theOverflowSet
   * @returns True if focus could be set to an active element, false if no operation was taken.
   */


  OverflowSetBase.prototype.focus = function (forceIntoFirstElement) {
    var focusSucceeded = false;

    if (this.props.doNotContainWithinFocusZone) {
      if (this._divContainer.current) {
        focusSucceeded = (0, _Utilities.focusFirstChild)(this._divContainer.current);
      }
    } else if (this._focusZone.current) {
      focusSucceeded = this._focusZone.current.focus(forceIntoFirstElement);
    }

    return focusSucceeded;
  };
  /**
   * Sets focus to a specific child element within the OverflowSet.
   * @param childElement - The child element within the zone to focus.
   * @returns True if focus could be set to an active element, false if no operation was taken.
   */


  OverflowSetBase.prototype.focusElement = function (childElement) {
    var focusSucceeded = false;

    if (!childElement) {
      return false;
    }

    if (this.props.doNotContainWithinFocusZone) {
      if (this._divContainer.current && (0, _Utilities.elementContains)(this._divContainer.current, childElement)) {
        childElement.focus();
        focusSucceeded = document.activeElement === childElement;
      }
    } else if (this._focusZone.current) {
      focusSucceeded = this._focusZone.current.focusElement(childElement);
    }

    return focusSucceeded;
  }; // Add keytip register/unregister handlers to lifecycle functions to correctly manage persisted keytips


  OverflowSetBase.prototype.componentDidMount = function () {
    this._registerPersistedKeytips();
  };

  OverflowSetBase.prototype.componentWillUnmount = function () {
    this._unregisterPersistedKeytips();
  };

  OverflowSetBase.prototype.componentWillUpdate = function () {
    this._unregisterPersistedKeytips();
  };

  OverflowSetBase.prototype.componentDidUpdate = function () {
    this._registerPersistedKeytips();
  };

  OverflowSetBase.prototype._registerPersistedKeytips = function () {
    var _this = this;

    Object.keys(this._persistedKeytips).forEach(function (key) {
      var keytip = _this._persistedKeytips[key];

      var uniqueID = _this._keytipManager.register(keytip, true); // Update map


      _this._persistedKeytips[uniqueID] = keytip;
      delete _this._persistedKeytips[key];
    });
  };

  OverflowSetBase.prototype._unregisterPersistedKeytips = function () {
    var _this = this; // Delete all persisted keytips saved


    Object.keys(this._persistedKeytips).forEach(function (uniqueID) {
      _this._keytipManager.unregister(_this._persistedKeytips[uniqueID], uniqueID, true);
    });
    this._persistedKeytips = {};
  };
  /**
   * Gets the subMenu for an overflow item
   * Checks if itemSubMenuProvider has been defined, if not defaults to subMenuProps
   */


  OverflowSetBase.prototype._getSubMenuForItem = function (item) {
    if (this.props.itemSubMenuProvider) {
      return this.props.itemSubMenuProvider(item);
    }

    if (item.subMenuProps) {
      return item.subMenuProps.items;
    }

    return undefined;
  };

  OverflowSetBase.defaultProps = {
    vertical: false,
    role: 'menubar'
  };
  return OverflowSetBase;
}(_Utilities.BaseComponent);

exports.OverflowSetBase = OverflowSetBase;
},{"tslib":"xgwM","react":"mpTF","../../FocusZone":"v3nN","../../Utilities":"B5nc","../../utilities/keytips/KeytipManager":"qsTL"}],"Dr7t":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = void 0;
var overflowItemStyle = {
  flexShrink: 0,
  display: 'inherit'
};

var getStyles = function (props) {
  var className = props.className,
      vertical = props.vertical;
  return {
    root: ['ms-OverflowSet', {
      position: 'relative',
      display: 'flex',
      flexWrap: 'nowrap'
    }, vertical && {
      flexDirection: 'column'
    }, className],
    item: ['ms-OverflowSet-item', overflowItemStyle],
    overflowButton: ['ms-OverflowSet-overflowButton', overflowItemStyle]
  };
};

exports.getStyles = getStyles;
},{}],"xUMg":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.OverflowSet = void 0;

var _Utilities = require("../../Utilities");

var _OverflowSet = require("./OverflowSet.base");

var _OverflowSet2 = require("./OverflowSet.styles");

var OverflowSet = (0, _Utilities.styled)(_OverflowSet.OverflowSetBase, _OverflowSet2.getStyles, undefined, {
  scope: 'OverflowSet'
});
exports.OverflowSet = OverflowSet;
},{"../../Utilities":"B5nc","./OverflowSet.base":"Z5Rd","./OverflowSet.styles":"Dr7t"}],"ADeK":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _OverflowSet = require("./OverflowSet");

Object.keys(_OverflowSet).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _OverflowSet[key];
    }
  });
});

var _OverflowSet2 = require("./OverflowSet.base");

Object.keys(_OverflowSet2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _OverflowSet2[key];
    }
  });
});
},{"./OverflowSet":"xUMg","./OverflowSet.base":"Z5Rd"}],"VMzb":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _index = require("./components/OverflowSet/index");

Object.keys(_index).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index[key];
    }
  });
});
},{"./components/OverflowSet/index":"ADeK"}],"LgkO":[function(require,module,exports) {
/**
 * Copyright (c) 2013-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.
 */

'use strict';

var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';

module.exports = ReactPropTypesSecret;

},{}],"lyfy":[function(require,module,exports) {
/**
 * Copyright (c) 2013-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.
 */

'use strict';

var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');

function emptyFunction() {}
function emptyFunctionWithReset() {}
emptyFunctionWithReset.resetWarningCache = emptyFunction;

module.exports = function() {
  function shim(props, propName, componentName, location, propFullName, secret) {
    if (secret === ReactPropTypesSecret) {
      // It is still safe when called from React.
      return;
    }
    var err = new Error(
      'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
      'Use PropTypes.checkPropTypes() to call them. ' +
      'Read more at http://fb.me/use-check-prop-types'
    );
    err.name = 'Invariant Violation';
    throw err;
  };
  shim.isRequired = shim;
  function getShim() {
    return shim;
  };
  // Important!
  // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
  var ReactPropTypes = {
    array: shim,
    bool: shim,
    func: shim,
    number: shim,
    object: shim,
    string: shim,
    symbol: shim,

    any: shim,
    arrayOf: getShim,
    element: shim,
    elementType: shim,
    instanceOf: getShim,
    node: shim,
    objectOf: getShim,
    oneOf: getShim,
    oneOfType: getShim,
    shape: getShim,
    exact: getShim,

    checkPropTypes: emptyFunctionWithReset,
    resetWarningCache: emptyFunction
  };

  ReactPropTypes.PropTypes = ReactPropTypes;

  return ReactPropTypes;
};

},{"./lib/ReactPropTypesSecret":"LgkO"}],"B0VN":[function(require,module,exports) {
/**
 * Copyright (c) 2013-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.
 */
if ("production" !== 'production') {
  var ReactIs = require('react-is'); // By explicitly using `prop-types` you are opting into new development behavior.
  // http://fb.me/prop-types-in-prod


  var throwOnDirectAccess = true;
  module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess);
} else {
  // By explicitly using `prop-types` you are opting into new production behavior.
  // http://fb.me/prop-types-in-prod
  module.exports = require('./factoryWithThrowingShims')();
}
},{"./factoryWithThrowingShims":"lyfy"}],"HPzL":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ResizeGroupDirection = void 0;

/**
 * {@docCategory ResizeGroup}
 */
var ResizeGroupDirection;
exports.ResizeGroupDirection = ResizeGroupDirection;

(function (ResizeGroupDirection) {
  ResizeGroupDirection[ResizeGroupDirection["horizontal"] = 0] = "horizontal";
  ResizeGroupDirection[ResizeGroupDirection["vertical"] = 1] = "vertical";
})(ResizeGroupDirection || (exports.ResizeGroupDirection = ResizeGroupDirection = {}));
},{}],"t5UR":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ResizeGroupBase = exports.getNextResizeGroupStateProvider = exports.getMeasurementCache = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var PropTypes = _interopRequireWildcard(require("prop-types"));

var _Utilities = require("../../Utilities");

var _ResizeGroup = require("./ResizeGroup.types");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var RESIZE_DELAY = 16;
/**
 * Returns a simple object is able to store measurements with a given key.
 */

var getMeasurementCache = function () {
  var measurementsCache = {};
  return {
    /**
     * Checks if the provided data has a cacheKey. If it has a cacheKey and there is a
     * corresponding entry in the measurementsCache, then it will return that value.
     * Returns undefined otherwise.
     */
    getCachedMeasurement: function (data) {
      if (data && data.cacheKey && measurementsCache.hasOwnProperty(data.cacheKey)) {
        return measurementsCache[data.cacheKey];
      }

      return undefined;
    },

    /**
     * Should be called whenever there is a new measurement associated with a given data object.
     * If the data has a cacheKey, store that measurement in the measurementsCache.
     */
    addMeasurementToCache: function (data, measurement) {
      if (data.cacheKey) {
        measurementsCache[data.cacheKey] = measurement;
      }
    }
  };
};
/**
 * Returns a function that is able to compute the next state for the ResizeGroup given the current
 * state and any measurement updates.
 */


exports.getMeasurementCache = getMeasurementCache;

var getNextResizeGroupStateProvider = function (measurementCache) {
  if (measurementCache === void 0) {
    measurementCache = getMeasurementCache();
  }

  var _measurementCache = measurementCache;

  var _containerDimension;
  /**
   * Gets the width/height of the data rendered in a hidden div.
   * @param measuredData - The data corresponding to the measurement we wish to take.
   * @param getElementToMeasureDimension - A function that returns the measurement of the rendered data. Only called when the measurement
   * is not in the cache.
   */


  function _getMeasuredDimension(measuredData, getElementToMeasureDimension) {
    var cachedDimension = _measurementCache.getCachedMeasurement(measuredData);

    if (cachedDimension !== undefined) {
      return cachedDimension;
    }

    var measuredDimension = getElementToMeasureDimension();

    _measurementCache.addMeasurementToCache(measuredData, measuredDimension);

    return measuredDimension;
  }
  /**
   * Will get the next IResizeGroupState based on the current data while trying to shrink contents
   * to fit in the container.
   * @param data - The initial data point to start measuring.
   * @param onReduceData - Function that transforms the data into something that should render with less width/height.
   * @param getElementToMeasureDimension - A function that returns the measurement of the rendered data. Only called when the measurement
   * is not in the cache.
   */


  function _shrinkContentsUntilTheyFit(data, onReduceData, getElementToMeasureDimension) {
    var dataToMeasure = data;

    var measuredDimension = _getMeasuredDimension(data, getElementToMeasureDimension);

    while (measuredDimension > _containerDimension) {
      var nextMeasuredData = onReduceData(dataToMeasure); // We don't want to get stuck in an infinite render loop when there are no more
      // scaling steps, so implementations of onReduceData should return undefined when
      // there are no more scaling states to apply.

      if (nextMeasuredData === undefined) {
        return {
          renderedData: dataToMeasure,
          resizeDirection: undefined,
          dataToMeasure: undefined
        };
      }

      measuredDimension = _measurementCache.getCachedMeasurement(nextMeasuredData); // If the measurement isn't in the cache, we need to rerender with some data in a hidden div

      if (measuredDimension === undefined) {
        return {
          dataToMeasure: nextMeasuredData,
          resizeDirection: 'shrink'
        };
      }

      dataToMeasure = nextMeasuredData;
    }

    return {
      renderedData: dataToMeasure,
      resizeDirection: undefined,
      dataToMeasure: undefined
    };
  }
  /**
   * This function should be called when the state changes in a manner that might allow for more content to fit
   * on the screen, such as the window width/height growing.
   * @param data - The initial data point to start measuring.
   * @param onGrowData - Function that transforms the data into something that may take up more space when rendering.
   * @param getElementToMeasureDimension - A function that returns the measurement of the rendered data. Only called when the measurement
   * is not in the cache.
   */


  function _growDataUntilItDoesNotFit(data, onGrowData, getElementToMeasureDimension, onReduceData) {
    var dataToMeasure = data;

    var measuredDimension = _getMeasuredDimension(data, getElementToMeasureDimension);

    while (measuredDimension < _containerDimension) {
      var nextMeasuredData = onGrowData(dataToMeasure); // We don't want to get stuck in an infinite render loop when there are no more
      // scaling steps, so implementations of onGrowData should return undefined when
      // there are no more scaling states to apply.

      if (nextMeasuredData === undefined) {
        return {
          renderedData: dataToMeasure,
          resizeDirection: undefined,
          dataToMeasure: undefined
        };
      }

      measuredDimension = _measurementCache.getCachedMeasurement(nextMeasuredData); // If the measurement isn't in the cache, we need to rerender with some data in a hidden div

      if (measuredDimension === undefined) {
        return {
          dataToMeasure: nextMeasuredData
        };
      }

      dataToMeasure = nextMeasuredData;
    } // Once the loop is done, we should now shrink until the contents fit.


    return tslib_1.__assign({
      resizeDirection: 'shrink'
    }, _shrinkContentsUntilTheyFit(dataToMeasure, onReduceData, getElementToMeasureDimension));
  }
  /**
   * Handles an update to the container width/eheight. Should only be called when we knew the previous container width/height.
   * @param newDimension - The new width/height of the container.
   * @param fullDimensionData - The initial data passed in as a prop to resizeGroup.
   * @param renderedData - The data that was rendered prior to the container size changing.
   * @param onGrowData - Set to true if the Resize group has an onGrowData function.
   */


  function _updateContainerDimension(newDimension, fullDimensionData, renderedData, onGrowData) {
    var nextState;

    if (newDimension > _containerDimension) {
      if (onGrowData) {
        nextState = {
          resizeDirection: 'grow',
          dataToMeasure: onGrowData(renderedData)
        };
      } else {
        nextState = {
          resizeDirection: 'shrink',
          dataToMeasure: fullDimensionData
        };
      }
    } else {
      nextState = {
        resizeDirection: 'shrink',
        dataToMeasure: renderedData
      };
    }

    _containerDimension = newDimension;
    return tslib_1.__assign({}, nextState, {
      measureContainer: false
    });
  }

  function getNextState(props, currentState, getElementToMeasureDimension, newContainerDimension) {
    // If there is no new container width/height or data to measure, there is no need for a new state update
    if (newContainerDimension === undefined && currentState.dataToMeasure === undefined) {
      return undefined;
    }

    if (newContainerDimension) {
      // If we know what the last container size was and we rendered data at that width/height, we can do an optimized render
      if (_containerDimension && currentState.renderedData && !currentState.dataToMeasure) {
        return tslib_1.__assign({}, currentState, _updateContainerDimension(newContainerDimension, props.data, currentState.renderedData, props.onGrowData));
      } // If we are just setting the container width/height for the first time, we can't do any optimizations


      _containerDimension = newContainerDimension;
    }

    var nextState = tslib_1.__assign({}, currentState, {
      measureContainer: false
    });

    if (currentState.dataToMeasure) {
      if (currentState.resizeDirection === 'grow' && props.onGrowData) {
        nextState = tslib_1.__assign({}, nextState, _growDataUntilItDoesNotFit(currentState.dataToMeasure, props.onGrowData, getElementToMeasureDimension, props.onReduceData));
      } else {
        nextState = tslib_1.__assign({}, nextState, _shrinkContentsUntilTheyFit(currentState.dataToMeasure, props.onReduceData, getElementToMeasureDimension));
      }
    }

    return nextState;
  }
  /** Function that determines if we need to render content for measurement based on the measurement cache contents. */


  function shouldRenderDataForMeasurement(dataToMeasure) {
    if (!dataToMeasure || _measurementCache.getCachedMeasurement(dataToMeasure) !== undefined) {
      return false;
    }

    return true;
  }

  function getInitialResizeGroupState(data) {
    return {
      dataToMeasure: tslib_1.__assign({}, data),
      resizeDirection: 'grow',
      measureContainer: true
    };
  }

  return {
    getNextState: getNextState,
    shouldRenderDataForMeasurement: shouldRenderDataForMeasurement,
    getInitialResizeGroupState: getInitialResizeGroupState
  };
}; // Provides a context property that (if true) tells any child components that
// they are only being used for measurement purposes and will not be visible.


exports.getNextResizeGroupStateProvider = getNextResizeGroupStateProvider;
var MeasuredContext = (0, _Utilities.provideContext)({
  isMeasured: PropTypes.bool
}, function () {
  return {
    isMeasured: true
  };
}); // Styles for the hidden div used for measurement

var hiddenDivStyles = {
  position: 'fixed',
  visibility: 'hidden'
};
var hiddenParentStyles = {
  position: 'relative'
};

var ResizeGroupBase =
/** @class */
function (_super) {
  tslib_1.__extends(ResizeGroupBase, _super);

  function ResizeGroupBase(props) {
    var _this = _super.call(this, props) || this;

    _this._nextResizeGroupStateProvider = getNextResizeGroupStateProvider(); // The root div which is the container inside of which we are trying to fit content.

    _this._root = React.createRef(); // A div that can be used for the initial measurement so that we can avoid mounting a second instance
    // of the component being measured for the initial render.

    _this._initialHiddenDiv = React.createRef(); // A hidden div that is used for mounting a new instance of the component for measurement in a hidden
    // div without unmounting the currently visible content.

    _this._updateHiddenDiv = React.createRef(); // Tracks if any content has been rendered to the user. This enables us to do some performance optimizations
    // for the initial render.

    _this._hasRenderedContent = false;
    _this.state = _this._nextResizeGroupStateProvider.getInitialResizeGroupState(_this.props.data);

    _this._warnDeprecations({
      styles: 'className'
    });

    return _this;
  }

  ResizeGroupBase.prototype.render = function () {
    var _a = this.props,
        className = _a.className,
        onRenderData = _a.onRenderData;
    var _b = this.state,
        dataToMeasure = _b.dataToMeasure,
        renderedData = _b.renderedData;
    var divProps = (0, _Utilities.getNativeProps)(this.props, _Utilities.divProperties, ['data']);

    var dataNeedsMeasuring = this._nextResizeGroupStateProvider.shouldRenderDataForMeasurement(dataToMeasure);

    var isInitialMeasure = !this._hasRenderedContent && dataNeedsMeasuring; // We only ever render the final content to the user. All measurements are done in a hidden div.
    // For the initial render, we want this to be as fast as possible, so we need to make sure that we only mount one version of the
    // component for measurement and the final render. For renders that update what is on screen, we want to make sure that
    // there are no jarring effects such as the screen flashing as we apply scaling steps for meassurement. In the update case,
    // we mount a second version of the component just for measurement purposes and leave the rendered content untouched until we know the
    // next state sto show to the user.

    return React.createElement("div", tslib_1.__assign({}, divProps, {
      className: className,
      ref: this._root
    }), React.createElement("div", {
      style: hiddenParentStyles
    }, dataNeedsMeasuring && !isInitialMeasure && React.createElement("div", {
      style: hiddenDivStyles,
      ref: this._updateHiddenDiv
    }, React.createElement(MeasuredContext, null, onRenderData(dataToMeasure))), React.createElement("div", {
      ref: this._initialHiddenDiv,
      style: isInitialMeasure ? hiddenDivStyles : undefined,
      "data-automation-id": "visibleContent"
    }, isInitialMeasure ? onRenderData(dataToMeasure) : renderedData && onRenderData(renderedData))));
  };

  ResizeGroupBase.prototype.componentDidMount = function () {
    this._afterComponentRendered(this.props.direction);

    this._events.on(window, 'resize', this._async.debounce(this._onResize, RESIZE_DELAY, {
      leading: true
    }));
  };

  ResizeGroupBase.prototype.componentWillReceiveProps = function (nextProps) {
    this.setState({
      dataToMeasure: tslib_1.__assign({}, nextProps.data),
      resizeDirection: 'grow',
      measureContainer: true // Receiving new props means the parent might rerender and the root width/height might change

    });
  };

  ResizeGroupBase.prototype.componentDidUpdate = function (prevProps) {
    if (this.state.renderedData) {
      this._hasRenderedContent = true;

      if (this.props.dataDidRender) {
        this.props.dataDidRender(this.state.renderedData);
      }
    }

    this._afterComponentRendered(this.props.direction);
  };

  ResizeGroupBase.prototype.remeasure = function () {
    if (this._root.current) {
      this.setState({
        measureContainer: true
      });
    }
  };

  ResizeGroupBase.prototype._afterComponentRendered = function (direction) {
    var _this = this;

    this._async.requestAnimationFrame(function () {
      var containerDimension = undefined;

      if (_this.state.measureContainer && _this._root.current) {
        var boundingRect = _this._root.current.getBoundingClientRect();

        containerDimension = direction && direction === _ResizeGroup.ResizeGroupDirection.vertical ? boundingRect.height : boundingRect.width;
      }

      var nextState = _this._nextResizeGroupStateProvider.getNextState(_this.props, _this.state, function () {
        var refToMeasure = !_this._hasRenderedContent ? _this._initialHiddenDiv : _this._updateHiddenDiv;

        if (!refToMeasure.current) {
          return 0;
        }

        return direction && direction === _ResizeGroup.ResizeGroupDirection.vertical ? refToMeasure.current.scrollHeight : refToMeasure.current.scrollWidth;
      }, containerDimension);

      if (nextState) {
        _this.setState(nextState);
      }
    });
  };

  ResizeGroupBase.prototype._onResize = function () {
    if (this._root.current) {
      this.setState({
        measureContainer: true
      });
    }
  };

  return ResizeGroupBase;
}(_Utilities.BaseComponent);

exports.ResizeGroupBase = ResizeGroupBase;
},{"tslib":"xgwM","react":"mpTF","prop-types":"B0VN","../../Utilities":"B5nc","./ResizeGroup.types":"HPzL"}],"LjRy":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ResizeGroup = void 0;

var _ResizeGroup = require("./ResizeGroup.base");

var ResizeGroup = _ResizeGroup.ResizeGroupBase;
exports.ResizeGroup = ResizeGroup;
},{"./ResizeGroup.base":"t5UR"}],"Sjj5":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _ResizeGroup = require("./ResizeGroup");

Object.keys(_ResizeGroup).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _ResizeGroup[key];
    }
  });
});

var _ResizeGroup2 = require("./ResizeGroup.base");

Object.keys(_ResizeGroup2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _ResizeGroup2[key];
    }
  });
});

var _ResizeGroup3 = require("./ResizeGroup.types");

Object.keys(_ResizeGroup3).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _ResizeGroup3[key];
    }
  });
});
},{"./ResizeGroup":"LjRy","./ResizeGroup.base":"t5UR","./ResizeGroup.types":"HPzL"}],"nafp":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _index = require("./components/ResizeGroup/index");

Object.keys(_index).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index[key];
    }
  });
});
},{"./components/ResizeGroup/index":"Sjj5"}],"ohmO":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.TooltipDelay = void 0;

/**
 * {@docCategory Tooltip}
 */
var TooltipDelay;
exports.TooltipDelay = TooltipDelay;

(function (TooltipDelay) {
  TooltipDelay[TooltipDelay["zero"] = 0] = "zero";
  TooltipDelay[TooltipDelay["medium"] = 1] = "medium";
  TooltipDelay[TooltipDelay["long"] = 2] = "long";
})(TooltipDelay || (exports.TooltipDelay = TooltipDelay = {}));
},{}],"WRHQ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.TooltipBase = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Utilities = require("../../Utilities");

var _Tooltip = require("./Tooltip.types");

var _Callout = require("../../Callout");

var _DirectionalHint = require("../../common/DirectionalHint");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var getClassNames = (0, _Utilities.classNamesFunction)();

var TooltipBase =
/** @class */
function (_super) {
  tslib_1.__extends(TooltipBase, _super);

  function TooltipBase() {
    var _this = _super !== null && _super.apply(this, arguments) || this;

    _this._onRenderContent = function (props) {
      return React.createElement("p", {
        className: _this._classNames.subText
      }, props.content);
    };

    return _this;
  }

  TooltipBase.prototype.render = function () {
    var _a = this.props,
        className = _a.className,
        calloutProps = _a.calloutProps,
        delay = _a.delay,
        directionalHint = _a.directionalHint,
        directionalHintForRTL = _a.directionalHintForRTL,
        styles = _a.styles,
        id = _a.id,
        maxWidth = _a.maxWidth,
        _b = _a.onRenderContent,
        onRenderContent = _b === void 0 ? this._onRenderContent : _b,
        targetElement = _a.targetElement,
        theme = _a.theme;
    this._classNames = getClassNames(styles, {
      theme: theme,
      className: className || calloutProps && calloutProps.className,
      delay: delay,
      beakWidth: calloutProps && calloutProps.beakWidth,
      gapSpace: calloutProps && calloutProps.gapSpace,
      maxWidth: maxWidth
    });
    return React.createElement(_Callout.Callout, tslib_1.__assign({
      target: targetElement,
      directionalHint: directionalHint,
      directionalHintForRTL: directionalHintForRTL
    }, calloutProps, (0, _Utilities.getNativeProps)(this.props, _Utilities.divProperties, ['id']), {
      className: this._classNames.root
    }), React.createElement("div", {
      className: this._classNames.content,
      id: id,
      role: "tooltip",
      onMouseEnter: this.props.onMouseEnter,
      onMouseLeave: this.props.onMouseLeave
    }, onRenderContent(this.props, this._onRenderContent)));
  }; // Specify default props values


  TooltipBase.defaultProps = {
    directionalHint: _DirectionalHint.DirectionalHint.topCenter,
    delay: _Tooltip.TooltipDelay.medium,
    maxWidth: '364px',
    calloutProps: {
      isBeakVisible: true,
      beakWidth: 16,
      gapSpace: 0,
      setInitialFocus: true,
      doNotLayer: false
    }
  };
  return TooltipBase;
}(React.Component);

exports.TooltipBase = TooltipBase;
},{"tslib":"xgwM","react":"mpTF","../../Utilities":"B5nc","./Tooltip.types":"ohmO","../../Callout":"jp3a","../../common/DirectionalHint":"uAUO"}],"l01l":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = void 0;

var _Tooltip = require("./Tooltip.types");

var _Styling = require("../../Styling");

var getStyles = function (props) {
  var className = props.className,
      delay = props.delay,
      _a = props.beakWidth,
      beakWidth = _a === void 0 ? 16 : _a,
      _b = props.gapSpace,
      gapSpace = _b === void 0 ? 0 : _b,
      maxWidth = props.maxWidth,
      theme = props.theme;
  var palette = theme.palette,
      fonts = theme.fonts; // The math here is done to account for the 45 degree rotation of the beak

  var tooltipGapSpace = -(Math.sqrt(beakWidth * beakWidth / 2) + gapSpace);
  return {
    root: ['ms-Tooltip', theme.fonts.medium, _Styling.AnimationClassNames.fadeIn200, {
      background: palette.white,
      padding: '8px',
      animationDelay: '300ms',
      maxWidth: maxWidth,
      selectors: {
        ':after': {
          content: "''",
          position: 'absolute',
          bottom: tooltipGapSpace,
          left: tooltipGapSpace,
          right: tooltipGapSpace,
          top: tooltipGapSpace
        }
      }
    }, delay === _Tooltip.TooltipDelay.zero && {
      animationDelay: '0s'
    }, delay === _Tooltip.TooltipDelay.long && {
      animationDelay: '500ms'
    }, className],
    content: ['ms-Tooltip-content', fonts.small, {
      color: palette.neutralPrimary,
      wordWrap: 'break-word',
      overflowWrap: 'break-word',
      overflow: 'hidden'
    }],
    subText: ['ms-Tooltip-subtext', {
      // Using inherit here to avoid unintentional global overrides of the <p> tag.
      fontSize: 'inherit',
      fontWeight: 'inherit',
      color: 'inherit',
      margin: 0
    }]
  };
};

exports.getStyles = getStyles;
},{"./Tooltip.types":"ohmO","../../Styling":"AHeq"}],"LmyI":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Tooltip = void 0;

var _Utilities = require("../../Utilities");

var _Tooltip = require("./Tooltip.base");

var _Tooltip2 = require("./Tooltip.styles");

var Tooltip = (0, _Utilities.styled)(_Tooltip.TooltipBase, _Tooltip2.getStyles, undefined, {
  scope: 'Tooltip'
});
exports.Tooltip = Tooltip;
},{"../../Utilities":"B5nc","./Tooltip.base":"WRHQ","./Tooltip.styles":"l01l"}],"UCDv":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.TooltipOverflowMode = void 0;

/**
 * {@docCategory Tooltip}
 */
var TooltipOverflowMode;
exports.TooltipOverflowMode = TooltipOverflowMode;

(function (TooltipOverflowMode) {
  /** Only show tooltip if parent DOM element is overflowing */
  TooltipOverflowMode[TooltipOverflowMode["Parent"] = 0] = "Parent";
  /** Only show tooltip if tooltip host's content is overflowing */

  TooltipOverflowMode[TooltipOverflowMode["Self"] = 1] = "Self";
})(TooltipOverflowMode || (exports.TooltipOverflowMode = TooltipOverflowMode = {}));
},{}],"BGTr":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.TooltipHostBase = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Utilities = require("../../Utilities");

var _TooltipHost = require("./TooltipHost.types");

var _Tooltip = require("./Tooltip");

var _Tooltip2 = require("./Tooltip.types");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var getClassNames = (0, _Utilities.classNamesFunction)();

var TooltipHostBase =
/** @class */
function (_super) {
  tslib_1.__extends(TooltipHostBase, _super); // Constructor


  function TooltipHostBase(props) {
    var _this = _super.call(this, props) || this; // The wrapping div that gets the hover events


    _this._tooltipHost = React.createRef(); // The ID of the setTimeout that will eventually close the tooltip if the
    // the tooltip isn't hovered over.

    _this._closingTimer = -1;

    _this.show = function () {
      _this._toggleTooltip(true);
    };

    _this.dismiss = function () {
      _this._hideTooltip();
    }; // Show Tooltip


    _this._onTooltipMouseEnter = function (ev) {
      var overflowMode = _this.props.overflowMode;

      if (TooltipHostBase._currentVisibleTooltip && TooltipHostBase._currentVisibleTooltip !== _this) {
        TooltipHostBase._currentVisibleTooltip.dismiss();
      }

      TooltipHostBase._currentVisibleTooltip = _this;

      if (overflowMode !== undefined) {
        var overflowElement = _this._getTargetElement();

        if (overflowElement && !(0, _Utilities.hasOverflow)(overflowElement)) {
          return;
        }
      }

      _this._clearDismissTimer();

      if (ev.target && (0, _Utilities.portalContainsElement)(ev.target, _this._getTargetElement())) {
        // Do not show tooltip when target is inside a portal relative to TooltipHost.
        return;
      }

      _this._toggleTooltip(true);
    }; // Hide Tooltip


    _this._onTooltipMouseLeave = function (ev) {
      if (_this.props.closeDelay) {
        _this._clearDismissTimer();

        _this._closingTimer = _this._async.setTimeout(function () {
          _this._toggleTooltip(false);
        }, _this.props.closeDelay);
      } else {
        _this._toggleTooltip(false);
      }

      if (TooltipHostBase._currentVisibleTooltip === _this) {
        TooltipHostBase._currentVisibleTooltip = undefined;
      }
    };

    _this._clearDismissTimer = function () {
      _this._async.clearTimeout(_this._closingTimer);
    }; // Hide Tooltip


    _this._hideTooltip = function () {
      _this._toggleTooltip(false);
    };

    _this.state = {
      isTooltipVisible: false
    };
    return _this;
  } // Render


  TooltipHostBase.prototype.render = function () {
    var _a = this.props,
        calloutProps = _a.calloutProps,
        children = _a.children,
        content = _a.content,
        delay = _a.delay,
        directionalHint = _a.directionalHint,
        directionalHintForRTL = _a.directionalHintForRTL,
        className = _a.hostClassName,
        id = _a.id,
        _b = _a.setAriaDescribedBy,
        setAriaDescribedBy = _b === void 0 ? true : _b,
        tooltipProps = _a.tooltipProps,
        styles = _a.styles,
        theme = _a.theme;
    this._classNames = getClassNames(styles, {
      theme: theme,
      className: className
    });
    var isTooltipVisible = this.state.isTooltipVisible;
    var tooltipId = id || (0, _Utilities.getId)('tooltip');
    var isContentPresent = !!(content || tooltipProps && tooltipProps.onRenderContent && tooltipProps.onRenderContent());
    var showTooltip = isTooltipVisible && isContentPresent;
    var ariaDescribedBy = setAriaDescribedBy && isTooltipVisible && isContentPresent ? tooltipId : undefined;
    return React.createElement("div", tslib_1.__assign({
      className: this._classNames.root,
      ref: this._tooltipHost
    }, {
      onFocusCapture: this._onTooltipMouseEnter
    }, {
      onBlurCapture: this._hideTooltip
    }, {
      onMouseEnter: this._onTooltipMouseEnter,
      onMouseLeave: this._onTooltipMouseLeave,
      "aria-describedby": ariaDescribedBy
    }), children, showTooltip && React.createElement(_Tooltip.Tooltip, tslib_1.__assign({
      id: tooltipId,
      delay: delay,
      content: content,
      targetElement: this._getTargetElement(),
      directionalHint: directionalHint,
      directionalHintForRTL: directionalHintForRTL,
      calloutProps: (0, _Utilities.assign)({}, calloutProps, {
        onMouseEnter: this._onTooltipMouseEnter,
        onMouseLeave: this._onTooltipMouseLeave
      }),
      onMouseEnter: this._onTooltipMouseEnter,
      onMouseLeave: this._onTooltipMouseLeave
    }, (0, _Utilities.getNativeProps)(this.props, _Utilities.divProperties), tooltipProps)));
  };

  TooltipHostBase.prototype.componentWillUnmount = function () {
    if (TooltipHostBase._currentVisibleTooltip && TooltipHostBase._currentVisibleTooltip === this) {
      TooltipHostBase._currentVisibleTooltip = undefined;
    }
  };

  TooltipHostBase.prototype._getTargetElement = function () {
    if (!this._tooltipHost.current) {
      return undefined;
    }

    var overflowMode = this.props.overflowMode; // Select target element based on overflow mode. For parent mode, you want to position the tooltip relative
    // to the parent element, otherwise it might look off.

    if (overflowMode !== undefined) {
      switch (overflowMode) {
        case _TooltipHost.TooltipOverflowMode.Parent:
          return this._tooltipHost.current.parentElement;

        case _TooltipHost.TooltipOverflowMode.Self:
          return this._tooltipHost.current;
      }
    }

    return this._tooltipHost.current;
  };

  TooltipHostBase.prototype._toggleTooltip = function (isTooltipVisible) {
    var _this = this;

    if (this.state.isTooltipVisible !== isTooltipVisible) {
      this.setState({
        isTooltipVisible: isTooltipVisible
      }, function () {
        return _this.props.onTooltipToggle && _this.props.onTooltipToggle(_this.state.isTooltipVisible);
      });
    }
  };

  TooltipHostBase.defaultProps = {
    delay: _Tooltip2.TooltipDelay.medium
  };
  return TooltipHostBase;
}(_Utilities.BaseComponent);

exports.TooltipHostBase = TooltipHostBase;
},{"tslib":"xgwM","react":"mpTF","../../Utilities":"B5nc","./TooltipHost.types":"UCDv","./Tooltip":"LmyI","./Tooltip.types":"ohmO"}],"Vozw":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = void 0;

var _Styling = require("../../Styling");

var GlobalClassNames = {
  root: 'ms-TooltipHost'
};

var getStyles = function (props) {
  var className = props.className,
      theme = props.theme;
  var classNames = (0, _Styling.getGlobalClassNames)(GlobalClassNames, theme);
  return {
    root: [classNames.root, {
      display: 'inline'
    }, className]
  };
};

exports.getStyles = getStyles;
},{"../../Styling":"AHeq"}],"AI6L":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.TooltipHost = void 0;

var _Utilities = require("../../Utilities");

var _TooltipHost = require("./TooltipHost.base");

var _TooltipHost2 = require("./TooltipHost.styles");

var TooltipHost = (0, _Utilities.styled)(_TooltipHost.TooltipHostBase, _TooltipHost2.getStyles, undefined, {
  scope: 'TooltipHost'
});
exports.TooltipHost = TooltipHost;
},{"../../Utilities":"B5nc","./TooltipHost.base":"BGTr","./TooltipHost.styles":"Vozw"}],"p0FE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _Tooltip = require("./Tooltip");

Object.keys(_Tooltip).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Tooltip[key];
    }
  });
});

var _Tooltip2 = require("./Tooltip.base");

Object.keys(_Tooltip2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Tooltip2[key];
    }
  });
});

var _Tooltip3 = require("./Tooltip.types");

Object.keys(_Tooltip3).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Tooltip3[key];
    }
  });
});

var _TooltipHost = require("./TooltipHost");

Object.keys(_TooltipHost).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _TooltipHost[key];
    }
  });
});

var _TooltipHost2 = require("./TooltipHost.base");

Object.keys(_TooltipHost2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _TooltipHost2[key];
    }
  });
});

var _TooltipHost3 = require("./TooltipHost.types");

Object.keys(_TooltipHost3).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _TooltipHost3[key];
    }
  });
});

var _DirectionalHint = require("../../common/DirectionalHint");

Object.keys(_DirectionalHint).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _DirectionalHint[key];
    }
  });
});
},{"./Tooltip":"LmyI","./Tooltip.base":"WRHQ","./Tooltip.types":"ohmO","./TooltipHost":"AI6L","./TooltipHost.base":"BGTr","./TooltipHost.types":"UCDv","../../common/DirectionalHint":"uAUO"}],"J0oy":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _index = require("./components/Tooltip/index");

Object.keys(_index).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index[key];
    }
  });
});
},{"./components/Tooltip/index":"p0FE"}],"vTEY":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.CommandBarBase = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Utilities = require("../../Utilities");

var _OverflowSet = require("../../OverflowSet");

var _ResizeGroup = require("../../ResizeGroup");

var _FocusZone = require("../../FocusZone");

var _Button = require("../../Button");

var _Tooltip = require("../../Tooltip");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var getClassNames = (0, _Utilities.classNamesFunction)();

var CommandBarBase =
/** @class */
function (_super) {
  tslib_1.__extends(CommandBarBase, _super);

  function CommandBarBase() {
    var _this = _super !== null && _super.apply(this, arguments) || this;

    _this._overflowSet = React.createRef();
    _this._resizeGroup = React.createRef();

    _this._onRenderData = function (data) {
      return React.createElement(_FocusZone.FocusZone, {
        className: (0, _Utilities.css)(_this._classNames.root),
        direction: _FocusZone.FocusZoneDirection.horizontal,
        role: 'menubar',
        "aria-label": _this.props.ariaLabel
      }, React.createElement(_OverflowSet.OverflowSet, {
        componentRef: _this._resolveRef('_overflowSet'),
        className: (0, _Utilities.css)(_this._classNames.primarySet),
        doNotContainWithinFocusZone: true,
        role: 'presentation',
        items: data.primaryItems,
        overflowItems: data.overflowItems.length ? data.overflowItems : undefined,
        onRenderItem: _this._onRenderItem,
        onRenderOverflowButton: _this._onRenderOverflowButton
      }), data.farItems && React.createElement(_OverflowSet.OverflowSet, {
        className: (0, _Utilities.css)(_this._classNames.secondarySet),
        doNotContainWithinFocusZone: true,
        role: 'presentation',
        items: data.farItems,
        onRenderItem: _this._onRenderItem,
        onRenderOverflowButton: _Utilities.nullRender
      }));
    };

    _this._onRenderItem = function (item) {
      var CommandButtonType = _this.props.buttonAs || item.commandBarButtonAs || _Button.CommandBarButton;
      var itemText = item.text || item.name;

      if (item.onRender) {
        // These are the top level items, there is no relevant menu dismissing function to
        // provide for the IContextualMenuItem onRender function. Pass in a no op function instead.
        return item.onRender(item, function () {
          return undefined;
        });
      }

      var commandButtonProps = tslib_1.__assign({
        allowDisabledFocus: true,
        role: 'menuitem'
      }, item, {
        styles: tslib_1.__assign({
          root: {
            height: '100%'
          },
          label: {
            whiteSpace: 'nowrap'
          }
        }, item.buttonStyles),
        className: (0, _Utilities.css)('ms-CommandBarItem-link', item.className),
        text: !item.iconOnly ? itemText : undefined,
        menuProps: item.subMenuProps,
        onClick: _this._onButtonClick(item)
      });

      if (item.iconOnly && itemText !== undefined) {
        return React.createElement(_Tooltip.TooltipHost, tslib_1.__assign({
          content: itemText
        }, item.tooltipHostProps), React.createElement(CommandButtonType, tslib_1.__assign({}, commandButtonProps, {
          defaultRender: _Button.CommandBarButton
        })));
      }

      return React.createElement(CommandButtonType, tslib_1.__assign({}, commandButtonProps, {
        defaultRender: _Button.CommandBarButton
      }));
    };

    _this._onRenderOverflowButton = function (overflowItems) {
      var _a = _this.props,
          _b = _a.overflowButtonAs,
          OverflowButtonType = _b === void 0 ? _Button.CommandBarButton : _b,
          _c = _a.overflowButtonProps // assure that props is not empty
      ,
          overflowButtonProps = _c === void 0 ? {} : _c // assure that props is not empty
      ;
      var combinedOverflowItems = (overflowButtonProps.menuProps ? overflowButtonProps.menuProps.items : []).concat(overflowItems);

      var overflowProps = tslib_1.__assign({}, overflowButtonProps, {
        styles: tslib_1.__assign({
          menuIcon: {
            fontSize: '17px'
          }
        }, overflowButtonProps.styles),
        className: (0, _Utilities.css)('ms-CommandBar-overflowButton', overflowButtonProps.className),
        menuProps: tslib_1.__assign({}, overflowButtonProps.menuProps, {
          items: combinedOverflowItems
        }),
        menuIconProps: tslib_1.__assign({
          iconName: 'More'
        }, overflowButtonProps.menuIconProps)
      });

      return React.createElement(OverflowButtonType, tslib_1.__assign({}, overflowProps));
    };

    _this._onReduceData = function (data) {
      var _a = _this.props,
          shiftOnReduce = _a.shiftOnReduce,
          onDataReduced = _a.onDataReduced;
      var primaryItems = data.primaryItems,
          overflowItems = data.overflowItems,
          cacheKey = data.cacheKey; // Use first item if shiftOnReduce, otherwise use last item

      var movedItem = primaryItems[shiftOnReduce ? 0 : primaryItems.length - 1];

      if (movedItem !== undefined) {
        movedItem.renderedInOverflow = true;
        overflowItems = [movedItem].concat(overflowItems);
        primaryItems = shiftOnReduce ? primaryItems.slice(1) : primaryItems.slice(0, -1);

        var newData = tslib_1.__assign({}, data, {
          primaryItems: primaryItems,
          overflowItems: overflowItems
        });

        cacheKey = _this._computeCacheKey(newData);

        if (onDataReduced) {
          onDataReduced(movedItem);
        }

        newData.cacheKey = cacheKey;
        return newData;
      }

      return undefined;
    };

    _this._onGrowData = function (data) {
      var _a = _this.props,
          shiftOnReduce = _a.shiftOnReduce,
          onDataGrown = _a.onDataGrown;
      var minimumOverflowItems = data.minimumOverflowItems;
      var primaryItems = data.primaryItems,
          overflowItems = data.overflowItems,
          cacheKey = data.cacheKey;
      var movedItem = overflowItems[0]; // Make sure that moved item exists and is not one of the original overflow items

      if (movedItem !== undefined && overflowItems.length > minimumOverflowItems) {
        movedItem.renderedInOverflow = false;
        overflowItems = overflowItems.slice(1); // if shiftOnReduce, movedItem goes first, otherwise, last.

        primaryItems = shiftOnReduce ? [movedItem].concat(primaryItems) : primaryItems.concat([movedItem]);

        var newData = tslib_1.__assign({}, data, {
          primaryItems: primaryItems,
          overflowItems: overflowItems
        });

        cacheKey = _this._computeCacheKey(newData);

        if (onDataGrown) {
          onDataGrown(movedItem);
        }

        newData.cacheKey = cacheKey;
        return newData;
      }

      return undefined;
    };

    return _this;
  }

  CommandBarBase.prototype.render = function () {
    var _a = this.props,
        className = _a.className,
        items = _a.items,
        overflowItems = _a.overflowItems,
        farItems = _a.farItems,
        styles = _a.styles,
        theme = _a.theme,
        dataDidRender = _a.dataDidRender,
        _b = _a.onReduceData,
        onReduceData = _b === void 0 ? this._onReduceData : _b,
        _c = _a.onGrowData,
        onGrowData = _c === void 0 ? this._onGrowData : _c;
    var commandBarData = {
      primaryItems: items.slice(),
      overflowItems: overflowItems.slice(),
      minimumOverflowItems: overflowItems.slice().length,
      farItems: farItems,
      cacheKey: ''
    };
    this._classNames = getClassNames(styles, {
      theme: theme
    });
    return React.createElement(_ResizeGroup.ResizeGroup, {
      componentRef: this._resizeGroup,
      className: className,
      data: commandBarData,
      onReduceData: onReduceData,
      onGrowData: onGrowData,
      onRenderData: this._onRenderData,
      dataDidRender: dataDidRender
    });
  };

  CommandBarBase.prototype.focus = function () {
    var overflowSet = this._overflowSet.current;
    overflowSet && overflowSet.focus();
  };

  CommandBarBase.prototype.remeasure = function () {
    this._resizeGroup.current && this._resizeGroup.current.remeasure();
  };

  CommandBarBase.prototype._onButtonClick = function (item) {
    return function (ev) {
      // inactive is deprecated. remove check in 7.0
      if (item.inactive) {
        return;
      }

      if (item.onClick) {
        item.onClick(ev, item);
      }
    };
  };

  CommandBarBase.prototype._computeCacheKey = function (data) {
    var primaryItems = data.primaryItems,
        _a = data.farItems,
        farItems = _a === void 0 ? [] : _a,
        overflowItems = data.overflowItems;

    var returnKey = function (acc, current) {
      var _a = current.cacheKey,
          cacheKey = _a === void 0 ? current.key : _a;
      return acc + cacheKey;
    };

    var primaryKey = primaryItems.reduce(returnKey, '');
    var farKey = farItems.reduce(returnKey, '');
    var overflowKey = !!overflowItems.length ? 'overflow' : '';
    return [primaryKey, farKey, overflowKey].join(' ');
  };

  CommandBarBase.defaultProps = {
    items: [],
    overflowItems: []
  };
  return CommandBarBase;
}(_Utilities.BaseComponent);

exports.CommandBarBase = CommandBarBase;
},{"tslib":"xgwM","react":"mpTF","../../Utilities":"B5nc","../../OverflowSet":"VMzb","../../ResizeGroup":"nafp","../../FocusZone":"v3nN","../../Button":"XfLs","../../Tooltip":"J0oy"}],"z0HS":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = void 0;

var getStyles = function (props) {
  var className = props.className,
      theme = props.theme;
  var palette = theme.palette;
  return {
    root: [theme.fonts.medium, 'ms-CommandBar', {
      display: 'flex',
      backgroundColor: palette.neutralLighter,
      padding: '0 16px',
      height: '40px'
    }, className],
    primarySet: ['ms-CommandBar-primaryCommand', {
      flexGrow: '1',
      display: 'flex',
      alignItems: 'stretch'
    }],
    secondarySet: ['ms-CommandBar-secondaryCommand', {
      flexShrink: '0',
      display: 'flex',
      alignItems: 'stretch'
    }]
  };
};

exports.getStyles = getStyles;
},{}],"v85U":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.CommandBar = void 0;

var _Utilities = require("../../Utilities");

var _CommandBar = require("./CommandBar.base");

var _CommandBar2 = require("./CommandBar.styles");

// Create a CommandBar variant which uses these default styles and this styled subcomponent.
var CommandBar = (0, _Utilities.styled)(_CommandBar.CommandBarBase, _CommandBar2.getStyles, undefined, {
  scope: 'CommandBar'
});
exports.CommandBar = CommandBar;
},{"../../Utilities":"B5nc","./CommandBar.base":"vTEY","./CommandBar.styles":"z0HS"}],"xVzM":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _CommandBar = require("./CommandBar");

Object.keys(_CommandBar).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _CommandBar[key];
    }
  });
});

var _CommandBar2 = require("./CommandBar.base");

Object.keys(_CommandBar2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _CommandBar2[key];
    }
  });
});
},{"./CommandBar":"v85U","./CommandBar.base":"vTEY"}],"eCHI":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "ResponsiveMode", {
  enumerable: true,
  get: function () {
    return _withResponsiveMode.ResponsiveMode;
  }
});
exports.DialogType = void 0;

var _withResponsiveMode = require("../../utilities/decorators/withResponsiveMode");

// Exported because the type is an optional prop and not exported otherwise.

/**
 * {@docCategory Dialog}
 */
var DialogType;
exports.DialogType = DialogType;

(function (DialogType) {
  /** Standard dialog */
  DialogType[DialogType["normal"] = 0] = "normal";
  /** Dialog with large header banner */

  DialogType[DialogType["largeHeader"] = 1] = "largeHeader";
  /** Dialog with an 'x' close button in the upper-right corner */

  DialogType[DialogType["close"] = 2] = "close";
})(DialogType || (exports.DialogType = DialogType = {}));
},{"../../utilities/decorators/withResponsiveMode":"Q4um"}],"Uvsf":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = exports.animationDuration = void 0;

var _Styling = require("../../Styling");

var animationDuration = _Styling.AnimationVariables.durationValue2;
exports.animationDuration = animationDuration;
var globalClassNames = {
  root: 'ms-Modal',
  main: 'ms-Dialog-main',
  scrollableContent: 'ms-Modal-scrollableContent',
  isOpen: 'is-open',
  layer: 'ms-Modal-Layer'
};

var getStyles = function (props) {
  var className = props.className,
      containerClassName = props.containerClassName,
      scrollableContentClassName = props.scrollableContentClassName,
      isOpen = props.isOpen,
      isVisible = props.isVisible,
      hasBeenOpened = props.hasBeenOpened,
      modalRectangleTop = props.modalRectangleTop,
      theme = props.theme,
      topOffsetFixed = props.topOffsetFixed,
      isModeless = props.isModeless,
      layerClassName = props.layerClassName,
      isDefaultDragHandle = props.isDefaultDragHandle;
  var palette = theme.palette;
  var classNames = (0, _Styling.getGlobalClassNames)(globalClassNames, theme);
  return {
    root: [classNames.root, theme.fonts.medium, {
      backgroundColor: 'transparent',
      position: isModeless ? 'absolute' : 'fixed',
      height: '100%',
      width: '100%',
      display: 'flex',
      alignItems: 'center',
      justifyContent: 'center',
      opacity: 0,
      pointerEvents: 'none',
      transition: "opacity " + animationDuration
    }, topOffsetFixed && hasBeenOpened && {
      alignItems: 'flex-start'
    }, isOpen && classNames.isOpen, isVisible && {
      opacity: 1,
      pointerEvents: 'auto'
    }, className],
    main: [classNames.main, {
      boxShadow: '0 0 5px 0 rgba(0, 0, 0, 0.4)',
      backgroundColor: palette.white,
      boxSizing: 'border-box',
      position: 'relative',
      textAlign: 'left',
      outline: '3px solid transparent',
      maxHeight: '100%',
      overflowY: 'auto',
      zIndex: isModeless ? _Styling.ZIndexes.Layer : undefined
    }, topOffsetFixed && hasBeenOpened && {
      top: modalRectangleTop
    }, isDefaultDragHandle && {
      cursor: 'move'
    }, containerClassName],
    scrollableContent: [classNames.scrollableContent, {
      overflowY: 'auto',
      flexGrow: 1,
      maxHeight: '100vh',
      selectors: (_a = {}, _a['@supports (-webkit-overflow-scrolling: touch)'] = {
        maxHeight: window.innerHeight
      }, _a)
    }, scrollableContentClassName],
    layer: isModeless && [layerClassName, classNames.layer, {
      position: 'static',
      width: 'unset',
      height: 'unset'
    }],
    keyboardMoveIconContainer: {
      position: 'absolute',
      display: 'flex',
      justifyContent: 'center',
      width: '100%',
      padding: '3px 0px'
    },
    keyboardMoveIcon: {
      fontSize: '24px',
      width: '24px'
    }
  };

  var _a;
};

exports.getStyles = getStyles;
},{"../../Styling":"AHeq"}],"MPrA":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.OverlayBase = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Utilities = require("../../Utilities");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var getClassNames = (0, _Utilities.classNamesFunction)();

var OverlayBase =
/** @class */
function (_super) {
  tslib_1.__extends(OverlayBase, _super);

  function OverlayBase() {
    return _super !== null && _super.apply(this, arguments) || this;
  }

  OverlayBase.prototype.componentDidMount = function () {
    (0, _Utilities.disableBodyScroll)();
  };

  OverlayBase.prototype.componentWillUnmount = function () {
    (0, _Utilities.enableBodyScroll)();
  };

  OverlayBase.prototype.render = function () {
    var _a = this.props,
        isDark = _a.isDarkThemed,
        className = _a.className,
        theme = _a.theme,
        styles = _a.styles;
    var divProps = (0, _Utilities.getNativeProps)(this.props, _Utilities.divProperties);
    var classNames = getClassNames(styles, {
      theme: theme,
      className: className,
      isDark: isDark
    });
    return React.createElement("div", tslib_1.__assign({}, divProps, {
      className: classNames.root
    }));
  };

  return OverlayBase;
}(_Utilities.BaseComponent);

exports.OverlayBase = OverlayBase;
},{"tslib":"xgwM","react":"mpTF","../../Utilities":"B5nc"}],"gM2L":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = void 0;

var _Styling = require("../../Styling");

var GlobalClassNames = {
  root: 'ms-Overlay',
  rootDark: 'ms-Overlay--dark'
};

var getStyles = function (props) {
  var className = props.className,
      theme = props.theme,
      isNone = props.isNone,
      isDark = props.isDark;
  var palette = theme.palette;
  var classNames = (0, _Styling.getGlobalClassNames)(GlobalClassNames, theme);
  return {
    root: [classNames.root, theme.fonts.medium, {
      backgroundColor: palette.whiteTranslucent40,
      top: 0,
      right: 0,
      bottom: 0,
      left: 0,
      position: 'absolute',
      selectors: (_a = {}, _a[_Styling.HighContrastSelector] = {
        border: '1px solid WindowText',
        opacity: 0
      }, _a)
    }, isNone && {
      visibility: 'hidden'
    }, isDark && [classNames.rootDark, {
      backgroundColor: palette.blackTranslucent40
    }], className]
  };

  var _a;
};

exports.getStyles = getStyles;
},{"../../Styling":"AHeq"}],"YZQ1":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Overlay = void 0;

var _Utilities = require("../../Utilities");

var _Overlay = require("./Overlay.base");

var _Overlay2 = require("./Overlay.styles");

var Overlay = (0, _Utilities.styled)(_Overlay.OverlayBase, _Overlay2.getStyles, undefined, {
  scope: 'Overlay'
});
exports.Overlay = Overlay;
},{"../../Utilities":"B5nc","./Overlay.base":"MPrA","./Overlay.styles":"gM2L"}],"RTrF":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _Overlay = require("./Overlay");

Object.keys(_Overlay).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Overlay[key];
    }
  });
});

var _Overlay2 = require("./Overlay.base");

Object.keys(_Overlay2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Overlay2[key];
    }
  });
});
},{"./Overlay":"YZQ1","./Overlay.base":"MPrA"}],"gVaT":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _index = require("./components/Overlay/index");

Object.keys(_index).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index[key];
    }
  });
});
},{"./components/Overlay/index":"RTrF"}],"oCz7":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getClassNames = void 0;

var _Utilities = require("../../Utilities");

var _Styling = require("../../Styling");

var getClassNames = (0, _Utilities.memoizeFunction)(function (className, isDragging) {
  return {
    root: (0, _Styling.mergeStyles)(className, isDragging && {
      touchAction: 'none',
      selectors: {
        '& *': {
          userSelect: 'none'
        }
      }
    })
  };
});
exports.getClassNames = getClassNames;
},{"../../Utilities":"B5nc","../../Styling":"AHeq"}],"GwQe":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.DraggableZone = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _DraggableZone = require("./DraggableZone.styles");

var _Utilities = require("../../Utilities");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var eventMapping = {
  touch: {
    start: 'touchstart',
    move: 'touchmove',
    stop: 'touchend'
  },
  mouse: {
    start: 'mousedown',
    move: 'mousemove',
    stop: 'mouseup'
  }
};

var DraggableZone =
/** @class */
function (_super) {
  tslib_1.__extends(DraggableZone, _super);

  function DraggableZone(props) {
    var _this = _super.call(this, props) || this;

    _this._currentEventType = eventMapping.mouse;
    _this._events = [];

    _this._onMouseDown = function (event) {
      var onMouseDown = React.Children.only(_this.props.children).props.onMouseDown;

      if (onMouseDown) {
        onMouseDown(event);
      }

      _this._currentEventType = eventMapping.mouse;
      return _this._onDragStart(event);
    };

    _this._onMouseUp = function (event) {
      var onMouseUp = React.Children.only(_this.props.children).props.onMouseUp;

      if (onMouseUp) {
        onMouseUp(event);
      }

      _this._currentEventType = eventMapping.mouse;
      return _this._onDragStop(event);
    };

    _this._onTouchStart = function (event) {
      var onTouchStart = React.Children.only(_this.props.children).props.onTouchStart;

      if (onTouchStart) {
        onTouchStart(event);
      }

      _this._currentEventType = eventMapping.touch;
      return _this._onDragStart(event);
    };

    _this._onTouchEnd = function (event) {
      var onTouchEnd = React.Children.only(_this.props.children).props.onTouchEnd;

      if (onTouchEnd) {
        onTouchEnd(event);
      }

      _this._currentEventType = eventMapping.touch;

      _this._onDragStop(event);
    };

    _this._onDragStart = function (event) {
      // Only handle left click for dragging
      if (typeof event.button === 'number' && event.button !== 0) {
        return false;
      } // If the target doesn't match the handleSelector OR
      // if the target does match the preventDragSelector, bail out


      if (_this.props.handleSelector && !_this._matchesSelector(event.target, _this.props.handleSelector) || _this.props.preventDragSelector && _this._matchesSelector(event.target, _this.props.preventDragSelector)) {
        return;
      } // Remember the touch identifier if this is a touch event so we can
      // distinguish between individual touches in multitouch scenarios
      // by remembering which touch point we were given


      _this._touchId = _this._getTouchId(event);

      var position = _this._getControlPosition(event);

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

      var dragData = _this._createDragDataFromPosition(position);

      _this.props.onStart && _this.props.onStart(event, dragData);

      _this.setState({
        isDragging: true,
        lastPosition: position
      }); // hook up the appropriate mouse/touch events to the body to ensure
      // smooth dragging


      _this._events = [(0, _Utilities.on)(document.body, _this._currentEventType.move, _this._onDrag), (0, _Utilities.on)(document.body, _this._currentEventType.stop, _this._onDragStop)];
    };

    _this._onDrag = function (event) {
      // Prevent scrolling on mobile devices
      if (event.type === 'touchmove') {
        event.preventDefault();
      }

      var position = _this._getControlPosition(event);

      if (!position) {
        return;
      } // create the updated drag data from the position data


      var updatedData = _this._createUpdatedDragData(_this._createDragDataFromPosition(position));

      var updatedPosition = updatedData.position;
      _this.props.onDragChange && _this.props.onDragChange(event, updatedData);

      _this.setState({
        position: updatedPosition,
        lastPosition: position
      });
    };

    _this._onDragStop = function (event) {
      if (!_this.state.isDragging) {
        return;
      }

      var position = _this._getControlPosition(event);

      if (!position) {
        return;
      }

      var baseDragData = _this._createDragDataFromPosition(position); // Set dragging to false and reset the lastPosition


      _this.setState({
        isDragging: false,
        lastPosition: undefined
      });

      _this.props.onStop && _this.props.onStop(event, baseDragData);

      if (_this.props.position) {
        _this.setState({
          position: _this.props.position
        });
      } // Remove event handlers


      _this._events.forEach(function (dispose) {
        return dispose();
      });
    };

    _this.state = {
      isDragging: false,
      position: _this.props.position || {
        x: 0,
        y: 0
      },
      lastPosition: undefined
    };
    return _this;
  }

  DraggableZone.prototype.componentDidUpdate = function (prevProps) {
    if (this.props.position && (!prevProps.position || this.props.position !== prevProps.position)) {
      this.setState({
        position: this.props.position
      });
    }
  };

  DraggableZone.prototype.componentWillUnmount = function () {
    this._events.forEach(function (dispose) {
      return dispose();
    });
  };

  DraggableZone.prototype.render = function () {
    var child = React.Children.only(this.props.children);
    var props = child.props;
    var position = this.props.position;
    var _a = this.state,
        statePosition = _a.position,
        isDragging = _a.isDragging;
    var x = statePosition.x;
    var y = statePosition.y;

    if (position && !isDragging) {
      x = position.x;
      y = position.y;
    }

    return React.cloneElement(child, {
      style: tslib_1.__assign({}, props.style, {
        transform: "translate(" + x + "px, " + y + "px)"
      }),
      className: (0, _DraggableZone.getClassNames)(props.className, this.state.isDragging).root,
      onMouseDown: this._onMouseDown,
      onMouseUp: this._onMouseUp,
      onTouchStart: this._onTouchStart,
      onTouchEnd: this._onTouchEnd
    });
  };
  /**
   * Get the control position based off the event that fired
   * @param event - The event to get offsets from
   */


  DraggableZone.prototype._getControlPosition = function (event) {
    var touchObj = this._getActiveTouch(event); // did we get the right touch?


    if (this._touchId !== undefined && !touchObj) {
      return undefined;
    }

    var eventToGetOffset = touchObj || event;
    return {
      x: eventToGetOffset.clientX,
      y: eventToGetOffset.clientY
    };
  };
  /**
   * Get the active touch point that we have saved from the event's TouchList
   * @param event - The event used to get the TouchList for the active touch point
   */


  DraggableZone.prototype._getActiveTouch = function (event) {
    return event.targetTouches && this._findTouchInTouchList(event.targetTouches) || event.changedTouches && this._findTouchInTouchList(event.changedTouches);
  };
  /**
   * Get the initial touch identifier associated with the given event
   * @param event - The event that contains the TouchList
   */


  DraggableZone.prototype._getTouchId = function (event) {
    var touch = event.targetTouches && event.targetTouches[0] || event.changedTouches && event.changedTouches[0];

    if (touch) {
      return touch.identifier;
    }
  };
  /**
   * Returns if an element (or any of the element's parents) match the given selector
   */


  DraggableZone.prototype._matchesSelector = function (element, selector) {
    if (!element || element === document.body) {
      return false;
    }
    /* tslint:disable-next-line:no-string-literal */


    var matchesSelectorFn = element.matches || element.webkitMatchesSelector || element['msMatchesSelector']
    /* for IE */
    ;

    if (!matchesSelectorFn) {
      return false;
    }

    return matchesSelectorFn.call(element, selector) || this._matchesSelector(element.parentElement, selector);
  };
  /**
   * Attempts to find the Touch that matches the identifier  we stored in dragStart
   * @param touchList The TouchList to look for the stored identifier from dragStart
   */


  DraggableZone.prototype._findTouchInTouchList = function (touchList) {
    if (this._touchId === undefined) {
      return;
    }

    for (var i = 0; i < touchList.length; i++) {
      if (touchList[i].identifier === this._touchId) {
        return touchList[i];
      }
    }

    return undefined;
  };
  /**
   * Create DragData based off of the last known position and the new position passed in
   * @param position The new position as part of the drag
   */


  DraggableZone.prototype._createDragDataFromPosition = function (position) {
    var lastPosition = this.state.lastPosition; // If we have no lastPosition, use the given position
    // for last position

    if (lastPosition === undefined) {
      return {
        delta: {
          x: 0,
          y: 0
        },
        lastPosition: position,
        position: position
      };
    }

    return {
      delta: {
        x: position.x - lastPosition.x,
        y: position.y - lastPosition.y
      },
      lastPosition: lastPosition,
      position: position
    };
  };
  /**
   * Creates an updated DragData based off the current position and given baseDragData
   * @param baseDragData The base DragData (gotten from _createDragDataFromPosition) used to calculate the updated positions
   */


  DraggableZone.prototype._createUpdatedDragData = function (baseDragData) {
    var position = this.state.position;
    return {
      position: {
        x: position.x + baseDragData.delta.x,
        y: position.y + baseDragData.delta.y
      },
      delta: baseDragData.delta,
      lastPosition: position
    };
  };

  return DraggableZone;
}(React.Component);

exports.DraggableZone = DraggableZone;
},{"tslib":"xgwM","react":"mpTF","./DraggableZone.styles":"oCz7","../../Utilities":"B5nc"}],"Pr8W":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _DraggableZone = require("./DraggableZone");

Object.keys(_DraggableZone).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _DraggableZone[key];
    }
  });
});

var _DraggableZone2 = require("./DraggableZone.styles");

Object.keys(_DraggableZone2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _DraggableZone2[key];
    }
  });
});
},{"./DraggableZone":"GwQe","./DraggableZone.styles":"oCz7"}],"UF30":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ModalBase = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Utilities = require("../../Utilities");

var _index = require("../FocusTrapZone/index");

var _Modal = require("./Modal.styles");

var _Overlay = require("../../Overlay");

var _Layer = require("../../Layer");

var _index2 = require("../Popup/index");

var _withResponsiveMode = require("../../utilities/decorators/withResponsiveMode");

var _index3 = require("../Callout/index");

var _index4 = require("../Icon/index");

var _index5 = require("../../utilities/DraggableZone/index");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// @TODO - need to change this to a panel whenever the breakpoint is under medium (verify the spec)
var DefaultLayerProps = {
  eventBubblingEnabled: false
};
var getClassNames = (0, _Utilities.classNamesFunction)();

var ModalBase =
/** @class */
function (_super) {
  tslib_1.__extends(ModalBase, _super);

  function ModalBase(props) {
    var _this = _super.call(this, props) || this;

    _this._focusTrapZone = React.createRef(); // Allow the user to scroll within the modal but not on the body

    _this._allowScrollOnModal = function (elt) {
      if (elt) {
        (0, _Utilities.allowScrollOnElement)(elt, _this._events);
      } else {
        _this._events.off(_this._scrollableContent);
      }

      _this._scrollableContent = elt;
    };

    _this._onModalContextMenuClose = function () {
      _this.setState({
        isModalMenuOpen: false
      });
    };

    _this._onModalClose = function () {
      _this._lastSetX = 0;
      _this._lastSetY = 0;

      _this.setState({
        isModalMenuOpen: false,
        isInKeyboardMoveMode: false,
        isOpen: false,
        x: 0,
        y: 0
      }); // Call the onDismiss callback


      if (_this.props.onDismissed) {
        _this.props.onDismissed();
      }
    };

    _this._onDragStart = function () {
      _this.setState({
        isModalMenuOpen: false,
        isInKeyboardMoveMode: false
      });
    };

    _this._onDrag = function (_, ui) {
      var _a = _this.state,
          x = _a.x,
          y = _a.y;

      _this.setState({
        x: x + ui.delta.x,
        y: y + ui.delta.y
      });
    };

    _this._onDragStop = function () {
      _this.focus();
    };

    _this._onDialogKeyUp = function (event) {
      // Need to handle the CTRL + ALT + SPACE key during keyup due to FireFox bug:
      // https://bugzilla.mozilla.org/show_bug.cgi?id=1220143
      // Otherwise it would continue to fire a click even if the event was cancelled
      // during mouseDown.
      if (event.altKey && event.ctrlKey && event.keyCode === _Utilities.KeyCodes.space) {
        _this.setState({
          isModalMenuOpen: !_this.state.isModalMenuOpen
        });

        event.preventDefault();
        event.stopPropagation();
      }
    };

    _this._onDialogKeyDown = function (event) {
      if (event.altKey && event.ctrlKey && event.keyCode === _Utilities.KeyCodes.space) {
        // CTRL + ALT + SPACE is handled during keyUp
        event.preventDefault();
        event.stopPropagation();
        return;
      }

      if (_this.state.isModalMenuOpen && (event.altKey || event.keyCode === _Utilities.KeyCodes.escape)) {
        _this.setState({
          isModalMenuOpen: false
        });
      }

      if (_this.state.isInKeyboardMoveMode && (event.keyCode === _Utilities.KeyCodes.escape || event.keyCode === _Utilities.KeyCodes.enter)) {
        _this.setState({
          isInKeyboardMoveMode: false
        });

        event.preventDefault();
        event.stopPropagation();
      }

      if (_this.state.isInKeyboardMoveMode) {
        var handledEvent = true;

        var delta = _this._getMoveDelta(event);

        switch (event.keyCode) {
          case _Utilities.KeyCodes.escape:
            _this.setState({
              x: _this._lastSetX,
              y: _this._lastSetY
            });

          case _Utilities.KeyCodes.enter:
            {
              _this._lastSetX = 0;
              _this._lastSetY = 0;

              _this.setState({
                isInKeyboardMoveMode: false
              });

              break;
            }

          case _Utilities.KeyCodes.up:
            {
              _this.setState({
                y: _this.state.y - delta
              });

              break;
            }

          case _Utilities.KeyCodes.down:
            {
              _this.setState({
                y: _this.state.y + delta
              });

              break;
            }

          case _Utilities.KeyCodes.left:
            {
              _this.setState({
                x: _this.state.x - delta
              });

              break;
            }

          case _Utilities.KeyCodes.right:
            {
              _this.setState({
                x: _this.state.x + delta
              });

              break;
            }

          default:
            {
              handledEvent = false;
            }
        }

        if (handledEvent) {
          event.preventDefault();
          event.stopPropagation();
        }
      }
    };

    _this._onEnterKeyboardMoveMode = function () {
      _this._lastSetX = _this.state.x;
      _this._lastSetY = _this.state.y;

      _this.setState({
        isInKeyboardMoveMode: true,
        isModalMenuOpen: false
      });
    };

    _this._onExitKeyboardMoveMode = function () {
      _this._lastSetX = 0;
      _this._lastSetY = 0;

      _this.setState({
        isInKeyboardMoveMode: false
      });
    };

    _this.state = {
      id: (0, _Utilities.getId)('Modal'),
      isOpen: props.isOpen,
      isVisible: props.isOpen,
      hasBeenOpened: props.isOpen,
      x: 0,
      y: 0
    };
    _this._lastSetX = 0;
    _this._lastSetY = 0;

    _this._warnDeprecations({
      onLayerDidMount: 'layerProps.onLayerDidMount'
    });

    return _this;
  }

  ModalBase.prototype.componentWillReceiveProps = function (newProps) {
    clearTimeout(this._onModalCloseTimer); // Opening the dialog

    if (newProps.isOpen) {
      if (!this.state.isOpen) {
        // First Open
        this.setState({
          isOpen: true
        });
      } else {
        // Modal has been opened
        // Reopen during closing
        this.setState({
          hasBeenOpened: true,
          isVisible: true
        });

        if (newProps.topOffsetFixed) {
          var dialogMain = document.getElementsByClassName('ms-Dialog-main');
          var modalRectangle = void 0;

          if (dialogMain.length > 0) {
            modalRectangle = dialogMain[0].getBoundingClientRect();
            this.setState({
              modalRectangleTop: modalRectangle.top
            });
          }
        }
      }
    } // Closing the dialog


    if (!newProps.isOpen && this.state.isOpen) {
      this._onModalCloseTimer = this._async.setTimeout(this._onModalClose, parseFloat(_Modal.animationDuration) * 1000);
      this.setState({
        isVisible: false
      });
    }
  };

  ModalBase.prototype.componentDidUpdate = function (prevProps, prevState) {
    if (!prevProps.isOpen && !prevState.isVisible) {
      this.setState({
        isVisible: true
      });
    }
  };

  ModalBase.prototype.render = function () {
    var _a = this.props,
        className = _a.className,
        containerClassName = _a.containerClassName,
        scrollableContentClassName = _a.scrollableContentClassName,
        elementToFocusOnDismiss = _a.elementToFocusOnDismiss,
        firstFocusableSelector = _a.firstFocusableSelector,
        forceFocusInsideTrap = _a.forceFocusInsideTrap,
        ignoreExternalFocusing = _a.ignoreExternalFocusing,
        isBlocking = _a.isBlocking,
        isClickableOutsideFocusTrap = _a.isClickableOutsideFocusTrap,
        isDarkOverlay = _a.isDarkOverlay,
        onDismiss = _a.onDismiss,
        layerProps = _a.layerProps,
        responsiveMode = _a.responsiveMode,
        titleAriaId = _a.titleAriaId,
        styles = _a.styles,
        subtitleAriaId = _a.subtitleAriaId,
        theme = _a.theme,
        topOffsetFixed = _a.topOffsetFixed,
        onLayerDidMount = _a.onLayerDidMount,
        isModeless = _a.isModeless,
        dragOptions = _a.dragOptions;
    var _b = this.state,
        isOpen = _b.isOpen,
        isVisible = _b.isVisible,
        hasBeenOpened = _b.hasBeenOpened,
        modalRectangleTop = _b.modalRectangleTop,
        x = _b.x,
        y = _b.y,
        isInKeyboardMoveMode = _b.isInKeyboardMoveMode;

    if (!isOpen) {
      return null;
    }

    var layerClassName = layerProps === undefined ? '' : layerProps.className;
    var classNames = getClassNames(styles, {
      theme: theme,
      className: className,
      containerClassName: containerClassName,
      scrollableContentClassName: scrollableContentClassName,
      isOpen: isOpen,
      isVisible: isVisible,
      hasBeenOpened: hasBeenOpened,
      modalRectangleTop: modalRectangleTop,
      topOffsetFixed: topOffsetFixed,
      isModeless: isModeless,
      layerClassName: layerClassName,
      isDefaultDragHandle: dragOptions && !dragOptions.dragHandleSelector
    });

    var mergedLayerProps = tslib_1.__assign({}, DefaultLayerProps, this.props.layerProps, {
      onLayerDidMount: layerProps && layerProps.onLayerDidMount ? layerProps.onLayerDidMount : onLayerDidMount,
      insertFirst: isModeless,
      className: classNames.layer
    });

    var modalContent = React.createElement(_index.FocusTrapZone, {
      componentRef: this._focusTrapZone,
      className: classNames.main,
      elementToFocusOnDismiss: elementToFocusOnDismiss,
      isClickableOutsideFocusTrap: isModeless || isClickableOutsideFocusTrap || !isBlocking,
      ignoreExternalFocusing: ignoreExternalFocusing,
      forceFocusInsideTrap: isModeless ? !isModeless : forceFocusInsideTrap,
      firstFocusableSelector: firstFocusableSelector,
      focusPreviouslyFocusedInnerElement: true,
      onKeyDown: dragOptions ? this._onDialogKeyDown : undefined,
      onKeyUp: dragOptions ? this._onDialogKeyUp : undefined,
      onBlur: isInKeyboardMoveMode ? this._onExitKeyboardMoveMode : undefined
    }, dragOptions && isInKeyboardMoveMode && React.createElement("div", {
      className: classNames.keyboardMoveIconContainer
    }, dragOptions.keyboardMoveIconProps ? React.createElement(_index4.Icon, tslib_1.__assign({}, dragOptions.keyboardMoveIconProps)) : React.createElement(_index4.Icon, {
      iconName: "move",
      className: classNames.keyboardMoveIcon
    })), React.createElement("div", {
      ref: this._allowScrollOnModal,
      className: classNames.scrollableContent,
      "data-is-scrollable": true
    }, dragOptions && this.state.isModalMenuOpen && React.createElement(dragOptions.menu, {
      items: [{
        key: 'move',
        text: dragOptions.moveMenuItemText,
        onClick: this._onEnterKeyboardMoveMode
      }, {
        key: 'close',
        text: dragOptions.closeMenuItemText,
        onClick: this._onModalClose
      }],
      onDismiss: this._onModalContextMenuClose,
      alignTargetEdge: true,
      coverTarget: true,
      directionalHint: _index3.DirectionalHint.topLeftEdge,
      directionalHintFixed: true,
      shouldFocusOnMount: true,
      target: this._scrollableContent
    }), this.props.children)); // @temp tuatology - Will adjust this to be a panel at certain breakpoints

    if (responsiveMode >= _withResponsiveMode.ResponsiveMode.small) {
      return React.createElement(_Layer.Layer, tslib_1.__assign({}, mergedLayerProps), React.createElement(_index2.Popup, {
        role: isModeless || !isBlocking ? 'dialog' : 'alertdialog',
        "aria-modal": !isModeless,
        ariaLabelledBy: titleAriaId,
        ariaDescribedBy: subtitleAriaId,
        onDismiss: onDismiss
      }, React.createElement("div", {
        className: classNames.root
      }, !isModeless && React.createElement(_Overlay.Overlay, {
        isDarkThemed: isDarkOverlay,
        onClick: isBlocking ? undefined : onDismiss
      }), dragOptions ? React.createElement(_index5.DraggableZone, {
        handleSelector: dragOptions.dragHandleSelector || "." + classNames.main.split(' ')[0],
        preventDragSelector: "button",
        onStart: this._onDragStart,
        onDragChange: this._onDrag,
        onStop: this._onDragStop,
        position: {
          x: x,
          y: y
        }
      }, modalContent) : modalContent)));
    }

    return null;
  };

  ModalBase.prototype.focus = function () {
    if (this._focusTrapZone.current) {
      this._focusTrapZone.current.focus();
    }
  };

  ModalBase.prototype._getMoveDelta = function (event) {
    var delta = 10;

    if (event.shiftKey) {
      if (!event.ctrlKey) {
        delta = 50;
      }
    } else if (event.ctrlKey) {
      delta = 1;
    }

    return delta;
  };

  ModalBase.defaultProps = {
    isOpen: false,
    isDarkOverlay: true,
    isBlocking: false,
    className: '',
    containerClassName: ''
  };
  ModalBase = tslib_1.__decorate([_withResponsiveMode.withResponsiveMode], ModalBase);
  return ModalBase;
}(_Utilities.BaseComponent);

exports.ModalBase = ModalBase;
},{"tslib":"xgwM","react":"mpTF","../../Utilities":"B5nc","../FocusTrapZone/index":"QOOm","./Modal.styles":"Uvsf","../../Overlay":"gVaT","../../Layer":"sWnj","../Popup/index":"rIRy","../../utilities/decorators/withResponsiveMode":"Q4um","../Callout/index":"jyN2","../Icon/index":"QCkz","../../utilities/DraggableZone/index":"Pr8W"}],"BnVf":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Modal = void 0;

var _Utilities = require("../../Utilities");

var _Modal = require("./Modal.base");

var _Modal2 = require("./Modal.styles");

var Modal = (0, _Utilities.styled)(_Modal.ModalBase, _Modal2.getStyles, undefined, {
  scope: 'Modal'
});
exports.Modal = Modal;
},{"../../Utilities":"B5nc","./Modal.base":"UF30","./Modal.styles":"Uvsf"}],"T1n2":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _Modal = require("./Modal");

Object.keys(_Modal).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Modal[key];
    }
  });
});

var _Modal2 = require("./Modal.base");

Object.keys(_Modal2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Modal2[key];
    }
  });
});
},{"./Modal":"BnVf","./Modal.base":"UF30"}],"tqHC":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
var _exportNames = {};
Object.defineProperty(exports, "default", {
  enumerable: true,
  get: function () {
    return _index.Modal;
  }
});

var _index = require("./components/Modal/index");

Object.keys(_index).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index[key];
    }
  });
});
},{"./components/Modal/index":"T1n2"}],"iuK0":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.DialogFooterBase = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Utilities = require("../../Utilities");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var getClassNames = (0, _Utilities.classNamesFunction)();

var DialogFooterBase =
/** @class */
function (_super) {
  tslib_1.__extends(DialogFooterBase, _super);

  function DialogFooterBase() {
    return _super !== null && _super.apply(this, arguments) || this;
  }

  DialogFooterBase.prototype.render = function () {
    var _a = this.props,
        className = _a.className,
        styles = _a.styles,
        theme = _a.theme;
    this._classNames = getClassNames(styles, {
      theme: theme,
      className: className
    });
    return React.createElement("div", {
      className: this._classNames.actions
    }, React.createElement("div", {
      className: this._classNames.actionsRight
    }, this._renderChildrenAsActions()));
  };

  DialogFooterBase.prototype._renderChildrenAsActions = function () {
    var _this = this;

    return React.Children.map(this.props.children, function (child) {
      return child ? React.createElement("span", {
        className: _this._classNames.action
      }, child) : null;
    });
  };

  return DialogFooterBase;
}(_Utilities.BaseComponent);

exports.DialogFooterBase = DialogFooterBase;
},{"tslib":"xgwM","react":"mpTF","../../Utilities":"B5nc"}],"Lxpw":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = void 0;

var _Styling = require("../../Styling");

var GlobalClassNames = {
  actions: 'ms-Dialog-actions',
  action: 'ms-Dialog-action',
  actionsRight: 'ms-Dialog-actionsRight'
};

var getStyles = function (props) {
  var className = props.className,
      theme = props.theme;
  var classNames = (0, _Styling.getGlobalClassNames)(GlobalClassNames, theme);
  return {
    actions: [classNames.actions, {
      position: 'relative',
      width: '100%',
      minHeight: '24px',
      lineHeight: '24px',
      margin: '20px 0 0',
      fontSize: '0',
      selectors: {
        '.ms-Button': {
          lineHeight: 'normal'
        }
      }
    }, className],
    action: [classNames.action],
    actionsRight: [classNames.actionsRight, {
      textAlign: 'right',
      marginRight: '-4px',
      fontSize: '0',
      selectors: {
        $action: {
          margin: '0 4px'
        }
      }
    }]
  };
};

exports.getStyles = getStyles;
},{"../../Styling":"AHeq"}],"oo8p":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.DialogFooter = void 0;

var _Utilities = require("../../Utilities");

var _DialogFooter = require("./DialogFooter.base");

var _DialogFooter2 = require("./DialogFooter.styles");

var DialogFooter = (0, _Utilities.styled)(_DialogFooter.DialogFooterBase, _DialogFooter2.getStyles, undefined, {
  scope: 'DialogFooter'
});
exports.DialogFooter = DialogFooter;
},{"../../Utilities":"B5nc","./DialogFooter.base":"iuK0","./DialogFooter.styles":"Lxpw"}],"ZWiV":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.DialogContentBase = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Utilities = require("../../Utilities");

var _DialogContent = require("./DialogContent.types");

var _Button = require("../../Button");

var _DialogFooter = require("./DialogFooter");

var _withResponsiveMode = require("../../utilities/decorators/withResponsiveMode");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var getClassNames = (0, _Utilities.classNamesFunction)();
var DialogFooterType = React.createElement(_DialogFooter.DialogFooter, null).type;

var DialogContentBase =
/** @class */
function (_super) {
  tslib_1.__extends(DialogContentBase, _super);

  function DialogContentBase(props) {
    return _super.call(this, props) || this;
  }

  DialogContentBase.prototype.render = function () {
    var _a = this.props,
        showCloseButton = _a.showCloseButton,
        className = _a.className,
        closeButtonAriaLabel = _a.closeButtonAriaLabel,
        onDismiss = _a.onDismiss,
        subTextId = _a.subTextId,
        subText = _a.subText,
        titleId = _a.titleId,
        title = _a.title,
        type = _a.type,
        styles = _a.styles,
        theme = _a.theme,
        draggableHeaderClassName = _a.draggableHeaderClassName;
    var classNames = getClassNames(styles, {
      theme: theme,
      className: className,
      isLargeHeader: type === _DialogContent.DialogType.largeHeader,
      isClose: type === _DialogContent.DialogType.close,
      draggableHeaderClassName: draggableHeaderClassName
    });

    var groupings = this._groupChildren();

    var subTextContent;

    if (subText) {
      subTextContent = React.createElement("p", {
        className: classNames.subText,
        id: subTextId
      }, subText);
    }

    return React.createElement("div", {
      className: classNames.content
    }, React.createElement("div", {
      className: classNames.header
    }, React.createElement("p", {
      className: classNames.title,
      id: titleId,
      role: "heading",
      "aria-level": 2
    }, title), React.createElement("div", {
      className: classNames.topButton
    }, this.props.topButtonsProps.map(function (props, index) {
      return React.createElement(_Button.IconButton, tslib_1.__assign({
        key: props.uniqueId || index
      }, props));
    }), (type === _DialogContent.DialogType.close || showCloseButton && type !== _DialogContent.DialogType.largeHeader) && React.createElement(_Button.IconButton, {
      className: classNames.button,
      iconProps: {
        iconName: 'Cancel'
      },
      ariaLabel: closeButtonAriaLabel,
      onClick: onDismiss
    }))), React.createElement("div", {
      className: classNames.inner
    }, React.createElement("div", {
      className: classNames.innerContent
    }, subTextContent, groupings.contents), groupings.footers));
  }; // @TODO - typing the footers as an array of DialogFooter is difficult because
  // casing "child as DialogFooter" causes a problem because
  // "Neither type 'ReactElement<any>' nor type 'DialogFooter' is assignable to the other."


  DialogContentBase.prototype._groupChildren = function () {
    var groupings = {
      footers: [],
      contents: []
    };
    React.Children.map(this.props.children, function (child) {
      if (typeof child === 'object' && child !== null && child.type === DialogFooterType) {
        groupings.footers.push(child);
      } else {
        groupings.contents.push(child);
      }
    });
    return groupings;
  };

  DialogContentBase.defaultProps = {
    showCloseButton: false,
    className: '',
    topButtonsProps: [],
    closeButtonAriaLabel: 'Close'
  };
  DialogContentBase = tslib_1.__decorate([_withResponsiveMode.withResponsiveMode], DialogContentBase);
  return DialogContentBase;
}(_Utilities.BaseComponent);

exports.DialogContentBase = DialogContentBase;
},{"tslib":"xgwM","react":"mpTF","../../Utilities":"B5nc","./DialogContent.types":"eCHI","../../Button":"XfLs","./DialogFooter":"oo8p","../../utilities/decorators/withResponsiveMode":"Q4um"}],"VIvE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = void 0;

var _Styling = require("../../Styling");

var GlobalClassNames = {
  contentLgHeader: 'ms-Dialog-lgHeader',
  close: 'ms-Dialog--close',
  subText: 'ms-Dialog-subText',
  header: 'ms-Dialog-header',
  headerLg: 'ms-Dialog--lgHeader',
  button: 'ms-Dialog-button ms-Dialog-button--close',
  inner: 'ms-Dialog-inner',
  content: 'ms-Dialog-content',
  title: 'ms-Dialog-title'
};

var getStyles = function (props) {
  var className = props.className,
      theme = props.theme,
      isLargeHeader = props.isLargeHeader,
      isClose = props.isClose,
      hidden = props.hidden,
      isMultiline = props.isMultiline,
      draggableHeaderClassName = props.draggableHeaderClassName;
  var palette = theme.palette,
      fonts = theme.fonts;
  var classNames = (0, _Styling.getGlobalClassNames)(GlobalClassNames, theme);
  return {
    content: [isLargeHeader && classNames.contentLgHeader, isClose && classNames.close, {
      flexGrow: 1,
      overflowY: 'hidden' // required for allowScrollOnElement

    }, className],
    subText: [classNames.subText, isLargeHeader ? fonts.medium : fonts.small, {
      margin: '0 0 20px 0',
      paddingTop: '8px',
      color: palette.neutralPrimary,
      lineHeight: '1.5',
      wordWrap: 'break-word',
      fontWeight: _Styling.FontWeights.semilight
    }],
    header: [classNames.header, {
      position: 'relative',
      width: '100%',
      boxSizing: 'border-box'
    }, isLargeHeader && [classNames.headerLg, {
      backgroundColor: palette.themePrimary
    }], isClose && classNames.close, draggableHeaderClassName && [draggableHeaderClassName, {
      cursor: 'move'
    }]],
    button: [classNames.button, hidden && {
      selectors: {
        '.ms-Icon.ms-Icon--Cancel': {
          color: palette.neutralSecondary,
          fontSize: '16px'
        }
      }
    }],
    inner: [classNames.inner, {
      padding: isMultiline ? '0 20px 20px' : '0 28px 20px'
    }],
    innerContent: [classNames.content, {
      position: 'relative',
      width: '100%',
      selectors: {
        '.ms-Button.ms-Button--compount': {
          marginBottom: '20px',
          selectors: {
            '&:last-child': {
              marginBottom: '0'
            }
          }
        }
      }
    }, className],
    title: [classNames.title, {
      color: palette.neutralPrimary,
      margin: '0',
      padding: '20px 36px 20px 28px'
    }, fonts.xLarge, isLargeHeader && [{
      color: palette.white,
      marginBottom: '8px',
      padding: '26px 28px 28px'
    }, fonts.xxLarge], isMultiline && fonts.xxLarge],
    topButton: [{
      display: 'flex',
      flexDirection: 'row',
      flexWrap: 'nowrap',
      position: 'absolute',
      top: '0',
      right: '0',
      padding: '12px 12px 0 0',
      selectors: {
        '> *': {
          flex: '0 0 auto'
        }
      }
    }]
  };
};

exports.getStyles = getStyles;
},{"../../Styling":"AHeq"}],"DckB":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.DialogContent = void 0;

var _Utilities = require("../../Utilities");

var _DialogContent = require("./DialogContent.base");

var _DialogContent2 = require("./DialogContent.styles");

var DialogContent = (0, _Utilities.styled)(_DialogContent.DialogContentBase, _DialogContent2.getStyles, undefined, {
  scope: 'DialogContent'
});
exports.DialogContent = DialogContent;
},{"../../Utilities":"B5nc","./DialogContent.base":"ZWiV","./DialogContent.styles":"VIvE"}],"fI0U":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.DialogBase = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Utilities = require("../../Utilities");

var _DialogContent = require("./DialogContent.types");

var _Modal = require("../../Modal");

var _withResponsiveMode = require("../../utilities/decorators/withResponsiveMode");

var _DialogContent2 = require("./DialogContent");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var getClassNames = (0, _Utilities.classNamesFunction)();
var DefaultModalProps = {
  isDarkOverlay: false,
  isBlocking: false,
  className: '',
  containerClassName: '',
  topOffsetFixed: false
};
var DefaultDialogContentProps = {
  type: _DialogContent.DialogType.normal,
  className: '',
  topButtonsProps: []
};

var DialogBase =
/** @class */
function (_super) {
  tslib_1.__extends(DialogBase, _super);

  function DialogBase(props) {
    var _this = _super.call(this, props) || this;

    _this._getSubTextId = function () {
      var _a = _this.props,
          ariaDescribedById = _a.ariaDescribedById,
          modalProps = _a.modalProps,
          dialogContentProps = _a.dialogContentProps,
          subText = _a.subText;
      var id = ariaDescribedById || modalProps && modalProps.subtitleAriaId;

      if (!id) {
        id = (subText || dialogContentProps && dialogContentProps.subText) && _this._defaultSubTextId;
      }

      return id;
    };

    _this._getTitleTextId = function () {
      var _a = _this.props,
          ariaLabelledById = _a.ariaLabelledById,
          modalProps = _a.modalProps,
          dialogContentProps = _a.dialogContentProps,
          title = _a.title;
      var id = ariaLabelledById || modalProps && modalProps.titleAriaId;

      if (!id) {
        id = (title || dialogContentProps && dialogContentProps.title) && _this._defaultTitleTextId;
      }

      return id;
    };

    _this._id = (0, _Utilities.getId)('Dialog');
    _this._defaultTitleTextId = _this._id + '-title';
    _this._defaultSubTextId = _this._id + '-subText';

    if ("production" !== 'production') {
      (0, _Utilities.warnDeprecations)('Dialog', props, {
        isOpen: 'hidden',
        type: 'dialogContentProps.type',
        subText: 'dialogContentProps.subText',
        contentClassName: 'dialogContentProps.className',
        topButtonsProps: 'dialogContentProps.topButtonsProps',
        className: 'modalProps.className',
        isDarkOverlay: 'modalProps.isDarkOverlay',
        isBlocking: 'modalProps.isBlocking',
        containerClassName: 'modalProps.containerClassName',
        onDismissed: 'modalProps.onDismissed',
        onLayerDidMount: 'modalProps.layerProps.onLayerDidMount',
        ariaDescribedById: 'modalProps.subtitleAriaId',
        ariaLabelledById: 'modalProps.titleAriaId'
      });
    }

    return _this;
  }

  DialogBase.prototype.render = function () {
    var _a = this.props,
        className = _a.className,
        containerClassName = _a.containerClassName,
        contentClassName = _a.contentClassName,
        elementToFocusOnDismiss = _a.elementToFocusOnDismiss,
        firstFocusableSelector = _a.firstFocusableSelector,
        forceFocusInsideTrap = _a.forceFocusInsideTrap,
        styles = _a.styles,
        hidden = _a.hidden,
        ignoreExternalFocusing = _a.ignoreExternalFocusing,
        isBlocking = _a.isBlocking,
        isClickableOutsideFocusTrap = _a.isClickableOutsideFocusTrap,
        isDarkOverlay = _a.isDarkOverlay,
        isOpen = _a.isOpen,
        onDismiss = _a.onDismiss,
        onDismissed = _a.onDismissed,
        onLayerDidMount = _a.onLayerDidMount,
        responsiveMode = _a.responsiveMode,
        subText = _a.subText,
        theme = _a.theme,
        title = _a.title,
        topButtonsProps = _a.topButtonsProps,
        type = _a.type,
        minWidth = _a.minWidth,
        maxWidth = _a.maxWidth,
        modalProps = _a.modalProps;

    var mergedLayerProps = tslib_1.__assign({}, modalProps ? modalProps.layerProps : {
      onLayerDidMount: onLayerDidMount
    });

    if (onLayerDidMount && !mergedLayerProps.onLayerDidMount) {
      mergedLayerProps.onLayerDidMount = onLayerDidMount;
    }

    var dialogDraggableClassName;
    var dragOptions; // if we are draggable, make sure we are using the correct
    // draggable classname and selectors

    if (modalProps && modalProps.dragOptions && !modalProps.dragOptions.dragHandleSelector) {
      dialogDraggableClassName = 'ms-Dialog-draggable-header';
      dragOptions = tslib_1.__assign({}, modalProps.dragOptions, {
        dragHandleSelector: "." + dialogDraggableClassName
      });
    } else {
      dragOptions = modalProps && modalProps.dragOptions;
    }

    var mergedModalProps = tslib_1.__assign({}, DefaultModalProps, modalProps, {
      layerProps: mergedLayerProps,
      dragOptions: dragOptions
    });

    var dialogContentProps = tslib_1.__assign({}, DefaultDialogContentProps, this.props.dialogContentProps, {
      draggableHeaderClassName: dialogDraggableClassName
    });

    var classNames = getClassNames(styles, {
      theme: theme,
      className: className || mergedModalProps.className,
      containerClassName: containerClassName || mergedModalProps.containerClassName,
      hidden: hidden,
      dialogDefaultMinWidth: minWidth,
      dialogDefaultMaxWidth: maxWidth
    });
    return React.createElement(_Modal.Modal, tslib_1.__assign({
      elementToFocusOnDismiss: elementToFocusOnDismiss,
      firstFocusableSelector: firstFocusableSelector,
      forceFocusInsideTrap: forceFocusInsideTrap,
      ignoreExternalFocusing: ignoreExternalFocusing,
      isClickableOutsideFocusTrap: isClickableOutsideFocusTrap,
      onDismissed: onDismissed,
      responsiveMode: responsiveMode
    }, mergedModalProps, {
      isDarkOverlay: isDarkOverlay !== undefined ? isDarkOverlay : mergedModalProps.isDarkOverlay,
      isBlocking: isBlocking !== undefined ? isBlocking : mergedModalProps.isBlocking,
      isOpen: isOpen !== undefined ? isOpen : !hidden,
      className: classNames.root,
      containerClassName: classNames.main,
      onDismiss: onDismiss ? onDismiss : mergedModalProps.onDismiss,
      subtitleAriaId: this._getSubTextId(),
      titleAriaId: this._getTitleTextId()
    }), React.createElement(_DialogContent2.DialogContent, tslib_1.__assign({
      titleId: this._defaultTitleTextId,
      subTextId: this._defaultSubTextId,
      title: title,
      subText: subText,
      showCloseButton: isBlocking !== undefined ? !isBlocking : !mergedModalProps.isBlocking,
      topButtonsProps: topButtonsProps ? topButtonsProps : dialogContentProps.topButtonsProps,
      type: type !== undefined ? type : dialogContentProps.type,
      onDismiss: onDismiss ? onDismiss : dialogContentProps.onDismiss,
      className: contentClassName || dialogContentProps.className
    }, dialogContentProps), this.props.children));
  };

  DialogBase.defaultProps = {
    hidden: true
  };
  DialogBase = tslib_1.__decorate([_withResponsiveMode.withResponsiveMode], DialogBase);
  return DialogBase;
}(React.Component);

exports.DialogBase = DialogBase;
},{"tslib":"xgwM","react":"mpTF","../../Utilities":"B5nc","./DialogContent.types":"eCHI","../../Modal":"tqHC","../../utilities/decorators/withResponsiveMode":"Q4um","./DialogContent":"DckB"}],"bLVN":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = void 0;

var _Styling = require("../../Styling");

var GlobalClassNames = {
  root: 'ms-Dialog'
};

var getStyles = function (props) {
  var className = props.className,
      containerClassName = props.containerClassName,
      _a = props.dialogDefaultMinWidth,
      dialogDefaultMinWidth = _a === void 0 ? '288px' : _a,
      _b = props.dialogDefaultMaxWidth,
      dialogDefaultMaxWidth = _b === void 0 ? '340px' : _b,
      hidden = props.hidden,
      theme = props.theme;
  var classNames = (0, _Styling.getGlobalClassNames)(GlobalClassNames, theme);
  return {
    root: [classNames.root, theme.fonts.medium, className],
    main: [{
      width: dialogDefaultMinWidth,
      outline: '3px solid transparent',
      selectors: (_c = {}, _c["@media (min-width: " + _Styling.ScreenWidthMinMedium + "px)"] = {
        width: 'auto',
        maxWidth: dialogDefaultMaxWidth,
        minWidth: dialogDefaultMinWidth
      }, _c)
    }, !hidden && {
      display: 'flex'
    }, containerClassName]
  };

  var _c;
};

exports.getStyles = getStyles;
},{"../../Styling":"AHeq"}],"YQ10":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Dialog = void 0;

var _Utilities = require("../../Utilities");

var _Dialog = require("./Dialog.base");

var _Dialog2 = require("./Dialog.styles");

var Dialog = (0, _Utilities.styled)(_Dialog.DialogBase, _Dialog2.getStyles, undefined, {
  scope: 'Dialog'
});
exports.Dialog = Dialog;
},{"../../Utilities":"B5nc","./Dialog.base":"fI0U","./Dialog.styles":"bLVN"}],"Xdt5":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _Dialog = require("./Dialog");

Object.keys(_Dialog).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Dialog[key];
    }
  });
});

var _Dialog2 = require("./Dialog.base");

Object.keys(_Dialog2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Dialog2[key];
    }
  });
});

var _DialogContent = require("./DialogContent");

Object.keys(_DialogContent).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _DialogContent[key];
    }
  });
});

var _DialogContent2 = require("./DialogContent.base");

Object.keys(_DialogContent2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _DialogContent2[key];
    }
  });
});

var _DialogFooter = require("./DialogFooter");

Object.keys(_DialogFooter).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _DialogFooter[key];
    }
  });
});

var _DialogFooter2 = require("./DialogFooter.base");

Object.keys(_DialogFooter2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _DialogFooter2[key];
    }
  });
});

var _DialogContent3 = require("./DialogContent.types");

Object.keys(_DialogContent3).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _DialogContent3[key];
    }
  });
});
},{"./Dialog":"YQ10","./Dialog.base":"fI0U","./DialogContent":"DckB","./DialogContent.base":"ZWiV","./DialogFooter":"oo8p","./DialogFooter.base":"iuK0","./DialogContent.types":"eCHI"}],"zBYt":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
var _exportNames = {};
Object.defineProperty(exports, "default", {
  enumerable: true,
  get: function () {
    return _index.Dialog;
  }
});

var _index = require("./components/Dialog/index");

Object.keys(_index).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index[key];
    }
  });
});
},{"./components/Dialog/index":"Xdt5"}],"GtgI":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "ResponsiveMode", {
  enumerable: true,
  get: function () {
    return _withResponsiveMode.ResponsiveMode;
  }
});
Object.defineProperty(exports, "DropdownMenuItemType", {
  enumerable: true,
  get: function () {
    return _SelectableOption.SelectableOptionMenuItemType;
  }
});

var _withResponsiveMode = require("../../utilities/decorators/withResponsiveMode");

var _SelectableOption = require("../../utilities/selectableOption/SelectableOption.types");
},{"../../utilities/decorators/withResponsiveMode":"Q4um","../../utilities/selectableOption/SelectableOption.types":"yh6c"}],"RhKO":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.DropdownSizePosCache = void 0;

var _Dropdown = require("../Dropdown.types");

/**
 * A utility class to cache size and position in cache.
 *
 * Dropdown options has non-selectable display types. It is therefore not cheap to determine
 * the total number of actual selectable options as well as the position an option is in the
 * list of options - O(n) cost for each lookup.
 *
 * Given that we potentially have to make this determination on every single render pass, this
 * cache should provide a little bit of relief.
 */
var DropdownSizePosCache =
/** @class */
function () {
  function DropdownSizePosCache() {
    this._size = 0;
  }
  /**
   * Invalidates the cache and recalculate the size of selectable options.
   */


  DropdownSizePosCache.prototype.updateOptions = function (options) {
    var displayOnlyOptionsCache = [];
    var size = 0;

    for (var i = 0; i < options.length; i++) {
      if (options[i].itemType === _Dropdown.DropdownMenuItemType.Divider || options[i].itemType === _Dropdown.DropdownMenuItemType.Header) {
        displayOnlyOptionsCache.push(i);
      } else {
        size++;
      }
    }

    this._size = size;
    this._displayOnlyOptionsCache = displayOnlyOptionsCache;
  };

  Object.defineProperty(DropdownSizePosCache.prototype, "optionSetSize", {
    /**
     * The size of all the selectable options.
     */
    get: function () {
      return this._size;
    },
    enumerable: true,
    configurable: true
  });
  /**
   * Returns the position of this option element relative to the full set of selectable option elements.
   * Note: the first selectable element is position 1 in the set.
   * @param index The raw index of the option element.
   */

  DropdownSizePosCache.prototype.positionInSet = function (index) {
    if (index === undefined) {
      return undefined;
    } // we could possibly memoize this too but this should be good enough, most of the time (the expectation is that
    // when you have a lot of options, the selectable options will heavily dominate over the non-selectable options.


    var offset = 0;

    while (index > this._displayOnlyOptionsCache[offset]) {
      offset++;
    }

    if (this._displayOnlyOptionsCache[offset] === index) {
      throw new Error("Unexpected: Option at index " + index + " is not a selectable element.");
    }

    return index - offset + 1;
  };

  return DropdownSizePosCache;
}();

exports.DropdownSizePosCache = DropdownSizePosCache;
},{"../Dropdown.types":"GtgI"}],"Tast":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.PanelType = void 0;

/**
 * {@docCategory Panel}
 */
var PanelType;
exports.PanelType = PanelType;

(function (PanelType) {
  /**
   * Renders the Panel with a `fluid` (full screen) width.
   * Recommended for use on small screen breakpoints.
   * - Small (320-479): full screen width, 16px left/right padding
   * - Medium (480-639): full screen width, 16px left/right padding
   * - Large (640-1023): full screen width, 32px left/right padding
   * - XLarge (1024-1365): full screen width, 32px left/right padding
   * - XXLarge (1366-up): full screen width, 40px left/right padding
   */
  PanelType[PanelType["smallFluid"] = 0] = "smallFluid";
  /**
   * Renders the Panel in fixed-width `small` size, anchored to the far side (right in LTR mode).
   * - Small (320-479): adapts to `PanelType.smallFluid` at this breakpoint
   * - Medium (480-639): 340px width, 16px left/right padding
   * - Large (640-1023): 340px width, 32px left/right padding
   * - XLarge (1024-1365): 340px width, 32px left/right padding
   * - XXLarge (1366-up): 340px width, 40px left/right padding
   */

  PanelType[PanelType["smallFixedFar"] = 1] = "smallFixedFar";
  /**
   * Renders the Panel in fixed-width `small` size, anchored to the near side (left in LTR mode).
   * - Small (320-479): 272px width, 16px left/right padding
   * - Medium (480-639): 272px width, 16px left/right padding
   * - Large (640-1023): 272px width, 32px left/right padding
   * - XLarge (1024-1365): 272px width, 32px left/right padding
   * - XXLarge (1366-up): 272px width, 40px left/right padding
   */

  PanelType[PanelType["smallFixedNear"] = 2] = "smallFixedNear";
  /**
   * Renders the Panel in `medium` size, anchored to the far side (right in LTR mode).
   * - Small (320-479): adapts to `PanelType.smallFluid` at this breakpoint
   * - Medium (480-639): adapts to `PanelType.smallFixedFar` at this breakpoint
   * - Large (640-1023): 592px width, 32px left/right padding
   * - XLarge (1024-1365): 644px width, 32px left/right padding
   * - XXLarge (1366-up): 644px width, 40px left/right padding
   */

  PanelType[PanelType["medium"] = 3] = "medium";
  /**
   * Renders the Panel in `large` size, anchored to the far side (right in LTR mode).
   * - Small (320-479): adapts to `PanelType.smallFluid` at this breakpoint
   * - Medium (480-639):  adapts to `PanelType.smallFixedFar` at this breakpoint
   * - Large (640-1023): adapts to `PanelType.medium` at this breakpoint
   * - XLarge (1024-1365): 48px fixed left margin, fluid width, 32px left/right padding
   * - XXLarge (1366-up): 428px fixed left margin, fluid width, 40px left/right padding
   */

  PanelType[PanelType["large"] = 4] = "large";
  /**
   * Renders the Panel in `large` size, anchored to the far side (right in LTR mode), with a fixed width at XX-Large breakpoint.
   * - Small (320-479): adapts to `PanelType.smallFluid` at this breakpoint
   * - Medium (480-639): adapts to `PanelType.smallFixedFar` at this breakpoint
   * - Large (640-1023): adapts to `PanelType.medium` at this breakpoint
   * - XLarge (1024-1365): 48px fixed left margin, fluid width, 32px left/right padding
   * - XXLarge (1366-up): 940px width, 40px left/right padding
   */

  PanelType[PanelType["largeFixed"] = 5] = "largeFixed";
  /**
   * Renders the Panel in `extra large` size, anchored to the far side (right in LTR mode).
   * - Small (320-479): adapts to `PanelType.smallFluid` at this breakpoint
   * - Medium (480-639): adapts to `PanelType.smallFixedFar` at this breakpoint
   * - Large (640-1023): adapts to `PanelType.medium` at this breakpoint
   * - XLarge (1024-1365): adapts to `PanelType.large` at this breakpoint
   * - XXLarge (1366-1919): 176px fixed left margin, fluid width, 40px left/right padding
   * - XXXLarge (1920-up): 176px fixed left margin, fluid width, 40px left/right padding
   */

  PanelType[PanelType["extraLarge"] = 6] = "extraLarge";
  /**
   * Renders the Panel in `custom` size using `customWidth`, anchored to the far side (right in LTR mode).
   * - Has a fixed width provided by the `customWidth` prop
   * - When screen width reaches the `customWidth` value it will behave like a fluid width Panel
   * taking up 100% of the viewport width
   */

  PanelType[PanelType["custom"] = 7] = "custom";
  /**
   * Renders the Panel in `custom` size using `customWidth`, anchored to the near side (left in LTR mode).
   * - Has a fixed width provided by the `customWidth` prop
   * - When screen width reaches the `customWidth` value it will behave like a fluid width Panel
   * taking up 100% of the viewport width
   */

  PanelType[PanelType["customNear"] = 8] = "customNear";
})(PanelType || (exports.PanelType = PanelType = {}));
},{}],"Fguj":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.PanelBase = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Button = require("../../Button");

var _Layer = require("../../Layer");

var _Overlay = require("../../Overlay");

var _Popup = require("../../Popup");

var _Styling = require("../../Styling");

var _Utilities = require("../../Utilities");

var _index = require("../FocusTrapZone/index");

var _Panel = require("./Panel.types");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var getClassNames = (0, _Utilities.classNamesFunction)();

var PanelBase =
/** @class */
function (_super) {
  tslib_1.__extends(PanelBase, _super);

  function PanelBase(props) {
    var _this = _super.call(this, props) || this;

    _this._panel = React.createRef();

    _this.dismiss = function (ev) {
      if (_this._isOpen) {
        _this._isOpen = false;

        if (_this.props.onDismiss) {
          _this.props.onDismiss(ev);
        }

        if (!ev || ev && !ev.defaultPrevented) {
          _this.setState({
            isAnimating: true
          }, function () {
            _this._async.setTimeout(_this._onTransitionComplete, 200);
          });
        }
      }
    }; // Allow the user to scroll within the panel but not on the body


    _this._allowScrollOnPanel = function (elt) {
      if (elt) {
        (0, _Utilities.allowScrollOnElement)(elt, _this._events);
      } else {
        _this._events.off(_this._scrollableContent);
      }

      _this._scrollableContent = elt;
    };

    _this._onRenderNavigation = function (props) {
      if (!_this.props.onRenderNavigationContent && !_this.props.onRenderNavigation && !_this.props.hasCloseButton) {
        return null;
      }

      var _a = _this.props.onRenderNavigationContent,
          onRenderNavigationContent = _a === void 0 ? _this._onRenderNavigationContent : _a;
      return React.createElement("div", {
        className: _this._classNames.navigation
      }, onRenderNavigationContent(props, _this._onRenderNavigationContent));
    };

    _this._onRenderNavigationContent = function (props) {
      var closeButtonAriaLabel = props.closeButtonAriaLabel,
          hasCloseButton = props.hasCloseButton;
      var theme = (0, _Styling.getTheme)();

      if (hasCloseButton) {
        // TODO -Issue #5689: Comment in once Button is converted to mergeStyles
        // const iconButtonStyles = this._classNames.subComponentStyles
        // ? (this._classNames.subComponentStyles.iconButton as IStyleFunctionOrObject<IButtonStyleProps, IButtonStyles>)
        // : undefined;
        return React.createElement(_Button.IconButton // TODO -Issue #5689: Comment in once Button is converted to mergeStyles
        // className={iconButtonStyles}
        , {
          // TODO -Issue #5689: Comment in once Button is converted to mergeStyles
          // className={iconButtonStyles}
          styles: {
            root: {
              height: 'auto',
              width: '44px',
              color: theme.palette.neutralSecondary,
              fontSize: _Styling.IconFontSizes.large
            },
            rootHovered: {
              color: theme.palette.neutralPrimary
            }
          },
          className: _this._classNames.closeButton,
          onClick: _this._onPanelClick,
          ariaLabel: closeButtonAriaLabel,
          title: closeButtonAriaLabel,
          "data-is-visible": true,
          iconProps: {
            iconName: 'Cancel'
          }
        });
      }

      return null;
    };

    _this._onRenderHeader = function (props, defaultRender, headerTextId) {
      var headerText = props.headerText;

      if (headerText) {
        return React.createElement("div", {
          className: _this._classNames.header
        }, React.createElement("p", {
          className: _this._classNames.headerText,
          id: headerTextId,
          role: "heading",
          "aria-level": 2
        }, headerText));
      }

      return null;
    };

    _this._onRenderBody = function (props) {
      return React.createElement("div", {
        className: _this._classNames.content
      }, props.children);
    };

    _this._onRenderFooter = function (props) {
      var _a = _this.props.onRenderFooterContent,
          onRenderFooterContent = _a === void 0 ? null : _a;

      if (onRenderFooterContent) {
        return React.createElement("div", {
          className: _this._classNames.footer
        }, React.createElement("div", {
          className: _this._classNames.footerInner
        }, onRenderFooterContent()));
      }

      return null;
    };

    _this._onPanelClick = function (ev) {
      _this.dismiss(ev);
    };

    _this._onTransitionComplete = function () {
      _this._updateFooterPosition();

      _this.setState({
        isAnimating: false
      });

      if (_this._isOpen && _this.props.onOpened) {
        _this.props.onOpened();
      }

      if (!_this._isOpen && _this.props.onDismissed) {
        _this.props.onDismissed();
      }
    };

    _this._warnDeprecations({
      ignoreExternalFocusing: 'focusTrapZoneProps',
      forceFocusInsideTrap: 'focusTrapZoneProps',
      firstFocusableSelector: 'focusTrapZoneProps'
    });

    _this._isOpen = !!props.isOpen;
    _this.state = {
      isFooterSticky: false,
      isAnimating: false,
      id: (0, _Utilities.getId)('Panel')
    };
    return _this;
  }

  PanelBase.prototype.componentDidMount = function () {
    this._events.on(window, 'resize', this._updateFooterPosition);

    if (this._shouldListenForOuterClick(this.props)) {
      this._events.on(document.body, 'mousedown', this._dismissOnOuterClick, true);
    }

    if (this.props.isOpen) {
      this.open();
    }
  };

  PanelBase.prototype.componentDidUpdate = function (previousProps) {
    var shouldListenOnOuterClick = this._shouldListenForOuterClick(this.props);

    var previousShouldListenOnOuterClick = this._shouldListenForOuterClick(previousProps);

    if (shouldListenOnOuterClick && !previousShouldListenOnOuterClick) {
      this._events.on(document.body, 'mousedown', this._dismissOnOuterClick, true);
    } else if (!shouldListenOnOuterClick && previousShouldListenOnOuterClick) {
      this._events.off(document.body, 'mousedown', this._dismissOnOuterClick, true);
    }
  };

  PanelBase.prototype.componentWillReceiveProps = function (newProps) {
    if (newProps.isOpen !== this._isOpen) {
      if (newProps.isOpen) {
        this.open();
      } else {
        this.dismiss();
      }
    }
  };

  PanelBase.prototype.render = function () {
    var _a = this.props,
        _b = _a.className,
        className = _b === void 0 ? '' : _b,
        elementToFocusOnDismiss = _a.elementToFocusOnDismiss,
        firstFocusableSelector = _a.firstFocusableSelector,
        focusTrapZoneProps = _a.focusTrapZoneProps,
        forceFocusInsideTrap = _a.forceFocusInsideTrap,
        hasCloseButton = _a.hasCloseButton,
        headerText = _a.headerText,
        _c = _a.headerClassName,
        headerClassName = _c === void 0 ? '' : _c,
        ignoreExternalFocusing = _a.ignoreExternalFocusing,
        isBlocking = _a.isBlocking,
        isFooterAtBottom = _a.isFooterAtBottom,
        isLightDismiss = _a.isLightDismiss,
        isHiddenOnDismiss = _a.isHiddenOnDismiss,
        layerProps = _a.layerProps,
        type = _a.type,
        styles = _a.styles,
        theme = _a.theme,
        customWidth = _a.customWidth,
        _d = _a.onLightDismissClick,
        onLightDismissClick = _d === void 0 ? this._onPanelClick : _d,
        _e = _a.onRenderNavigation,
        onRenderNavigation = _e === void 0 ? this._onRenderNavigation : _e,
        _f = _a.onRenderHeader,
        onRenderHeader = _f === void 0 ? this._onRenderHeader : _f,
        _g = _a.onRenderBody,
        onRenderBody = _g === void 0 ? this._onRenderBody : _g,
        _h = _a.onRenderFooter,
        onRenderFooter = _h === void 0 ? this._onRenderFooter : _h;
    var _j = this.state,
        isFooterSticky = _j.isFooterSticky,
        isAnimating = _j.isAnimating,
        id = _j.id;
    var isLeft = type === _Panel.PanelType.smallFixedNear || type === _Panel.PanelType.customNear ? true : false;
    var isRTL = (0, _Utilities.getRTL)();
    var isOnRightSide = isRTL ? isLeft : !isLeft;
    var headerTextId = headerText && id + '-headerText';
    var customWidthStyles = type === _Panel.PanelType.custom || type === _Panel.PanelType.customNear ? {
      width: customWidth
    } : {};
    var nativeProps = (0, _Utilities.getNativeProps)(this.props, _Utilities.divProperties);
    var isOpen = this._isOpen;

    if (!isOpen && !isAnimating && !isHiddenOnDismiss) {
      return null;
    }

    this._classNames = getClassNames(styles, {
      theme: theme,
      className: className,
      focusTrapZoneClassName: focusTrapZoneProps ? focusTrapZoneProps.className : undefined,
      hasCloseButton: hasCloseButton,
      headerClassName: headerClassName,
      isAnimating: isAnimating,
      isFooterSticky: isFooterSticky,
      isFooterAtBottom: isFooterAtBottom,
      isOnRightSide: isOnRightSide,
      isOpen: isOpen,
      isHiddenOnDismiss: isHiddenOnDismiss,
      type: type
    });
    var _classNames = this._classNames;
    var overlay;

    if (isBlocking && isOpen) {
      overlay = React.createElement(_Overlay.Overlay, {
        className: _classNames.overlay,
        isDarkThemed: false,
        onClick: isLightDismiss ? onLightDismissClick : undefined
      });
    }

    var header = onRenderHeader(this.props, this._onRenderHeader, headerTextId);
    return React.createElement(_Layer.Layer, tslib_1.__assign({}, layerProps), React.createElement(_Popup.Popup, {
      role: "dialog",
      "aria-modal": "true",
      ariaLabelledBy: header ? headerTextId : undefined,
      onDismiss: this.dismiss,
      className: _classNames.hiddenPanel
    }, React.createElement("div", tslib_1.__assign({
      "aria-hidden": !isOpen && isAnimating
    }, nativeProps, {
      ref: this._panel,
      className: _classNames.root
    }), overlay, React.createElement(_index.FocusTrapZone, tslib_1.__assign({
      ignoreExternalFocusing: ignoreExternalFocusing,
      forceFocusInsideTrap: !isBlocking || isHiddenOnDismiss && !isOpen ? false : forceFocusInsideTrap,
      firstFocusableSelector: firstFocusableSelector,
      isClickableOutsideFocusTrap: true
    }, focusTrapZoneProps, {
      className: _classNames.main,
      style: customWidthStyles,
      elementToFocusOnDismiss: elementToFocusOnDismiss
    }), React.createElement("div", {
      className: _classNames.commands,
      "data-is-visible": true
    }, onRenderNavigation(this.props, this._onRenderNavigation)), React.createElement("div", {
      className: _classNames.contentInner
    }, header, React.createElement("div", {
      ref: this._allowScrollOnPanel,
      className: _classNames.scrollableContent,
      "data-is-scrollable": true
    }, onRenderBody(this.props, this._onRenderBody)), onRenderFooter(this.props, this._onRenderFooter))))));
  };

  PanelBase.prototype.open = function () {
    var _this = this;

    if (!this._isOpen) {
      this._isOpen = true;
      this.setState({
        isAnimating: true
      }, function () {
        _this._async.setTimeout(_this._onTransitionComplete, 200);
      });

      if (this.props.onOpen) {
        this.props.onOpen();
      }
    }
  };

  PanelBase.prototype._shouldListenForOuterClick = function (props) {
    return !!props.isBlocking && !!props.isOpen;
  };

  PanelBase.prototype._updateFooterPosition = function () {
    var scrollableContent = this._scrollableContent;

    if (scrollableContent) {
      var height = scrollableContent.clientHeight;
      var innerHeight_1 = scrollableContent.scrollHeight;
      this.setState({
        isFooterSticky: height < innerHeight_1 ? true : false
      });
    }
  };

  PanelBase.prototype._dismissOnOuterClick = function (ev) {
    var panel = this._panel.current;

    if (this._isOpen && panel) {
      if (!(0, _Utilities.elementContains)(panel, ev.target)) {
        if (this.props.onOuterClick) {
          this.props.onOuterClick();
          ev.preventDefault();
        } else {
          this.dismiss();
        }
      }
    }
  };

  PanelBase.defaultProps = {
    isHiddenOnDismiss: false,
    isOpen: false,
    isBlocking: true,
    hasCloseButton: true,
    type: _Panel.PanelType.smallFixedFar
  };
  return PanelBase;
}(_Utilities.BaseComponent);

exports.PanelBase = PanelBase;
},{"tslib":"xgwM","react":"mpTF","../../Button":"XfLs","../../Layer":"sWnj","../../Overlay":"gVaT","../../Popup":"XkwY","../../Styling":"AHeq","../../Utilities":"B5nc","../FocusTrapZone/index":"QOOm","./Panel.types":"Tast"}],"nJz3":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var _Panel = require("./Panel.types");

var _Styling = require("../../Styling");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// TODO -Issue #5689: Comment in once Button is converted to mergeStyles
// import { IStyleFunctionOrObject } from '../../Utilities';
// import { IButtonStyles, IButtonStyleProps } from '../../Button';
var GlobalClassNames = {
  root: 'ms-Panel',
  main: 'ms-Panel-main',
  commands: 'ms-Panel-commands',
  contentInner: 'ms-Panel-contentInner',
  scrollableContent: 'ms-Panel-scrollableContent',
  navigation: 'ms-Panel-navigation',
  closeButton: 'ms-Panel-closeButton ms-PanelAction-close',
  header: 'ms-Panel-header',
  headerText: 'ms-Panel-headerText',
  content: 'ms-Panel-content',
  footer: 'ms-Panel-footer',
  footerInner: 'ms-Panel-footerInner',
  isOpen: 'is-open',
  hasCloseButton: 'ms-Panel--hasCloseButton',
  smallFluid: 'ms-Panel--smFluid',
  smallFixedNear: 'ms-Panel--smLeft',
  smallFixedFar: 'ms-Panel--sm',
  medium: 'ms-Panel--md',
  large: 'ms-Panel--lg',
  largeFixed: 'ms-Panel--fixed',
  extraLarge: 'ms-Panel--xl',
  custom: 'ms-Panel--custom',
  customNear: 'ms-Panel--customLeft'
};
var panelWidth = {
  full: '100%',
  auto: 'auto',
  xs: 272,
  sm: 340,
  md1: 592,
  md2: 644,
  lg: 940
};
var panelMargin = {
  auto: 'auto',
  none: 0,
  md: 48,
  lg: 428,
  xl: 176
}; // Following consts are used below in `getPanelBreakpoints()` function to provide
// necessary fallbacks for different types of Panel in different breakpoints.

var smallPanelSelectors = (_a = {}, _a["@media (min-width: " + _Styling.ScreenWidthMinMedium + "px)"] = {
  width: panelWidth.sm
}, _a);
var mediumPanelSelectors = (_b = {}, _b["@media (min-width: " + _Styling.ScreenWidthMinLarge + "px)"] = {
  width: panelWidth.md1
}, _b["@media (min-width: " + _Styling.ScreenWidthMinXLarge + "px)"] = {
  width: panelWidth.md2
}, _b);
var largePanelSelectors = (_c = {}, _c["@media (min-width: " + _Styling.ScreenWidthMinUhfMobile + "px)"] = {
  left: panelMargin.md,
  width: panelWidth.auto
}, _c["@media (min-width: " + _Styling.ScreenWidthMinXXLarge + "px)"] = {
  left: panelMargin.lg
}, _c);
var largeFixedPanelSelectors = (_d = {}, _d["@media (min-width: " + _Styling.ScreenWidthMinXXLarge + "px)"] = {
  left: panelMargin.auto,
  width: panelWidth.lg
}, _d);
var extraLargePanelSelectors = (_e = {}, _e["@media (min-width: " + _Styling.ScreenWidthMinXXLarge + "px)"] = {
  left: panelMargin.xl
}, _e); // Make sure Panels have fallbacks to different breakpoints by reusing same selectors.
// This is done in the effort to follow design redlines.

var getPanelBreakpoints = function (type) {
  var selectors; // Panel types `smallFluid`, `smallFixedNear`, `custom` and `customNear`
  // are not checked in here because they render the same in all the breakpoints
  // and have the checks done separately in the `getStyles` function below.

  switch (type) {
    case _Panel.PanelType.smallFixedFar:
      selectors = tslib_1.__assign({}, smallPanelSelectors);
      break;

    case _Panel.PanelType.medium:
      selectors = tslib_1.__assign({}, smallPanelSelectors, mediumPanelSelectors);
      break;

    case _Panel.PanelType.large:
      selectors = tslib_1.__assign({}, smallPanelSelectors, mediumPanelSelectors, largePanelSelectors);
      break;

    case _Panel.PanelType.largeFixed:
      selectors = tslib_1.__assign({}, smallPanelSelectors, mediumPanelSelectors, largePanelSelectors, largeFixedPanelSelectors);
      break;

    case _Panel.PanelType.extraLarge:
      selectors = tslib_1.__assign({}, smallPanelSelectors, mediumPanelSelectors, largePanelSelectors, extraLargePanelSelectors);
      break;

    default:
      break;
  }

  return selectors;
};

var commandBarHeight = '44px';
var sharedPaddingStyles = {
  paddingLeft: '16px',
  paddingRight: '16px',
  selectors: (_f = {}, _f["@media screen and (min-width: " + _Styling.ScreenWidthMinLarge + "px)"] = {
    paddingLeft: '32px',
    paddingRight: '32px'
  }, _f["@media screen and (min-width: " + _Styling.ScreenWidthMinXXLarge + "px)"] = {
    paddingLeft: '40px',
    paddingRight: '40px'
  }, _f)
}; // // TODO -Issue #5689: Comment in once Button is converted to mergeStyles
// function getIconButtonStyles(props: IPanelStyleProps): IStyleFunctionOrObject<IButtonStyleProps, IButtonStyles> {
//   const { theme } = props;
//   return () => ({
//     root: {
//       height: 'auto',
//       width: '44px',
//       color: theme.palette.neutralSecondary,
//       fontSize: IconFontSizes.large
//     },
//     rootHovered: {
//       color: theme.palette.neutralPrimary
//     }
//   });
// }

var getStyles = function (props) {
  var className = props.className,
      focusTrapZoneClassName = props.focusTrapZoneClassName,
      hasCloseButton = props.hasCloseButton,
      headerClassName = props.headerClassName,
      isAnimating = props.isAnimating,
      isFooterSticky = props.isFooterSticky,
      isFooterAtBottom = props.isFooterAtBottom,
      isOnRightSide = props.isOnRightSide,
      isOpen = props.isOpen,
      isHiddenOnDismiss = props.isHiddenOnDismiss,
      theme = props.theme,
      _a = props.type,
      type = _a === void 0 ? _Panel.PanelType.smallFixedFar : _a;
  var palette = theme.palette;
  var classNames = (0, _Styling.getGlobalClassNames)(GlobalClassNames, theme);
  var isCustomPanel = type === _Panel.PanelType.custom || type === _Panel.PanelType.customNear;
  return {
    root: [classNames.root, theme.fonts.medium, isOpen && classNames.isOpen, hasCloseButton && classNames.hasCloseButton, {
      pointerEvents: 'none',
      position: 'absolute',
      top: 0,
      left: 0,
      right: 0,
      bottom: 0
    }, isCustomPanel && isOnRightSide && classNames.custom, isCustomPanel && !isOnRightSide && classNames.customNear, className],
    overlay: [{
      pointerEvents: 'auto',
      cursor: 'pointer'
    }, isOpen && isAnimating && _Styling.AnimationClassNames.fadeIn100, !isOpen && isAnimating && _Styling.AnimationClassNames.fadeOut100],
    hiddenPanel: [!isOpen && !isAnimating && isHiddenOnDismiss && {
      visibility: 'hidden'
    }],
    main: [classNames.main, {
      backgroundColor: palette.white,
      boxShadow: '0px 0px 30px 0px rgba(0,0,0,0.2)',
      pointerEvents: 'auto',
      position: 'absolute',
      display: 'flex',
      flexDirection: 'column',
      overflowX: 'hidden',
      overflowY: 'auto',
      WebkitOverflowScrolling: 'touch',
      bottom: 0,
      top: 0,
      // (left, right, width) - Properties to be overridden depending on the type of the Panel and the screen breakpoint.
      left: panelMargin.auto,
      right: panelMargin.none,
      width: panelWidth.full,
      selectors: tslib_1.__assign((_b = {}, _b[_Styling.HighContrastSelector] = {
        borderLeft: "3px solid " + palette.neutralLight,
        borderRight: "3px solid " + palette.neutralLight
      }, _b), getPanelBreakpoints(type))
    }, type === _Panel.PanelType.smallFluid && {
      left: panelMargin.none
    }, type === _Panel.PanelType.smallFixedNear && {
      left: panelMargin.none,
      right: panelMargin.auto,
      width: panelWidth.xs
    }, type === _Panel.PanelType.customNear && {
      right: 'auto',
      left: 0
    }, isCustomPanel && {
      maxWidth: '100vw'
    }, isOpen && isAnimating && !isOnRightSide && _Styling.AnimationClassNames.slideRightIn40, isOpen && isAnimating && isOnRightSide && _Styling.AnimationClassNames.slideLeftIn40, !isOpen && isAnimating && !isOnRightSide && _Styling.AnimationClassNames.slideLeftOut40, !isOpen && isAnimating && isOnRightSide && _Styling.AnimationClassNames.slideRightOut40, focusTrapZoneClassName],
    commands: [classNames.commands],
    navigation: [classNames.navigation, {
      padding: '0 5px',
      height: commandBarHeight,
      display: 'flex',
      justifyContent: 'flex-end'
    }],
    closeButton: [classNames.closeButton],
    contentInner: [classNames.contentInner, {
      display: 'flex',
      flexDirection: 'column',
      flexGrow: 1,
      overflowY: 'hidden'
    }],
    header: [classNames.header, sharedPaddingStyles, {
      margin: '14px 0',
      // Ensure that title doesn't shrink if screen is too small
      flexGrow: 0,
      selectors: (_c = {}, _c["@media (min-width: " + _Styling.ScreenWidthMinXLarge + "px)"] = {
        marginTop: '30px'
      }, _c)
    }],
    headerText: [classNames.headerText, _Styling.DefaultFontStyles.xLarge, {
      color: palette.neutralPrimary,
      lineHeight: '32px',
      margin: 0
    }, headerClassName],
    scrollableContent: [classNames.scrollableContent, {
      overflowY: 'auto'
    }, isFooterAtBottom && {
      flexGrow: 1
    }],
    content: [classNames.content, sharedPaddingStyles, {
      marginBottom: 0,
      paddingBottom: 20
    }],
    footer: [classNames.footer, {
      // Ensure that footer doesn't shrink if screen is too small
      flexGrow: 0,
      borderTop: '1px solid transparent',
      transition: "opacity " + _Styling.AnimationVariables.durationValue3 + " " + _Styling.AnimationVariables.easeFunction2
    }, isFooterSticky && {
      background: palette.white,
      borderTopColor: palette.neutralLight
    }],
    footerInner: [classNames.footerInner, sharedPaddingStyles, {
      paddingBottom: '20px',
      paddingTop: '20px'
    }] // subComponentStyles: {
    //   iconButton: getIconButtonStyles(props)
    // }

  };

  var _b, _c;
};

exports.getStyles = getStyles;

var _a, _b, _c, _d, _e, _f;
},{"tslib":"xgwM","./Panel.types":"Tast","../../Styling":"AHeq"}],"XgJV":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Panel = void 0;

var _Utilities = require("../../Utilities");

var _Panel = require("./Panel.base");

var _Panel2 = require("./Panel.styles");

/**
 * Panel description
 */
var Panel = (0, _Utilities.styled)(_Panel.PanelBase, _Panel2.getStyles, undefined, {
  scope: 'Panel'
});
exports.Panel = Panel;
},{"../../Utilities":"B5nc","./Panel.base":"Fguj","./Panel.styles":"nJz3"}],"hxgY":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _Panel = require("./Panel");

Object.keys(_Panel).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Panel[key];
    }
  });
});

var _Panel2 = require("./Panel.types");

Object.keys(_Panel2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Panel2[key];
    }
  });
});
},{"./Panel":"XgJV","./Panel.types":"Tast"}],"W4Ke":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _index = require("./components/Panel/index");

Object.keys(_index).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index[key];
    }
  });
});
},{"./components/Panel/index":"hxgY"}],"EQsG":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.DropdownBase = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Utilities = require("../../Utilities");

var _Callout = require("../../Callout");

var _Checkbox = require("../../Checkbox");

var _Button = require("../../Button");

var _DirectionalHint = require("../../common/DirectionalHint");

var _Dropdown = require("./Dropdown.types");

var _DropdownSizePosCache = require("./utilities/DropdownSizePosCache");

var _FocusZone = require("../../FocusZone");

var _Icon = require("../../Icon");

var _Label = require("../../Label");

var _KeytipData = require("../../KeytipData");

var _Panel = require("../../Panel");

var _withResponsiveMode = require("../../utilities/decorators/withResponsiveMode");

var _index = require("../../utilities/selectableOption/index");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var getClassNames = (0, _Utilities.classNamesFunction)();

var DropdownBase =
/** @class */
function (_super) {
  tslib_1.__extends(DropdownBase, _super);

  function DropdownBase(props) {
    var _this = _super.call(this, props) || this;

    _this._host = React.createRef();
    _this._focusZone = React.createRef();
    _this._dropDown = React.createRef();
    _this._scrollIdleDelay = 250
    /* ms */
    ;
    _this._sizePosCache = new _DropdownSizePosCache.DropdownSizePosCache();
    _this._requestAnimationFrame = (0, _Utilities.safeRequestAnimationFrame)(_this);

    _this._onChange = function (event, options, index, checked, multiSelect) {
      var _a = _this.props,
          onChange = _a.onChange,
          onChanged = _a.onChanged;

      if (onChange) {
        // for single-select, option passed in will always be selected.
        // for multi-select, flip the checked value
        var changedOpt = multiSelect ? tslib_1.__assign({}, options[index], {
          selected: !checked
        }) : options[index];
        onChange(tslib_1.__assign({}, event, {
          target: _this._dropDown.current
        }), changedOpt, index);
      }

      if (onChanged) {
        // for single-select, option passed in will always be selected.
        // for multi-select, flip the checked value
        var changedOpt = multiSelect ? tslib_1.__assign({}, options[index], {
          selected: !checked
        }) : options[index];
        onChanged(changedOpt, index);
      }
    };
    /** Render text in dropdown input */


    _this._onRenderTitle = function (items) {
      var _a = _this.props.multiSelectDelimiter,
          multiSelectDelimiter = _a === void 0 ? ', ' : _a;
      var displayTxt = items.map(function (i) {
        return i.text;
      }).join(multiSelectDelimiter);
      return React.createElement("span", null, displayTxt);
    };
    /** Render placeholder text in dropdown input */


    _this._onRenderPlaceholder = function (props) {
      if (!_this._placeholder) {
        return null;
      }

      return React.createElement("span", null, _this._placeholder);
    };
    /** Render Callout or Panel container and pass in list */


    _this._onRenderContainer = function (props) {
      var calloutProps = props.calloutProps,
          panelProps = props.panelProps;
      var _a = _this.props,
          responsiveMode = _a.responsiveMode,
          dropdownWidth = _a.dropdownWidth;
      var isSmall = responsiveMode <= _withResponsiveMode.ResponsiveMode.medium;
      var panelStyles = _this._classNames.subComponentStyles ? _this._classNames.subComponentStyles.panel : undefined;
      return isSmall ? React.createElement(_Panel.Panel, tslib_1.__assign({
        isOpen: true,
        isLightDismiss: true,
        onDismissed: _this._onDismiss,
        hasCloseButton: false,
        styles: panelStyles
      }, panelProps), _this._renderFocusableList(props)) : React.createElement(_Callout.Callout, tslib_1.__assign({
        isBeakVisible: false,
        gapSpace: 0,
        doNotLayer: false,
        directionalHintFixed: false,
        directionalHint: _DirectionalHint.DirectionalHint.bottomLeftEdge
      }, calloutProps, {
        className: _this._classNames.callout,
        target: _this._dropDown.current,
        onDismiss: _this._onDismiss,
        onScroll: _this._onScroll,
        onPositioned: _this._onPositioned,
        calloutWidth: dropdownWidth || (_this._dropDown.current ? _this._dropDown.current.clientWidth : 0)
      }), _this._renderFocusableList(props));
    };
    /** Render Caret Down Icon */


    _this._onRenderCaretDown = function (props) {
      return React.createElement(_Icon.Icon, {
        className: _this._classNames.caretDown,
        iconName: "ChevronDown",
        "aria-hidden": true
      });
    };
    /** Render List of items */


    _this._onRenderList = function (props) {
      var _a = props.onRenderItem,
          onRenderItem = _a === void 0 ? _this._onRenderItem : _a;
      return React.createElement(React.Fragment, null, props.options.map(function (item, index) {
        return onRenderItem(tslib_1.__assign({}, item, {
          index: index
        }), _this._onRenderItem);
      }));
    };

    _this._onRenderItem = function (item) {
      switch (item.itemType) {
        case _index.SelectableOptionMenuItemType.Divider:
          return _this._renderSeparator(item);

        case _index.SelectableOptionMenuItemType.Header:
          return _this._renderHeader(item);

        default:
          return _this._renderOption(item);
      }
    };

    _this._renderOption = function (item) {
      var _a = _this.props.onRenderOption,
          onRenderOption = _a === void 0 ? _this._onRenderOption : _a;
      var _b = _this.state.selectedIndices,
          selectedIndices = _b === void 0 ? [] : _b;
      var id = _this._id;
      var isItemSelected = item.index !== undefined && selectedIndices ? selectedIndices.indexOf(item.index) > -1 : false; // select the right className based on the combination of selected/disabled

      var itemClassName = item.hidden // predicate: item hidden
      ? _this._classNames.dropdownItemHidden : isItemSelected && item.disabled === true // predicate: both selected and disabled
      ? _this._classNames.dropdownItemSelectedAndDisabled : isItemSelected // predicate: selected only
      ? _this._classNames.dropdownItemSelected : item.disabled === true // predicate: disabled only
      ? _this._classNames.dropdownItemDisabled : _this._classNames.dropdownItem;
      return !_this.props.multiSelect ? React.createElement(_Button.CommandButton, {
        id: id + '-list' + item.index,
        key: item.key,
        "data-index": item.index,
        "data-is-focusable": !item.disabled,
        disabled: item.disabled,
        className: itemClassName,
        onClick: _this._onItemClick(item),
        onMouseEnter: _this._onItemMouseEnter.bind(_this, item),
        onMouseLeave: _this._onMouseItemLeave.bind(_this, item),
        onMouseMove: _this._onItemMouseMove.bind(_this, item),
        role: "option",
        "aria-selected": isItemSelected ? 'true' : 'false',
        ariaLabel: item.ariaLabel,
        title: item.title ? item.title : item.text
      }, onRenderOption(item, _this._onRenderOption)) : React.createElement(_Checkbox.Checkbox, {
        id: id + '-list' + item.index,
        key: item.key,
        "data-index": item.index,
        "data-is-focusable": !item.disabled,
        disabled: item.disabled,
        onChange: _this._onItemClick(item),
        inputProps: {
          onMouseEnter: _this._onItemMouseEnter.bind(_this, item),
          onMouseLeave: _this._onMouseItemLeave.bind(_this, item),
          onMouseMove: _this._onItemMouseMove.bind(_this, item)
        },
        label: item.text,
        title: item.title ? item.title : item.text,
        onRenderLabel: _this._onRenderLabel.bind(_this, item),
        className: itemClassName,
        role: "option",
        "aria-selected": isItemSelected ? 'true' : 'false',
        checked: isItemSelected
      });
    };
    /** Render content of item (i.e. text/icon inside of button) */


    _this._onRenderOption = function (item) {
      return React.createElement("span", {
        className: _this._classNames.dropdownOptionText
      }, item.text);
    };
    /** Render custom label for drop down item */


    _this._onRenderLabel = function (item) {
      var _a = _this.props.onRenderOption,
          onRenderOption = _a === void 0 ? _this._onRenderOption : _a;
      return onRenderOption(item, _this._onRenderOption);
    };

    _this._onPositioned = function (positions) {
      if (_this._focusZone.current) {
        // Focusing an element can trigger a reflow. Making this wait until there is an animation
        // frame can improve perf significantly.
        _this._requestAnimationFrame(function () {
          var selectedIndices = _this.state.selectedIndices;

          if (selectedIndices && selectedIndices[0] && !_this.props.options[selectedIndices[0]].disabled) {
            var element = (0, _Utilities.getDocument)().querySelector("#" + _this._id + "-list" + selectedIndices[0]);

            _this._focusZone.current.focusElement(element);
          } else {
            _this._focusZone.current.focus();
          }
        });
      }

      if (!_this.state.calloutRenderEdge || _this.state.calloutRenderEdge !== positions.targetEdge) {
        _this.setState({
          calloutRenderEdge: positions.targetEdge
        });
      }
    };

    _this._onItemClick = function (item) {
      return function (event) {
        if (!item.disabled) {
          _this.setSelectedIndex(event, item.index);

          if (!_this.props.multiSelect) {
            // only close the callout when it's in single-select mode
            _this.setState({
              isOpen: false
            });
          }
        }
      };
    };
    /**
     * Scroll handler for the callout to make sure the mouse events
     * for updating focus are not interacting during scroll
     */


    _this._onScroll = function () {
      if (!_this._isScrollIdle && _this._scrollIdleTimeoutId !== undefined) {
        clearTimeout(_this._scrollIdleTimeoutId);
        _this._scrollIdleTimeoutId = undefined;
      } else {
        _this._isScrollIdle = false;
      }

      _this._scrollIdleTimeoutId = setTimeout(function () {
        _this._isScrollIdle = true;
      }, _this._scrollIdleDelay);
    };

    _this._onMouseItemLeave = function (item, ev) {
      if (_this._shouldIgnoreMouseEvent()) {
        return;
      }
      /**
       * IE11 focus() method forces parents to scroll to top of element.
       * Edge and IE expose a setActive() function for focusable divs that
       * sets the page focus but does not scroll the parent element.
       */


      if (_this._host.current) {
        if (_this._host.current.setActive) {
          try {
            _this._host.current.setActive();
          } catch (e) {
            /* no-op */
          }
        } else {
          _this._host.current.focus();
        }
      }
    };

    _this._onDismiss = function () {
      _this.setState({
        isOpen: false
      });

      if (_this._dropDown.current) {
        _this._dropDown.current.focus();
      }
    };

    _this._onDropdownBlur = function (ev) {
      // If Dropdown disabled do not proceed with this logic.
      var disabled = _this._isDisabled();

      if (disabled) {
        return;
      } // hasFocus tracks whether the root element has focus so always update the state.


      _this.setState({
        hasFocus: false
      });

      if (_this.state.isOpen) {
        // Do not onBlur when the callout is opened
        return;
      }

      if (_this.props.onBlur) {
        _this.props.onBlur(ev);
      }
    };

    _this._onDropdownKeyDown = function (ev) {
      // If Dropdown disabled do not process any keyboard events.
      var disabled = _this._isDisabled();

      if (disabled) {
        return;
      } // Take note if we are processing an alt (option) or meta (command) keydown.
      // See comment in _shouldHandleKeyUp for reasoning.


      _this._lastKeyDownWasAltOrMeta = _this._isAltOrMeta(ev);

      if (_this.props.onKeyDown) {
        _this.props.onKeyDown(ev);

        if (ev.defaultPrevented) {
          return;
        }
      }

      var newIndex;
      var selectedIndex = _this.state.selectedIndices.length ? _this.state.selectedIndices[0] : -1;
      var containsExpandCollapseModifier = ev.altKey || ev.metaKey;
      var isOpen = _this.state.isOpen;

      switch (ev.which) {
        case _Utilities.KeyCodes.enter:
          _this.setState({
            isOpen: !isOpen
          });

          break;

        case _Utilities.KeyCodes.escape:
          if (!isOpen) {
            return;
          }

          _this.setState({
            isOpen: false
          });

          break;

        case _Utilities.KeyCodes.up:
          if (containsExpandCollapseModifier) {
            if (isOpen) {
              _this.setState({
                isOpen: false
              });

              break;
            }

            return;
          }

          if (_this.props.multiSelect) {
            _this.setState({
              isOpen: true
            });
          } else if (!_this._isDisabled()) {
            newIndex = _this._moveIndex(ev, -1, selectedIndex - 1, selectedIndex);
          }

          break;

        case _Utilities.KeyCodes.down:
          if (containsExpandCollapseModifier) {
            ev.stopPropagation();
            ev.preventDefault();
          }

          if (containsExpandCollapseModifier && !isOpen || _this.props.multiSelect) {
            _this.setState({
              isOpen: true
            });
          } else if (!_this._isDisabled()) {
            newIndex = _this._moveIndex(ev, 1, selectedIndex + 1, selectedIndex);
          }

          break;

        case _Utilities.KeyCodes.home:
          if (!_this.props.multiSelect) {
            newIndex = _this._moveIndex(ev, 1, 0, selectedIndex);
          }

          break;

        case _Utilities.KeyCodes.end:
          if (!_this.props.multiSelect) {
            newIndex = _this._moveIndex(ev, -1, _this.props.options.length - 1, selectedIndex);
          }

          break;

        case _Utilities.KeyCodes.space:
          // event handled in _onDropdownKeyUp
          break;

        default:
          return;
      }

      if (newIndex !== selectedIndex) {
        ev.stopPropagation();
        ev.preventDefault();
      }
    };

    _this._onDropdownKeyUp = function (ev) {
      // If Dropdown disabled do not process any keyboard events.
      var disabled = _this._isDisabled();

      if (disabled) {
        return;
      }

      var shouldHandleKey = _this._shouldHandleKeyUp(ev);

      var isOpen = _this.state.isOpen;

      if (_this.props.onKeyUp) {
        _this.props.onKeyUp(ev);

        if (ev.preventDefault) {
          return;
        }
      }

      switch (ev.which) {
        case _Utilities.KeyCodes.space:
          _this.setState({
            isOpen: !isOpen
          });

          break;

        default:
          if (shouldHandleKey && isOpen) {
            _this.setState({
              isOpen: false
            });
          }

          return;
      }

      ev.stopPropagation();
      ev.preventDefault();
    };

    _this._onZoneKeyDown = function (ev) {
      var elementToFocus; // Take note if we are processing an alt (option) or meta (command) keydown.
      // See comment in _shouldHandleKeyUp for reasoning.

      _this._lastKeyDownWasAltOrMeta = _this._isAltOrMeta(ev);
      var containsExpandCollapseModifier = ev.altKey || ev.metaKey;

      switch (ev.which) {
        case _Utilities.KeyCodes.up:
          if (containsExpandCollapseModifier) {
            _this.setState({
              isOpen: false
            });
          } else {
            if (_this._host.current) {
              elementToFocus = (0, _Utilities.getLastFocusable)(_this._host.current, _this._host.current.lastChild, true);
            }
          }

          break;
        // All directional keystrokes should be canceled when the zone is rendered.
        // This avoids the body scroll from reacting and thus dismissing the dropdown.

        case _Utilities.KeyCodes.home:
        case _Utilities.KeyCodes.end:
        case _Utilities.KeyCodes.pageUp:
        case _Utilities.KeyCodes.pageDown:
          break;

        case _Utilities.KeyCodes.down:
          if (!containsExpandCollapseModifier && _this._host.current) {
            elementToFocus = (0, _Utilities.getFirstFocusable)(_this._host.current, _this._host.current.firstChild, true);
          }

          break;

        case _Utilities.KeyCodes.escape:
          _this.setState({
            isOpen: false
          });

          break;

        case _Utilities.KeyCodes.tab:
          _this.setState({
            isOpen: false
          });

          return;

        default:
          return;
      }

      if (elementToFocus) {
        elementToFocus.focus();
      }

      ev.stopPropagation();
      ev.preventDefault();
    };

    _this._onZoneKeyUp = function (ev) {
      var shouldHandleKey = _this._shouldHandleKeyUp(ev);

      if (shouldHandleKey && _this.state.isOpen) {
        _this.setState({
          isOpen: false
        });

        ev.preventDefault();
      }
    };

    _this._onDropdownClick = function (ev) {
      if (_this.props.onClick) {
        _this.props.onClick(ev);

        if (ev.preventDefault) {
          return;
        }
      }

      var isOpen = _this.state.isOpen;

      var disabled = _this._isDisabled();

      if (!disabled) {
        _this.setState({
          isOpen: !isOpen
        });
      }
    };

    _this._onFocus = function (ev) {
      var _a = _this.state,
          isOpen = _a.isOpen,
          selectedIndices = _a.selectedIndices,
          hasFocus = _a.hasFocus;
      var _b = _this.props,
          multiSelect = _b.multiSelect,
          openOnKeyboardFocus = _b.openOnKeyboardFocus;

      var disabled = _this._isDisabled();

      if (!disabled) {
        if (!isOpen && selectedIndices.length === 0 && !multiSelect) {
          // Per aria
          _this._moveIndex(ev, 1, 0, -1);
        }

        if (_this.props.onFocus) {
          _this.props.onFocus(ev);
        }

        var state = {
          hasFocus: true
        };

        if (openOnKeyboardFocus && !hasFocus) {
          state.isOpen = true;
        }

        _this.setState(state);
      }
    };
    /**
     * Because the isDisabled prop is deprecated, we have had to repeat this logic all over the place.
     * This helper method avoids all the repetition.
     */


    _this._isDisabled = function () {
      var disabled = _this.props.disabled;
      var isDisabled = _this.props.isDisabled; // Remove this deprecation workaround at 1.0.0

      if (isDisabled !== undefined) {
        disabled = isDisabled;
      }

      return disabled;
    };

    (0, _Utilities.initializeComponentRef)(_this);

    if ("production" !== 'production') {
      (0, _Utilities.warnDeprecations)('Dropdown', props, {
        isDisabled: 'disabled',
        onChanged: 'onChange',
        placeHolder: 'placeholder',
        onRenderPlaceHolder: 'onRenderPlaceholder'
      });
      (0, _Utilities.warnMutuallyExclusive)('Dropdown', props, {
        defaultSelectedKey: 'selectedKey',
        defaultSelectedKeys: 'selectedKeys',
        selectedKeys: 'selectedKey',
        multiSelect: 'defaultSelectedKey',
        selectedKey: 'multiSelect'
      });
    }

    _this._id = props.id || (0, _Utilities.getId)('Dropdown');
    _this._isScrollIdle = true;
    var selectedIndices;

    if (_this.props.multiSelect) {
      var selectedKeys = props.defaultSelectedKeys !== undefined ? props.defaultSelectedKeys : props.selectedKeys;
      selectedIndices = _this._getSelectedIndexes(props.options, selectedKeys);
    } else {
      var selectedKey = props.defaultSelectedKey !== undefined ? props.defaultSelectedKey : props.selectedKey;
      selectedIndices = _this._getSelectedIndexes(props.options, selectedKey);

      _this._sizePosCache.updateOptions(props.options);
    }

    _this.state = {
      isOpen: false,
      selectedIndices: selectedIndices,
      hasFocus: false,
      calloutRenderEdge: undefined
    };
    return _this;
  }

  Object.defineProperty(DropdownBase.prototype, "selectedOptions", {
    /**
     * All selected options
     */
    get: function () {
      var options = this.props.options;
      var selectedIndices = this.state.selectedIndices;
      return (0, _index.getAllSelectedOptions)(options, selectedIndices);
    },
    enumerable: true,
    configurable: true
  });

  DropdownBase.prototype.componentWillUnmount = function () {
    clearTimeout(this._scrollIdleTimeoutId);
  };

  DropdownBase.prototype.componentWillReceiveProps = function (newProps) {
    // In controlled component usage where selectedKey is provided, update the selectedIndex
    // state if the key or options change.
    var selectedKeyProp; // this does a shallow compare (assumes options are pure), for the purposes of determining whether
    // defaultSelectedKey/defaultSelectedKeys are respected.

    var didOptionsChange = newProps.options !== this.props.options;

    if (newProps.multiSelect) {
      if (didOptionsChange && newProps.defaultSelectedKeys !== undefined) {
        selectedKeyProp = 'defaultSelectedKeys';
      } else {
        selectedKeyProp = 'selectedKeys';
      }
    } else {
      if (didOptionsChange && newProps.defaultSelectedKey !== undefined) {
        selectedKeyProp = 'defaultSelectedKey';
      } else {
        selectedKeyProp = 'selectedKey';
      }
    }

    if (newProps[selectedKeyProp] !== undefined && (newProps[selectedKeyProp] !== this.props[selectedKeyProp] || didOptionsChange)) {
      this.setState({
        selectedIndices: this._getSelectedIndexes(newProps.options, newProps[selectedKeyProp])
      });
    }

    if (newProps.options !== this.props.options && // preexisting code assumes purity of the options...
    !newProps.multiSelect // only relevant in single selection
    ) {
        this._sizePosCache.updateOptions(newProps.options);
      }
  };

  DropdownBase.prototype.componentDidUpdate = function (prevProps, prevState) {
    if (prevState.isOpen === true && this.state.isOpen === false) {
      this._gotMouseMove = false;

      if (this._dropDown.current) {
        this._dropDown.current.focus();
      }

      if (this.props.onDismiss) {
        this.props.onDismiss();
      }
    }
  };

  DropdownBase.prototype.render = function () {
    var _this = this;

    var id = this._id;
    var props = this.props;
    var className = props.className,
        label = props.label,
        options = props.options,
        ariaLabel = props.ariaLabel,
        required = props.required,
        errorMessage = props.errorMessage,
        multiSelect = props.multiSelect,
        keytipProps = props.keytipProps,
        propStyles = props.styles,
        theme = props.theme,
        panelProps = props.panelProps,
        calloutProps = props.calloutProps,
        _a = props.onRenderTitle,
        onRenderTitle = _a === void 0 ? this._onRenderTitle : _a,
        _b = props.onRenderContainer,
        onRenderContainer = _b === void 0 ? this._onRenderContainer : _b,
        _c = props.onRenderCaretDown,
        onRenderCaretDown = _c === void 0 ? this._onRenderCaretDown : _c;
    var _d = this.state,
        isOpen = _d.isOpen,
        selectedIndices = _d.selectedIndices,
        hasFocus = _d.hasFocus,
        calloutRenderEdge = _d.calloutRenderEdge;
    var onRenderPlaceholder = props.onRenderPlaceholder || props.onRenderPlaceHolder || this._onRenderPlaceholder;
    var selectedOptions = (0, _index.getAllSelectedOptions)(options, selectedIndices);
    var divProps = (0, _Utilities.getNativeProps)(props, _Utilities.divProperties);

    var disabled = this._isDisabled();

    var optionId = id + '-option';
    var ariaAttrs = multiSelect || disabled ? {
      role: undefined,
      ariaActiveDescendant: undefined,
      childRole: undefined,
      ariaSetSize: undefined,
      ariaPosInSet: undefined,
      ariaSelected: undefined
    } : // single select
    {
      role: 'listbox',
      ariaActiveDescendant: isOpen && selectedIndices.length === 1 && selectedIndices[0] >= 0 ? this._id + '-list' + selectedIndices[0] : optionId,
      childRole: 'option',
      ariaSetSize: this._sizePosCache.optionSetSize,
      ariaPosInSet: this._sizePosCache.positionInSet(selectedIndices[0]),
      ariaSelected: selectedIndices[0] === undefined ? undefined : true
    };
    this._classNames = getClassNames(propStyles, {
      theme: theme,
      className: className,
      hasError: !!(errorMessage && errorMessage.length > 0),
      hasLabel: !!label,
      isOpen: isOpen,
      required: required,
      disabled: disabled,
      isRenderingPlaceholder: !selectedOptions.length,
      panelClassName: !!panelProps ? panelProps.className : undefined,
      calloutClassName: !!calloutProps ? calloutProps.className : undefined,
      calloutRenderEdge: calloutRenderEdge
    });
    var labelStyles = this._classNames.subComponentStyles ? this._classNames.subComponentStyles.label : undefined;
    return React.createElement("div", {
      className: this._classNames.root
    }, label && React.createElement(_Label.Label, {
      className: this._classNames.label,
      id: id + '-label',
      htmlFor: id,
      required: required,
      styles: labelStyles
    }, label), React.createElement(_KeytipData.KeytipData, {
      keytipProps: keytipProps,
      disabled: disabled
    }, function (keytipAttributes) {
      return React.createElement("div", tslib_1.__assign({}, keytipAttributes, {
        "data-is-focusable": !disabled,
        ref: _this._dropDown,
        id: id,
        tabIndex: disabled ? -1 : 0,
        "aria-expanded": isOpen ? 'true' : 'false',
        role: ariaAttrs.role,
        "aria-label": ariaLabel,
        "aria-labelledby": label && !ariaLabel ? id + '-label' : undefined,
        "aria-describedby": (0, _Utilities.mergeAriaAttributeValues)(optionId, keytipAttributes['aria-describedby']),
        "aria-activedescendant": isOpen ? ariaAttrs.ariaActiveDescendant : undefined,
        "aria-required": required,
        "aria-disabled": disabled,
        "aria-owns": isOpen ? id + '-list' : undefined
      }, divProps, {
        className: _this._classNames.dropdown,
        onBlur: _this._onDropdownBlur,
        onKeyDown: _this._onDropdownKeyDown,
        onKeyUp: _this._onDropdownKeyUp,
        onClick: _this._onDropdownClick,
        onFocus: _this._onFocus
      }), React.createElement("span", {
        id: optionId,
        className: _this._classNames.title,
        "aria-atomic": true,
        role: ariaAttrs.childRole,
        "aria-live": !hasFocus || disabled || multiSelect || isOpen ? 'off' : 'assertive',
        "aria-label": selectedOptions.length ? selectedOptions[0].text : _this._placeholder,
        "aria-setsize": ariaAttrs.ariaSetSize,
        "aria-posinset": ariaAttrs.ariaPosInSet,
        "aria-selected": ariaAttrs.ariaSelected
      }, // If option is selected render title, otherwise render the placeholder text
      selectedOptions.length ? onRenderTitle(selectedOptions, _this._onRenderTitle) : onRenderPlaceholder(props, _this._onRenderPlaceholder)), React.createElement("span", {
        className: _this._classNames.caretDownWrapper
      }, onRenderCaretDown(props, _this._onRenderCaretDown)));
    }), isOpen && onRenderContainer(props, this._onRenderContainer), errorMessage && errorMessage.length > 0 && React.createElement("div", {
      className: this._classNames.errorMessage
    }, errorMessage));
  };

  DropdownBase.prototype.focus = function (shouldOpenOnFocus) {
    if (this._dropDown.current && this._dropDown.current.tabIndex !== -1) {
      this._dropDown.current.focus();

      if (shouldOpenOnFocus) {
        this.setState({
          isOpen: true
        });
      }
    }
  };

  DropdownBase.prototype.setSelectedIndex = function (event, index) {
    var _this = this;

    var _a = this.props,
        options = _a.options,
        selectedKey = _a.selectedKey,
        selectedKeys = _a.selectedKeys,
        multiSelect = _a.multiSelect,
        notifyOnReselect = _a.notifyOnReselect;
    var _b = this.state.selectedIndices,
        selectedIndices = _b === void 0 ? [] : _b;
    var checked = selectedIndices ? selectedIndices.indexOf(index) > -1 : false;
    var newIndexes = [];
    index = Math.max(0, Math.min(options.length - 1, index)); // If this is a controlled component then no state change should take place.

    if (selectedKey !== undefined || selectedKeys !== undefined) {
      this._onChange(event, options, index, checked, multiSelect);

      return;
    }

    if (!multiSelect && !notifyOnReselect && index === selectedIndices[0]) {
      return;
    } else if (multiSelect) {
      newIndexes = selectedIndices ? this._copyArray(selectedIndices) : [];

      if (checked) {
        var position = newIndexes.indexOf(index);

        if (position > -1) {
          // unchecked the current one
          newIndexes.splice(position, 1);
        }
      } else {
        // add the new selected index into the existing one
        newIndexes.push(index);
      }
    } else {
      // Set the selected option if this is an uncontrolled component
      newIndexes = [index];
    }

    event.persist(); // Call onChange after state is updated

    this.setState({
      selectedIndices: newIndexes
    }, function () {
      _this._onChange(event, options, index, checked, multiSelect);
    });
  };

  Object.defineProperty(DropdownBase.prototype, "_placeholder", {
    /** Get either props.placeholder (new name) or props.placeHolder (old name) */
    get: function () {
      return this.props.placeholder || this.props.placeHolder;
    },
    enumerable: true,
    configurable: true
  });

  DropdownBase.prototype._copyArray = function (array) {
    var newArray = [];

    for (var _i = 0, array_1 = array; _i < array_1.length; _i++) {
      var element = array_1[_i];
      newArray.push(element);
    }

    return newArray;
  };
  /**
   * Finds the next valid Dropdown option and sets the selected index to it.
   * @param stepValue - Value of how many items the function should traverse.  Should be -1 or 1.
   * @param index - Index of where the search should start
   * @param selectedIndex - The selectedIndex Dropdown's state
   * @returns The next valid dropdown option's index
   */


  DropdownBase.prototype._moveIndex = function (event, stepValue, index, selectedIndex) {
    var options = this.props.options; // Return selectedIndex if nothing has changed or options is empty

    if (selectedIndex === index || options.length === 0) {
      return selectedIndex;
    } // Set starting index to 0 if index is < 0


    if (index < 0) {
      index = 0;
    } // Set starting index to last option index if greater than options.length


    if (index >= options.length) {
      index = options.length - 1;
    }

    var stepCounter = 0; // If current index is a header or divider, or disabled, increment by step

    while (options[index].itemType === _Dropdown.DropdownMenuItemType.Header || options[index].itemType === _Dropdown.DropdownMenuItemType.Divider || options[index].disabled) {
      // If stepCounter exceeds length of options, then return selectedIndex (-1)
      if (stepCounter >= options.length) {
        return selectedIndex;
      } // If index + stepValue is out of bounds, wrap around


      if (index + stepValue < 0) {
        index = options.length;
      } else if (index + stepValue >= options.length) {
        index = -1;
      }

      index = index + stepValue;
      stepCounter++;
    }

    this.setSelectedIndex(event, index);
    return index;
  };
  /** Wrap item list in a FocusZone */


  DropdownBase.prototype._renderFocusableList = function (props) {
    var _a = props.onRenderList,
        onRenderList = _a === void 0 ? this._onRenderList : _a,
        label = props.label,
        ariaLabel = props.ariaLabel;
    var id = this._id;
    return React.createElement("div", {
      className: this._classNames.dropdownItemsWrapper,
      onKeyDown: this._onZoneKeyDown,
      onKeyUp: this._onZoneKeyUp,
      ref: this._host,
      tabIndex: 0
    }, React.createElement(_FocusZone.FocusZone, {
      ref: this._focusZone,
      direction: _FocusZone.FocusZoneDirection.vertical,
      id: id + '-list',
      className: this._classNames.dropdownItems,
      "aria-label": ariaLabel,
      "aria-labelledby": label && !ariaLabel ? id + '-label' : undefined,
      role: "listbox"
    }, onRenderList(props, this._onRenderList)));
  };

  DropdownBase.prototype._renderSeparator = function (item) {
    var index = item.index,
        key = item.key;

    if (index > 0) {
      return React.createElement("div", {
        role: "separator",
        key: key,
        className: this._classNames.dropdownDivider
      });
    }

    return null;
  };

  DropdownBase.prototype._renderHeader = function (item) {
    var _a = this.props.onRenderOption,
        onRenderOption = _a === void 0 ? this._onRenderOption : _a;
    var key = item.key;
    return React.createElement("div", {
      key: key,
      className: this._classNames.dropdownItemHeader
    }, onRenderOption(item, this._onRenderOption));
  };

  DropdownBase.prototype._onItemMouseEnter = function (item, ev) {
    if (this._shouldIgnoreMouseEvent()) {
      return;
    }

    var targetElement = ev.currentTarget;
    targetElement.focus();
  };

  DropdownBase.prototype._onItemMouseMove = function (item, ev) {
    var targetElement = ev.currentTarget;
    this._gotMouseMove = true;

    if (!this._isScrollIdle || document.activeElement === targetElement) {
      return;
    }

    targetElement.focus();
  };

  DropdownBase.prototype._shouldIgnoreMouseEvent = function () {
    return !this._isScrollIdle || !this._gotMouseMove;
  };
  /** Get all selected indexes for multi-select mode */


  DropdownBase.prototype._getSelectedIndexes = function (options, selectedKey) {
    if (selectedKey === undefined) {
      if (this.props.multiSelect) {
        return this._getAllSelectedIndices(options);
      }

      var selectedIndex = this._getSelectedIndex(options, null);

      return selectedIndex !== -1 ? [selectedIndex] : [];
    } else if (!Array.isArray(selectedKey)) {
      var selectedIndex = this._getSelectedIndex(options, selectedKey);

      return selectedIndex !== -1 ? [selectedIndex] : [];
    }

    var selectedIndices = [];

    for (var _i = 0, selectedKey_1 = selectedKey; _i < selectedKey_1.length; _i++) {
      var key = selectedKey_1[_i];

      var selectedIndex = this._getSelectedIndex(options, key);

      selectedIndex !== -1 && selectedIndices.push(selectedIndex);
    }

    return selectedIndices;
  };

  DropdownBase.prototype._getAllSelectedIndices = function (options) {
    return options.map(function (option, index) {
      return option.selected ? index : -1;
    }).filter(function (index) {
      return index !== -1;
    });
  };

  DropdownBase.prototype._getSelectedIndex = function (options, selectedKey) {
    return (0, _Utilities.findIndex)(options, function (option) {
      // tslint:disable-next-line:triple-equals
      if (selectedKey != null) {
        return option.key === selectedKey;
      } else {
        return !!option.isSelected || !!option.selected;
      }
    });
  };
  /**
   * Returns true if the key for the event is alt (Mac option) or meta (Mac command).
   */


  DropdownBase.prototype._isAltOrMeta = function (ev) {
    return ev.which === _Utilities.KeyCodes.alt || ev.key === 'Meta';
  };
  /**
   * We close the menu on key up only if ALL of the following are true:
   * - Most recent key down was alt or meta (command)
   * - The alt/meta key down was NOT followed by some other key (such as down/up arrow to
   *   expand/collapse the menu)
   * - We're not on a Mac (or iOS)
   *
   * This is because on Windows, pressing alt moves focus to the application menu bar or similar,
   * closing any open context menus. There is not a similar behavior on Macs.
   */


  DropdownBase.prototype._shouldHandleKeyUp = function (ev) {
    var keyPressIsAltOrMetaAlone = this._lastKeyDownWasAltOrMeta && this._isAltOrMeta(ev);

    this._lastKeyDownWasAltOrMeta = false;
    return !!keyPressIsAltOrMetaAlone && !((0, _Utilities.isMac)() || (0, _Utilities.isIOS)());
  };

  DropdownBase.defaultProps = {
    options: []
  };
  DropdownBase = tslib_1.__decorate([_withResponsiveMode.withResponsiveMode], DropdownBase);
  return DropdownBase;
}(React.Component);

exports.DropdownBase = DropdownBase;
},{"tslib":"xgwM","react":"mpTF","../../Utilities":"B5nc","../../Callout":"jp3a","../../Checkbox":"OuLn","../../Button":"XfLs","../../common/DirectionalHint":"uAUO","./Dropdown.types":"GtgI","./utilities/DropdownSizePosCache":"RhKO","../../FocusZone":"v3nN","../../Icon":"s5pL","../../Label":"RcoC","../../KeytipData":"ltoP","../../Panel":"W4Ke","../../utilities/decorators/withResponsiveMode":"Q4um","../../utilities/selectableOption/index":"unBv"}],"J4pD":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var _Styling = require("../../Styling");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var GlobalClassNames = {
  root: 'ms-Dropdown-container',
  label: 'ms-Dropdown-label',
  dropdown: 'ms-Dropdown',
  title: 'ms-Dropdown-title',
  caretDownWrapper: 'ms-Dropdown-caretDownWrapper',
  caretDown: 'ms-Dropdown-caretDown',
  callout: 'ms-Dropdown-callout',
  panel: 'ms-Dropdown-panel',
  dropdownItems: 'ms-Dropdown-items',
  dropdownItem: 'ms-Dropdown-item',
  dropdownDivider: 'ms-Dropdown-divider',
  dropdownOptionText: 'ms-Dropdown-optionText',
  dropdownItemHeader: 'ms-Dropdown-header',
  titleIsPlaceHolder: 'ms-Dropdown-titleIsPlaceHolder',
  titleHasError: 'ms-Dropdown-title--hasError'
};
var DROPDOWN_HEIGHT = 32;
var DROPDOWN_ITEM_HEIGHT = 32;
var highContrastAdjustMixin = (_a = {}, _a[_Styling.HighContrastSelector + ", " + _Styling.HighContrastSelectorWhite.replace('@media ', '')] = {
  MsHighContrastAdjust: 'none'
}, _a);
var highContrastItemAndTitleStateMixin = {
  selectors: tslib_1.__assign((_b = {}, _b[_Styling.HighContrastSelector] = {
    backgroundColor: 'Highlight',
    borderColor: 'Highlight',
    color: 'HighlightText',
    selectors: {
      ':hover': {
        color: 'HighlightText' // overrides the hover styling for buttons that are also selected

      }
    }
  }, _b), highContrastAdjustMixin)
};
var highContrastBorderState = {
  selectors: (_c = {}, _c[_Styling.HighContrastSelector] = {
    borderColor: 'Highlight'
  }, _c)
};
var MinimumScreenSelector = (0, _Styling.getScreenSelector)(0, _Styling.ScreenWidthMinMedium);

var getStyles = function (props) {
  var theme = props.theme,
      hasError = props.hasError,
      hasLabel = props.hasLabel,
      className = props.className,
      isOpen = props.isOpen,
      disabled = props.disabled,
      required = props.required,
      isRenderingPlaceholder = props.isRenderingPlaceholder,
      panelClassName = props.panelClassName,
      calloutClassName = props.calloutClassName;

  if (!theme) {
    throw new Error('theme is undefined or null in base Dropdown getStyles function.');
  }

  var globalClassnames = (0, _Styling.getGlobalClassNames)(GlobalClassNames, theme);
  var palette = theme.palette,
      semanticColors = theme.semanticColors;
  var rootHoverFocusActiveSelectorNeutralDarkMixin = {
    color: semanticColors.menuItemTextHovered
  };
  var rootHoverFocusActiveSelectorBodySubtextMixin = {
    color: semanticColors.bodySubtext
  };
  var borderColorError = {
    borderColor: semanticColors.errorText
  };
  var dropdownItemStyle = [globalClassnames.dropdownItem, {
    backgroundColor: 'transparent',
    boxSizing: 'border-box',
    cursor: 'pointer',
    display: 'block',
    padding: '4px 16px',
    width: '100%',
    minHeight: DROPDOWN_ITEM_HEIGHT,
    lineHeight: 20,
    height: 'auto',
    position: 'relative',
    border: '1px solid transparent',
    wordWrap: 'break-word',
    overflowWrap: 'break-word',
    textAlign: 'left'
  }];
  var dropdownItemSelected = dropdownItemStyle.concat([{
    backgroundColor: palette.neutralQuaternaryAlt,
    color: palette.black
  }, highContrastItemAndTitleStateMixin]);
  var dropdownItemDisabled = dropdownItemStyle.concat([{
    color: semanticColors.disabledText,
    cursor: 'default'
  }]);
  return {
    root: globalClassnames.root,
    label: globalClassnames.label,
    dropdown: [globalClassnames.dropdown, _Styling.normalize, tslib_1.__assign({}, theme.fonts.medium, {
      color: semanticColors.menuItemText,
      position: 'relative',
      outline: 0,
      userSelect: 'none',
      selectors: (_a = {}, _a['&:hover .' + globalClassnames.title] = [!disabled && rootHoverFocusActiveSelectorNeutralDarkMixin, {
        borderColor: palette.neutralDark
      }, highContrastBorderState], _a['&:focus .' + globalClassnames.title] = [!disabled && rootHoverFocusActiveSelectorNeutralDarkMixin, {
        borderColor: palette.themePrimary
        /* see https://github.com/OfficeDev/office-ui-fabric-react/pull/9182 for semantic color disc */

      }, highContrastItemAndTitleStateMixin], _a['&:active .' + globalClassnames.title] = [!disabled && rootHoverFocusActiveSelectorNeutralDarkMixin, {
        borderColor: palette.themeDark
      }, highContrastBorderState], _a['&:hover .' + globalClassnames.caretDown] = !disabled && rootHoverFocusActiveSelectorNeutralDarkMixin, _a['&:focus .' + globalClassnames.caretDown] = [!disabled && rootHoverFocusActiveSelectorNeutralDarkMixin, {
        selectors: tslib_1.__assign((_b = {}, _b[_Styling.HighContrastSelector] = {
          color: 'HighlightText'
        }, _b), highContrastAdjustMixin)
      }], _a['&:active .' + globalClassnames.caretDown] = !disabled && rootHoverFocusActiveSelectorNeutralDarkMixin, _a['&:hover .' + globalClassnames.titleIsPlaceHolder] = rootHoverFocusActiveSelectorBodySubtextMixin, _a['&:focus .' + globalClassnames.titleIsPlaceHolder] = rootHoverFocusActiveSelectorBodySubtextMixin, _a['&:active .' + globalClassnames.titleIsPlaceHolder] = rootHoverFocusActiveSelectorBodySubtextMixin, _a['&:hover .' + globalClassnames.titleHasError] = borderColorError, _a['&:active .' + globalClassnames.titleHasError] = borderColorError, _a['&:focus .' + globalClassnames.titleHasError] = borderColorError, _a)
    }), className, isOpen && 'is-open', disabled && 'is-disabled', required && 'is-required', required && !hasLabel && {
      selectors: (_c = {
        ':after': {
          content: "'*'",
          color: semanticColors.errorText,
          position: 'absolute',
          top: -5,
          right: -10
        }
      }, _c[_Styling.HighContrastSelector] = {
        selectors: {
          ':after': {
            right: -14 // moving the * 4 pixel to right to alleviate border clipping in HC mode.

          }
        }
      }, _c)
    }],
    title: [globalClassnames.title, _Styling.normalize, {
      backgroundColor: semanticColors.inputBackground,
      borderWidth: 1,
      borderStyle: 'solid',
      borderColor: semanticColors.inputBorder,
      cursor: 'pointer',
      display: 'block',
      height: DROPDOWN_HEIGHT,
      lineHeight: DROPDOWN_HEIGHT - 2,
      padding: "0 " + DROPDOWN_HEIGHT + "px 0 12px",
      position: 'relative',
      overflow: 'hidden',
      whiteSpace: 'nowrap',
      textOverflow: 'ellipsis'
    }, isRenderingPlaceholder && [globalClassnames.titleIsPlaceHolder, {
      color: semanticColors.inputPlaceholderText
    }], hasError && [globalClassnames.titleHasError, borderColorError], disabled && {
      backgroundColor: semanticColors.disabledBackground,
      border: 'none',
      color: semanticColors.disabledText,
      cursor: 'default',
      selectors: (_d = {}, _d[_Styling.HighContrastSelector] = {
        border: '1px solid GrayText',
        color: 'GrayText'
      }, _d)
    }],
    caretDownWrapper: [globalClassnames.caretDownWrapper, {
      position: 'absolute',
      top: 1,
      right: 12,
      height: DROPDOWN_HEIGHT,
      lineHeight: DROPDOWN_HEIGHT - 2 // height minus the border

    }, !disabled && {
      cursor: 'pointer'
    }],
    caretDown: [globalClassnames.caretDown, {
      color: semanticColors.bodySubtext,
      fontSize: _Styling.FontSizes.small,
      pointerEvents: 'none'
    }, disabled && {
      color: semanticColors.disabledText,
      selectors: (_e = {}, _e[_Styling.HighContrastSelector] = {
        color: 'GrayText'
      }, _e)
    }],
    errorMessage: tslib_1.__assign({
      color: semanticColors.errorText
    }, theme.fonts.small, {
      paddingTop: 5
    }),
    callout: [globalClassnames.callout, {
      boxShadow: '0 0 2px 0 rgba(0,0,0,0.2)',
      border: "1px solid " + semanticColors.variantBorder
    }, calloutClassName],
    dropdownItemsWrapper: {
      selectors: {
        '&:focus': {
          outline: 0
        }
      }
    },
    dropdownItems: [globalClassnames.dropdownItems, {
      display: 'block'
    }],
    dropdownItem: dropdownItemStyle.concat([{
      selectors: (_f = {}, _f[_Styling.HighContrastSelector] = {
        borderColor: 'Window'
      }, _f['&:hover'] = {
        color: 'inherit'
      }, _f['&:focus'] = {
        backgroundColor: semanticColors.listItemBackgroundHovered
      }, _f['&:active'] = {
        backgroundColor: semanticColors.listHeaderBackgroundHovered,
        color: palette.black
      }, _f)
    }]),
    dropdownItemSelected: dropdownItemSelected,
    dropdownItemDisabled: dropdownItemDisabled,
    dropdownItemSelectedAndDisabled: [dropdownItemSelected, dropdownItemDisabled, {
      backgroundColor: 'transparent'
    }],
    dropdownItemHidden: dropdownItemStyle.concat([{
      display: 'none'
    }]),
    dropdownDivider: [globalClassnames.dropdownDivider, {
      height: 1,
      backgroundColor: semanticColors.bodyDivider
    }],
    dropdownOptionText: [globalClassnames.dropdownOptionText, {
      overflow: 'hidden',
      whiteSpace: 'nowrap',
      textOverflow: 'ellipsis',
      minWidth: 0,
      maxWidth: '100%',
      wordWrap: 'break-word',
      overflowWrap: 'break-word',
      margin: '1px'
    }],
    dropdownItemHeader: [globalClassnames.dropdownItemHeader, tslib_1.__assign({}, theme.fonts.medium, {
      fontWeight: _Styling.FontWeights.semibold,
      color: semanticColors.menuHeader,
      background: 'none',
      backgroundColor: 'transparent',
      border: 'none',
      height: DROPDOWN_ITEM_HEIGHT,
      lineHeight: DROPDOWN_ITEM_HEIGHT,
      cursor: 'default',
      padding: '0px 16px',
      userSelect: 'none',
      textAlign: 'left'
    })],
    subComponentStyles: {
      label: {
        root: {
          display: 'inline-block'
        }
      },
      panel: {
        root: [panelClassName],
        main: {
          // Force drop shadow even under medium breakpoint
          boxShadow: '-30px 0px 30px -30px rgba(0,0,0,0.2)',
          selectors: (_g = {}, // In case of extra small screen sizes
          _g[MinimumScreenSelector] = {
            // panelWidth xs
            width: 272
          }, _g)
        },
        contentInner: {
          padding: '0 0 20px'
        }
      }
    }
  };

  var _a, _b, _c, _d, _e, _f, _g;
};

exports.getStyles = getStyles;

var _a, _b, _c;
},{"tslib":"xgwM","../../Styling":"AHeq"}],"JOVa":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Dropdown = void 0;

var _Utilities = require("../../Utilities");

var _Dropdown = require("./Dropdown.base");

var _Dropdown2 = require("./Dropdown.styles");

var Dropdown = (0, _Utilities.styled)(_Dropdown.DropdownBase, _Dropdown2.getStyles, undefined, {
  scope: 'Dropdown'
});
exports.Dropdown = Dropdown;
},{"../../Utilities":"B5nc","./Dropdown.base":"EQsG","./Dropdown.styles":"J4pD"}],"Pl29":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _Dropdown = require("./Dropdown");

Object.keys(_Dropdown).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Dropdown[key];
    }
  });
});

var _Dropdown2 = require("./Dropdown.base");

Object.keys(_Dropdown2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Dropdown2[key];
    }
  });
});

var _Dropdown3 = require("./Dropdown.types");

Object.keys(_Dropdown3).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Dropdown3[key];
    }
  });
});
},{"./Dropdown":"JOVa","./Dropdown.base":"EQsG","./Dropdown.types":"GtgI"}],"VKFL":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.initializeIcons = initializeIcons;

var _styling = require("@uifabric/styling");

// Your use of the content in the files referenced here is subject to the terms of the license at https://aka.ms/fabric-assets-license
// tslint:disable:max-line-length
function initializeIcons(baseUrl, options) {
  if (baseUrl === void 0) {
    baseUrl = '';
  }

  var subset = {
    style: {
      MozOsxFontSmoothing: 'grayscale',
      WebkitFontSmoothing: 'antialiased',
      fontStyle: 'normal',
      fontWeight: 'normal',
      speak: 'none'
    },
    fontFace: {
      fontFamily: "\"FabricMDL2Icons\"",
      src: "url('" + baseUrl + "fabric-icons-a13498cf.woff') format('woff')"
    },
    icons: {
      GlobalNavButton: '\uE700',
      ChevronDown: '\uE70D',
      ChevronUp: '\uE70E',
      Edit: '\uE70F',
      Add: '\uE710',
      Cancel: '\uE711',
      More: '\uE712',
      Settings: '\uE713',
      Mail: '\uE715',
      Filter: '\uE71C',
      Search: '\uE721',
      Share: '\uE72D',
      BlockedSite: '\uE72F',
      FavoriteStar: '\uE734',
      FavoriteStarFill: '\uE735',
      CheckMark: '\uE73E',
      Delete: '\uE74D',
      ChevronLeft: '\uE76B',
      ChevronRight: '\uE76C',
      Calendar: '\uE787',
      Megaphone: '\uE789',
      Undo: '\uE7A7',
      Flag: '\uE7C1',
      Page: '\uE7C3',
      Pinned: '\uE840',
      View: '\uE890',
      Clear: '\uE894',
      Download: '\uE896',
      Upload: '\uE898',
      Folder: '\uE8B7',
      Sort: '\uE8CB',
      AlignRight: '\uE8E2',
      AlignLeft: '\uE8E4',
      Tag: '\uE8EC',
      AddFriend: '\uE8FA',
      Info: '\uE946',
      SortLines: '\uE9D0',
      List: '\uEA37',
      CircleRing: '\uEA3A',
      Heart: '\uEB51',
      HeartFill: '\uEB52',
      Tiles: '\uECA5',
      Embed: '\uECCE',
      Glimmer: '\uECF4',
      Ascending: '\uEDC0',
      Descending: '\uEDC1',
      SortUp: '\uEE68',
      SortDown: '\uEE69',
      SyncToPC: '\uEE6E',
      LargeGrid: '\uEECB',
      SkypeCheck: '\uEF80',
      SkypeClock: '\uEF81',
      SkypeMinus: '\uEF82',
      ClearFilter: '\uEF8F',
      Flow: '\uEF90',
      StatusCircleCheckmark: '\uF13E',
      MoreVertical: '\uF2BC'
    }
  };
  (0, _styling.registerIcons)(subset, options);
}
},{"@uifabric/styling":"Dytz"}],"XepD":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.initializeIcons = initializeIcons;

var _styling = require("@uifabric/styling");

// Your use of the content in the files referenced here is subject to the terms of the license at https://aka.ms/fabric-assets-license
// tslint:disable:max-line-length
function initializeIcons(baseUrl, options) {
  if (baseUrl === void 0) {
    baseUrl = '';
  }

  var subset = {
    style: {
      MozOsxFontSmoothing: 'grayscale',
      WebkitFontSmoothing: 'antialiased',
      fontStyle: 'normal',
      fontWeight: 'normal',
      speak: 'none'
    },
    fontFace: {
      fontFamily: "\"FabricMDL2Icons-0\"",
      src: "url('" + baseUrl + "fabric-icons-0-2a8db1f5.woff') format('woff')"
    },
    icons: {
      InternetSharing: '\uE704',
      Brightness: '\uE706',
      MapPin: '\uE707',
      Airplane: '\uE709',
      Tablet: '\uE70A',
      QuickNote: '\uE70B',
      Video: '\uE714',
      People: '\uE716',
      Phone: '\uE717',
      Pin: '\uE718',
      Shop: '\uE719',
      Stop: '\uE71A',
      Link: '\uE71B',
      AllApps: '\uE71D',
      Zoom: '\uE71E',
      ZoomOut: '\uE71F',
      Microphone: '\uE720',
      Camera: '\uE722',
      Attach: '\uE723',
      Send: '\uE724',
      FavoriteList: '\uE728',
      PageSolid: '\uE729',
      Forward: '\uE72A',
      Back: '\uE72B',
      Refresh: '\uE72C',
      Lock: '\uE72E',
      ReportHacked: '\uE730',
      EMI: '\uE731',
      MiniLink: '\uE732',
      Blocked: '\uE733',
      ReadingMode: '\uE736',
      Favicon: '\uE737',
      Remove: '\uE738',
      Checkbox: '\uE739',
      CheckboxComposite: '\uE73A',
      CheckboxFill: '\uE73B',
      CheckboxIndeterminate: '\uE73C',
      CheckboxCompositeReversed: '\uE73D',
      BackToWindow: '\uE73F',
      FullScreen: '\uE740',
      Print: '\uE749',
      Up: '\uE74A',
      Down: '\uE74B',
      OEM: '\uE74C',
      Save: '\uE74E',
      ReturnKey: '\uE751',
      Cloud: '\uE753',
      Flashlight: '\uE754',
      CommandPrompt: '\uE756',
      Sad: '\uE757',
      RealEstate: '\uE758',
      SIPMove: '\uE759',
      EraseTool: '\uE75C',
      GripperTool: '\uE75E',
      Dialpad: '\uE75F',
      PageLeft: '\uE760',
      PageRight: '\uE761',
      MultiSelect: '\uE762',
      KeyboardClassic: '\uE765',
      Play: '\uE768',
      Pause: '\uE769',
      InkingTool: '\uE76D',
      Emoji2: '\uE76E',
      GripperBarHorizontal: '\uE76F',
      System: '\uE770',
      Personalize: '\uE771',
      SearchAndApps: '\uE773',
      Globe: '\uE774',
      EaseOfAccess: '\uE776',
      ContactInfo: '\uE779',
      Unpin: '\uE77A',
      Contact: '\uE77B',
      Memo: '\uE77C',
      IncomingCall: '\uE77E',
      Paste: '\uE77F',
      WindowsLogo: '\uE782',
      Error: '\uE783',
      GripperBarVertical: '\uE784',
      Unlock: '\uE785',
      Slideshow: '\uE786',
      AutoEnhanceOn: '\uE78D',
      AutoEnhanceOff: '\uE78E',
      Color: '\uE790',
      SaveAs: '\uE792',
      Light: '\uE793',
      Filters: '\uE795',
      AspectRatio: '\uE799',
      Contrast: '\uE7A1',
      Redo: '\uE7A6',
      Crop: '\uE7A8',
      PhotoCollection: '\uE7AA',
      Album: '\uE7AB',
      Rotate: '\uE7AD',
      PanoIndicator: '\uE7B0',
      Translate: '\uE7B2',
      RedEye: '\uE7B3',
      ThumbnailView: '\uE7B6',
      Package: '\uE7B8',
      Telemarketer: '\uE7B9',
      Warning: '\uE7BA'
    }
  };
  (0, _styling.registerIcons)(subset, options);
}
},{"@uifabric/styling":"Dytz"}],"UqUM":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.initializeIcons = initializeIcons;

var _styling = require("@uifabric/styling");

// Your use of the content in the files referenced here is subject to the terms of the license at https://aka.ms/fabric-assets-license
// tslint:disable:max-line-length
function initializeIcons(baseUrl, options) {
  if (baseUrl === void 0) {
    baseUrl = '';
  }

  var subset = {
    style: {
      MozOsxFontSmoothing: 'grayscale',
      WebkitFontSmoothing: 'antialiased',
      fontStyle: 'normal',
      fontWeight: 'normal',
      speak: 'none'
    },
    fontFace: {
      fontFamily: "\"FabricMDL2Icons-1\"",
      src: "url('" + baseUrl + "fabric-icons-1-360e3054.woff') format('woff')"
    },
    icons: {
      Financial: '\uE7BB',
      Education: '\uE7BE',
      ShoppingCart: '\uE7BF',
      Train: '\uE7C0',
      Move: '\uE7C2',
      TouchPointer: '\uE7C9',
      Merge: '\uE7D5',
      TurnRight: '\uE7DB',
      Ferry: '\uE7E3',
      Highlight: '\uE7E6',
      PowerButton: '\uE7E8',
      Tab: '\uE7E9',
      Admin: '\uE7EF',
      TVMonitor: '\uE7F4',
      Speakers: '\uE7F5',
      Game: '\uE7FC',
      UnstackSelected: '\uE7FE',
      StackIndicator: '\uE7FF',
      Nav2DMapView: '\uE800',
      StreetsideSplitMinimize: '\uE802',
      Car: '\uE804',
      Bus: '\uE806',
      EatDrink: '\uE807',
      SeeDo: '\uE808',
      LocationCircle: '\uE80E',
      Home: '\uE80F',
      SwitcherStartEnd: '\uE810',
      ParkingLocation: '\uE811',
      IncidentTriangle: '\uE814',
      Touch: '\uE815',
      MapDirections: '\uE816',
      CaretHollow: '\uE817',
      CaretSolid: '\uE818',
      History: '\uE81C',
      Location: '\uE81D',
      MapLayers: '\uE81E',
      SearchNearby: '\uE820',
      Work: '\uE821',
      Recent: '\uE823',
      Hotel: '\uE824',
      Bank: '\uE825',
      LocationDot: '\uE827',
      Dictionary: '\uE82D',
      ChromeBack: '\uE830',
      FolderOpen: '\uE838',
      PinnedFill: '\uE842',
      RevToggleKey: '\uE845',
      USB: '\uE88E',
      Previous: '\uE892',
      Next: '\uE893',
      Sync: '\uE895',
      Help: '\uE897',
      Emoji: '\uE899',
      MailForward: '\uE89C',
      ClosePane: '\uE89F',
      OpenPane: '\uE8A0',
      PreviewLink: '\uE8A1',
      ZoomIn: '\uE8A3',
      Bookmarks: '\uE8A4',
      Document: '\uE8A5',
      ProtectedDocument: '\uE8A6',
      OpenInNewWindow: '\uE8A7',
      MailFill: '\uE8A8',
      ViewAll: '\uE8A9',
      Switch: '\uE8AB',
      Rename: '\uE8AC',
      Go: '\uE8AD',
      Remote: '\uE8AF',
      SelectAll: '\uE8B3',
      Orientation: '\uE8B4',
      Import: '\uE8B5',
      Picture: '\uE8B9',
      ChromeClose: '\uE8BB',
      ShowResults: '\uE8BC',
      Message: '\uE8BD',
      CalendarDay: '\uE8BF',
      CalendarWeek: '\uE8C0',
      MailReplyAll: '\uE8C2',
      Read: '\uE8C3',
      Cut: '\uE8C6',
      PaymentCard: '\uE8C7',
      Copy: '\uE8C8',
      Important: '\uE8C9',
      MailReply: '\uE8CA',
      GotoToday: '\uE8D1',
      Font: '\uE8D2',
      FontColor: '\uE8D3',
      FolderFill: '\uE8D5',
      Permissions: '\uE8D7',
      DisableUpdates: '\uE8D8',
      Unfavorite: '\uE8D9',
      Italic: '\uE8DB',
      Underline: '\uE8DC',
      Bold: '\uE8DD',
      MoveToFolder: '\uE8DE',
      Dislike: '\uE8E0',
      Like: '\uE8E1',
      AlignCenter: '\uE8E3',
      OpenFile: '\uE8E5',
      FontDecrease: '\uE8E7'
    }
  };
  (0, _styling.registerIcons)(subset, options);
}
},{"@uifabric/styling":"Dytz"}],"c18W":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.initializeIcons = initializeIcons;

var _styling = require("@uifabric/styling");

// Your use of the content in the files referenced here is subject to the terms of the license at https://aka.ms/fabric-assets-license
// tslint:disable:max-line-length
function initializeIcons(baseUrl, options) {
  if (baseUrl === void 0) {
    baseUrl = '';
  }

  var subset = {
    style: {
      MozOsxFontSmoothing: 'grayscale',
      WebkitFontSmoothing: 'antialiased',
      fontStyle: 'normal',
      fontWeight: 'normal',
      speak: 'none'
    },
    fontFace: {
      fontFamily: "\"FabricMDL2Icons-2\"",
      src: "url('" + baseUrl + "fabric-icons-2-8820ef0b.woff') format('woff')"
    },
    icons: {
      FontIncrease: '\uE8E8',
      FontSize: '\uE8E9',
      CellPhone: '\uE8EA',
      RepeatOne: '\uE8ED',
      RepeatAll: '\uE8EE',
      Calculator: '\uE8EF',
      Library: '\uE8F1',
      PostUpdate: '\uE8F3',
      NewFolder: '\uE8F4',
      CalendarReply: '\uE8F5',
      UnsyncFolder: '\uE8F6',
      SyncFolder: '\uE8F7',
      BlockContact: '\uE8F8',
      Accept: '\uE8FB',
      BulletedList: '\uE8FD',
      Preview: '\uE8FF',
      News: '\uE900',
      Chat: '\uE901',
      Group: '\uE902',
      World: '\uE909',
      Comment: '\uE90A',
      DockLeft: '\uE90C',
      DockRight: '\uE90D',
      Repair: '\uE90F',
      Accounts: '\uE910',
      Street: '\uE913',
      RadioBullet: '\uE915',
      Stopwatch: '\uE916',
      Clock: '\uE917',
      WorldClock: '\uE918',
      AlarmClock: '\uE919',
      Photo: '\uE91B',
      ActionCenter: '\uE91C',
      Hospital: '\uE91D',
      Timer: '\uE91E',
      FullCircleMask: '\uE91F',
      LocationFill: '\uE920',
      ChromeMinimize: '\uE921',
      ChromeRestore: '\uE923',
      Annotation: '\uE924',
      Fingerprint: '\uE928',
      Handwriting: '\uE929',
      ChromeFullScreen: '\uE92D',
      Completed: '\uE930',
      Label: '\uE932',
      FlickDown: '\uE935',
      FlickUp: '\uE936',
      FlickLeft: '\uE937',
      FlickRight: '\uE938',
      MiniExpand: '\uE93A',
      MiniContract: '\uE93B',
      Streaming: '\uE93E',
      MusicInCollection: '\uE940',
      OneDriveLogo: '\uE941',
      CompassNW: '\uE942',
      Code: '\uE943',
      LightningBolt: '\uE945',
      CalculatorMultiply: '\uE947',
      CalculatorAddition: '\uE948',
      CalculatorSubtract: '\uE949',
      CalculatorPercentage: '\uE94C',
      CalculatorEqualTo: '\uE94E',
      PrintfaxPrinterFile: '\uE956',
      StorageOptical: '\uE958',
      Communications: '\uE95A',
      Headset: '\uE95B',
      Health: '\uE95E',
      FrontCamera: '\uE96B',
      ChevronUpSmall: '\uE96D',
      ChevronDownSmall: '\uE96E',
      ChevronLeftSmall: '\uE96F',
      ChevronRightSmall: '\uE970',
      ChevronUpMed: '\uE971',
      ChevronDownMed: '\uE972',
      ChevronLeftMed: '\uE973',
      ChevronRightMed: '\uE974',
      Devices2: '\uE975',
      PC1: '\uE977',
      PresenceChickletVideo: '\uE979',
      Reply: '\uE97A',
      HalfAlpha: '\uE97E',
      ConstructionCone: '\uE98F',
      DoubleChevronLeftMed: '\uE991',
      Volume0: '\uE992',
      Volume1: '\uE993',
      Volume2: '\uE994',
      Volume3: '\uE995',
      Chart: '\uE999',
      Robot: '\uE99A',
      Manufacturing: '\uE99C',
      LockSolid: '\uE9A2',
      FitPage: '\uE9A6',
      FitWidth: '\uE9A7',
      BidiLtr: '\uE9AA',
      BidiRtl: '\uE9AB',
      RightDoubleQuote: '\uE9B1',
      Sunny: '\uE9BD',
      CloudWeather: '\uE9BE',
      Cloudy: '\uE9BF',
      PartlyCloudyDay: '\uE9C0'
    }
  };
  (0, _styling.registerIcons)(subset, options);
}
},{"@uifabric/styling":"Dytz"}],"nDOI":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.initializeIcons = initializeIcons;

var _styling = require("@uifabric/styling");

// Your use of the content in the files referenced here is subject to the terms of the license at https://aka.ms/fabric-assets-license
// tslint:disable:max-line-length
function initializeIcons(baseUrl, options) {
  if (baseUrl === void 0) {
    baseUrl = '';
  }

  var subset = {
    style: {
      MozOsxFontSmoothing: 'grayscale',
      WebkitFontSmoothing: 'antialiased',
      fontStyle: 'normal',
      fontWeight: 'normal',
      speak: 'none'
    },
    fontFace: {
      fontFamily: "\"FabricMDL2Icons-3\"",
      src: "url('" + baseUrl + "fabric-icons-3-7c253e01.woff') format('woff')"
    },
    icons: {
      PartlyCloudyNight: '\uE9C1',
      ClearNight: '\uE9C2',
      RainShowersDay: '\uE9C3',
      Rain: '\uE9C4',
      Thunderstorms: '\uE9C6',
      RainSnow: '\uE9C7',
      Snow: '\uE9C8',
      BlowingSnow: '\uE9C9',
      Frigid: '\uE9CA',
      Fog: '\uE9CB',
      Squalls: '\uE9CC',
      Duststorm: '\uE9CD',
      Unknown: '\uE9CE',
      Precipitation: '\uE9CF',
      Ribbon: '\uE9D1',
      AreaChart: '\uE9D2',
      Assign: '\uE9D3',
      FlowChart: '\uE9D4',
      CheckList: '\uE9D5',
      Diagnostic: '\uE9D9',
      Generate: '\uE9DA',
      LineChart: '\uE9E6',
      Equalizer: '\uE9E9',
      BarChartHorizontal: '\uE9EB',
      BarChartVertical: '\uE9EC',
      Freezing: '\uE9EF',
      FunnelChart: '\uE9F1',
      Processing: '\uE9F5',
      Quantity: '\uE9F8',
      ReportDocument: '\uE9F9',
      StackColumnChart: '\uE9FC',
      SnowShowerDay: '\uE9FD',
      HailDay: '\uEA00',
      WorkFlow: '\uEA01',
      HourGlass: '\uEA03',
      StoreLogoMed20: '\uEA04',
      TimeSheet: '\uEA05',
      TriangleSolid: '\uEA08',
      UpgradeAnalysis: '\uEA0B',
      VideoSolid: '\uEA0C',
      RainShowersNight: '\uEA0F',
      SnowShowerNight: '\uEA11',
      Teamwork: '\uEA12',
      HailNight: '\uEA13',
      PeopleAdd: '\uEA15',
      Glasses: '\uEA16',
      DateTime2: '\uEA17',
      Shield: '\uEA18',
      Header1: '\uEA19',
      PageAdd: '\uEA1A',
      NumberedList: '\uEA1C',
      PowerBILogo: '\uEA1E',
      Info2: '\uEA1F',
      MusicInCollectionFill: '\uEA36',
      Asterisk: '\uEA38',
      ErrorBadge: '\uEA39',
      CircleFill: '\uEA3B',
      Record2: '\uEA3F',
      AllAppsMirrored: '\uEA40',
      BookmarksMirrored: '\uEA41',
      BulletedListMirrored: '\uEA42',
      CaretHollowMirrored: '\uEA45',
      CaretSolidMirrored: '\uEA46',
      ChromeBackMirrored: '\uEA47',
      ClosePaneMirrored: '\uEA49',
      DockLeftMirrored: '\uEA4C',
      DoubleChevronLeftMedMirrored: '\uEA4D',
      GoMirrored: '\uEA4F',
      HelpMirrored: '\uEA51',
      ImportMirrored: '\uEA52',
      ImportAllMirrored: '\uEA53',
      ListMirrored: '\uEA55',
      MailForwardMirrored: '\uEA56',
      MailReplyMirrored: '\uEA57',
      MailReplyAllMirrored: '\uEA58',
      MiniContractMirrored: '\uEA59',
      MiniExpandMirrored: '\uEA5A',
      OpenPaneMirrored: '\uEA5B',
      ParkingLocationMirrored: '\uEA5E',
      SendMirrored: '\uEA63',
      ShowResultsMirrored: '\uEA65',
      ThumbnailViewMirrored: '\uEA67',
      Media: '\uEA69',
      Devices3: '\uEA6C',
      Focus: '\uEA6F',
      VideoLightOff: '\uEA74',
      Lightbulb: '\uEA80',
      StatusTriangle: '\uEA82',
      VolumeDisabled: '\uEA85',
      Puzzle: '\uEA86',
      EmojiNeutral: '\uEA87',
      EmojiDisappointed: '\uEA88',
      HomeSolid: '\uEA8A',
      Ringer: '\uEA8F',
      PDF: '\uEA90',
      HeartBroken: '\uEA92',
      StoreLogo16: '\uEA96',
      MultiSelectMirrored: '\uEA98',
      Broom: '\uEA99',
      Cocktails: '\uEA9D'
    }
  };
  (0, _styling.registerIcons)(subset, options);
}
},{"@uifabric/styling":"Dytz"}],"vJR8":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.initializeIcons = initializeIcons;

var _styling = require("@uifabric/styling");

// Your use of the content in the files referenced here is subject to the terms of the license at https://aka.ms/fabric-assets-license
// tslint:disable:max-line-length
function initializeIcons(baseUrl, options) {
  if (baseUrl === void 0) {
    baseUrl = '';
  }

  var subset = {
    style: {
      MozOsxFontSmoothing: 'grayscale',
      WebkitFontSmoothing: 'antialiased',
      fontStyle: 'normal',
      fontWeight: 'normal',
      speak: 'none'
    },
    fontFace: {
      fontFamily: "\"FabricMDL2Icons-4\"",
      src: "url('" + baseUrl + "fabric-icons-4-15a649f8.woff') format('woff')"
    },
    icons: {
      Wines: '\uEABF',
      Articles: '\uEAC1',
      Cycling: '\uEAC7',
      DietPlanNotebook: '\uEAC8',
      Pill: '\uEACB',
      ExerciseTracker: '\uEACC',
      HandsFree: '\uEAD0',
      Medical: '\uEAD4',
      Running: '\uEADA',
      Weights: '\uEADB',
      Trackers: '\uEADF',
      AddNotes: '\uEAE3',
      AllCurrency: '\uEAE4',
      BarChart4: '\uEAE7',
      CirclePlus: '\uEAEE',
      Coffee: '\uEAEF',
      Cotton: '\uEAF3',
      Market: '\uEAFC',
      Money: '\uEAFD',
      PieDouble: '\uEB04',
      PieSingle: '\uEB05',
      RemoveFilter: '\uEB08',
      Savings: '\uEB0B',
      Sell: '\uEB0C',
      StockDown: '\uEB0F',
      StockUp: '\uEB11',
      Lamp: '\uEB19',
      Source: '\uEB1B',
      MSNVideos: '\uEB1C',
      Cricket: '\uEB1E',
      Golf: '\uEB1F',
      Baseball: '\uEB20',
      Soccer: '\uEB21',
      MoreSports: '\uEB22',
      AutoRacing: '\uEB24',
      CollegeHoops: '\uEB25',
      CollegeFootball: '\uEB26',
      ProFootball: '\uEB27',
      ProHockey: '\uEB28',
      Rugby: '\uEB2D',
      SubstitutionsIn: '\uEB31',
      Tennis: '\uEB33',
      Arrivals: '\uEB34',
      Design: '\uEB3C',
      Website: '\uEB41',
      Drop: '\uEB42',
      HistoricalWeather: '\uEB43',
      SkiResorts: '\uEB45',
      Snowflake: '\uEB46',
      BusSolid: '\uEB47',
      FerrySolid: '\uEB48',
      AirplaneSolid: '\uEB4C',
      TrainSolid: '\uEB4D',
      Ticket: '\uEB54',
      WifiWarning4: '\uEB63',
      Devices4: '\uEB66',
      AzureLogo: '\uEB6A',
      BingLogo: '\uEB6B',
      MSNLogo: '\uEB6C',
      OutlookLogoInverse: '\uEB6D',
      OfficeLogo: '\uEB6E',
      SkypeLogo: '\uEB6F',
      Door: '\uEB75',
      EditMirrored: '\uEB7E',
      GiftCard: '\uEB8E',
      DoubleBookmark: '\uEB8F',
      StatusErrorFull: '\uEB90',
      Certificate: '\uEB95',
      FastForward: '\uEB9D',
      Rewind: '\uEB9E',
      Photo2: '\uEB9F',
      OpenSource: '\uEBC2',
      Movers: '\uEBCD',
      CloudDownload: '\uEBD3',
      Family: '\uEBDA',
      WindDirection: '\uEBE6',
      Bug: '\uEBE8',
      SiteScan: '\uEBEC',
      BrowserScreenShot: '\uEBED',
      F12DevTools: '\uEBEE',
      CSS: '\uEBEF',
      JS: '\uEBF0',
      DeliveryTruck: '\uEBF4',
      ReminderPerson: '\uEBF7',
      ReminderGroup: '\uEBF8',
      TabletMode: '\uEBFC',
      Umbrella: '\uEC04',
      NetworkTower: '\uEC05',
      CityNext: '\uEC06',
      CityNext2: '\uEC07',
      Section: '\uEC0C',
      OneNoteLogoInverse: '\uEC0D',
      ToggleFilled: '\uEC11',
      ToggleBorder: '\uEC12',
      SliderThumb: '\uEC13',
      ToggleThumb: '\uEC14',
      Documentation: '\uEC17',
      Badge: '\uEC1B',
      Giftbox: '\uEC1F',
      VisualStudioLogo: '\uEC22'
    }
  };
  (0, _styling.registerIcons)(subset, options);
}
},{"@uifabric/styling":"Dytz"}],"wbtx":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.initializeIcons = initializeIcons;

var _styling = require("@uifabric/styling");

// Your use of the content in the files referenced here is subject to the terms of the license at https://aka.ms/fabric-assets-license
// tslint:disable:max-line-length
function initializeIcons(baseUrl, options) {
  if (baseUrl === void 0) {
    baseUrl = '';
  }

  var subset = {
    style: {
      MozOsxFontSmoothing: 'grayscale',
      WebkitFontSmoothing: 'antialiased',
      fontStyle: 'normal',
      fontWeight: 'normal',
      speak: 'none'
    },
    fontFace: {
      fontFamily: "\"FabricMDL2Icons-5\"",
      src: "url('" + baseUrl + "fabric-icons-5-f6de453a.woff') format('woff')"
    },
    icons: {
      HomeGroup: '\uEC26',
      ExcelLogoInverse: '\uEC28',
      WordLogoInverse: '\uEC29',
      PowerPointLogoInverse: '\uEC2A',
      Cafe: '\uEC32',
      SpeedHigh: '\uEC4A',
      Commitments: '\uEC4D',
      ThisPC: '\uEC4E',
      MusicNote: '\uEC4F',
      MicOff: '\uEC54',
      EdgeLogo: '\uEC60',
      CompletedSolid: '\uEC61',
      AlbumRemove: '\uEC62',
      MessageFill: '\uEC70',
      TabletSelected: '\uEC74',
      MobileSelected: '\uEC75',
      LaptopSelected: '\uEC76',
      TVMonitorSelected: '\uEC77',
      DeveloperTools: '\uEC7A',
      Shapes: '\uEC7C',
      InsertTextBox: '\uEC7D',
      LowerBrightness: '\uEC8A',
      WebComponents: '\uEC8B',
      OfflineStorage: '\uEC8C',
      DOM: '\uEC8D',
      CloudUpload: '\uEC8E',
      ScrollUpDown: '\uEC8F',
      DateTime: '\uEC92',
      Event: '\uECA3',
      Cake: '\uECA4',
      Org: '\uECA6',
      PartyLeader: '\uECA7',
      DRM: '\uECA8',
      CloudAdd: '\uECA9',
      AppIconDefault: '\uECAA',
      Photo2Add: '\uECAB',
      Photo2Remove: '\uECAC',
      POI: '\uECAF',
      AddTo: '\uECC8',
      RadioBtnOff: '\uECCA',
      RadioBtnOn: '\uECCB',
      ExploreContent: '\uECCD',
      Product: '\uECDC',
      ProgressLoopInner: '\uECDE',
      ProgressLoopOuter: '\uECDF',
      Blocked2: '\uECE4',
      FangBody: '\uECEB',
      PageHeader: '\uECEE',
      ChatInviteFriend: '\uECFE',
      Brush: '\uECFF',
      Shirt: '\uED00',
      Crown: '\uED01',
      Diamond: '\uED02',
      ScaleUp: '\uED09',
      QRCode: '\uED14',
      Feedback: '\uED15',
      SharepointLogoInverse: '\uED18',
      YammerLogo: '\uED19',
      Hide: '\uED1A',
      Uneditable: '\uED1D',
      ReturnToSession: '\uED24',
      OpenFolderHorizontal: '\uED25',
      CalendarMirrored: '\uED28',
      SwayLogoInverse: '\uED29',
      OutOfOffice: '\uED34',
      Trophy: '\uED3F',
      ReopenPages: '\uED50',
      EmojiTabSymbols: '\uED58',
      AADLogo: '\uED68',
      AccessLogo: '\uED69',
      AdminALogoInverse32: '\uED6A',
      AdminCLogoInverse32: '\uED6B',
      AdminDLogoInverse32: '\uED6C',
      AdminELogoInverse32: '\uED6D',
      AdminLLogoInverse32: '\uED6E',
      AdminMLogoInverse32: '\uED6F',
      AdminOLogoInverse32: '\uED70',
      AdminPLogoInverse32: '\uED71',
      AdminSLogoInverse32: '\uED72',
      AdminYLogoInverse32: '\uED73',
      DelveLogoInverse: '\uED76',
      ExchangeLogoInverse: '\uED78',
      LyncLogo: '\uED79',
      OfficeVideoLogoInverse: '\uED7A',
      SocialListeningLogo: '\uED7C',
      VisioLogoInverse: '\uED7D',
      Balloons: '\uED7E',
      Cat: '\uED7F',
      MailAlert: '\uED80',
      MailCheck: '\uED81',
      MailLowImportance: '\uED82',
      MailPause: '\uED83',
      MailRepeat: '\uED84',
      SecurityGroup: '\uED85',
      Table: '\uED86',
      VoicemailForward: '\uED87',
      VoicemailReply: '\uED88',
      Waffle: '\uED89',
      RemoveEvent: '\uED8A',
      EventInfo: '\uED8B'
    }
  };
  (0, _styling.registerIcons)(subset, options);
}
},{"@uifabric/styling":"Dytz"}],"iPrz":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.initializeIcons = initializeIcons;

var _styling = require("@uifabric/styling");

// Your use of the content in the files referenced here is subject to the terms of the license at https://aka.ms/fabric-assets-license
// tslint:disable:max-line-length
function initializeIcons(baseUrl, options) {
  if (baseUrl === void 0) {
    baseUrl = '';
  }

  var subset = {
    style: {
      MozOsxFontSmoothing: 'grayscale',
      WebkitFontSmoothing: 'antialiased',
      fontStyle: 'normal',
      fontWeight: 'normal',
      speak: 'none'
    },
    fontFace: {
      fontFamily: "\"FabricMDL2Icons-6\"",
      src: "url('" + baseUrl + "fabric-icons-6-32b702b9.woff') format('woff')"
    },
    icons: {
      ForwardEvent: '\uED8C',
      WipePhone: '\uED8D',
      AddOnlineMeeting: '\uED8E',
      JoinOnlineMeeting: '\uED8F',
      RemoveLink: '\uED90',
      PeopleBlock: '\uED91',
      PeopleRepeat: '\uED92',
      PeopleAlert: '\uED93',
      PeoplePause: '\uED94',
      TransferCall: '\uED95',
      AddPhone: '\uED96',
      UnknownCall: '\uED97',
      NoteReply: '\uED98',
      NoteForward: '\uED99',
      NotePinned: '\uED9A',
      RemoveOccurrence: '\uED9B',
      Timeline: '\uED9C',
      EditNote: '\uED9D',
      CircleHalfFull: '\uED9E',
      Room: '\uED9F',
      Unsubscribe: '\uEDA0',
      Subscribe: '\uEDA1',
      HardDrive: '\uEDA2',
      RecurringTask: '\uEDB2',
      TaskManager: '\uEDB7',
      TaskManagerMirrored: '\uEDB8',
      Combine: '\uEDBB',
      Split: '\uEDBC',
      DoubleChevronUp: '\uEDBD',
      DoubleChevronLeft: '\uEDBE',
      DoubleChevronRight: '\uEDBF',
      TextBox: '\uEDC2',
      TextField: '\uEDC3',
      NumberField: '\uEDC4',
      Dropdown: '\uEDC5',
      PenWorkspace: '\uEDC6',
      BookingsLogo: '\uEDC7',
      ClassNotebookLogoInverse: '\uEDC8',
      DelveAnalyticsLogo: '\uEDCA',
      DocsLogoInverse: '\uEDCB',
      Dynamics365Logo: '\uEDCC',
      DynamicSMBLogo: '\uEDCD',
      OfficeAssistantLogo: '\uEDCE',
      OfficeStoreLogo: '\uEDCF',
      OneNoteEduLogoInverse: '\uEDD0',
      PlannerLogo: '\uEDD1',
      PowerApps: '\uEDD2',
      Suitcase: '\uEDD3',
      ProjectLogoInverse: '\uEDD4',
      CaretLeft8: '\uEDD5',
      CaretRight8: '\uEDD6',
      CaretUp8: '\uEDD7',
      CaretDown8: '\uEDD8',
      CaretLeftSolid8: '\uEDD9',
      CaretRightSolid8: '\uEDDA',
      CaretUpSolid8: '\uEDDB',
      CaretDownSolid8: '\uEDDC',
      ClearFormatting: '\uEDDD',
      Superscript: '\uEDDE',
      Subscript: '\uEDDF',
      Strikethrough: '\uEDE0',
      Export: '\uEDE1',
      ExportMirrored: '\uEDE2',
      SingleBookmark: '\uEDFF',
      SingleBookmarkSolid: '\uEE00',
      DoubleChevronDown: '\uEE04',
      FollowUser: '\uEE05',
      ReplyAll: '\uEE0A',
      WorkforceManagement: '\uEE0F',
      RecruitmentManagement: '\uEE12',
      Questionnaire: '\uEE19',
      ManagerSelfService: '\uEE23',
      ProductRelease: '\uEE2E',
      ReplyMirrored: '\uEE35',
      ReplyAllMirrored: '\uEE36',
      Medal: '\uEE38',
      AddGroup: '\uEE3D',
      QuestionnaireMirrored: '\uEE4B',
      TemporaryUser: '\uEE58',
      CaretSolid16: '\uEE62',
      GroupedDescending: '\uEE66',
      GroupedAscending: '\uEE67',
      AwayStatus: '\uEE6A',
      MyMoviesTV: '\uEE6C',
      GenericScan: '\uEE6F',
      AustralianRules: '\uEE70',
      WifiEthernet: '\uEE77',
      TrackersMirrored: '\uEE92',
      DateTimeMirrored: '\uEE93',
      StopSolid: '\uEE95',
      DoubleChevronUp12: '\uEE96',
      DoubleChevronDown12: '\uEE97',
      DoubleChevronLeft12: '\uEE98',
      DoubleChevronRight12: '\uEE99',
      CalendarAgenda: '\uEE9A',
      AddEvent: '\uEEB5',
      AssetLibrary: '\uEEB6',
      DataConnectionLibrary: '\uEEB7',
      DocLibrary: '\uEEB8',
      FormLibrary: '\uEEB9'
    }
  };
  (0, _styling.registerIcons)(subset, options);
}
},{"@uifabric/styling":"Dytz"}],"Wmt1":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.initializeIcons = initializeIcons;

var _styling = require("@uifabric/styling");

// Your use of the content in the files referenced here is subject to the terms of the license at https://aka.ms/fabric-assets-license
// tslint:disable:max-line-length
function initializeIcons(baseUrl, options) {
  if (baseUrl === void 0) {
    baseUrl = '';
  }

  var subset = {
    style: {
      MozOsxFontSmoothing: 'grayscale',
      WebkitFontSmoothing: 'antialiased',
      fontStyle: 'normal',
      fontWeight: 'normal',
      speak: 'none'
    },
    fontFace: {
      fontFamily: "\"FabricMDL2Icons-7\"",
      src: "url('" + baseUrl + "fabric-icons-7-bbebf62d.woff') format('woff')"
    },
    icons: {
      FormLibraryMirrored: '\uEEBA',
      ReportLibrary: '\uEEBB',
      ReportLibraryMirrored: '\uEEBC',
      ContactCard: '\uEEBD',
      CustomList: '\uEEBE',
      CustomListMirrored: '\uEEBF',
      IssueTracking: '\uEEC0',
      IssueTrackingMirrored: '\uEEC1',
      PictureLibrary: '\uEEC2',
      OfficeAddinsLogo: '\uEEC7',
      OfflineOneDriveParachute: '\uEEC8',
      OfflineOneDriveParachuteDisabled: '\uEEC9',
      TriangleSolidUp12: '\uEECC',
      TriangleSolidDown12: '\uEECD',
      TriangleSolidLeft12: '\uEECE',
      TriangleSolidRight12: '\uEECF',
      TriangleUp12: '\uEED0',
      TriangleDown12: '\uEED1',
      TriangleLeft12: '\uEED2',
      TriangleRight12: '\uEED3',
      ArrowUpRight8: '\uEED4',
      ArrowDownRight8: '\uEED5',
      DocumentSet: '\uEED6',
      DelveAnalytics: '\uEEEE',
      ArrowUpRightMirrored8: '\uEEEF',
      ArrowDownRightMirrored8: '\uEEF0',
      CompanyDirectory: '\uEF0D',
      OpenEnrollment: '\uEF1C',
      CompanyDirectoryMirrored: '\uEF2B',
      OneDriveAdd: '\uEF32',
      ProfileSearch: '\uEF35',
      Header2: '\uEF36',
      Header3: '\uEF37',
      Header4: '\uEF38',
      RingerSolid: '\uEF3A',
      Eyedropper: '\uEF3C',
      MarketDown: '\uEF42',
      CalendarWorkWeek: '\uEF51',
      SidePanel: '\uEF52',
      GlobeFavorite: '\uEF53',
      CaretTopLeftSolid8: '\uEF54',
      CaretTopRightSolid8: '\uEF55',
      ViewAll2: '\uEF56',
      DocumentReply: '\uEF57',
      PlayerSettings: '\uEF58',
      ReceiptForward: '\uEF59',
      ReceiptReply: '\uEF5A',
      ReceiptCheck: '\uEF5B',
      Fax: '\uEF5C',
      RecurringEvent: '\uEF5D',
      ReplyAlt: '\uEF5E',
      ReplyAllAlt: '\uEF5F',
      EditStyle: '\uEF60',
      EditMail: '\uEF61',
      Lifesaver: '\uEF62',
      LifesaverLock: '\uEF63',
      InboxCheck: '\uEF64',
      FolderSearch: '\uEF65',
      CollapseMenu: '\uEF66',
      ExpandMenu: '\uEF67',
      Boards: '\uEF68',
      SunAdd: '\uEF69',
      SunQuestionMark: '\uEF6A',
      LandscapeOrientation: '\uEF6B',
      DocumentSearch: '\uEF6C',
      PublicCalendar: '\uEF6D',
      PublicContactCard: '\uEF6E',
      PublicEmail: '\uEF6F',
      PublicFolder: '\uEF70',
      WordDocument: '\uEF71',
      PowerPointDocument: '\uEF72',
      ExcelDocument: '\uEF73',
      GroupedList: '\uEF74',
      ClassroomLogo: '\uEF75',
      Sections: '\uEF76',
      EditPhoto: '\uEF77',
      Starburst: '\uEF78',
      ShareiOS: '\uEF79',
      AirTickets: '\uEF7A',
      PencilReply: '\uEF7B',
      Tiles2: '\uEF7C',
      SkypeCircleCheck: '\uEF7D',
      SkypeCircleClock: '\uEF7E',
      SkypeCircleMinus: '\uEF7F',
      SkypeMessage: '\uEF83',
      ClosedCaption: '\uEF84',
      ATPLogo: '\uEF85',
      OfficeFormsLogoInverse: '\uEF86',
      RecycleBin: '\uEF87',
      EmptyRecycleBin: '\uEF88',
      Hide2: '\uEF89',
      Breadcrumb: '\uEF8C',
      BirthdayCake: '\uEF8D',
      TimeEntry: '\uEF95',
      CRMProcesses: '\uEFB1',
      PageEdit: '\uEFB6',
      PageArrowRight: '\uEFB8',
      PageRemove: '\uEFBA',
      Database: '\uEFC7',
      DataManagementSettings: '\uEFC8'
    }
  };
  (0, _styling.registerIcons)(subset, options);
}
},{"@uifabric/styling":"Dytz"}],"XSxG":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.initializeIcons = initializeIcons;

var _styling = require("@uifabric/styling");

// Your use of the content in the files referenced here is subject to the terms of the license at https://aka.ms/fabric-assets-license
// tslint:disable:max-line-length
function initializeIcons(baseUrl, options) {
  if (baseUrl === void 0) {
    baseUrl = '';
  }

  var subset = {
    style: {
      MozOsxFontSmoothing: 'grayscale',
      WebkitFontSmoothing: 'antialiased',
      fontStyle: 'normal',
      fontWeight: 'normal',
      speak: 'none'
    },
    fontFace: {
      fontFamily: "\"FabricMDL2Icons-8\"",
      src: "url('" + baseUrl + "fabric-icons-8-50fd817c.woff') format('woff')"
    },
    icons: {
      CRMServices: '\uEFD2',
      EditContact: '\uEFD3',
      ConnectContacts: '\uEFD4',
      AppIconDefaultAdd: '\uEFDA',
      AppIconDefaultList: '\uEFDE',
      ActivateOrders: '\uEFE0',
      DeactivateOrders: '\uEFE1',
      DocumentManagement: '\uEFFC',
      CRMReport: '\uEFFE',
      KnowledgeArticle: '\uF000',
      Relationship: '\uF003',
      HomeVerify: '\uF00E',
      ZipFolder: '\uF012',
      SurveyQuestions: '\uF01B',
      TextDocument: '\uF029',
      TextDocumentShared: '\uF02B',
      PageCheckedOut: '\uF02C',
      SaveAndClose: '\uF038',
      Script: '\uF03A',
      Archive: '\uF03F',
      ActivityFeed: '\uF056',
      Compare: '\uF057',
      EventDate: '\uF059',
      ArrowUpRight: '\uF069',
      CaretRight: '\uF06B',
      SetAction: '\uF071',
      CaretSolidLeft: '\uF08D',
      CaretSolidDown: '\uF08E',
      CaretSolidRight: '\uF08F',
      CaretSolidUp: '\uF090',
      PowerAppsLogo: '\uF091',
      PowerApps2Logo: '\uF092',
      SearchIssue: '\uF09A',
      SearchIssueMirrored: '\uF09B',
      FabricAssetLibrary: '\uF09C',
      FabricDataConnectionLibrary: '\uF09D',
      FabricDocLibrary: '\uF09E',
      FabricFormLibrary: '\uF09F',
      FabricFormLibraryMirrored: '\uF0A0',
      FabricReportLibrary: '\uF0A1',
      FabricReportLibraryMirrored: '\uF0A2',
      FabricPublicFolder: '\uF0A3',
      FabricFolderSearch: '\uF0A4',
      FabricMovetoFolder: '\uF0A5',
      FabricUnsyncFolder: '\uF0A6',
      FabricSyncFolder: '\uF0A7',
      FabricOpenFolderHorizontal: '\uF0A8',
      FabricFolder: '\uF0A9',
      FabricFolderFill: '\uF0AA',
      FabricNewFolder: '\uF0AB',
      FabricPictureLibrary: '\uF0AC',
      AddFavorite: '\uF0C8',
      AddFavoriteFill: '\uF0C9',
      BufferTimeBefore: '\uF0CF',
      BufferTimeAfter: '\uF0D0',
      BufferTimeBoth: '\uF0D1',
      PublishContent: '\uF0D4',
      ClipboardList: '\uF0E3',
      ClipboardListMirrored: '\uF0E4',
      CannedChat: '\uF0F2',
      SkypeForBusinessLogo: '\uF0FC',
      TabCenter: '\uF100',
      PageCheckedin: '\uF104',
      PageList: '\uF106',
      ReadOutLoud: '\uF112',
      CaretBottomLeftSolid8: '\uF121',
      CaretBottomRightSolid8: '\uF122',
      FolderHorizontal: '\uF12B',
      MicrosoftStaffhubLogo: '\uF130',
      GiftboxOpen: '\uF133',
      StatusCircleOuter: '\uF136',
      StatusCircleInner: '\uF137',
      StatusCircleRing: '\uF138',
      StatusTriangleOuter: '\uF139',
      StatusTriangleInner: '\uF13A',
      StatusTriangleExclamation: '\uF13B',
      StatusCircleExclamation: '\uF13C',
      StatusCircleErrorX: '\uF13D',
      StatusCircleInfo: '\uF13F',
      StatusCircleBlock: '\uF140',
      StatusCircleBlock2: '\uF141',
      StatusCircleQuestionMark: '\uF142',
      StatusCircleSync: '\uF143',
      Toll: '\uF160',
      ExploreContentSingle: '\uF164',
      CollapseContent: '\uF165',
      CollapseContentSingle: '\uF166',
      InfoSolid: '\uF167',
      ProgressRingDots: '\uF16A',
      CaloriesAdd: '\uF172',
      BranchFork: '\uF173',
      AddHome: '\uF17B',
      MobileReport: '\uF18A',
      ScaleVolume: '\uF18C',
      HardDriveGroup: '\uF18F',
      FastMode: '\uF19A',
      ToggleLeft: '\uF19E',
      ToggleRight: '\uF19F',
      TriangleShape: '\uF1A7',
      RectangleShape: '\uF1A9'
    }
  };
  (0, _styling.registerIcons)(subset, options);
}
},{"@uifabric/styling":"Dytz"}],"uMFj":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.initializeIcons = initializeIcons;

var _styling = require("@uifabric/styling");

// Your use of the content in the files referenced here is subject to the terms of the license at https://aka.ms/fabric-assets-license
// tslint:disable:max-line-length
function initializeIcons(baseUrl, options) {
  if (baseUrl === void 0) {
    baseUrl = '';
  }

  var subset = {
    style: {
      MozOsxFontSmoothing: 'grayscale',
      WebkitFontSmoothing: 'antialiased',
      fontStyle: 'normal',
      fontWeight: 'normal',
      speak: 'none'
    },
    fontFace: {
      fontFamily: "\"FabricMDL2Icons-9\"",
      src: "url('" + baseUrl + "fabric-icons-9-88060b8a.woff') format('woff')"
    },
    icons: {
      Trophy2: '\uF1AE',
      BucketColor: '\uF1B6',
      BucketColorFill: '\uF1B7',
      Taskboard: '\uF1C2',
      SingleColumn: '\uF1D3',
      DoubleColumn: '\uF1D4',
      TripleColumn: '\uF1D5',
      ColumnLeftTwoThirds: '\uF1D6',
      ColumnRightTwoThirds: '\uF1D7',
      AccessLogoFill: '\uF1DB',
      AnalyticsLogo: '\uF1DE',
      AnalyticsQuery: '\uF1DF',
      NewAnalyticsQuery: '\uF1E0',
      AnalyticsReport: '\uF1E1',
      WordLogo: '\uF1E3',
      WordLogoFill: '\uF1E4',
      ExcelLogo: '\uF1E5',
      ExcelLogoFill: '\uF1E6',
      OneNoteLogo: '\uF1E7',
      OneNoteLogoFill: '\uF1E8',
      OutlookLogo: '\uF1E9',
      OutlookLogoFill: '\uF1EA',
      PowerPointLogo: '\uF1EB',
      PowerPointLogoFill: '\uF1EC',
      PublisherLogo: '\uF1ED',
      PublisherLogoFill: '\uF1EE',
      ScheduleEventAction: '\uF1EF',
      FlameSolid: '\uF1F3',
      ServerProcesses: '\uF1FE',
      Server: '\uF201',
      SaveAll: '\uF203',
      LinkedInLogo: '\uF20A',
      Decimals: '\uF218',
      SidePanelMirrored: '\uF221',
      ProtectRestrict: '\uF22A',
      Blog: '\uF22B',
      UnknownMirrored: '\uF22E',
      PublicContactCardMirrored: '\uF230',
      GridViewSmall: '\uF232',
      GridViewMedium: '\uF233',
      GridViewLarge: '\uF234',
      Step: '\uF241',
      StepInsert: '\uF242',
      StepShared: '\uF243',
      StepSharedAdd: '\uF244',
      StepSharedInsert: '\uF245',
      ViewDashboard: '\uF246',
      ViewList: '\uF247',
      ViewListGroup: '\uF248',
      ViewListTree: '\uF249',
      TriggerAuto: '\uF24A',
      TriggerUser: '\uF24B',
      PivotChart: '\uF24C',
      StackedBarChart: '\uF24D',
      StackedLineChart: '\uF24E',
      BuildQueue: '\uF24F',
      BuildQueueNew: '\uF250',
      UserFollowed: '\uF25C',
      ContactLink: '\uF25F',
      Stack: '\uF26F',
      Bullseye: '\uF272',
      VennDiagram: '\uF273',
      FiveTileGrid: '\uF274',
      FocalPoint: '\uF277',
      RingerRemove: '\uF279',
      TeamsLogoInverse: '\uF27A',
      TeamsLogo: '\uF27B',
      TeamsLogoFill: '\uF27C',
      SkypeForBusinessLogoFill: '\uF27D',
      SharepointLogo: '\uF27E',
      SharepointLogoFill: '\uF27F',
      DelveLogo: '\uF280',
      DelveLogoFill: '\uF281',
      OfficeVideoLogo: '\uF282',
      OfficeVideoLogoFill: '\uF283',
      ExchangeLogo: '\uF284',
      ExchangeLogoFill: '\uF285',
      Signin: '\uF286',
      DocumentApproval: '\uF28B',
      CloneToDesktop: '\uF28C',
      InstallToDrive: '\uF28D',
      Blur: '\uF28E',
      Build: '\uF28F',
      ProcessMetaTask: '\uF290',
      BranchFork2: '\uF291',
      BranchLocked: '\uF292',
      BranchCommit: '\uF293',
      BranchCompare: '\uF294',
      BranchMerge: '\uF295',
      BranchPullRequest: '\uF296',
      BranchSearch: '\uF297',
      BranchShelveset: '\uF298',
      RawSource: '\uF299',
      MergeDuplicate: '\uF29A',
      RowsGroup: '\uF29B',
      RowsChild: '\uF29C',
      Deploy: '\uF29D',
      Redeploy: '\uF29E',
      ServerEnviroment: '\uF29F',
      VisioDiagram: '\uF2A0'
    }
  };
  (0, _styling.registerIcons)(subset, options);
}
},{"@uifabric/styling":"Dytz"}],"FHQZ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.initializeIcons = initializeIcons;

var _styling = require("@uifabric/styling");

// Your use of the content in the files referenced here is subject to the terms of the license at https://aka.ms/fabric-assets-license
// tslint:disable:max-line-length
function initializeIcons(baseUrl, options) {
  if (baseUrl === void 0) {
    baseUrl = '';
  }

  var subset = {
    style: {
      MozOsxFontSmoothing: 'grayscale',
      WebkitFontSmoothing: 'antialiased',
      fontStyle: 'normal',
      fontWeight: 'normal',
      speak: 'none'
    },
    fontFace: {
      fontFamily: "\"FabricMDL2Icons-10\"",
      src: "url('" + baseUrl + "fabric-icons-10-1ca3e4a1.woff') format('woff')"
    },
    icons: {
      HighlightMappedShapes: '\uF2A1',
      TextCallout: '\uF2A2',
      IconSetsFlag: '\uF2A4',
      VisioLogo: '\uF2A7',
      VisioLogoFill: '\uF2A8',
      VisioDocument: '\uF2A9',
      TimelineProgress: '\uF2AA',
      TimelineDelivery: '\uF2AB',
      Backlog: '\uF2AC',
      TeamFavorite: '\uF2AD',
      TaskGroup: '\uF2AE',
      TaskGroupMirrored: '\uF2AF',
      ScopeTemplate: '\uF2B0',
      AssessmentGroupTemplate: '\uF2B1',
      NewTeamProject: '\uF2B2',
      CommentAdd: '\uF2B3',
      CommentNext: '\uF2B4',
      CommentPrevious: '\uF2B5',
      ShopServer: '\uF2B6',
      LocaleLanguage: '\uF2B7',
      QueryList: '\uF2B8',
      UserSync: '\uF2B9',
      UserPause: '\uF2BA',
      StreamingOff: '\uF2BB',
      ArrowTallUpLeft: '\uF2BD',
      ArrowTallUpRight: '\uF2BE',
      ArrowTallDownLeft: '\uF2BF',
      ArrowTallDownRight: '\uF2C0',
      FieldEmpty: '\uF2C1',
      FieldFilled: '\uF2C2',
      FieldChanged: '\uF2C3',
      FieldNotChanged: '\uF2C4',
      RingerOff: '\uF2C5',
      PlayResume: '\uF2C6',
      BulletedList2: '\uF2C7',
      BulletedList2Mirrored: '\uF2C8',
      ImageCrosshair: '\uF2C9',
      GitGraph: '\uF2CA',
      Repo: '\uF2CB',
      RepoSolid: '\uF2CC',
      FolderQuery: '\uF2CD',
      FolderList: '\uF2CE',
      FolderListMirrored: '\uF2CF',
      LocationOutline: '\uF2D0',
      POISolid: '\uF2D1',
      CalculatorNotEqualTo: '\uF2D2',
      BoxSubtractSolid: '\uF2D3',
      BoxAdditionSolid: '\uF2D4',
      BoxMultiplySolid: '\uF2D5',
      BoxPlaySolid: '\uF2D6',
      BoxCheckmarkSolid: '\uF2D7',
      CirclePauseSolid: '\uF2D8',
      CirclePause: '\uF2D9',
      MSNVideosSolid: '\uF2DA',
      CircleStopSolid: '\uF2DB',
      CircleStop: '\uF2DC',
      NavigateBack: '\uF2DD',
      NavigateBackMirrored: '\uF2DE',
      NavigateForward: '\uF2DF',
      NavigateForwardMirrored: '\uF2E0',
      UnknownSolid: '\uF2E1',
      UnknownMirroredSolid: '\uF2E2',
      CircleAddition: '\uF2E3',
      CircleAdditionSolid: '\uF2E4',
      FilePDB: '\uF2E5',
      FileTemplate: '\uF2E6',
      FileSQL: '\uF2E7',
      FileJAVA: '\uF2E8',
      FileASPX: '\uF2E9',
      FileCSS: '\uF2EA',
      FileSass: '\uF2EB',
      FileLess: '\uF2EC',
      FileHTML: '\uF2ED',
      JavaScriptLanguage: '\uF2EE',
      CSharpLanguage: '\uF2EF',
      CSharp: '\uF2F0',
      VisualBasicLanguage: '\uF2F1',
      VB: '\uF2F2',
      CPlusPlusLanguage: '\uF2F3',
      CPlusPlus: '\uF2F4',
      FSharpLanguage: '\uF2F5',
      FSharp: '\uF2F6',
      TypeScriptLanguage: '\uF2F7',
      PythonLanguage: '\uF2F8',
      PY: '\uF2F9',
      CoffeeScript: '\uF2FA',
      MarkDownLanguage: '\uF2FB',
      FullWidth: '\uF2FE',
      FullWidthEdit: '\uF2FF',
      Plug: '\uF300',
      PlugSolid: '\uF301',
      PlugConnected: '\uF302',
      PlugDisconnected: '\uF303',
      UnlockSolid: '\uF304',
      Variable: '\uF305',
      Parameter: '\uF306',
      CommentUrgent: '\uF307',
      Storyboard: '\uF308',
      DiffInline: '\uF309',
      DiffSideBySide: '\uF30A'
    }
  };
  (0, _styling.registerIcons)(subset, options);
}
},{"@uifabric/styling":"Dytz"}],"O0H4":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.initializeIcons = initializeIcons;

var _styling = require("@uifabric/styling");

// Your use of the content in the files referenced here is subject to the terms of the license at https://aka.ms/fabric-assets-license
// tslint:disable:max-line-length
function initializeIcons(baseUrl, options) {
  if (baseUrl === void 0) {
    baseUrl = '';
  }

  var subset = {
    style: {
      MozOsxFontSmoothing: 'grayscale',
      WebkitFontSmoothing: 'antialiased',
      fontStyle: 'normal',
      fontWeight: 'normal',
      speak: 'none'
    },
    fontFace: {
      fontFamily: "\"FabricMDL2Icons-11\"",
      src: "url('" + baseUrl + "fabric-icons-11-93bad8ee.woff') format('woff')"
    },
    icons: {
      ImageDiff: '\uF30B',
      ImagePixel: '\uF30C',
      FileBug: '\uF30D',
      FileCode: '\uF30E',
      FileComment: '\uF30F',
      BusinessHoursSign: '\uF310',
      FileImage: '\uF311',
      FileSymlink: '\uF312',
      AutoFillTemplate: '\uF313',
      WorkItem: '\uF314',
      WorkItemBug: '\uF315',
      LogRemove: '\uF316',
      ColumnOptions: '\uF317',
      Packages: '\uF318',
      BuildIssue: '\uF319',
      AssessmentGroup: '\uF31A',
      VariableGroup: '\uF31B',
      FullHistory: '\uF31C',
      SingleColumnEdit: '\uF321',
      DoubleColumnEdit: '\uF322',
      TripleColumnEdit: '\uF323',
      ColumnLeftTwoThirdsEdit: '\uF324',
      ColumnRightTwoThirdsEdit: '\uF325',
      StreamLogo: '\uF329',
      PassiveAuthentication: '\uF32A',
      AlertSolid: '\uF331',
      MegaphoneSolid: '\uF332',
      TaskSolid: '\uF333',
      ConfigurationSolid: '\uF334',
      BugSolid: '\uF335',
      CrownSolid: '\uF336',
      Trophy2Solid: '\uF337',
      QuickNoteSolid: '\uF338',
      ConstructionConeSolid: '\uF339',
      PageListSolid: '\uF33A',
      PageListMirroredSolid: '\uF33B',
      StarburstSolid: '\uF33C',
      ReadingModeSolid: '\uF33D',
      SadSolid: '\uF33E',
      HealthSolid: '\uF33F',
      ShieldSolid: '\uF340',
      GiftBoxSolid: '\uF341',
      ShoppingCartSolid: '\uF342',
      MailSolid: '\uF343',
      ChatSolid: '\uF344',
      RibbonSolid: '\uF345',
      FinancialSolid: '\uF346',
      FinancialMirroredSolid: '\uF347',
      HeadsetSolid: '\uF348',
      PermissionsSolid: '\uF349',
      ParkingSolid: '\uF34A',
      ParkingMirroredSolid: '\uF34B',
      DiamondSolid: '\uF34C',
      AsteriskSolid: '\uF34D',
      OfflineStorageSolid: '\uF34E',
      BankSolid: '\uF34F',
      DecisionSolid: '\uF350',
      Parachute: '\uF351',
      ParachuteSolid: '\uF352',
      FiltersSolid: '\uF353',
      ColorSolid: '\uF354',
      ReviewSolid: '\uF355',
      ReviewRequestSolid: '\uF356',
      ReviewRequestMirroredSolid: '\uF357',
      ReviewResponseSolid: '\uF358',
      FeedbackRequestSolid: '\uF359',
      FeedbackRequestMirroredSolid: '\uF35A',
      FeedbackResponseSolid: '\uF35B',
      WorkItemBar: '\uF35C',
      WorkItemBarSolid: '\uF35D',
      Separator: '\uF35E',
      NavigateExternalInline: '\uF35F',
      PlanView: '\uF360',
      TimelineMatrixView: '\uF361',
      EngineeringGroup: '\uF362',
      ProjectCollection: '\uF363',
      CaretBottomRightCenter8: '\uF364',
      CaretBottomLeftCenter8: '\uF365',
      CaretTopRightCenter8: '\uF366',
      CaretTopLeftCenter8: '\uF367',
      DonutChart: '\uF368',
      ChevronUnfold10: '\uF369',
      ChevronFold10: '\uF36A',
      DoubleChevronDown8: '\uF36B',
      DoubleChevronUp8: '\uF36C',
      DoubleChevronLeft8: '\uF36D',
      DoubleChevronRight8: '\uF36E',
      ChevronDownEnd6: '\uF36F',
      ChevronUpEnd6: '\uF370',
      ChevronLeftEnd6: '\uF371',
      ChevronRightEnd6: '\uF372',
      ContextMenu: '\uF37C',
      AzureAPIManagement: '\uF37F',
      AzureServiceEndpoint: '\uF380',
      VSTSLogo: '\uF381',
      VSTSAltLogo1: '\uF382',
      VSTSAltLogo2: '\uF383',
      FileTypeSolution: '\uF387',
      WordLogoInverse16: '\uF390',
      WordLogo16: '\uF391'
    }
  };
  (0, _styling.registerIcons)(subset, options);
}
},{"@uifabric/styling":"Dytz"}],"ph7c":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.initializeIcons = initializeIcons;

var _styling = require("@uifabric/styling");

// Your use of the content in the files referenced here is subject to the terms of the license at https://aka.ms/fabric-assets-license
// tslint:disable:max-line-length
function initializeIcons(baseUrl, options) {
  if (baseUrl === void 0) {
    baseUrl = '';
  }

  var subset = {
    style: {
      MozOsxFontSmoothing: 'grayscale',
      WebkitFontSmoothing: 'antialiased',
      fontStyle: 'normal',
      fontWeight: 'normal',
      speak: 'none'
    },
    fontFace: {
      fontFamily: "\"FabricMDL2Icons-12\"",
      src: "url('" + baseUrl + "fabric-icons-12-d9534567.woff') format('woff')"
    },
    icons: {
      WordLogoFill16: '\uF392',
      PowerPointLogoInverse16: '\uF393',
      PowerPointLogo16: '\uF394',
      PowerPointLogoFill16: '\uF395',
      ExcelLogoInverse16: '\uF396',
      ExcelLogo16: '\uF397',
      ExcelLogoFill16: '\uF398',
      OneNoteLogoInverse16: '\uF399',
      OneNoteLogo16: '\uF39A',
      OneNoteLogoFill16: '\uF39B',
      OutlookLogoInverse16: '\uF39C',
      OutlookLogo16: '\uF39D',
      OutlookLogoFill16: '\uF39E',
      PublisherLogoInverse16: '\uF39F',
      PublisherLogo16: '\uF3A0',
      PublisherLogoFill16: '\uF3A1',
      VisioLogoInverse16: '\uF3A2',
      VisioLogo16: '\uF3A3',
      VisioLogoFill16: '\uF3A4',
      TestBeaker: '\uF3A5',
      TestBeakerSolid: '\uF3A6',
      TestExploreSolid: '\uF3A7',
      TestAutoSolid: '\uF3A8',
      TestUserSolid: '\uF3A9',
      TestImpactSolid: '\uF3AA',
      TestPlan: '\uF3AB',
      TestStep: '\uF3AC',
      TestParameter: '\uF3AD',
      TestSuite: '\uF3AE',
      TestCase: '\uF3AF',
      Sprint: '\uF3B0',
      SignOut: '\uF3B1',
      TriggerApproval: '\uF3B2',
      Rocket: '\uF3B3',
      AzureKeyVault: '\uF3B4',
      Onboarding: '\uF3BA',
      Transition: '\uF3BC',
      LikeSolid: '\uF3BF',
      DislikeSolid: '\uF3C0',
      CRMCustomerInsightsApp: '\uF3C8',
      EditCreate: '\uF3C9',
      UnSetColor: '\uF3F9',
      DeclineCall: '\uF405',
      RectangularClipping: '\uF407',
      TeamsLogo16: '\uF40A',
      TeamsLogoFill16: '\uF40B',
      Spacer: '\uF40D',
      SkypeLogo16: '\uF40E',
      SkypeForBusinessLogo16: '\uF40F',
      SkypeForBusinessLogoFill16: '\uF410',
      FilterSolid: '\uF412',
      MailUndelivered: '\uF415',
      MailTentative: '\uF416',
      MailTentativeMirrored: '\uF417',
      MailReminder: '\uF418',
      ReceiptUndelivered: '\uF419',
      ReceiptTentative: '\uF41A',
      ReceiptTentativeMirrored: '\uF41B',
      Inbox: '\uF41C',
      IRMReply: '\uF41D',
      IRMReplyMirrored: '\uF41E',
      IRMForward: '\uF41F',
      IRMForwardMirrored: '\uF420',
      VoicemailIRM: '\uF421',
      EventAccepted: '\uF422',
      EventTentative: '\uF423',
      EventTentativeMirrored: '\uF424',
      EventDeclined: '\uF425',
      IDBadge: '\uF427',
      BackgroundColor: '\uF42B',
      OfficeFormsLogoInverse16: '\uF433',
      OfficeFormsLogo: '\uF434',
      OfficeFormsLogoFill: '\uF435',
      OfficeFormsLogo16: '\uF436',
      OfficeFormsLogoFill16: '\uF437',
      OfficeFormsLogoInverse24: '\uF43A',
      OfficeFormsLogo24: '\uF43B',
      OfficeFormsLogoFill24: '\uF43C',
      PageLock: '\uF43F',
      NotExecuted: '\uF440',
      NotImpactedSolid: '\uF441',
      FieldReadOnly: '\uF442',
      FieldRequired: '\uF443',
      BacklogBoard: '\uF444',
      ExternalBuild: '\uF445',
      ExternalTFVC: '\uF446',
      ExternalXAML: '\uF447',
      IssueSolid: '\uF448',
      DefectSolid: '\uF449',
      LadybugSolid: '\uF44A',
      NugetLogo: '\uF44C',
      TFVCLogo: '\uF44D',
      ProjectLogo32: '\uF47E',
      ProjectLogoFill32: '\uF47F',
      ProjectLogo16: '\uF480',
      ProjectLogoFill16: '\uF481',
      SwayLogo32: '\uF482',
      SwayLogoFill32: '\uF483',
      SwayLogo16: '\uF484',
      SwayLogoFill16: '\uF485'
    }
  };
  (0, _styling.registerIcons)(subset, options);
}
},{"@uifabric/styling":"Dytz"}],"AdrH":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.initializeIcons = initializeIcons;

var _styling = require("@uifabric/styling");

// Your use of the content in the files referenced here is subject to the terms of the license at https://aka.ms/fabric-assets-license
// tslint:disable:max-line-length
function initializeIcons(baseUrl, options) {
  if (baseUrl === void 0) {
    baseUrl = '';
  }

  var subset = {
    style: {
      MozOsxFontSmoothing: 'grayscale',
      WebkitFontSmoothing: 'antialiased',
      fontStyle: 'normal',
      fontWeight: 'normal',
      speak: 'none'
    },
    fontFace: {
      fontFamily: "\"FabricMDL2Icons-13\"",
      src: "url('" + baseUrl + "fabric-icons-13-0b48c801.woff') format('woff')"
    },
    icons: {
      ClassNotebookLogo32: '\uF486',
      ClassNotebookLogoFill32: '\uF487',
      ClassNotebookLogo16: '\uF488',
      ClassNotebookLogoFill16: '\uF489',
      ClassNotebookLogoInverse32: '\uF48A',
      ClassNotebookLogoInverse16: '\uF48B',
      StaffNotebookLogo32: '\uF48C',
      StaffNotebookLogoFill32: '\uF48D',
      StaffNotebookLogo16: '\uF48E',
      StaffNotebookLogoFill16: '\uF48F',
      StaffNotebookLogoInverted32: '\uF490',
      StaffNotebookLogoInverted16: '\uF491',
      KaizalaLogo: '\uF492',
      TaskLogo: '\uF493',
      ProtectionCenterLogo32: '\uF494',
      GallatinLogo: '\uF496',
      Globe2: '\uF49A',
      Guitar: '\uF49B',
      Breakfast: '\uF49C',
      Brunch: '\uF49D',
      BeerMug: '\uF49E',
      Vacation: '\uF49F',
      Teeth: '\uF4A0',
      Taxi: '\uF4A1',
      Chopsticks: '\uF4A2',
      SyncOccurence: '\uF4A3',
      UnsyncOccurence: '\uF4A4',
      GIF: '\uF4A9',
      PrimaryCalendar: '\uF4AE',
      SearchCalendar: '\uF4AF',
      VideoOff: '\uF4B0',
      MicrosoftFlowLogo: '\uF4B1',
      BusinessCenterLogo: '\uF4B2',
      ToDoLogoBottom: '\uF4B3',
      ToDoLogoTop: '\uF4B4',
      EditSolid12: '\uF4B5',
      EditSolidMirrored12: '\uF4B6',
      UneditableSolid12: '\uF4B7',
      UneditableSolidMirrored12: '\uF4B8',
      UneditableMirrored: '\uF4B9',
      AdminALogo32: '\uF4BA',
      AdminALogoFill32: '\uF4BB',
      ToDoLogoInverse: '\uF4BC',
      Snooze: '\uF4BD',
      WaffleOffice365: '\uF4E0',
      ImageSearch: '\uF4E8',
      NewsSearch: '\uF4E9',
      VideoSearch: '\uF4EA',
      R: '\uF4EB',
      FontColorA: '\uF4EC',
      FontColorSwatch: '\uF4ED',
      LightWeight: '\uF4EE',
      NormalWeight: '\uF4EF',
      SemiboldWeight: '\uF4F0',
      GroupObject: '\uF4F1',
      UngroupObject: '\uF4F2',
      AlignHorizontalLeft: '\uF4F3',
      AlignHorizontalCenter: '\uF4F4',
      AlignHorizontalRight: '\uF4F5',
      AlignVerticalTop: '\uF4F6',
      AlignVerticalCenter: '\uF4F7',
      AlignVerticalBottom: '\uF4F8',
      HorizontalDistributeCenter: '\uF4F9',
      VerticalDistributeCenter: '\uF4FA',
      Ellipse: '\uF4FB',
      Line: '\uF4FC',
      Octagon: '\uF4FD',
      Hexagon: '\uF4FE',
      Pentagon: '\uF4FF',
      RightTriangle: '\uF500',
      HalfCircle: '\uF501',
      QuarterCircle: '\uF502',
      ThreeQuarterCircle: '\uF503',
      '6PointStar': '\uF504',
      '12PointStar': '\uF505',
      ArrangeBringToFront: '\uF506',
      ArrangeSendToBack: '\uF507',
      ArrangeSendBackward: '\uF508',
      ArrangeBringForward: '\uF509',
      BorderDash: '\uF50A',
      BorderDot: '\uF50B',
      LineStyle: '\uF50C',
      LineThickness: '\uF50D',
      WindowEdit: '\uF50E',
      HintText: '\uF50F',
      MediaAdd: '\uF510',
      AnchorLock: '\uF511',
      AutoHeight: '\uF512',
      ChartSeries: '\uF513',
      ChartXAngle: '\uF514',
      ChartYAngle: '\uF515',
      Combobox: '\uF516',
      LineSpacing: '\uF517',
      Padding: '\uF518',
      PaddingTop: '\uF519',
      PaddingBottom: '\uF51A',
      PaddingLeft: '\uF51B',
      PaddingRight: '\uF51C',
      NavigationFlipper: '\uF51D',
      AlignJustify: '\uF51E'
    }
  };
  (0, _styling.registerIcons)(subset, options);
}
},{"@uifabric/styling":"Dytz"}],"wtHp":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.initializeIcons = initializeIcons;

var _styling = require("@uifabric/styling");

// Your use of the content in the files referenced here is subject to the terms of the license at https://aka.ms/fabric-assets-license
// tslint:disable:max-line-length
function initializeIcons(baseUrl, options) {
  if (baseUrl === void 0) {
    baseUrl = '';
  }

  var subset = {
    style: {
      MozOsxFontSmoothing: 'grayscale',
      WebkitFontSmoothing: 'antialiased',
      fontStyle: 'normal',
      fontWeight: 'normal',
      speak: 'none'
    },
    fontFace: {
      fontFamily: "\"FabricMDL2Icons-14\"",
      src: "url('" + baseUrl + "fabric-icons-14-9a8324a9.woff') format('woff')"
    },
    icons: {
      TextOverflow: '\uF51F',
      VisualsFolder: '\uF520',
      VisualsStore: '\uF521',
      PictureCenter: '\uF522',
      PictureFill: '\uF523',
      PicturePosition: '\uF524',
      PictureStretch: '\uF525',
      PictureTile: '\uF526',
      Slider: '\uF527',
      SliderHandleSize: '\uF528',
      DefaultRatio: '\uF529',
      NumberSequence: '\uF52A',
      GUID: '\uF52B',
      ReportAdd: '\uF52C',
      DashboardAdd: '\uF52D',
      MapPinSolid: '\uF52E',
      WebPublish: '\uF52F',
      PieSingleSolid: '\uF530',
      BlockedSolid: '\uF531',
      DrillDown: '\uF532',
      DrillDownSolid: '\uF533',
      DrillExpand: '\uF534',
      DrillShow: '\uF535',
      SpecialEvent: '\uF536',
      OneDriveFolder16: '\uF53B',
      FunctionalManagerDashboard: '\uF542',
      BIDashboard: '\uF543',
      CodeEdit: '\uF544',
      RenewalCurrent: '\uF545',
      RenewalFuture: '\uF546',
      SplitObject: '\uF547',
      BulkUpload: '\uF548',
      DownloadDocument: '\uF549',
      Flower: '\uF54E',
      WaitlistConfirm: '\uF550',
      WaitlistConfirmMirrored: '\uF551',
      LaptopSecure: '\uF552',
      DragObject: '\uF553',
      EntryView: '\uF554',
      EntryDecline: '\uF555',
      ContactCardSettings: '\uF556',
      ContactCardSettingsMirrored: '\uF557',
      CalendarSettings: '\uF558',
      CalendarSettingsMirrored: '\uF559',
      HardDriveLock: '\uF55A',
      HardDriveUnlock: '\uF55B',
      AccountManagement: '\uF55C',
      TransitionPop: '\uF5B2',
      TransitionPush: '\uF5B3',
      TransitionEffect: '\uF5B4',
      LookupEntities: '\uF5B5',
      ExploreData: '\uF5B6',
      AddBookmark: '\uF5B7',
      SearchBookmark: '\uF5B8',
      DrillThrough: '\uF5B9',
      MasterDatabase: '\uF5BA',
      CertifiedDatabase: '\uF5BB',
      MaximumValue: '\uF5BC',
      MinimumValue: '\uF5BD',
      VisualStudioIDELogo32: '\uF5D0',
      PasteAsText: '\uF5D5',
      PasteAsCode: '\uF5D6',
      BrowserTab: '\uF5D7',
      BrowserTabScreenshot: '\uF5D8',
      DesktopScreenshot: '\uF5D9',
      FileYML: '\uF5DA',
      ClipboardSolid: '\uF5DC',
      FabricUserFolder: '\uF5E5',
      FabricNetworkFolder: '\uF5E6',
      AnalyticsView: '\uF5F1',
      Video360Generic: '\uF609',
      Leave: '\uF627',
      Trending12: '\uF62D',
      Blocked12: '\uF62E',
      Warning12: '\uF62F',
      CheckedOutByOther12: '\uF630',
      CheckedOutByYou12: '\uF631',
      CircleShapeSolid: '\uF63C',
      SquareShapeSolid: '\uF63D',
      TriangleShapeSolid: '\uF63E',
      DropShapeSolid: '\uF63F',
      RectangleShapeSolid: '\uF640',
      ZoomToFit: '\uF649',
      InsertColumnsLeft: '\uF64A',
      InsertColumnsRight: '\uF64B',
      InsertRowsAbove: '\uF64C',
      InsertRowsBelow: '\uF64D',
      DeleteColumns: '\uF64E',
      DeleteRows: '\uF64F',
      DeleteRowsMirrored: '\uF650',
      DeleteTable: '\uF651',
      AccountBrowser: '\uF652',
      VersionControlPush: '\uF664',
      StackedColumnChart2: '\uF666',
      TripleColumnWide: '\uF66E',
      QuadColumn: '\uF66F',
      WhiteBoardApp16: '\uF673',
      WhiteBoardApp32: '\uF674',
      InsertSignatureLine: '\uF677',
      ArrangeByFrom: '\uF678'
    }
  };
  (0, _styling.registerIcons)(subset, options);
}
},{"@uifabric/styling":"Dytz"}],"Ky0F":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.initializeIcons = initializeIcons;

var _styling = require("@uifabric/styling");

// Your use of the content in the files referenced here is subject to the terms of the license at https://aka.ms/fabric-assets-license
// tslint:disable:max-line-length
function initializeIcons(baseUrl, options) {
  if (baseUrl === void 0) {
    baseUrl = '';
  }

  var subset = {
    style: {
      MozOsxFontSmoothing: 'grayscale',
      WebkitFontSmoothing: 'antialiased',
      fontStyle: 'normal',
      fontWeight: 'normal',
      speak: 'none'
    },
    fontFace: {
      fontFamily: "\"FabricMDL2Icons-15\"",
      src: "url('" + baseUrl + "fabric-icons-15-65272067.woff') format('woff')"
    },
    icons: {
      Phishing: '\uF679',
      CreateMailRule: '\uF67A',
      PublishCourse: '\uF699',
      DictionaryRemove: '\uF69A',
      UserRemove: '\uF69B',
      UserEvent: '\uF69C',
      Encryption: '\uF69D',
      PasswordField: '\uF6AA',
      OpenInNewTab: '\uF6AB',
      Hide3: '\uF6AC',
      VerifiedBrandSolid: '\uF6AD',
      MarkAsProtected: '\uF6AE',
      AuthenticatorApp: '\uF6B1',
      WebTemplate: '\uF6B2',
      DefenderTVM: '\uF6B3',
      MedalSolid: '\uF6B9',
      D365TalentLearn: '\uF6BB',
      D365TalentInsight: '\uF6BC',
      D365TalentHRCore: '\uF6BD',
      BacklogList: '\uF6BF',
      ButtonControl: '\uF6C0',
      TableGroup: '\uF6D9',
      MountainClimbing: '\uF6DB',
      TagUnknown: '\uF6DF',
      TagUnknownMirror: '\uF6E0',
      TagUnknown12: '\uF6E1',
      TagUnknown12Mirror: '\uF6E2',
      Link12: '\uF6E3',
      Presentation: '\uF6E4',
      Presentation12: '\uF6E5',
      Lock12: '\uF6E6',
      BuildDefinition: '\uF6E9',
      ReleaseDefinition: '\uF6EA',
      SaveTemplate: '\uF6EC',
      UserGauge: '\uF6ED',
      BlockedSiteSolid12: '\uF70A',
      TagSolid: '\uF70E',
      OfficeChat: '\uF70F',
      OfficeChatSolid: '\uF710',
      MailSchedule: '\uF72E',
      WarningSolid: '\uF736',
      Blocked2Solid: '\uF737',
      SkypeCircleArrow: '\uF747',
      SkypeArrow: '\uF748',
      SyncStatus: '\uF751',
      SyncStatusSolid: '\uF752',
      ProjectDocument: '\uF759',
      ToDoLogoOutline: '\uF75B',
      VisioOnlineLogoFill32: '\uF75F',
      VisioOnlineLogo32: '\uF760',
      VisioOnlineLogoCloud32: '\uF761',
      VisioDiagramSync: '\uF762',
      Event12: '\uF763',
      EventDateMissed12: '\uF764',
      UserOptional: '\uF767',
      ResponsesMenu: '\uF768',
      DoubleDownArrow: '\uF769',
      DistributeDown: '\uF76A',
      BookmarkReport: '\uF76B',
      FilterSettings: '\uF76C',
      GripperDotsVertical: '\uF772',
      MailAttached: '\uF774',
      AddIn: '\uF775',
      LinkedDatabase: '\uF779',
      PromotedDatabase: '\uF77D',
      BarChartVerticalFilter: '\uF77E',
      BarChartVerticalFilterSolid: '\uF77F',
      MicrosoftTranslatorLogo: '\uF782',
      ShowTimeAs: '\uF787',
      FileRequest: '\uF789',
      WorkItemAlert: '\uF78F',
      PowerBILogo16: '\uF790',
      PowerBILogoBackplate16: '\uF791',
      BulletedListText: '\uF792',
      BulletedListBullet: '\uF793',
      BulletedListTextMirrored: '\uF794',
      BulletedListBulletMirrored: '\uF795',
      NumberedListText: '\uF796',
      NumberedListNumber: '\uF797',
      NumberedListTextMirrored: '\uF798',
      NumberedListNumberMirrored: '\uF799',
      RemoveLinkChain: '\uF79A',
      RemoveLinkX: '\uF79B',
      FabricTextHighlight: '\uF79C',
      ClearFormattingA: '\uF79D',
      ClearFormattingEraser: '\uF79E',
      Photo2Fill: '\uF79F',
      IncreaseIndentText: '\uF7A0',
      IncreaseIndentArrow: '\uF7A1',
      DecreaseIndentText: '\uF7A2',
      DecreaseIndentArrow: '\uF7A3',
      IncreaseIndentTextMirrored: '\uF7A4',
      IncreaseIndentArrowMirrored: '\uF7A5',
      DecreaseIndentTextMirrored: '\uF7A6',
      DecreaseIndentArrowMirrored: '\uF7A7',
      CheckListText: '\uF7A8',
      CheckListCheck: '\uF7A9',
      CheckListTextMirrored: '\uF7AA',
      CheckListCheckMirrored: '\uF7AB',
      NumberSymbol: '\uF7AC'
    }
  };
  (0, _styling.registerIcons)(subset, options);
}
},{"@uifabric/styling":"Dytz"}],"CJEm":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.initializeIcons = initializeIcons;

var _styling = require("@uifabric/styling");

// Your use of the content in the files referenced here is subject to the terms of the license at https://aka.ms/fabric-assets-license
// tslint:disable:max-line-length
function initializeIcons(baseUrl, options) {
  if (baseUrl === void 0) {
    baseUrl = '';
  }

  var subset = {
    style: {
      MozOsxFontSmoothing: 'grayscale',
      WebkitFontSmoothing: 'antialiased',
      fontStyle: 'normal',
      fontWeight: 'normal',
      speak: 'none'
    },
    fontFace: {
      fontFamily: "\"FabricMDL2Icons-16\"",
      src: "url('" + baseUrl + "fabric-icons-16-dff5b9a6.woff') format('woff')"
    },
    icons: {
      Coupon: '\uF7BC',
      VerifiedBrand: '\uF7BD',
      ReleaseGate: '\uF7BE',
      ReleaseGateCheck: '\uF7BF',
      ReleaseGateError: '\uF7C0',
      M365InvoicingLogo: '\uF7C1',
      FabricTextHighlightComposite: '\uF7DA',
      Dataflows: '\uF7DD',
      GenericScanFilled: '\uF7DE',
      DiagnosticDataBarTooltip: '\uF7DF',
      SaveToMobile: '\uF7E0',
      Orientation2: '\uF7E1',
      ScreenCast: '\uF7E2',
      ShowGrid: '\uF7E3',
      SnapToGrid: '\uF7E4',
      ContactList: '\uF7E5',
      NewMail: '\uF7EA',
      EyeShadow: '\uF7EB',
      FabricFolderConfirm: '\uF7FF',
      InformationBarriers: '\uF803',
      CommentActive: '\uF804',
      ColumnVerticalSectionEdit: '\uF806',
      WavingHand: '\uF807',
      ShakeDevice: '\uF80A',
      SmartGlassRemote: '\uF80B',
      Rotate90Clockwise: '\uF80D',
      Rotate90CounterClockwise: '\uF80E',
      CampaignTemplate: '\uF811',
      ChartTemplate: '\uF812',
      PageListFilter: '\uF813',
      SecondaryNav: '\uF814',
      ColumnVerticalSection: '\uF81E',
      SkypeCircleSlash: '\uF825',
      SkypeSlash: '\uF826',
      CustomizeToolbar: '\uF828',
      DuplicateRow: '\uF82A',
      RemoveFromTrash: '\uF82B',
      MailOptions: '\uF82C',
      Childof: '\uF82D',
      Footer: '\uF82E',
      Header: '\uF82F',
      BarChartVerticalFill: '\uF830',
      StackedColumnChart2Fill: '\uF831',
      PlainText: '\uF834',
      AccessibiltyChecker: '\uF835',
      DatabaseSync: '\uF842',
      ReservationOrders: '\uF845',
      TabOneColumn: '\uF849',
      TabTwoColumn: '\uF84A',
      TabThreeColumn: '\uF84B',
      MicrosoftTranslatorLogoGreen: '\uF852',
      MicrosoftTranslatorLogoBlue: '\uF853',
      InternalInvestigation: '\uF854',
      AppleTVPlay: '\uF859',
      AppleTVMonitor: '\uF85A',
      AppleTVMicrophone: '\uF85B',
      AppleTVMenu: '\uF85C',
      AddReaction: '\uF85D',
      DecreaseIndentLegacy: '\uE290',
      IncreaseIndentLegacy: '\uE291',
      SizeLegacy: '\uE2B2'
    }
  };
  (0, _styling.registerIcons)(subset, options);
}
},{"@uifabric/styling":"Dytz"}],"XjOM":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.registerIconAliases = void 0;

var _styling = require("@uifabric/styling");

var registerIconAliases = function () {
  (0, _styling.registerIconAlias)('trash', 'delete');
  (0, _styling.registerIconAlias)('onedrive', 'onedrivelogo');
  (0, _styling.registerIconAlias)('alertsolid12', 'eventdatemissed12');
  (0, _styling.registerIconAlias)('sixpointstar', '6pointstar');
  (0, _styling.registerIconAlias)('twelvepointstar', '12pointstar');
  (0, _styling.registerIconAlias)('toggleon', 'toggleleft');
  (0, _styling.registerIconAlias)('toggleoff', 'toggleright');
};

exports.registerIconAliases = registerIconAliases;
var _default = registerIconAliases;
exports.default = _default;
},{"@uifabric/styling":"Dytz"}],"fHGY":[function(require,module,exports) {
"use strict";

var _setVersion = require("@uifabric/set-version");

// @uifabric/icons@6.5.4
// Do not modify this file, the file is generated as part of publish. The checked in version is a placeholder only.
(0, _setVersion.setVersion)('@uifabric/icons', '6.5.4');
},{"@uifabric/set-version":"c7t6"}],"uYgI":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.initializeIcons = initializeIcons;

var _fabricIcons = require("./fabric-icons");

var _fabricIcons2 = require("./fabric-icons-0");

var _fabricIcons3 = require("./fabric-icons-1");

var _fabricIcons4 = require("./fabric-icons-2");

var _fabricIcons5 = require("./fabric-icons-3");

var _fabricIcons6 = require("./fabric-icons-4");

var _fabricIcons7 = require("./fabric-icons-5");

var _fabricIcons8 = require("./fabric-icons-6");

var _fabricIcons9 = require("./fabric-icons-7");

var _fabricIcons10 = require("./fabric-icons-8");

var _fabricIcons11 = require("./fabric-icons-9");

var _fabricIcons12 = require("./fabric-icons-10");

var _fabricIcons13 = require("./fabric-icons-11");

var _fabricIcons14 = require("./fabric-icons-12");

var _fabricIcons15 = require("./fabric-icons-13");

var _fabricIcons16 = require("./fabric-icons-14");

var _fabricIcons17 = require("./fabric-icons-15");

var _fabricIcons18 = require("./fabric-icons-16");

var _iconAliases = require("./iconAliases");

require("./version");

var DEFAULT_BASE_URL = 'https://spoprod-a.akamaihd.net/files/fabric/assets/icons/';

function initializeIcons(baseUrl, options) {
  if (baseUrl === void 0) {
    baseUrl = DEFAULT_BASE_URL;
  }

  [_fabricIcons.initializeIcons, _fabricIcons2.initializeIcons, _fabricIcons3.initializeIcons, _fabricIcons4.initializeIcons, _fabricIcons5.initializeIcons, _fabricIcons6.initializeIcons, _fabricIcons7.initializeIcons, _fabricIcons8.initializeIcons, _fabricIcons9.initializeIcons, _fabricIcons10.initializeIcons, _fabricIcons11.initializeIcons, _fabricIcons12.initializeIcons, _fabricIcons13.initializeIcons, _fabricIcons14.initializeIcons, _fabricIcons15.initializeIcons, _fabricIcons16.initializeIcons, _fabricIcons17.initializeIcons, _fabricIcons18.initializeIcons].forEach(function (initialize) {
    return initialize(baseUrl, options);
  });
  (0, _iconAliases.registerIconAliases)();
}
},{"./fabric-icons":"VKFL","./fabric-icons-0":"XepD","./fabric-icons-1":"UqUM","./fabric-icons-2":"c18W","./fabric-icons-3":"nDOI","./fabric-icons-4":"vJR8","./fabric-icons-5":"wbtx","./fabric-icons-6":"iPrz","./fabric-icons-7":"Wmt1","./fabric-icons-8":"XSxG","./fabric-icons-9":"uMFj","./fabric-icons-10":"FHQZ","./fabric-icons-11":"O0H4","./fabric-icons-12":"ph7c","./fabric-icons-13":"AdrH","./fabric-icons-14":"wtHp","./fabric-icons-15":"Ky0F","./fabric-icons-16":"CJEm","./iconAliases":"XjOM","./version":"fHGY"}],"VgAP":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _icons = require("@uifabric/icons");

Object.keys(_icons).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _icons[key];
    }
  });
});
},{"@uifabric/icons":"uYgI"}],"kN8Z":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.SliderBase = exports.ONKEYDOWN_TIMEOUT_DURATION = exports.ValuePosition = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Utilities = require("../../Utilities");

var _Label = require("../../Label");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * @deprecated Unused.
 */
var ValuePosition;
exports.ValuePosition = ValuePosition;

(function (ValuePosition) {
  ValuePosition[ValuePosition["Previous"] = 0] = "Previous";
  ValuePosition[ValuePosition["Next"] = 1] = "Next";
})(ValuePosition || (exports.ValuePosition = ValuePosition = {}));

var getClassNames = (0, _Utilities.classNamesFunction)();
var ONKEYDOWN_TIMEOUT_DURATION = 1000;
exports.ONKEYDOWN_TIMEOUT_DURATION = ONKEYDOWN_TIMEOUT_DURATION;

var SliderBase =
/** @class */
function (_super) {
  tslib_1.__extends(SliderBase, _super);

  function SliderBase(props) {
    var _this = _super.call(this, props) || this;

    _this._sliderLine = React.createRef();
    _this._thumb = React.createRef();
    _this._onKeyDownTimer = -1;

    _this._getAriaValueText = function (value) {
      if (_this.props.ariaValueText && value !== undefined) {
        return _this.props.ariaValueText(value);
      }
    };

    _this._onMouseDownOrTouchStart = function (event) {
      if (event.type === 'mousedown') {
        _this._events.on(window, 'mousemove', _this._onMouseMoveOrTouchMove, true);

        _this._events.on(window, 'mouseup', _this._onMouseUpOrTouchEnd, true);
      } else if (event.type === 'touchstart') {
        _this._events.on(window, 'touchmove', _this._onMouseMoveOrTouchMove, true);

        _this._events.on(window, 'touchend', _this._onMouseUpOrTouchEnd, true);
      }

      _this._onMouseMoveOrTouchMove(event, true);
    };

    _this._onMouseMoveOrTouchMove = function (event, suppressEventCancelation) {
      if (!_this._sliderLine.current) {
        return;
      }

      var _a = _this.props,
          max = _a.max,
          min = _a.min,
          step = _a.step;
      var steps = (max - min) / step;

      var sliderPositionRect = _this._sliderLine.current.getBoundingClientRect();

      var sliderLength = !_this.props.vertical ? sliderPositionRect.width : sliderPositionRect.height;
      var stepLength = sliderLength / steps;
      var currentSteps;
      var distance;

      if (!_this.props.vertical) {
        var left = _this._getPosition(event, _this.props.vertical);

        distance = (0, _Utilities.getRTL)() ? sliderPositionRect.right - left : left - sliderPositionRect.left;
        currentSteps = distance / stepLength;
      } else {
        var bottom = _this._getPosition(event, _this.props.vertical);

        distance = sliderPositionRect.bottom - bottom;
        currentSteps = distance / stepLength;
      }

      var currentValue;
      var renderedValue; // The value shouldn't be bigger than max or be smaller than min.

      if (currentSteps > Math.floor(steps)) {
        renderedValue = currentValue = max;
      } else if (currentSteps < 0) {
        renderedValue = currentValue = min;
      } else {
        renderedValue = min + step * currentSteps;
        currentValue = min + step * Math.round(currentSteps);
      }

      _this._updateValue(currentValue, renderedValue);

      if (!suppressEventCancelation) {
        event.preventDefault();
        event.stopPropagation();
      }
    };

    _this._onMouseUpOrTouchEnd = function (event) {
      // Synchronize the renderedValue to the actual value.
      _this.setState({
        renderedValue: _this.state.value
      });

      if (_this.props.onChanged) {
        _this.props.onChanged(event, _this.state.value);
      }

      _this._events.off();
    };

    _this._onKeyDown = function (event) {
      var value = _this.state.value;
      var _a = _this.props,
          max = _a.max,
          min = _a.min,
          step = _a.step;
      var diff = 0;

      switch (event.which) {
        case (0, _Utilities.getRTLSafeKeyCode)(_Utilities.KeyCodes.left):
        case _Utilities.KeyCodes.down:
          diff = -step;

          _this._clearOnKeyDownTimer();

          _this._setOnKeyDownTimer(event);

          break;

        case (0, _Utilities.getRTLSafeKeyCode)(_Utilities.KeyCodes.right):
        case _Utilities.KeyCodes.up:
          diff = step;

          _this._clearOnKeyDownTimer();

          _this._setOnKeyDownTimer(event);

          break;

        case _Utilities.KeyCodes.home:
          value = min;
          break;

        case _Utilities.KeyCodes.end:
          value = max;
          break;

        default:
          return;
      }

      var newValue = Math.min(max, Math.max(min, value + diff));

      _this._updateValue(newValue, newValue);

      event.preventDefault();
      event.stopPropagation();
    };

    _this._clearOnKeyDownTimer = function () {
      _this._async.clearTimeout(_this._onKeyDownTimer);
    };

    _this._setOnKeyDownTimer = function (event) {
      // what is this for?
      _this._onKeyDownTimer = _this._async.setTimeout(function () {
        if (_this.props.onChanged) {
          _this.props.onChanged(event, _this.state.value);
        }
      }, ONKEYDOWN_TIMEOUT_DURATION);
    };

    _this._warnMutuallyExclusive({
      value: 'defaultValue'
    });

    _this._id = (0, _Utilities.getId)('Slider');
    var value = props.value !== undefined ? props.value : props.defaultValue !== undefined ? props.defaultValue : props.min;
    _this.state = {
      value: value,
      renderedValue: value
    };
    return _this;
  }
  /**
   * Invoked when a component is receiving new props. This method is not called for the initial render.
   */


  SliderBase.prototype.componentWillReceiveProps = function (newProps) {
    if (newProps.value !== undefined) {
      var value = Math.max(newProps.min, Math.min(newProps.max, newProps.value));
      this.setState({
        value: value,
        renderedValue: value
      });
    }
  };

  SliderBase.prototype.render = function () {
    var _a = this.props,
        ariaLabel = _a.ariaLabel,
        className = _a.className,
        disabled = _a.disabled,
        label = _a.label,
        max = _a.max,
        min = _a.min,
        showValue = _a.showValue,
        buttonProps = _a.buttonProps,
        vertical = _a.vertical,
        valueFormat = _a.valueFormat,
        styles = _a.styles,
        theme = _a.theme,
        originFromZero = _a.originFromZero;
    var _b = this.state,
        value = _b.value,
        renderedValue = _b.renderedValue;
    var thumbOffsetPercent = min === max ? 0 : (renderedValue - min) / (max - min) * 100;
    var zeroOffsetPercent = min >= 0 ? 0 : -min / (max - min) * 100;
    var lengthString = vertical ? 'height' : 'width';
    var onMouseDownProp = disabled ? {} : {
      onMouseDown: this._onMouseDownOrTouchStart
    };
    var onTouchStartProp = disabled ? {} : {
      onTouchStart: this._onMouseDownOrTouchStart
    };
    var onKeyDownProp = disabled ? {} : {
      onKeyDown: this._onKeyDown
    };
    var classNames = getClassNames(styles, {
      className: className,
      disabled: disabled,
      vertical: vertical,
      showTransitions: renderedValue === value,
      showValue: showValue,
      theme: theme
    });
    var divButtonProps = buttonProps ? (0, _Utilities.getNativeProps)(buttonProps, _Utilities.divProperties) : undefined;
    return React.createElement("div", {
      className: classNames.root
    }, label && React.createElement(_Label.Label, tslib_1.__assign({
      className: classNames.titleLabel
    }, ariaLabel ? {} : {
      htmlFor: this._id
    }), label), React.createElement("div", {
      className: classNames.container
    }, React.createElement("div", tslib_1.__assign({
      "aria-valuenow": value,
      "aria-valuemin": min,
      "aria-valuemax": max,
      "aria-valuetext": this._getAriaValueText(value),
      "aria-label": ariaLabel || label,
      "aria-disabled": disabled
    }, onMouseDownProp, onTouchStartProp, onKeyDownProp, divButtonProps, {
      className: (0, _Utilities.css)(classNames.slideBox, buttonProps.className),
      id: this._id,
      role: "slider",
      tabIndex: disabled ? undefined : 0,
      "data-is-focusable": !disabled
    }), React.createElement("div", {
      ref: this._sliderLine,
      className: classNames.line
    }, originFromZero && React.createElement("span", {
      className: (0, _Utilities.css)(classNames.zeroTick),
      style: this._getStyleUsingOffsetPercent(vertical, zeroOffsetPercent)
    }), React.createElement("span", {
      ref: this._thumb,
      className: classNames.thumb,
      style: this._getStyleUsingOffsetPercent(vertical, thumbOffsetPercent)
    }), originFromZero ? React.createElement(React.Fragment, null, React.createElement("span", {
      className: (0, _Utilities.css)(classNames.lineContainer, classNames.inactiveSection),
      style: (_c = {}, _c[lengthString] = Math.min(thumbOffsetPercent, zeroOffsetPercent) + '%', _c)
    }), React.createElement("span", {
      className: (0, _Utilities.css)(classNames.lineContainer, classNames.activeSection),
      style: (_d = {}, _d[lengthString] = Math.abs(zeroOffsetPercent - thumbOffsetPercent) + '%', _d)
    }), React.createElement("span", {
      className: (0, _Utilities.css)(classNames.lineContainer, classNames.inactiveSection),
      style: (_e = {}, _e[lengthString] = Math.min(100 - thumbOffsetPercent, 100 - zeroOffsetPercent) + '%', _e)
    })) : React.createElement(React.Fragment, null, React.createElement("span", {
      className: (0, _Utilities.css)(classNames.lineContainer, classNames.activeSection),
      style: (_f = {}, _f[lengthString] = thumbOffsetPercent + '%', _f)
    }), React.createElement("span", {
      className: (0, _Utilities.css)(classNames.lineContainer, classNames.inactiveSection),
      style: (_g = {}, _g[lengthString] = 100 - thumbOffsetPercent + '%', _g)
    })))), showValue && React.createElement(_Label.Label, {
      className: classNames.valueLabel
    }, valueFormat ? valueFormat(value) : value)));

    var _c, _d, _e, _f, _g;
  };

  SliderBase.prototype.focus = function () {
    if (this._thumb.current) {
      this._thumb.current.focus();
    }
  };

  Object.defineProperty(SliderBase.prototype, "value", {
    get: function () {
      return this.state.value;
    },
    enumerable: true,
    configurable: true
  });

  SliderBase.prototype._getStyleUsingOffsetPercent = function (vertical, thumbOffsetPercent) {
    var direction = vertical ? 'bottom' : (0, _Utilities.getRTL)() ? 'right' : 'left';
    return _a = {}, _a[direction] = thumbOffsetPercent + '%', _a;

    var _a;
  };

  SliderBase.prototype._getPosition = function (event, vertical) {
    var currentPosition;

    switch (event.type) {
      case 'mousedown':
      case 'mousemove':
        currentPosition = !vertical ? event.clientX : event.clientY;
        break;

      case 'touchstart':
      case 'touchmove':
        currentPosition = !vertical ? event.touches[0].clientX : event.touches[0].clientY;
        break;
    }

    return currentPosition;
  };

  SliderBase.prototype._updateValue = function (value, renderedValue) {
    var _this = this;

    var step = this.props.step;
    var numDec = 0;

    if (isFinite(step)) {
      while (Math.round(step * Math.pow(10, numDec)) / Math.pow(10, numDec) !== step) {
        numDec++;
      }
    } // Make sure value has correct number of decimal places based on number of decimals in step


    var roundedValue = parseFloat(value.toFixed(numDec));
    var valueChanged = roundedValue !== this.state.value;
    this.setState({
      value: roundedValue,
      renderedValue: renderedValue
    }, function () {
      if (valueChanged && _this.props.onChange) {
        _this.props.onChange(_this.state.value);
      }
    });
  };

  SliderBase.defaultProps = {
    step: 1,
    min: 0,
    max: 10,
    showValue: true,
    disabled: false,
    vertical: false,
    buttonProps: {},
    originFromZero: false
  };
  return SliderBase;
}(_Utilities.BaseComponent);

exports.SliderBase = SliderBase;
},{"tslib":"xgwM","react":"mpTF","../../Utilities":"B5nc","../../Label":"RcoC"}],"HpLK":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = void 0;

var _Styling = require("../../Styling");

var _utilities = require("@uifabric/utilities");

var GlobalClassNames = {
  root: 'ms-Slider',
  enabled: 'ms-Slider-enabled',
  disabled: 'ms-Slider-disabled',
  row: 'ms-Slider-row',
  column: 'ms-Slider-column',
  container: 'ms-Slider-container',
  slideBox: 'ms-Slider-slideBox',
  line: 'ms-Slider-line',
  thumb: 'ms-Slider-thumb',
  activeSection: 'ms-Slider-active',
  inactiveSection: 'ms-Slider-inactive',
  valueLabel: 'ms-Slider-value',
  showValue: 'ms-Slider-showValue',
  showTransitions: 'ms-Slider-showTransitions',
  zeroTick: 'ms-Slider-zeroTick'
};

var getStyles = function (props) {
  var className = props.className,
      titleLabelClassName = props.titleLabelClassName,
      theme = props.theme;
  var classNames = (0, _Styling.getGlobalClassNames)(GlobalClassNames, theme);
  var slideBoxActiveSectionStyles = !props.disabled && {
    backgroundColor: theme.palette.themePrimary,
    selectors: (_a = {}, _a[_Styling.HighContrastSelector] = {
      backgroundColor: 'Highlight'
    }, _a)
  };
  var slideBoxInactiveSectionStyles = !props.disabled && {
    backgroundColor: theme.palette.themeLight,
    selectors: (_b = {}, _b[_Styling.HighContrastSelector] = {
      borderColor: 'Highlight'
    }, _b)
  };
  var slideBoxActiveThumbStyles = !props.disabled && {
    border: "2px solid " + theme.palette.themePrimary,
    selectors: (_c = {}, _c[_Styling.HighContrastSelector] = {
      borderColor: 'Highlight'
    }, _c)
  };
  var slideBoxActiveZeroTickStyles = !props.disabled && {
    backgroundColor: theme.palette.themeLight,
    selectors: (_d = {}, _d[_Styling.HighContrastSelector] = {
      backgroundColor: 'Highlight'
    }, _d)
  };
  return {
    root: [classNames.root, theme.fonts.medium, {
      userSelect: 'none'
    }, props.vertical && {
      marginRight: 8
    }].concat([!props.disabled ? classNames.enabled : undefined], [props.disabled ? classNames.disabled : undefined], [!props.vertical ? classNames.row : undefined], [props.vertical ? classNames.column : undefined], [className]),
    titleLabel: [{
      padding: 0
    }, titleLabelClassName],
    container: [classNames.container, {
      display: 'flex',
      flexWrap: 'nowrap',
      alignItems: 'center'
    }, props.vertical && {
      flexDirection: 'column',
      height: '100%',
      textAlign: 'center',
      margin: '8px 0'
    }],
    slideBox: [classNames.slideBox, (0, _Styling.getFocusStyle)(theme), {
      background: 'transparent',
      border: 'none',
      flexGrow: 1,
      lineHeight: 28,
      display: 'flex',
      alignItems: 'center',
      selectors: {
        ':active $activeSection': slideBoxActiveSectionStyles,
        ':hover $activeSection': slideBoxActiveSectionStyles,
        ':active $inactiveSection': slideBoxInactiveSectionStyles,
        ':hover $inactiveSection': slideBoxInactiveSectionStyles,
        ':active $thumb': slideBoxActiveThumbStyles,
        ':hover $thumb': slideBoxActiveThumbStyles,
        ':active $zeroTick': slideBoxActiveZeroTickStyles,
        ':hover $zeroTick': slideBoxActiveZeroTickStyles,
        $thumb: [{
          borderWidth: 2,
          borderStyle: 'solid',
          borderColor: theme.palette.neutralSecondary,
          borderRadius: 10,
          boxSizing: 'border-box',
          background: theme.palette.white,
          display: 'block',
          width: 16,
          height: 16,
          position: 'absolute'
        }, props.vertical ? {
          left: -6,
          margin: '0 auto',
          transform: 'translateY(8px)'
        } : {
          top: -6,
          transform: (0, _utilities.getRTL)() ? 'translateX(50%)' : 'translateX(-50%)'
        }, props.showTransitions && {
          transition: "left " + _Styling.AnimationVariables.durationValue3 + " " + _Styling.AnimationVariables.easeFunction1
        }, props.disabled && {
          borderColor: theme.palette.neutralTertiaryAlt,
          selectors: (_e = {}, _e[_Styling.HighContrastSelector] = {
            borderColor: 'GrayText'
          }, _e)
        }]
      }
    }, props.vertical ? {
      height: '100%',
      width: 28,
      padding: '8px 0' // Make room for thumb at bottom of line

    } : {
      height: 28,
      width: 'auto',
      padding: '0 8px' // Make room for thumb at ends of line

    }].concat([props.showValue ? classNames.showValue : undefined], [props.showTransitions ? classNames.showTransitions : undefined]),
    thumb: [classNames.thumb],
    line: [classNames.line, {
      display: 'flex',
      position: 'relative',
      selectors: {
        $lineContainer: [{
          borderRadius: 4,
          boxSizing: 'border-box'
        }, props.vertical ? {
          width: 4,
          height: '100%'
        } : {
          height: 4,
          width: '100%'
        }]
      }
    }, props.vertical ? {
      height: '100%',
      width: 4,
      margin: '0 auto',
      flexDirection: 'column-reverse'
    } : {
      width: '100%'
    }],
    lineContainer: [{}],
    activeSection: [classNames.activeSection, {
      background: theme.palette.neutralSecondary,
      selectors: (_f = {}, _f[_Styling.HighContrastSelector] = {
        backgroundColor: 'WindowText'
      }, _f)
    }, props.showTransitions && {
      transition: "width " + _Styling.AnimationVariables.durationValue3 + " " + _Styling.AnimationVariables.easeFunction1
    }, props.disabled && {
      background: theme.palette.neutralTertiaryAlt,
      selectors: (_g = {}, _g[_Styling.HighContrastSelector] = {
        backgroundColor: 'GrayText',
        borderColor: 'GrayText'
      }, _g)
    }],
    inactiveSection: [classNames.inactiveSection, {
      background: theme.palette.neutralTertiaryAlt,
      selectors: (_h = {}, _h[_Styling.HighContrastSelector] = {
        border: '1px solid WindowText'
      }, _h)
    }, props.showTransitions && {
      transition: "width " + _Styling.AnimationVariables.durationValue3 + " " + _Styling.AnimationVariables.easeFunction1
    }, props.disabled && {
      background: theme.palette.neutralLight,
      selectors: (_j = {}, _j[_Styling.HighContrastSelector] = {
        borderColor: 'GrayText'
      }, _j)
    }],
    zeroTick: [classNames.zeroTick, {
      position: 'absolute',
      background: theme.palette.neutralTertiaryAlt,
      selectors: (_k = {}, _k[_Styling.HighContrastSelector] = {
        backgroundColor: 'WindowText'
      }, _k)
    }, props.disabled && {
      background: theme.palette.neutralLight,
      selectors: (_l = {}, _l[_Styling.HighContrastSelector] = {
        backgroundColor: 'GrayText'
      }, _l)
    }, props.vertical ? {
      width: '16px',
      height: '1px',
      transform: (0, _utilities.getRTL)() ? 'translateX(6px)' : 'translateX(-6px)'
    } : {
      width: '1px',
      height: '16px',
      transform: 'translateY(-6px)'
    }],
    valueLabel: [classNames.valueLabel, {
      flexShrink: 1,
      width: 30,
      lineHeight: '1' // using a string here meaning it's relative to the size of the font

    }, props.vertical ? {
      margin: '0 auto',
      whiteSpace: 'nowrap',
      width: 40
    } : {
      margin: '0 8px',
      whiteSpace: 'nowrap',
      width: 40
    }]
  };

  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
};

exports.getStyles = getStyles;
},{"../../Styling":"AHeq","@uifabric/utilities":"PHCX"}],"rlqg":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Slider = void 0;

var _Utilities = require("../../Utilities");

var _Slider = require("./Slider.base");

var _Slider2 = require("./Slider.styles");

var Slider = (0, _Utilities.styled)(_Slider.SliderBase, _Slider2.getStyles, undefined, {
  scope: 'Slider'
});
exports.Slider = Slider;
},{"../../Utilities":"B5nc","./Slider.base":"kN8Z","./Slider.styles":"HpLK"}],"TqUu":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _Slider = require("./Slider");

Object.keys(_Slider).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Slider[key];
    }
  });
});

var _Slider2 = require("./Slider.base");

Object.keys(_Slider2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Slider2[key];
    }
  });
});
},{"./Slider":"rlqg","./Slider.base":"kN8Z"}],"gVdr":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _index = require("./components/Slider/index");

Object.keys(_index).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index[key];
    }
  });
});
},{"./components/Slider/index":"TqUu"}],"mTRB":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.SpinnerType = exports.SpinnerSize = void 0;

/**
 * Possible variations of the spinner circle size.
 * {@docCategory Spinner}
 */
var SpinnerSize;
exports.SpinnerSize = SpinnerSize;

(function (SpinnerSize) {
  /**
   * 12px Spinner diameter
   */
  SpinnerSize[SpinnerSize["xSmall"] = 0] = "xSmall";
  /**
   * 16px Spinner diameter
   */

  SpinnerSize[SpinnerSize["small"] = 1] = "small";
  /**
   * 20px Spinner diameter
   */

  SpinnerSize[SpinnerSize["medium"] = 2] = "medium";
  /**
   * 28px Spinner diameter
   */

  SpinnerSize[SpinnerSize["large"] = 3] = "large";
})(SpinnerSize || (exports.SpinnerSize = SpinnerSize = {}));
/**
 * Deprecated at v2.0.0, use `SpinnerSize` instead.
 * @deprecated Use `SpinnerSize` instead.
 * {@docCategory Spinner}
 */


var SpinnerType;
exports.SpinnerType = SpinnerType;

(function (SpinnerType) {
  /**
   * Deprecated and will be removed at \>= 2.0.0. Use `SpinnerSize.medium` instead.
   * @deprecated Use `SpinnerSize.medium` instead.
   */
  SpinnerType[SpinnerType["normal"] = 0] = "normal";
  /**
   * Deprecated and will be removed at \>= 2.0.0. Use `SpinnerSize.large` instead.
   * @deprecated Use `SpinnerSize.large` instead.
   */

  SpinnerType[SpinnerType["large"] = 1] = "large";
})(SpinnerType || (exports.SpinnerType = SpinnerType = {}));
},{}],"kpZ0":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.SpinnerBase = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Spinner = require("./Spinner.types");

var _Utilities = require("../../Utilities");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var getClassNames = (0, _Utilities.classNamesFunction)();

var SpinnerBase =
/** @class */
function (_super) {
  tslib_1.__extends(SpinnerBase, _super);

  function SpinnerBase() {
    return _super !== null && _super.apply(this, arguments) || this;
  }

  SpinnerBase.prototype.render = function () {
    var _a = this.props,
        type = _a.type,
        size = _a.size,
        ariaLabel = _a.ariaLabel,
        ariaLive = _a.ariaLive,
        styles = _a.styles,
        label = _a.label,
        theme = _a.theme,
        className = _a.className,
        labelPosition = _a.labelPosition;
    var statusMessage = ariaLabel;
    var nativeProps = (0, _Utilities.getNativeProps)(this.props, _Utilities.divProperties, ['size']); // SpinnerType is deprecated. If someone is still using this property, rather than putting the SpinnerType into the ISpinnerStyleProps,
    // we'll map SpinnerType to its equivalent SpinnerSize and pass that in. Once SpinnerType finally goes away we should delete this.

    var styleSize = size;

    if (styleSize === undefined && type !== undefined) {
      styleSize = type === _Spinner.SpinnerType.large ? _Spinner.SpinnerSize.large : _Spinner.SpinnerSize.medium;
    }

    var classNames = getClassNames(styles, {
      theme: theme,
      size: styleSize,
      className: className,
      labelPosition: labelPosition
    });
    return React.createElement("div", tslib_1.__assign({}, nativeProps, {
      className: classNames.root
    }), React.createElement("div", {
      className: classNames.circle
    }), label && React.createElement("div", {
      className: classNames.label
    }, label), statusMessage && React.createElement("div", {
      role: "status",
      "aria-live": ariaLive
    }, React.createElement(_Utilities.DelayedRender, null, React.createElement("div", {
      className: classNames.screenReaderText
    }, statusMessage))));
  };

  SpinnerBase.defaultProps = {
    size: _Spinner.SpinnerSize.medium,
    ariaLive: 'polite',
    labelPosition: 'bottom'
  };
  return SpinnerBase;
}(_Utilities.BaseComponent);

exports.SpinnerBase = SpinnerBase;
},{"tslib":"xgwM","react":"mpTF","./Spinner.types":"mTRB","../../Utilities":"B5nc"}],"yvcw":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = void 0;

var _Spinner = require("./Spinner.types");

var _Styling = require("../../Styling");

var GlobalClassNames = {
  root: 'ms-Spinner',
  circle: 'ms-Spinner-circle',
  label: 'ms-Spinner-label'
};
var spinAnimation = (0, _Styling.keyframes)({
  '0%': {
    transform: 'rotate(0deg)'
  },
  '100%': {
    transform: 'rotate(360deg)'
  }
});

var getStyles = function (props) {
  var theme = props.theme,
      size = props.size,
      className = props.className,
      labelPosition = props.labelPosition;
  var palette = theme.palette;
  var classNames = (0, _Styling.getGlobalClassNames)(GlobalClassNames, theme);
  return {
    root: [classNames.root, {
      display: 'flex',
      flexDirection: 'column',
      alignItems: 'center',
      justifyContent: 'center'
    }, labelPosition === 'top' && {
      flexDirection: 'column-reverse'
    }, labelPosition === 'right' && {
      flexDirection: 'row'
    }, labelPosition === 'left' && {
      flexDirection: 'row-reverse'
    }, className],
    circle: [classNames.circle, {
      boxSizing: 'border-box',
      borderRadius: '50%',
      border: '1.5px solid ' + palette.themeLight,
      borderTopColor: palette.themePrimary,
      animationName: spinAnimation,
      animationDuration: '1.3s',
      animationIterationCount: 'infinite',
      animationTimingFunction: 'cubic-bezier(.53,.21,.29,.67)',
      selectors: (_a = {}, _a[_Styling.HighContrastSelector] = {
        borderTopColor: 'Highlight'
      }, _a)
    }, size === _Spinner.SpinnerSize.xSmall && ['ms-Spinner--xSmall', {
      width: 12,
      height: 12
    }], size === _Spinner.SpinnerSize.small && ['ms-Spinner--small', {
      width: 16,
      height: 16
    }], size === _Spinner.SpinnerSize.medium && ['ms-Spinner--medium', {
      width: 20,
      height: 20
    }], size === _Spinner.SpinnerSize.large && ['ms-Spinner--large', {
      width: 28,
      height: 28
    }]],
    label: [classNames.label, {
      color: palette.themePrimary,
      margin: '10px 0 0',
      textAlign: 'center'
    }, labelPosition === 'top' && {
      margin: '0 0 10px'
    }, labelPosition === 'right' && {
      margin: '0 0 0 10px'
    }, labelPosition === 'left' && {
      margin: '0 10px 0 0'
    }],
    screenReaderText: _Styling.hiddenContentStyle
  };

  var _a;
};

exports.getStyles = getStyles;
},{"./Spinner.types":"mTRB","../../Styling":"AHeq"}],"uy7L":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Spinner = void 0;

var _Utilities = require("../../Utilities");

var _Spinner = require("./Spinner.base");

var _Spinner2 = require("./Spinner.styles");

var Spinner = (0, _Utilities.styled)(_Spinner.SpinnerBase, _Spinner2.getStyles, undefined, {
  scope: 'Spinner'
});
exports.Spinner = Spinner;
},{"../../Utilities":"B5nc","./Spinner.base":"kpZ0","./Spinner.styles":"yvcw"}],"gNZb":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _Spinner = require("./Spinner");

Object.keys(_Spinner).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Spinner[key];
    }
  });
});

var _Spinner2 = require("./Spinner.base");

Object.keys(_Spinner2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Spinner2[key];
    }
  });
});

var _Spinner3 = require("./Spinner.types");

Object.keys(_Spinner3).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Spinner3[key];
    }
  });
});
},{"./Spinner":"uy7L","./Spinner.base":"kpZ0","./Spinner.types":"mTRB"}],"cr1E":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _index = require("./components/Spinner/index");

Object.keys(_index).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index[key];
    }
  });
});
},{"./components/Spinner/index":"gNZb"}],"xGAm":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.TextFieldBase = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Label = require("../../Label");

var _Icon = require("../../Icon");

var _Utilities = require("../../Utilities");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var getClassNames = (0, _Utilities.classNamesFunction)();
var DEFAULT_STATE_VALUE = '';

var TextFieldBase =
/** @class */
function (_super) {
  tslib_1.__extends(TextFieldBase, _super);

  function TextFieldBase(props) {
    var _this = _super.call(this, props) || this;

    _this._textElement = (0, _Utilities.createRef)();

    _this._onFocus = function (ev) {
      if (_this.props.onFocus) {
        _this.props.onFocus(ev);
      }

      _this.setState({
        isFocused: true
      });

      if (_this.props.validateOnFocusIn) {
        _this._validate(_this.state.value);
      }
    };

    _this._onBlur = function (ev) {
      if (_this.props.onBlur) {
        _this.props.onBlur(ev);
      }

      _this.setState({
        isFocused: false
      });

      if (_this.props.validateOnFocusOut) {
        _this._validate(_this.state.value);
      }
    };

    _this._onRenderLabel = function (props) {
      var label = props.label,
          required = props.required; // IProcessedStyleSet definition requires casting for what Label expects as its styles prop

      var labelStyles = _this._classNames.subComponentStyles ? _this._classNames.subComponentStyles.label : undefined;

      if (label) {
        return React.createElement(_Label.Label, {
          required: required,
          htmlFor: _this._id,
          styles: labelStyles,
          disabled: props.disabled,
          id: _this._labelId
        }, props.label);
      }

      return null;
    };

    _this._onRenderDescription = function (props) {
      if (props.description) {
        return React.createElement("span", {
          className: _this._classNames.description
        }, props.description);
      }

      return null;
    };

    _this._onInputChange = function (event) {
      event.persist();
      var element = event.target;
      var value = element.value; // Avoid doing unnecessary work when the value has not changed.

      if (value === _this._latestValue) {
        return;
      }

      _this._latestValue = value;

      _this.setState({
        value: value
      }, function () {
        _this._adjustInputHeight();

        if (_this.props.onChange) {
          _this.props.onChange(event, value);
        }

        if (_this.props.onChanged) {
          _this.props.onChanged(value);
        }
      });

      if (_shouldValidateAllChanges(_this.props)) {
        _this._delayedValidate(value);
      }

      if (_this.props.onBeforeChange) {
        _this.props.onBeforeChange(value);
      }
    };

    (0, _Utilities.initializeComponentRef)(_this);
    _this._async = new _Utilities.Async(_this);

    if ("production" !== 'production') {
      (0, _Utilities.warnDeprecations)('TextField', props, {
        iconClass: 'iconProps',
        addonString: 'prefix',
        onRenderAddon: 'onRenderPrefix',
        onChanged: 'onChange'
      });
      (0, _Utilities.warnMutuallyExclusive)('TextField', props, {
        value: 'defaultValue'
      });
    }

    _this._id = props.id || (0, _Utilities.getId)('TextField');
    _this._descriptionId = (0, _Utilities.getId)('TextFieldDescription');
    _this._labelId = (0, _Utilities.getId)('TextFieldLabel');

    if (props.value !== undefined) {
      _this._latestValue = props.value;
    } else if (props.defaultValue !== undefined) {
      _this._latestValue = props.defaultValue;
    } else {
      _this._latestValue = DEFAULT_STATE_VALUE;
    }

    _this.state = {
      value: _this._latestValue,
      isFocused: false,
      errorMessage: ''
    };
    _this._delayedValidate = _this._async.debounce(_this._validate, _this.props.deferredValidationTime);
    _this._lastValidation = 0;
    return _this;
  }

  Object.defineProperty(TextFieldBase.prototype, "value", {
    /**
     * Gets the current value of the text field.
     */
    get: function () {
      return this.state.value;
    },
    enumerable: true,
    configurable: true
  });

  TextFieldBase.prototype.componentDidMount = function () {
    this._isMounted = true;

    this._adjustInputHeight();

    if (this.props.validateOnLoad) {
      this._validate(this.state.value);
    }
  };

  TextFieldBase.prototype.componentWillReceiveProps = function (newProps) {
    var onBeforeChange = this.props.onBeforeChange; // If old value prop was undefined, then component is controlled and we should
    //    respect new undefined value and update state accordingly.

    if (newProps.value !== this.state.value && (newProps.value !== undefined || this.props.value !== undefined)) {
      if (onBeforeChange) {
        onBeforeChange(newProps.value);
      }

      this._id = newProps.id || this._id;

      this._setValue(newProps.value);

      if (_shouldValidateAllChanges(newProps)) {
        this._delayedValidate(newProps.value);
      }
    } // If component is not currently controlled and defaultValue changes, set value to new defaultValue.


    if (newProps.defaultValue !== this.props.defaultValue && newProps.value === undefined) {
      this._setValue(newProps.defaultValue);
    } // Text field is changing between single- and multi-line. After the change is complete,
    // we'll need to reset focus and selection/cursor.


    if (!!newProps.multiline !== !!this.props.multiline && this.state.isFocused) {
      this._shouldResetFocusAfterRender = true;
      this._selectionBeforeInputTypeChange = [this.selectionStart, this.selectionEnd];
    }
  };

  TextFieldBase.prototype.componentDidUpdate = function () {
    if (this._shouldResetFocusAfterRender) {
      // The text field has just changed between single- and multi-line, so we need to reset focus
      // and selection/cursor.
      this._shouldResetFocusAfterRender = false;
      this.focus();

      if (this._selectionBeforeInputTypeChange) {
        var _a = this._selectionBeforeInputTypeChange,
            start = _a[0],
            end = _a[1];

        if (start !== null && end !== null) {
          this.setSelectionRange(start, end);
        }
      }
    }
  };

  TextFieldBase.prototype.componentWillUnmount = function () {
    this._isMounted = false;

    this._async.dispose();
  };

  TextFieldBase.prototype.render = function () {
    var _a = this.props,
        borderless = _a.borderless,
        className = _a.className,
        disabled = _a.disabled,
        iconClass = _a.iconClass,
        iconProps = _a.iconProps,
        inputClassName = _a.inputClassName,
        label = _a.label,
        multiline = _a.multiline,
        required = _a.required,
        underlined = _a.underlined,
        addonString = _a.addonString,
        // @deprecated
    prefix = _a.prefix,
        resizable = _a.resizable,
        suffix = _a.suffix,
        theme = _a.theme,
        styles = _a.styles,
        autoAdjustHeight = _a.autoAdjustHeight,
        _b = _a.onRenderAddon,
        onRenderAddon = _b === void 0 ? this._onRenderAddon : _b,
        // @deprecated
    _c = _a.onRenderPrefix,
        // @deprecated
    onRenderPrefix = _c === void 0 ? this._onRenderPrefix : _c,
        _d = _a.onRenderSuffix,
        onRenderSuffix = _d === void 0 ? this._onRenderSuffix : _d,
        _e = _a.onRenderLabel,
        onRenderLabel = _e === void 0 ? this._onRenderLabel : _e,
        _f = _a.onRenderDescription,
        onRenderDescription = _f === void 0 ? this._onRenderDescription : _f;
    var isFocused = this.state.isFocused;
    var errorMessage = this._errorMessage;
    this._classNames = getClassNames(styles, {
      theme: theme,
      className: className,
      disabled: disabled,
      focused: isFocused,
      required: required,
      multiline: multiline,
      hasLabel: !!label,
      hasErrorMessage: !!errorMessage,
      borderless: borderless,
      resizable: resizable,
      hasIcon: !!iconProps,
      underlined: underlined,
      iconClass: iconClass,
      inputClassName: inputClassName,
      autoAdjustHeight: autoAdjustHeight
    });
    return React.createElement("div", {
      className: this._classNames.root
    }, React.createElement("div", {
      className: this._classNames.wrapper
    }, onRenderLabel(this.props, this._onRenderLabel), React.createElement("div", {
      className: this._classNames.fieldGroup
    }, (addonString !== undefined || this.props.onRenderAddon) && React.createElement("div", {
      className: this._classNames.prefix
    }, onRenderAddon(this.props, this._onRenderAddon)), (prefix !== undefined || this.props.onRenderPrefix) && React.createElement("div", {
      className: this._classNames.prefix
    }, onRenderPrefix(this.props, this._onRenderPrefix)), multiline ? this._renderTextArea() : this._renderInput(), (iconClass || iconProps) && React.createElement(_Icon.Icon, tslib_1.__assign({
      className: this._classNames.icon
    }, iconProps)), (suffix !== undefined || this.props.onRenderSuffix) && React.createElement("div", {
      className: this._classNames.suffix
    }, onRenderSuffix(this.props, this._onRenderSuffix)))), this._isDescriptionAvailable && React.createElement("span", {
      id: this._descriptionId
    }, onRenderDescription(this.props, this._onRenderDescription), errorMessage && React.createElement("div", {
      role: "alert"
    }, React.createElement(_Utilities.DelayedRender, null, React.createElement("p", {
      className: this._classNames.errorMessage
    }, React.createElement("span", {
      "data-automation-id": "error-message"
    }, errorMessage))))));
  };
  /**
   * Sets focus on the text field
   */


  TextFieldBase.prototype.focus = function () {
    if (this._textElement.current) {
      this._textElement.current.focus();
    }
  };
  /**
   * Blurs the text field.
   */


  TextFieldBase.prototype.blur = function () {
    if (this._textElement.current) {
      this._textElement.current.blur();
    }
  };
  /**
   * Selects the text field
   */


  TextFieldBase.prototype.select = function () {
    if (this._textElement.current) {
      this._textElement.current.select();
    }
  };
  /**
   * Sets the selection start of the text field to a specified value
   */


  TextFieldBase.prototype.setSelectionStart = function (value) {
    if (this._textElement.current) {
      this._textElement.current.selectionStart = value;
    }
  };
  /**
   * Sets the selection end of the text field to a specified value
   */


  TextFieldBase.prototype.setSelectionEnd = function (value) {
    if (this._textElement.current) {
      this._textElement.current.selectionEnd = value;
    }
  };

  Object.defineProperty(TextFieldBase.prototype, "selectionStart", {
    /**
     * Gets the selection start of the text field
     */
    get: function () {
      return this._textElement.current ? this._textElement.current.selectionStart : -1;
    },
    enumerable: true,
    configurable: true
  });
  Object.defineProperty(TextFieldBase.prototype, "selectionEnd", {
    /**
     * Gets the selection end of the text field
     */
    get: function () {
      return this._textElement.current ? this._textElement.current.selectionEnd : -1;
    },
    enumerable: true,
    configurable: true
  });
  /**
   * Sets the start and end positions of a selection in a text field.
   * @param start - Index of the start of the selection.
   * @param end - Index of the end of the selection.
   */

  TextFieldBase.prototype.setSelectionRange = function (start, end) {
    if (this._textElement.current) {
      this._textElement.current.setSelectionRange(start, end);
    }
  };

  TextFieldBase.prototype._setValue = function (value) {
    var _this = this;

    this._latestValue = value;
    this.setState({
      value: value || DEFAULT_STATE_VALUE,
      errorMessage: ''
    }, function () {
      _this._adjustInputHeight();
    });
  }; // @deprecated


  TextFieldBase.prototype._onRenderAddon = function (props) {
    var addonString = props.addonString;
    return React.createElement("span", {
      style: {
        paddingBottom: '1px'
      }
    }, addonString);
  };

  TextFieldBase.prototype._onRenderPrefix = function (props) {
    var prefix = props.prefix;
    return React.createElement("span", {
      style: {
        paddingBottom: '1px'
      }
    }, prefix);
  };

  TextFieldBase.prototype._onRenderSuffix = function (props) {
    var suffix = props.suffix;
    return React.createElement("span", {
      style: {
        paddingBottom: '1px'
      }
    }, suffix);
  };

  Object.defineProperty(TextFieldBase.prototype, "_errorMessage", {
    get: function () {
      var errorMessage = this.state.errorMessage;

      if (!errorMessage && this.props.errorMessage) {
        errorMessage = this.props.errorMessage;
      }

      return errorMessage;
    },
    enumerable: true,
    configurable: true
  });
  Object.defineProperty(TextFieldBase.prototype, "_isDescriptionAvailable", {
    /**
     * If a custom description render function is supplied then treat description as always available.
     * Otherwise defer to the presence of description or error message text.
     */
    get: function () {
      var props = this.props;
      return !!(props.onRenderDescription || props.description || this._errorMessage);
    },
    enumerable: true,
    configurable: true
  });

  TextFieldBase.prototype._renderTextArea = function () {
    var textAreaProps = (0, _Utilities.getNativeProps)(this.props, _Utilities.textAreaProperties, ['defaultValue']);
    return React.createElement("textarea", tslib_1.__assign({
      id: this._id
    }, textAreaProps, {
      ref: this._textElement,
      value: this.state.value,
      onInput: this._onInputChange,
      onChange: this._onInputChange,
      className: this._classNames.field,
      "aria-describedby": this._isDescriptionAvailable ? this._descriptionId : this.props['aria-describedby'],
      "aria-invalid": !!this._errorMessage,
      "aria-label": this.props.ariaLabel,
      readOnly: this.props.readOnly,
      onFocus: this._onFocus,
      onBlur: this._onBlur
    }));
  };

  TextFieldBase.prototype._renderInput = function () {
    var inputProps = (0, _Utilities.getNativeProps)(this.props, _Utilities.inputProperties, ['defaultValue']);
    var ariaLabelledBy = this.props['aria-labelledby'] || (this.props.label ? this._labelId : undefined);
    return React.createElement("input", tslib_1.__assign({
      type: 'text',
      id: this._id,
      "aria-labelledby": ariaLabelledBy
    }, inputProps, {
      ref: this._textElement,
      value: this.state.value,
      onInput: this._onInputChange,
      onChange: this._onInputChange,
      className: this._classNames.field,
      "aria-label": this.props.ariaLabel,
      "aria-describedby": this._isDescriptionAvailable ? this._descriptionId : this.props['aria-describedby'],
      "aria-invalid": !!this._errorMessage,
      readOnly: this.props.readOnly,
      onFocus: this._onFocus,
      onBlur: this._onBlur
    }));
  };

  TextFieldBase.prototype._validate = function (value) {
    var _this = this; // In case of _validate called multi-times during executing validate logic with promise return.


    if (this._latestValidateValue === value && _shouldValidateAllChanges(this.props)) {
      return;
    }

    this._latestValidateValue = value;
    var onGetErrorMessage = this.props.onGetErrorMessage;
    var result = onGetErrorMessage(value || '');

    if (result !== undefined) {
      if (typeof result === 'string' || !('then' in result)) {
        this.setState({
          errorMessage: result
        });

        this._notifyAfterValidate(value, result);
      } else {
        var currentValidation_1 = ++this._lastValidation;
        result.then(function (errorMessage) {
          if (_this._isMounted && currentValidation_1 === _this._lastValidation) {
            _this.setState({
              errorMessage: errorMessage
            });
          }

          _this._notifyAfterValidate(value, errorMessage);
        });
      }
    } else {
      this._notifyAfterValidate(value, '');
    }
  };

  TextFieldBase.prototype._notifyAfterValidate = function (value, errorMessage) {
    if (this._isMounted && value === this.state.value && this.props.onNotifyValidationResult) {
      this.props.onNotifyValidationResult(errorMessage, value);
    }
  };

  TextFieldBase.prototype._adjustInputHeight = function () {
    if (this._textElement.current && this.props.autoAdjustHeight && this.props.multiline) {
      var textField = this._textElement.current;
      textField.style.height = '';
      textField.style.height = textField.scrollHeight + 'px';
    }
  };

  TextFieldBase.defaultProps = {
    multiline: false,
    resizable: true,
    autoAdjustHeight: false,
    underlined: false,
    borderless: false,
    onChange: function () {
      /* noop */
    },
    onBeforeChange: function () {
      /* noop */
    },
    onNotifyValidationResult: function () {
      /* noop */
    },
    onGetErrorMessage: function () {
      return undefined;
    },
    deferredValidationTime: 200,
    errorMessage: '',
    validateOnFocusIn: false,
    validateOnFocusOut: false,
    validateOnLoad: true
  };
  return TextFieldBase;
}(React.Component);

exports.TextFieldBase = TextFieldBase;

/**
 * If `validateOnFocusIn` or `validateOnFocusOut` is true, validation should run **only** on that event.
 * Otherwise, validation should run on every change.
 */
function _shouldValidateAllChanges(props) {
  return !(props.validateOnFocusIn || props.validateOnFocusOut);
}
},{"tslib":"xgwM","react":"mpTF","../../Label":"RcoC","../../Icon":"s5pL","../../Utilities":"B5nc"}],"PjRT":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = getStyles;

var _Styling = require("../../Styling");

var globalClassNames = {
  root: 'ms-TextField',
  description: 'ms-TextField-description',
  errorMessage: 'ms-TextField-errorMessage',
  field: 'ms-TextField-field',
  fieldGroup: 'ms-TextField-fieldGroup',
  prefix: 'ms-TextField-prefix',
  suffix: 'ms-TextField-suffix',
  wrapper: 'ms-TextField-wrapper',
  multiline: 'ms-TextField--multiline',
  borderless: 'ms-TextField--borderless',
  underlined: 'ms-TextField--underlined',
  unresizable: 'ms-TextField--unresizable',
  required: 'is-required',
  disabled: 'is-disabled',
  active: 'is-active'
};

function getLabelStyles(props) {
  var underlined = props.underlined,
      disabled = props.disabled,
      focused = props.focused;
  return function () {
    return {
      root: [underlined && disabled && {
        color: props.theme.palette.neutralTertiary
      }, underlined && {
        fontSize: _Styling.FontSizes.medium,
        marginRight: 8,
        paddingLeft: 12,
        paddingRight: 0,
        lineHeight: '22px',
        height: 32
      }, underlined && focused && {
        selectors: (_a = {}, _a[_Styling.HighContrastSelector] = {
          height: 31 // -1px to prevent jumpiness in HC with the increased border-width to 2px

        }, _a)
      }]
    };

    var _a;
  };
}

function getStyles(props) {
  var theme = props.theme,
      className = props.className,
      disabled = props.disabled,
      focused = props.focused,
      required = props.required,
      multiline = props.multiline,
      hasLabel = props.hasLabel,
      borderless = props.borderless,
      underlined = props.underlined,
      hasIcon = props.hasIcon,
      resizable = props.resizable,
      hasErrorMessage = props.hasErrorMessage,
      iconClass = props.iconClass,
      inputClassName = props.inputClassName,
      autoAdjustHeight = props.autoAdjustHeight;
  var semanticColors = theme.semanticColors;
  var classNames = (0, _Styling.getGlobalClassNames)(globalClassNames, theme);
  var fieldPrefixSuffix = {
    background: semanticColors.disabledBackground,
    color: !disabled ? semanticColors.inputPlaceholderText : semanticColors.disabledText,
    display: 'flex',
    alignItems: 'center',
    padding: '0 10px',
    lineHeight: 1,
    whiteSpace: 'nowrap',
    flexShrink: 0
  }; // placeholder style constants

  var placeholderStyles = [theme.fonts.medium, {
    color: semanticColors.inputPlaceholderText,
    opacity: 1
  }];
  var disabledPlaceholderStyles = {
    color: semanticColors.disabledText
  };
  return {
    root: [classNames.root, theme.fonts.medium, required && classNames.required, disabled && classNames.disabled, focused && classNames.active, multiline && classNames.multiline, borderless && classNames.borderless, underlined && classNames.underlined, _Styling.normalize, {
      position: 'relative'
    }, className],
    wrapper: [classNames.wrapper, underlined && {
      display: 'flex',
      borderBottomWidth: 1,
      borderBottomStyle: 'solid',
      borderBottomColor: semanticColors.inputBorder,
      width: '100%'
    }, hasErrorMessage && underlined && !disabled && {
      borderBottomColor: semanticColors.errorText,
      selectors: {
        ':hover': {
          borderBottomColor: semanticColors.errorText,
          selectors: (_a = {}, _a[_Styling.HighContrastSelector] = {
            borderBottomColor: 'Highlight'
          }, _a)
        }
      }
    }, underlined && disabled && {
      borderBottomColor: semanticColors.disabledBackground
    }, underlined && !disabled && !focused && !hasErrorMessage && {
      selectors: {
        ':hover': {
          borderBottomColor: semanticColors.inputBorderHovered,
          selectors: (_b = {}, _b[_Styling.HighContrastSelector] = {
            borderBottomColor: 'Highlight'
          }, _b)
        }
      }
    }, underlined && focused && {
      borderBottomColor: !hasErrorMessage ? semanticColors.inputFocusBorderAlt : semanticColors.errorText,
      selectors: (_c = {}, _c[_Styling.HighContrastSelector] = {
        borderBottomWidth: 2,
        borderBottomColor: 'Highlight'
      }, _c)
    }],
    fieldGroup: [classNames.fieldGroup, _Styling.normalize, {
      border: "1px solid " + semanticColors.inputBorder,
      background: semanticColors.inputBackground,
      cursor: 'text',
      height: 32,
      display: 'flex',
      flexDirection: 'row',
      alignItems: 'stretch',
      position: 'relative',
      selectors: {
        ':hover': {
          selectors: (_d = {}, _d[_Styling.HighContrastSelector] = {
            borderColor: 'Highlight'
          }, _d)
        }
      }
    }, multiline && {
      minHeight: '60px',
      height: 'auto',
      display: 'flex'
    }, borderless && {
      border: 'none'
    }, !focused && !disabled && {
      selectors: {
        ':hover': {
          borderColor: semanticColors.inputBorderHovered
        }
      }
    }, focused && {
      borderColor: semanticColors.inputFocusBorderAlt,
      selectors: (_e = {}, _e[_Styling.HighContrastSelector] = {
        borderWidth: 2,
        borderColor: 'Highlight'
      }, _e)
    }, disabled && {
      backgroundColor: semanticColors.disabledBackground,
      borderColor: semanticColors.disabledBackground,
      cursor: 'default'
    }, underlined && {
      flex: '1 1 0px',
      border: 'none',
      textAlign: 'left'
    }, underlined && focused && {
      selectors: (_f = {}, _f[_Styling.HighContrastSelector] = {
        height: 31 // -1px to prevent jumpiness in HC with the increased border-width to 2px

      }, _f)
    }, underlined && disabled && {
      backgroundColor: 'transparent'
    }, hasErrorMessage && {
      borderColor: semanticColors.errorText,
      selectors: {
        '&:focus, &:hover': {
          borderColor: semanticColors.errorText
        }
      }
    }, hasErrorMessage && focused && {
      borderColor: semanticColors.errorText
    }, !hasLabel && required && {
      selectors: (_g = {
        ':after': {
          content: "'*'",
          color: semanticColors.errorText,
          position: 'absolute',
          top: -5,
          right: -10
        }
      }, _g[_Styling.HighContrastSelector] = {
        selectors: {
          ':after': {
            right: -14 // moving the * 4 pixel to right to alleviate border clipping in HC mode.

          }
        }
      }, _g)
    }],
    field: [theme.fonts.medium, classNames.field, _Styling.normalize, {
      fontSize: _Styling.FontSizes.medium,
      borderRadius: 0,
      border: 'none',
      background: 'none',
      backgroundColor: 'transparent',
      color: semanticColors.inputText,
      padding: '0 12px',
      width: '100%',
      minWidth: 0,
      textOverflow: 'ellipsis',
      outline: 0,
      selectors: {
        '&:active, &:focus, &:hover': {
          outline: 0
        },
        '::-ms-clear': {
          display: 'none'
        }
      }
    }, (0, _Styling.getPlaceholderStyles)(placeholderStyles), multiline && !resizable && [classNames.unresizable, {
      resize: 'none'
    }], multiline && {
      minHeight: 'inherit',
      lineHeight: 17,
      flexGrow: 1,
      paddingTop: 6,
      overflow: 'auto',
      width: '100%'
    }, multiline && autoAdjustHeight && {
      overflow: 'hidden'
    }, hasIcon && {
      paddingRight: 24
    }, multiline && hasIcon && {
      paddingRight: 40
    }, disabled && [{
      backgroundColor: 'transparent',
      borderColor: 'transparent',
      color: semanticColors.disabledText
    }, (0, _Styling.getPlaceholderStyles)(disabledPlaceholderStyles)], underlined && {
      textAlign: 'left'
    }, focused && !borderless && {
      selectors: (_h = {}, _h[_Styling.HighContrastSelector] = {
        paddingLeft: 11,
        paddingRight: 11
      }, _h)
    }, focused && multiline && !borderless && {
      selectors: (_j = {}, _j[_Styling.HighContrastSelector] = {
        paddingTop: 4 // take into consideration the 2px increased border-width (not when borderless).

      }, _j)
    }, inputClassName],
    icon: [multiline && {
      paddingRight: 24,
      paddingBottom: 8,
      alignItems: 'flex-end'
    }, {
      pointerEvents: 'none',
      position: 'absolute',
      bottom: 5,
      right: 8,
      top: 'auto',
      fontSize: 16,
      lineHeight: 18
    }, disabled && {
      color: semanticColors.disabledText
    }, iconClass],
    description: [classNames.description, {
      color: semanticColors.bodySubtext,
      fontSize: _Styling.FontSizes.xSmall
    }],
    errorMessage: [classNames.errorMessage, _Styling.AnimationClassNames.slideDownIn20, theme.fonts.small, {
      color: semanticColors.errorText,
      margin: 0,
      paddingTop: 5,
      display: 'flex',
      alignItems: 'center'
    }],
    prefix: [classNames.prefix, fieldPrefixSuffix],
    suffix: [classNames.suffix, fieldPrefixSuffix],
    subComponentStyles: {
      label: getLabelStyles(props)
    }
  };

  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
}
},{"../../Styling":"AHeq"}],"nkni":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.TextField = void 0;

var _Utilities = require("../../Utilities");

var _TextField = require("./TextField.base");

var _TextField2 = require("./TextField.styles");

var TextField = (0, _Utilities.styled)(_TextField.TextFieldBase, _TextField2.getStyles, undefined, {
  scope: 'TextField'
});
exports.TextField = TextField;
},{"../../Utilities":"B5nc","./TextField.base":"xGAm","./TextField.styles":"PjRT"}],"QDbM":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.parseMask = parseMask;
exports.getMaskDisplay = getMaskDisplay;
exports.getRightFormatIndex = getRightFormatIndex;
exports.getLeftFormatIndex = getLeftFormatIndex;
exports.clearRange = clearRange;
exports.clearNext = clearNext;
exports.clearPrev = clearPrev;
exports.insertString = insertString;
exports.DEFAULT_MASK_FORMAT_CHARS = void 0;
var DEFAULT_MASK_FORMAT_CHARS = {
  '9': /[0-9]/,
  a: /[a-zA-Z]/,
  '*': /[a-zA-Z0-9]/
};
/**
 * Takes in the mask string and the formatCharacters and returns an array of MaskValues
 * Example:
 * mask = 'Phone Number: (999) - 9999'
 * return = [
 *    { value: undefined, displayIndex: 16, format: /[0-9]/ },
 *    { value: undefined, displayIndex: 17, format: /[0-9]/ },
 *    { value: undefined, displayIndex: 18, format: /[0-9]/ },
 *    { value: undefined, displayIndex: 22, format: /[0-9]/ },
 * ]
 *
 * @param mask The string use to define the format of the displayed maskedValue.
 * @param formatChars An object defining how certain characters in the mask should accept input.
 */

exports.DEFAULT_MASK_FORMAT_CHARS = DEFAULT_MASK_FORMAT_CHARS;

function parseMask(mask, formatChars) {
  if (formatChars === void 0) {
    formatChars = DEFAULT_MASK_FORMAT_CHARS;
  }

  if (!mask) {
    return [];
  }

  var maskCharData = []; // Count the escape characters in the mask string.

  var escapedChars = 0;

  for (var i = 0; i + escapedChars < mask.length; i++) {
    var maskChar = mask.charAt(i + escapedChars);

    if (maskChar === '\\') {
      escapedChars++;
    } else {
      // Check if the maskChar is a format character.
      var maskFormat = formatChars[maskChar];

      if (maskFormat) {
        maskCharData.push({
          /**
           * Do not add escapedChars to the displayIndex.
           * The index refers to a position in the mask's displayValue.
           * Since the backslashes don't appear in the displayValue,
           * we do not add them to the charData displayIndex.
           */
          displayIndex: i,
          format: maskFormat
        });
      }
    }
  }

  return maskCharData;
}
/**
 * Takes in the mask string, an array of MaskValues, and the maskCharacter
 * returns the mask string formatted with the input values and maskCharacter.
 * If the maskChar is undefined, the maskDisplay is truncated to the last filled format character.
 * Example:
 * mask = 'Phone Number: (999) 999 - 9999'
 * maskCharData = '12345'
 * maskChar = '_'
 * return = 'Phone Number: (123) 45_ - ___'
 *
 * Example:
 * mask = 'Phone Number: (999) 999 - 9999'
 * value = '12345'
 * maskChar = undefined
 * return = 'Phone Number: (123) 45'
 *
 * @param mask The string use to define the format of the displayed maskedValue.
 * @param maskCharData The input values to insert into the mask string for displaying.
 * @param maskChar? A character to display in place of unfilled mask format characters.
 */


function getMaskDisplay(mask, maskCharData, maskChar) {
  var maskDisplay = mask;

  if (!maskDisplay) {
    return '';
  } // Remove all backslashes


  maskDisplay = maskDisplay.replace(/\\/g, ''); // lastDisplayIndex is is used to truncate the string if necessary.

  var lastDisplayIndex = 0;

  if (maskCharData.length > 0) {
    lastDisplayIndex = maskCharData[0].displayIndex - 1;
  }
  /**
   * For each input value, replace the character in the maskDisplay with the value.
   * If there is no value set for the format character, use the maskChar.
   */


  for (var _i = 0, maskCharData_1 = maskCharData; _i < maskCharData_1.length; _i++) {
    var charData = maskCharData_1[_i];
    var nextChar = ' ';

    if (charData.value) {
      nextChar = charData.value;

      if (charData.displayIndex > lastDisplayIndex) {
        lastDisplayIndex = charData.displayIndex;
      }
    } else {
      if (maskChar) {
        nextChar = maskChar;
      }
    } // Insert the character into the maskdisplay at its corresponding index


    maskDisplay = maskDisplay.slice(0, charData.displayIndex) + nextChar + maskDisplay.slice(charData.displayIndex + 1);
  } // Cut off all mask characters after the last filled format value


  if (!maskChar) {
    maskDisplay = maskDisplay.slice(0, lastDisplayIndex + 1);
  }

  return maskDisplay;
}
/**
 * Get the next format index right of or at a specified index.
 * If no index exists, returns the rightmost index.
 * @param maskCharData
 * @param index
 */


function getRightFormatIndex(maskCharData, index) {
  for (var i = 0; i < maskCharData.length; i++) {
    if (maskCharData[i].displayIndex >= index) {
      return maskCharData[i].displayIndex;
    }
  }

  return maskCharData[maskCharData.length - 1].displayIndex;
}
/**
 * Get the next format index left of a specified index.
 * If no index exists, returns the leftmost index.
 * @param maskCharData
 * @param index
 */


function getLeftFormatIndex(maskCharData, index) {
  for (var i = maskCharData.length - 1; i >= 0; i--) {
    if (maskCharData[i].displayIndex < index) {
      return maskCharData[i].displayIndex;
    }
  }

  return maskCharData[0].displayIndex;
}
/**
 * Deletes all values in maskCharData with a displayIndex that falls inside the specified range.
 * maskCharData is modified inline and also returned.
 * @param maskCharData
 * @param selectionStart
 * @param selectionCount
 */


function clearRange(maskCharData, selectionStart, selectionCount) {
  for (var i = 0; i < maskCharData.length; i++) {
    if (maskCharData[i].displayIndex >= selectionStart) {
      if (maskCharData[i].displayIndex >= selectionStart + selectionCount) {
        break;
      }

      maskCharData[i].value = undefined;
    }
  }

  return maskCharData;
}
/**
 * Deletes the input character at or after a specified index and returns the new array of charData
 * maskCharData is modified inline and also returned.
 * @param maskCharData
 * @param selectionStart
 */


function clearNext(maskCharData, selectionStart) {
  for (var i = 0; i < maskCharData.length; i++) {
    if (maskCharData[i].displayIndex >= selectionStart) {
      maskCharData[i].value = undefined;
      break;
    }
  }

  return maskCharData;
}
/**
 * Deletes the input character before a specified index and returns the new array of charData
 * maskCharData is modified inline and also returned.
 * @param maskCharData
 * @param selectionStart
 */


function clearPrev(maskCharData, selectionStart) {
  for (var i = maskCharData.length - 1; i >= 0; i--) {
    if (maskCharData[i].displayIndex < selectionStart) {
      maskCharData[i].value = undefined;
      break;
    }
  }

  return maskCharData;
}
/**
 * Deletes all values in maskCharData with a displayIndex that falls inside the specified range.
 * Modifies the maskCharData inplace with the passed string and returns the display index of the
 * next format character after the inserted string.
 * @param maskCharData
 * @param selectionStart
 * @param selectionCount
 * @return The displayIndex of the next format character
 */


function insertString(maskCharData, selectionStart, newString) {
  var stringIndex = 0;
  var nextIndex = 0;
  var isStringInserted = false; // Iterate through _maskCharData finding values with a displayIndex after the specified range start

  for (var i = 0; i < maskCharData.length && stringIndex < newString.length; i++) {
    if (maskCharData[i].displayIndex >= selectionStart) {
      isStringInserted = true;
      nextIndex = maskCharData[i].displayIndex; // Find the next character in the newString that matches the format

      while (stringIndex < newString.length) {
        // If the character matches the format regexp, set the maskCharData to the new character
        if (maskCharData[i].format.test(newString.charAt(stringIndex))) {
          maskCharData[i].value = newString.charAt(stringIndex++); // Set the nextIndex to the display index of the next mask format character.

          if (i + 1 < maskCharData.length) {
            nextIndex = maskCharData[i + 1].displayIndex;
          } else {
            nextIndex++;
          }

          break;
        }

        stringIndex++;
      }
    }
  }

  return isStringInserted ? nextIndex : selectionStart;
}
},{}],"iEZD":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.MaskedTextField = exports.DEFAULT_MASK_CHAR = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _TextField = require("../TextField");

var _Utilities = require("../../../Utilities");

var _inputMask = require("./inputMask");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var DEFAULT_MASK_CHAR = '_';
exports.DEFAULT_MASK_CHAR = DEFAULT_MASK_CHAR;

var MaskedTextField =
/** @class */
function (_super) {
  tslib_1.__extends(MaskedTextField, _super);

  function MaskedTextField(props) {
    var _this = _super.call(this, props) || this;
    /**
     * Tell BaseComponent to bypass resolution of componentRef.
     */


    _this._skipComponentRefResolution = true;
    _this._textField = React.createRef();
    (0, _Utilities.initializeComponentRef)(_this); // Translate mask into charData

    _this._maskCharData = (0, _inputMask.parseMask)(props.mask, props.maskFormat); // If an initial value is provided, use it to populate the format chars

    props.value !== undefined && _this.setValue(props.value);
    _this._isFocused = false;
    _this._moveCursorOnMouseUp = false;
    _this.state = {
      displayValue: (0, _inputMask.getMaskDisplay)(props.mask, _this._maskCharData, props.maskChar)
    };
    return _this;
  }

  MaskedTextField.prototype.componentWillReceiveProps = function (newProps) {
    if (newProps.mask !== this.props.mask || newProps.value !== this.props.value) {
      this._maskCharData = (0, _inputMask.parseMask)(newProps.mask, newProps.maskFormat);
      newProps.value !== undefined && this.setValue(newProps.value);
      this.setState({
        displayValue: (0, _inputMask.getMaskDisplay)(newProps.mask, this._maskCharData, newProps.maskChar)
      });
    }
  };

  MaskedTextField.prototype.componentDidUpdate = function () {
    // Move the cursor to the start of the mask format on update
    if (this.state.maskCursorPosition !== undefined && this._textField.current) {
      this._textField.current.setSelectionRange(this.state.maskCursorPosition, this.state.maskCursorPosition);
    }
  };

  MaskedTextField.prototype.render = function () {
    return React.createElement(_TextField.TextField, tslib_1.__assign({}, this.props, {
      onFocus: this._onFocus,
      onBlur: this._onBlur,
      onMouseDown: this._onMouseDown,
      onMouseUp: this._onMouseUp,
      onChange: this._onInputChange,
      onBeforeChange: this._onBeforeChange,
      onKeyDown: this._onKeyDown,
      onPaste: this._onPaste,
      value: this.state.displayValue,
      componentRef: this._textField
    }));
  };

  Object.defineProperty(MaskedTextField.prototype, "value", {
    /**
     * @returns The value of all filled format characters or undefined if not all format characters are filled
     */
    get: function () {
      var value = '';

      for (var i = 0; i < this._maskCharData.length; i++) {
        if (!this._maskCharData[i].value) {
          return undefined;
        }

        value += this._maskCharData[i].value;
      }

      return value;
    },
    enumerable: true,
    configurable: true
  });
  /**
   *
   */

  MaskedTextField.prototype.setValue = function (newValue) {
    var valueIndex = 0,
        charDataIndex = 0;

    while (valueIndex < newValue.length && charDataIndex < this._maskCharData.length) {
      // Test if the next character in the new value fits the next format character
      var testVal = newValue[valueIndex];

      if (this._maskCharData[charDataIndex].format.test(testVal)) {
        this._maskCharData[charDataIndex].value = testVal;
        charDataIndex++;
      }

      valueIndex++;
    }
  };

  MaskedTextField.prototype.focus = function () {
    var current = this._textField.current;
    current && current.focus();
  };

  MaskedTextField.prototype.blur = function () {
    var current = this._textField.current;
    current && current.blur();
  };

  MaskedTextField.prototype.select = function () {
    var current = this._textField.current;
    current && current.select();
  };

  MaskedTextField.prototype.setSelectionStart = function (value) {
    var current = this._textField.current;
    current && current.setSelectionStart(value);
  };

  MaskedTextField.prototype.setSelectionEnd = function (value) {
    var current = this._textField.current;
    current && current.setSelectionEnd(value);
  };

  MaskedTextField.prototype.setSelectionRange = function (start, end) {
    var current = this._textField.current;
    current && current.setSelectionRange(start, end);
  };

  Object.defineProperty(MaskedTextField.prototype, "selectionStart", {
    get: function () {
      var current = this._textField.current;
      return current && current.selectionStart !== null ? current.selectionStart : -1;
    },
    enumerable: true,
    configurable: true
  });
  Object.defineProperty(MaskedTextField.prototype, "selectionEnd", {
    get: function () {
      var current = this._textField.current;
      return current && current.selectionEnd ? current.selectionEnd : -1;
    },
    enumerable: true,
    configurable: true
  });

  MaskedTextField.prototype._onFocus = function (event) {
    if (this.props.onFocus) {
      this.props.onFocus(event);
    }

    this._isFocused = true; // Move the cursor position to the leftmost unfilled position

    for (var i = 0; i < this._maskCharData.length; i++) {
      if (!this._maskCharData[i].value) {
        this.setState({
          maskCursorPosition: this._maskCharData[i].displayIndex
        });
        break;
      }
    }
  };

  MaskedTextField.prototype._onBlur = function (event) {
    if (this.props.onBlur) {
      this.props.onBlur(event);
    }

    this._isFocused = false;
    this._moveCursorOnMouseUp = true;
  };

  MaskedTextField.prototype._onMouseDown = function (event) {
    if (this.props.onMouseDown) {
      this.props.onMouseDown(event);
    }

    if (!this._isFocused) {
      this._moveCursorOnMouseUp = true;
    }
  };

  MaskedTextField.prototype._onMouseUp = function (event) {
    if (this.props.onMouseUp) {
      this.props.onMouseUp(event);
    } // Move the cursor on mouseUp after focusing the textField


    if (this._moveCursorOnMouseUp) {
      this._moveCursorOnMouseUp = false; // Move the cursor position to the rightmost unfilled position

      for (var i = 0; i < this._maskCharData.length; i++) {
        if (!this._maskCharData[i].value) {
          this.setState({
            maskCursorPosition: this._maskCharData[i].displayIndex
          });
          break;
        }
      }
    }
  };

  MaskedTextField.prototype._onBeforeChange = function (value) {
    var current = this._textField.current;

    if (this.props.onBeforeChange) {
      this.props.onBeforeChange(value);
    }

    if (this._changeSelectionData === null && current) {
      this._changeSelectionData = {
        changeType: 'default',
        selectionStart: current.selectionStart !== null ? current.selectionStart : -1,
        selectionEnd: current.selectionEnd !== null ? current.selectionEnd : -1
      };
    }
  };

  MaskedTextField.prototype._onInputChange = function (ev, value) {
    if (!this._changeSelectionData) {
      return;
    }

    var displayValue = this.state.displayValue; // The initial value of cursorPos does not matter

    var cursorPos = 0;
    var _a = this._changeSelectionData,
        changeType = _a.changeType,
        selectionStart = _a.selectionStart,
        selectionEnd = _a.selectionEnd;

    if (changeType === 'textPasted') {
      var charsSelected = selectionEnd - selectionStart,
          charCount = value.length + charsSelected - displayValue.length,
          startPos = selectionStart,
          pastedString = value.substr(startPos, charCount); // Clear any selected characters

      if (charsSelected) {
        this._maskCharData = (0, _inputMask.clearRange)(this._maskCharData, selectionStart, charsSelected);
      }

      cursorPos = (0, _inputMask.insertString)(this._maskCharData, startPos, pastedString);
    } else if (changeType === 'delete' || changeType === 'backspace') {
      // isDel is true If the characters are removed LTR, otherwise RTL
      var isDel = changeType === 'delete',
          charCount = selectionEnd - selectionStart;

      if (charCount) {
        // charCount is > 0 if range was deleted
        this._maskCharData = (0, _inputMask.clearRange)(this._maskCharData, selectionStart, charCount);
        cursorPos = (0, _inputMask.getRightFormatIndex)(this._maskCharData, selectionStart);
      } else {
        // If charCount === 0, there was no selection and a single character was deleted
        if (isDel) {
          this._maskCharData = (0, _inputMask.clearNext)(this._maskCharData, selectionStart);
          cursorPos = (0, _inputMask.getRightFormatIndex)(this._maskCharData, selectionStart);
        } else {
          this._maskCharData = (0, _inputMask.clearPrev)(this._maskCharData, selectionStart);
          cursorPos = (0, _inputMask.getLeftFormatIndex)(this._maskCharData, selectionStart);
        }
      }
    } else if (value.length > displayValue.length) {
      // This case is if the user added characters
      var charCount = value.length - displayValue.length,
          startPos = selectionEnd - charCount,
          enteredString = value.substr(startPos, charCount);
      cursorPos = (0, _inputMask.insertString)(this._maskCharData, startPos, enteredString);
    } else if (value.length <= displayValue.length) {
      /**
       * This case is reached only if the user has selected a block of 1 or more
       * characters and input a character replacing the characters they've selected.
       */
      var charCount = 1,
          selectCount = displayValue.length + charCount - value.length,
          startPos = selectionEnd - charCount,
          enteredString = value.substr(startPos, charCount); // Clear the selected range

      this._maskCharData = (0, _inputMask.clearRange)(this._maskCharData, startPos, selectCount); // Insert the printed character

      cursorPos = (0, _inputMask.insertString)(this._maskCharData, startPos, enteredString);
    }

    this._changeSelectionData = null;
    var newValue = (0, _inputMask.getMaskDisplay)(this.props.mask, this._maskCharData, this.props.maskChar);
    this.setState({
      displayValue: newValue,
      maskCursorPosition: cursorPos
    }); // Perform onChange/d after input has been processed. Return value is expected to be the displayed text

    if (this.props.onChange) {
      this.props.onChange(ev, newValue);
    }

    if (this.props.onChanged) {
      this.props.onChanged(newValue);
    }
  };

  MaskedTextField.prototype._onKeyDown = function (event) {
    var current = this._textField.current;

    if (this.props.onKeyDown) {
      this.props.onKeyDown(event);
    }

    this._changeSelectionData = null;

    if (current && current.value) {
      var keyCode = event.keyCode,
          ctrlKey = event.ctrlKey,
          metaKey = event.metaKey; // Ignore ctrl and meta keydown

      if (ctrlKey || metaKey) {
        return;
      } // On backspace or delete, store the selection and the keyCode


      if (keyCode === _Utilities.KeyCodes.backspace || keyCode === _Utilities.KeyCodes.del) {
        var selectionStart = event.target.selectionStart,
            selectionEnd = event.target.selectionEnd; // Check if backspace or delete press is valid.

        if (!(keyCode === _Utilities.KeyCodes.backspace && selectionEnd && selectionEnd > 0) && !(keyCode === _Utilities.KeyCodes.del && selectionStart !== null && selectionStart < current.value.length)) {
          return;
        }

        this._changeSelectionData = {
          changeType: keyCode === _Utilities.KeyCodes.backspace ? 'backspace' : 'delete',
          selectionStart: selectionStart !== null ? selectionStart : -1,
          selectionEnd: selectionEnd !== null ? selectionEnd : -1
        };
      }
    }
  };

  MaskedTextField.prototype._onPaste = function (event) {
    if (this.props.onPaste) {
      this.props.onPaste(event);
    }

    var selectionStart = event.target.selectionStart,
        selectionEnd = event.target.selectionEnd; // Store the paste selection range

    this._changeSelectionData = {
      changeType: 'textPasted',
      selectionStart: selectionStart !== null ? selectionStart : -1,
      selectionEnd: selectionEnd !== null ? selectionEnd : -1
    };
  };

  MaskedTextField.defaultProps = {
    maskChar: DEFAULT_MASK_CHAR,
    maskFormat: _inputMask.DEFAULT_MASK_FORMAT_CHARS
  };

  tslib_1.__decorate([_Utilities.autobind], MaskedTextField.prototype, "_onFocus", null);

  tslib_1.__decorate([_Utilities.autobind], MaskedTextField.prototype, "_onBlur", null);

  tslib_1.__decorate([_Utilities.autobind], MaskedTextField.prototype, "_onMouseDown", null);

  tslib_1.__decorate([_Utilities.autobind], MaskedTextField.prototype, "_onMouseUp", null);

  tslib_1.__decorate([_Utilities.autobind], MaskedTextField.prototype, "_onBeforeChange", null);

  tslib_1.__decorate([_Utilities.autobind], MaskedTextField.prototype, "_onInputChange", null);

  tslib_1.__decorate([_Utilities.autobind], MaskedTextField.prototype, "_onKeyDown", null);

  tslib_1.__decorate([_Utilities.autobind], MaskedTextField.prototype, "_onPaste", null);

  return MaskedTextField;
}(React.Component);

exports.MaskedTextField = MaskedTextField;
},{"tslib":"xgwM","react":"mpTF","../TextField":"nkni","../../../Utilities":"B5nc","./inputMask":"QDbM"}],"zvFX":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _TextField = require("./TextField");

Object.keys(_TextField).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _TextField[key];
    }
  });
});

var _TextField2 = require("./TextField.base");

Object.keys(_TextField2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _TextField2[key];
    }
  });
});

var _MaskedTextField = require("./MaskedTextField/MaskedTextField");

Object.keys(_MaskedTextField).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _MaskedTextField[key];
    }
  });
});
},{"./TextField":"nkni","./TextField.base":"xGAm","./MaskedTextField/MaskedTextField":"iEZD"}],"R67r":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _index = require("./components/TextField/index");

Object.keys(_index).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index[key];
    }
  });
});
},{"./components/TextField/index":"zvFX"}],"Fr6U":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ToggleBase = void 0;

var tslib_1 = _interopRequireWildcard(require("tslib"));

var React = _interopRequireWildcard(require("react"));

var _Utilities = require("../../Utilities");

var _Label = require("../../Label");

var _KeytipData = require("../../KeytipData");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var getClassNames = (0, _Utilities.classNamesFunction)();

var ToggleBase =
/** @class */
function (_super) {
  tslib_1.__extends(ToggleBase, _super);

  function ToggleBase(props) {
    var _this = _super.call(this, props) || this;

    _this._toggleButton = React.createRef();

    _this._onClick = function (ev) {
      var _a = _this.props,
          disabled = _a.disabled,
          checkedProp = _a.checked,
          onChange = _a.onChange,
          onChanged = _a.onChanged,
          onClick = _a.onClick;
      var checked = _this.state.checked;

      if (!disabled) {
        // Only update the state if the user hasn't provided it.
        if (checkedProp === undefined) {
          _this.setState({
            checked: !checked
          });
        }

        if (onChange) {
          onChange(ev, !checked);
        }

        if (onChanged) {
          onChanged(!checked);
        }

        if (onClick) {
          onClick(ev);
        }
      }
    };

    _this._warnMutuallyExclusive({
      checked: 'defaultChecked'
    });

    _this._warnDeprecations({
      onAriaLabel: 'ariaLabel',
      offAriaLabel: undefined,
      onChanged: 'onChange'
    });

    _this.state = {
      checked: !!(props.checked || props.defaultChecked)
    };
    _this._id = props.id || (0, _Utilities.getId)('Toggle');
    return _this;
  }

  Object.defineProperty(ToggleBase.prototype, "checked", {
    /**
     * Gets the current checked state of the toggle.
     */
    get: function () {
      return this.state.checked;
    },
    enumerable: true,
    configurable: true
  });

  ToggleBase.prototype.componentWillReceiveProps = function (newProps) {
    if (newProps.checked !== undefined) {
      this.setState({
        checked: !!newProps.checked // convert null to false

      });
    }
  };

  ToggleBase.prototype.render = function () {
    var _this = this;

    var _a = this.props,
        _b = _a.as,
        RootType = _b === void 0 ? 'div' : _b,
        className = _a.className,
        theme = _a.theme,
        disabled = _a.disabled,
        keytipProps = _a.keytipProps,
        label = _a.label,
        ariaLabel = _a.ariaLabel,
        onAriaLabel = _a.onAriaLabel,
        offAriaLabel = _a.offAriaLabel,
        offText = _a.offText,
        onText = _a.onText,
        styles = _a.styles,
        inlineLabel = _a.inlineLabel;
    var checked = this.state.checked;
    var stateText = checked ? onText : offText;
    var badAriaLabel = checked ? onAriaLabel : offAriaLabel;
    var toggleNativeProps = (0, _Utilities.getNativeProps)(this.props, _Utilities.inputProperties, ['defaultChecked']);
    var classNames = getClassNames(styles, {
      theme: theme,
      className: className,
      disabled: disabled,
      checked: checked,
      inlineLabel: inlineLabel,
      onOffMissing: !onText && !offText
    });
    var labelId = this._id + "-label";
    var stateTextId = this._id + "-stateText"; // The following properties take priority for what Narrator should read:
    // 1. ariaLabel
    // 2. onAriaLabel (if checked) or offAriaLabel (if not checked)
    // 3. label
    // 4. onText (if checked) or offText (if not checked)

    var labelledById = undefined;

    if (!ariaLabel && !badAriaLabel) {
      if (label) {
        labelledById = labelId;
      } else if (stateText) {
        labelledById = stateTextId;
      }
    }

    return React.createElement(RootType, {
      className: classNames.root,
      hidden: toggleNativeProps.hidden
    }, label && React.createElement(_Label.Label, {
      htmlFor: this._id,
      className: classNames.label,
      id: labelId
    }, label), React.createElement("div", {
      className: classNames.container
    }, React.createElement(_KeytipData.KeytipData, {
      keytipProps: keytipProps,
      ariaDescribedBy: toggleNativeProps['aria-describedby'],
      disabled: disabled
    }, function (keytipAttributes) {
      return React.createElement("button", tslib_1.__assign({}, toggleNativeProps, keytipAttributes, {
        className: classNames.pill,
        disabled: disabled,
        id: _this._id,
        type: "button",
        role: "switch" // ARIA 1.1 definition; "checkbox" in ARIA 1.0
        ,
        ref: _this._toggleButton,
        "aria-disabled": disabled,
        "aria-checked": checked,
        "aria-label": ariaLabel ? ariaLabel : badAriaLabel,
        "data-is-focusable": true,
        onChange: _this._noop,
        onClick: _this._onClick,
        "aria-labelledby": labelledById
      }), React.createElement("div", {
        className: classNames.thumb
      }));
    }), stateText && React.createElement(_Label.Label, {
      htmlFor: this._id,
      className: classNames.text,
      id: stateTextId
    }, stateText)));
  };

  ToggleBase.prototype.focus = function () {
    if (this._toggleButton.current) {
      this._toggleButton.current.focus();
    }
  };

  ToggleBase.prototype._noop = function () {
    /* no-op */
  };

  return ToggleBase;
}(_Utilities.BaseComponent);

exports.ToggleBase = ToggleBase;
},{"tslib":"xgwM","react":"mpTF","../../Utilities":"B5nc","../../Label":"RcoC","../../KeytipData":"ltoP"}],"YPIU":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getStyles = void 0;

var _Styling = require("../../Styling");

var getStyles = function (props) {
  var theme = props.theme,
      className = props.className,
      disabled = props.disabled,
      checked = props.checked,
      inlineLabel = props.inlineLabel,
      onOffMissing = props.onOffMissing;
  var semanticColors = theme.semanticColors;
  var pillUncheckedBackground = semanticColors.bodyBackground;
  var pillCheckedBackground = semanticColors.inputBackgroundChecked;
  var pillCheckedHoveredBackground = semanticColors.inputBackgroundCheckedHovered;
  var pillCheckedDisabledBackground = semanticColors.disabledBodySubtext;
  var thumbBackground = semanticColors.inputBorderHovered;
  var thumbCheckedBackground = semanticColors.inputForegroundChecked;
  var thumbDisabledBackground = semanticColors.disabledBodySubtext;
  var thumbCheckedDisabledBackground = semanticColors.disabledBackground;
  var pillBorderColor = semanticColors.smallInputBorder;
  var pillBorderHoveredColor = semanticColors.inputBorderHovered;
  var pillBorderDisabledColor = semanticColors.disabledBodySubtext;
  var textDisabledColor = semanticColors.disabledText;
  return {
    root: ['ms-Toggle', checked && 'is-checked', !disabled && 'is-enabled', disabled && 'is-disabled', theme.fonts.medium, {
      marginBottom: '8px'
    }, inlineLabel && {
      display: 'flex',
      alignItems: 'center'
    }, className],
    label: ['ms-Toggle-label', disabled && {
      color: textDisabledColor,
      selectors: (_a = {}, _a[_Styling.HighContrastSelector] = {
        color: 'GrayText'
      }, _a)
    }, inlineLabel && !onOffMissing && {
      marginRight: 16
    }, onOffMissing && inlineLabel && {
      order: 1,
      marginLeft: 16
    }],
    container: ['ms-Toggle-innerContainer', {
      display: 'inline-flex',
      position: 'relative'
    }],
    pill: ['ms-Toggle-background', (0, _Styling.getFocusStyle)(theme, {
      inset: -3
    }), {
      fontSize: '20px',
      boxSizing: 'border-box',
      width: '2.2em',
      height: '1em',
      borderRadius: '1em',
      transition: 'all 0.1s ease',
      borderWidth: '1px',
      borderStyle: 'solid',
      background: pillUncheckedBackground,
      borderColor: pillBorderColor,
      cursor: 'pointer',
      display: 'flex',
      alignItems: 'center',
      padding: '0 .2em'
    }, !disabled && [!checked && {
      selectors: {
        ':hover': [{
          borderColor: pillBorderHoveredColor
        }],
        ':hover .ms-Toggle-thumb': [{
          selectors: (_b = {}, _b[_Styling.HighContrastSelector] = {
            borderColor: 'Highlight'
          }, _b)
        }]
      }
    }, checked && [{
      background: pillCheckedBackground,
      borderColor: 'transparent',
      justifyContent: 'flex-end'
    }, {
      selectors: (_c = {
        ':hover': [{
          backgroundColor: pillCheckedHoveredBackground,
          borderColor: 'transparent',
          selectors: (_d = {}, _d[_Styling.HighContrastSelector] = {
            backgroundColor: 'Highlight'
          }, _d)
        }]
      }, _c[_Styling.HighContrastSelector] = {
        backgroundColor: 'WindowText'
      }, _c)
    }]], disabled && [{
      cursor: 'default'
    }, !checked && [{
      borderColor: pillBorderDisabledColor
    }], checked && [{
      backgroundColor: pillCheckedDisabledBackground,
      borderColor: 'transparent',
      justifyContent: 'flex-end'
    }]], !disabled && {
      selectors: {
        '&:hover': {
          selectors: (_e = {}, _e[_Styling.HighContrastSelector] = {
            borderColor: 'Highlight'
          }, _e)
        }
      }
    }],
    thumb: ['ms-Toggle-thumb', {
      width: '.5em',
      height: '.5em',
      borderRadius: '.5em',
      transition: 'all 0.1s ease',
      backgroundColor: thumbBackground,

      /* Border is added to handle high contrast mode for Firefox */
      borderColor: 'transparent',
      borderWidth: '.28em',
      borderStyle: 'solid',
      boxSizing: 'border-box'
    }, !disabled && checked && [{
      backgroundColor: thumbCheckedBackground,
      selectors: (_f = {}, _f[_Styling.HighContrastSelector] = {
        backgroundColor: 'Window',
        borderColor: 'Window'
      }, _f)
    }], disabled && [!checked && [{
      backgroundColor: thumbDisabledBackground
    }], checked && [{
      backgroundColor: thumbCheckedDisabledBackground
    }]]],
    text: ['ms-Toggle-stateText', {
      selectors: {
        // Workaround: make rules more specific than Label rules.
        '&&': {
          padding: '0',
          margin: '0 8px',
          userSelect: 'none'
        }
      }
    }, disabled && {
      selectors: {
        '&&': {
          color: textDisabledColor,
          selectors: (_g = {}, _g[_Styling.HighContrastSelector] = {
            color: 'GrayText'
          }, _g)
        }
      }
    }]
  };

  var _a, _b, _c, _d, _e, _f, _g;
};

exports.getStyles = getStyles;
},{"../../Styling":"AHeq"}],"zjCb":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Toggle = void 0;

var _Utilities = require("../../Utilities");

var _Toggle = require("./Toggle.base");

var _Toggle2 = require("./Toggle.styles");

var Toggle = (0, _Utilities.styled)(_Toggle.ToggleBase, _Toggle2.getStyles, undefined, {
  scope: 'Toggle'
});
exports.Toggle = Toggle;
},{"../../Utilities":"B5nc","./Toggle.base":"Fr6U","./Toggle.styles":"YPIU"}],"nfQE":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _Toggle = require("./Toggle");

Object.keys(_Toggle).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Toggle[key];
    }
  });
});

var _Toggle2 = require("./Toggle.base");

Object.keys(_Toggle2).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _Toggle2[key];
    }
  });
});
},{"./Toggle":"zjCb","./Toggle.base":"Fr6U"}],"enG4":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _index = require("./components/Toggle/index");

Object.keys(_index).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return _index[key];
    }
  });
});
},{"./components/Toggle/index":"nfQE"}],"CjEO":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.fabric = void 0;

var _Button = require("office-ui-fabric-react/lib/components/Button");

var _ChoiceGroup = require("office-ui-fabric-react/lib/ChoiceGroup");

var _ComboBox = require("office-ui-fabric-react/lib/components/ComboBox");

var _CommandBar = require("office-ui-fabric-react/lib/components/CommandBar");

var _ContextualMenu = require("office-ui-fabric-react/lib/components/ContextualMenu");

var _utilities = require("@uifabric/utilities");

var _Dialog = require("office-ui-fabric-react/lib/Dialog");

var _Dropdown = require("office-ui-fabric-react/lib/components/Dropdown");

var _Styling = require("office-ui-fabric-react/lib/Styling");

var _Icon = require("office-ui-fabric-react/lib/Icon");

var _Icons = require("office-ui-fabric-react/lib/Icons");

var _Label = require("office-ui-fabric-react/lib/Label");

var _Modal = require("office-ui-fabric-react/lib/components/Modal");

var _Slider = require("office-ui-fabric-react/lib/Slider");

var _Spinner = require("office-ui-fabric-react/lib/Spinner");

var _TextField = require("office-ui-fabric-react/lib/TextField");

var _Toggle = require("office-ui-fabric-react/lib/Toggle");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
(0, _Icons.initializeIcons)();
var fabric = {
  ActionButton: _Button.ActionButton,
  ChoiceGroup: _ChoiceGroup.ChoiceGroup,
  ComboBox: _ComboBox.ComboBox,
  CommandBar: _CommandBar.CommandBar,
  ContextualMenuItemType: _ContextualMenu.ContextualMenuItemType,
  Customizer: _utilities.Customizer,
  DefaultButton: _Button.DefaultButton,
  Dialog: _Dialog.Dialog,
  DialogFooter: _Dialog.DialogFooter,
  DialogType: _Dialog.DialogType,
  Dropdown: _Dropdown.Dropdown,
  DropdownMenuItemType: _Dropdown.DropdownMenuItemType,
  Icon: _Icon.Icon,
  IconButton: _Button.IconButton,
  getFocusStyle: _Styling.getFocusStyle,
  getTheme: _Styling.getTheme,
  Label: _Label.Label,
  loadTheme: _Styling.loadTheme,
  Modal: _Modal.Modal,
  PrimaryButton: _Button.PrimaryButton,
  Slider: _Slider.Slider,
  Spinner: _Spinner.Spinner,
  SpinnerSize: _Spinner.SpinnerSize,
  TextField: _TextField.TextField,
  Toggle: _Toggle.Toggle
};
exports.fabric = fabric;
},{"office-ui-fabric-react/lib/components/Button":"EFSA","office-ui-fabric-react/lib/ChoiceGroup":"UZTq","office-ui-fabric-react/lib/components/ComboBox":"XlQ6","office-ui-fabric-react/lib/components/CommandBar":"xVzM","office-ui-fabric-react/lib/components/ContextualMenu":"NBX4","@uifabric/utilities":"PHCX","office-ui-fabric-react/lib/Dialog":"zBYt","office-ui-fabric-react/lib/components/Dropdown":"Pl29","office-ui-fabric-react/lib/Styling":"AHeq","office-ui-fabric-react/lib/Icon":"s5pL","office-ui-fabric-react/lib/Icons":"VgAP","office-ui-fabric-react/lib/Label":"RcoC","office-ui-fabric-react/lib/components/Modal":"T1n2","office-ui-fabric-react/lib/Slider":"gVdr","office-ui-fabric-react/lib/Spinner":"cr1E","office-ui-fabric-react/lib/TextField":"R67r","office-ui-fabric-react/lib/Toggle":"enG4"}],"Vlbn":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.use = use;
exports.base = void 0;

var SandDanceExplorer = _interopRequireWildcard(require("@msrvida/sanddance-explorer"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
var base = {
  fabric: null
};
/**
 * Specify the dependency libraries to use for rendering.
 * @param fabric Office UI Fabric React library.
 */

exports.base = base;

function use(fabric, vega, deck, layers, luma) {
  SandDanceExplorer.use(fabric, vega, deck, layers, luma);
  base.fabric = fabric;
}
},{"@msrvida/sanddance-explorer":"TX8u"}],"hk5u":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.strings = void 0;
var strings = {
  buttonLoadData: 'Load data',
  buttonThemeDark: 'Dark',
  buttonThemeLight: 'Light',
  buttonExport: 'Export',
  menuUserData: 'Use your own data',
  menuLocal: 'On this computer ...',
  menuUrl: 'Enter a URL ...',
  menuSnapshotsExportAsJSON: 'Export as .snapshots JSON file',
  menuSnapshotsExportAs: 'Export as ...',
  menuSnapshotsImport: 'Import a .snapshots JSON file',
  dialogTitleLocal: 'Use a file from your computer',
  dialogSubtextLocal: 'Your file will not be uploaded, it is only used by the browser on this computer.  The currently supported data formats are json (the default), csv (comma-separated values), tsv (tab-separated values), and topojson.',
  dialogTitleUrl: 'Use a data file via URL',
  dialogTitleSnapshotsExport: 'Export as',
  dialogTitleSnapshotsLocal: 'Use a snapshots file from your computer',
  dialogSubtextSnapshotsLocal: 'Use a file that was previously exported snapshots file. Your file will not be uploaded, it is only used by the browser on this computer.',
  dialogTitleSnapshotsUrl: 'Use a snapshots file via URL',
  dialogCloseButton: 'Close',
  dialogLoadButton: 'Load',
  labelLocal: '[local]',
  labelColorFilter: 'Note: Colors will be re-mapped to the filter when viewing this saved chart.',
  labelPreferences: 'Preferences',
  labelCompactUI: 'Compact UI',
  labelCompactUIDescription: 'Compact UI hides collapses labels on dropdown menus.',
  labelSnapshotsExportHTMLTitle: 'HTML',
  labelSnapshotsExportHTMLDescription: 'A self contained HTML page with current data and snapshots pre-loaded.',
  labelSnapshotsExportMarkdownTitle: 'Markdown',
  labelSnapshotsExportMarkdownDescription: 'Markdown is a language used by many blogging platforms. Exports a Markdown file with thumbnails of these snapshots which link back to the SandDance website.',
  labelSnapshotsShortcut: 'Tip: Your .snapshots JSON file can also be pre-loaded with this',
  labelLink: 'link',
  labelLinkDescription: 'A URL to revive this snapshot.',
  labelUrl: 'Url',
  labelDataFormat: 'Data format',
  labelDataUrlShortcut: 'Tip: Your data file can also be pre-loaded with this',
  urlInputPlaceholder: 'paste URL',
  sampleDataPrefix: 'Sample data',
  localFilePrefix: 'Local file',
  urlPrefix: 'Url',
  errorInvalidFileFormat: 'Invalid file format',
  errorNoUrl: 'Please enter a url',
  errorUrlHttp: 'Url must begin with "http"',
  errorDownloadFailure: 'Data could not be prepared for download.',
  errorDataSourceFromLocal: function errorDataSourceFromLocal(ds) {
    return "Could not load ".concat(ds.type, " from local file.");
  },
  errorDataSourceFromUrl: function errorDataSourceFromUrl(ds) {
    return "Could not load ".concat(ds.type, " from ").concat(ds.dataUrl);
  }
};
exports.strings = strings;
},{}],"BQaf":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.invalidUrlError = invalidUrlError;

var _language = require("./language");

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function invalidUrlError(url) {
  if (!url) {
    return _language.strings.errorNoUrl;
  }

  if (url.toLocaleLowerCase().substr(0, 4) !== 'http') {
    return _language.strings.errorUrlHttp;
  }
}
},{"./language":"hk5u"}],"EVeS":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.DataSourceButton = DataSourceButton;
exports.DataSourcePicker = void 0;

var React = _interopRequireWildcard(require("react"));

var _base = require("./base");

var _url = require("./url");

var _language = require("./language");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _typeof(obj) { 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); }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

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; }

function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

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); }

function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

function DataSourceButton(props) {
  var picker = props.getPicker();
  if (!picker) return null;
  var menuProps = {
    items: [{
      key: 'sample-section',
      itemType: _base.base.fabric.ContextualMenuItemType.Section,
      sectionProps: {
        title: _language.strings.sampleDataPrefix,
        items: props.dataSources.map(function (ds, i) {
          var item = {
            key: ds.id,
            text: ds.displayName,
            onClick: function onClick(e) {
              picker.changeDataSource(ds);
            }
          };
          return item;
        })
      }
    }, {
      key: 'user-section',
      itemType: _base.base.fabric.ContextualMenuItemType.Section,
      sectionProps: {
        topDivider: true,
        title: _language.strings.menuUserData,
        items: [{
          key: 'local',
          text: _language.strings.menuLocal,
          onClick: function onClick(e) {
            return picker.setState({
              dialogMode: 'local'
            });
          }
        }, {
          key: 'url',
          text: _language.strings.menuUrl,
          onClick: function onClick(e) {
            return picker.setState({
              dialogMode: 'url'
            });
          }
        }]
      }
    }]
  };
  return React.createElement(_base.base.fabric.PrimaryButton, {
    className: "sanddance-datasource-picker",
    text: dataSourcePrefix(props.dataSource.dataSourceType, props.dataSource.displayName),
    menuProps: menuProps
  });
}

var DataSourcePicker =
/*#__PURE__*/
function (_React$Component) {
  _inherits(DataSourcePicker, _React$Component);

  function DataSourcePicker(props) {
    var _this;

    _classCallCheck(this, DataSourcePicker);

    _this = _possibleConstructorReturn(this, _getPrototypeOf(DataSourcePicker).call(this, props));
    _this.state = {
      url: '',
      urlType: DataSourcePicker.urlTypes[0],
      working: false
    };
    return _this;
  }

  _createClass(DataSourcePicker, [{
    key: "changeDataSource",
    value: function changeDataSource(dataSource) {
      var _this2 = this;

      this.setState({
        working: true
      });
      return new Promise(function (resolve, reject) {
        var uploadFormatError = '';
        var urlError = '';

        _this2.setState({
          uploadFormatError: uploadFormatError,
          urlError: urlError
        });

        _this2.props.changeDataSource(dataSource).then(function () {
          _this2.setState({
            working: false,
            uploadFormatError: '',
            urlError: '',
            dialogMode: null
          });

          resolve();
        }).catch(function (reason) {
          _this2.setState({
            working: false
          });

          reject(reason);
        });
      });
    }
  }, {
    key: "upload",
    value: function upload(e) {
      var _this3 = this;

      if (e.target.files) {
        var file = e.target.files[0];
        var split = file.name.split('.');
        var type = split[split.length - 1];

        if (DataSourcePicker.urlTypes.indexOf(type) >= 0) {
          var reader = new FileReader();

          reader.onload = function () {
            var id = file.name;
            var displayName = file.name;
            var rawText = reader.result;
            var ds = {
              dataSourceType: 'local',
              displayName: displayName,
              id: id,
              rawText: rawText,
              type: type
            };

            _this3.changeDataSource(ds);
          };

          reader.readAsText(file);
        } else {
          var uploadFormatError = _language.strings.errorInvalidFileFormat;
          this.setState({
            uploadFormatError: uploadFormatError
          });
        }
      }
    }
  }, {
    key: "loadUrl",
    value: function loadUrl() {
      var _this4 = this;

      if (!this.state.url) {
        return this.setState({
          urlError: _language.strings.errorNoUrl
        });
      }

      if (this.state.url.toLocaleLowerCase().substr(0, 4) !== 'http') {
        return this.setState({
          urlError: _language.strings.errorUrlHttp
        });
      } //TODO: check url


      var url = this.state.url;
      var ds = {
        dataSourceType: 'url',
        displayName: url,
        id: url,
        dataUrl: url,
        type: this.state.urlType
      };
      this.changeDataSource(ds).catch(function (e) {
        _this4.setState({
          urlError: e.message
        });
      });
    }
  }, {
    key: "getUrlShortcut",
    value: function getUrlShortcut(dataUrl, type) {
      var dss = {
        dataSource: {
          dataSourceType: 'url',
          dataUrl: dataUrl,
          displayName: dataUrl.substring(dataUrl.lastIndexOf('/') + 1, dataUrl.lastIndexOf('.')),
          id: '',
          type: type
        }
      };
      return '#' + JSON.stringify(dss);
    }
  }, {
    key: "render",
    value: function render() {
      var _this5 = this;

      var closeDialog = function closeDialog() {
        _this5.setState({
          dialogMode: null
        });
      };

      var shortcut;

      if (this.state.url && !(0, _url.invalidUrlError)(this.state.url) && !this.state.urlError) {
        shortcut = this.getUrlShortcut(this.state.url, this.state.urlType);
      }

      return [React.createElement(_base.base.fabric.Dialog, {
        key: 'local',
        hidden: !(this.state.dialogMode === 'local'),
        onDismiss: closeDialog,
        dialogContentProps: {
          className: "sanddance-dialog ".concat(this.props.theme),
          type: _base.base.fabric.DialogType.normal,
          title: _language.strings.dialogTitleLocal,
          subText: _language.strings.dialogSubtextLocal
        }
      }, React.createElement("input", {
        type: "file",
        onChange: function onChange(e) {
          return _this5.upload(e);
        },
        disabled: this.state.working
      }), this.state.uploadFormatError && React.createElement("div", {
        className: "error"
      }, this.state.uploadFormatError)), React.createElement(_base.base.fabric.Dialog, {
        key: 'url',
        hidden: !(this.state.dialogMode === 'url'),
        onDismiss: closeDialog,
        dialogContentProps: {
          className: "sanddance-dialog ".concat(this.props.theme),
          type: _base.base.fabric.DialogType.normal,
          title: _language.strings.dialogTitleUrl
        }
      }, React.createElement("section", null, React.createElement(_base.base.fabric.TextField, {
        label: _language.strings.labelUrl,
        placeholder: _language.strings.urlInputPlaceholder,
        onKeyUp: function onKeyUp(e) {
          return e.keyCode === 13 && _this5.loadUrl();
        },
        onChange: function onChange(e, url) {
          return _this5.setState({
            url: url,
            urlError: ''
          });
        },
        value: this.state.url,
        disabled: this.state.working
      }), this.state.urlError && React.createElement("div", {
        className: "error"
      }, this.state.urlError)), React.createElement("section", null, React.createElement(_base.base.fabric.ChoiceGroup, {
        options: DataSourcePicker.urlTypes.map(function (urlType, i) {
          return {
            key: "".concat(i),
            text: urlType,
            disabled: _this5.state.working,
            checked: i === 0
          };
        }),
        onChange: function onChange(ev, option) {
          return _this5.setState({
            urlType: option.text,
            urlError: ''
          });
        },
        label: _language.strings.labelDataFormat
      })), React.createElement("section", {
        className: 'tip',
        style: {
          visibility: !(0, _url.invalidUrlError)(this.state.url) && !this.state.urlError ? 'visible' : 'hidden'
        }
      }, _language.strings.labelDataUrlShortcut, " ", React.createElement("a", {
        href: shortcut,
        title: _language.strings.labelLinkDescription,
        "aria-label": _language.strings.labelLinkDescription
      }, _language.strings.labelLink)), React.createElement(_base.base.fabric.DialogFooter, null, React.createElement(_base.base.fabric.PrimaryButton, {
        onClick: function onClick(e) {
          return _this5.loadUrl();
        },
        text: _language.strings.dialogLoadButton,
        disabled: this.state.working
      }), React.createElement(_base.base.fabric.DefaultButton, {
        onClick: closeDialog,
        text: _language.strings.dialogCloseButton
      })))];
    }
  }]);

  return DataSourcePicker;
}(React.Component);

exports.DataSourcePicker = DataSourcePicker;
DataSourcePicker.urlTypes = ['json', 'csv', 'tsv', 'topojson'];

function dataSourcePrefix(dt, displayName) {
  switch (dt) {
    case 'sample':
      return "".concat(_language.strings.sampleDataPrefix, ": ").concat(displayName);

    case 'local':
      return _language.strings.localFilePrefix;

    case 'url':
      return _language.strings.urlPrefix;
  }

  return _language.strings.buttonLoadData;
}
},{"react":"mpTF","./base":"Vlbn","./url":"BQaf","./language":"hk5u"}],"GTzW":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.downloadData = downloadData;

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
function downloadData(data, fileName) {
  // Adapted from https://ourcodeworld.com/articles/read/189/how-to-create-a-file-and-generate-a-download-with-javascript-in-the-browser-without-a-server
  var a = document.createElement('a');
  a.setAttribute('download', fileName);
  document.body.appendChild(a);
  var blob = dataURIToBlob(data);
  a.href = URL.createObjectURL(blob); // we must revoke the object URL, 
  // since we can't know when the download occured, we have to attach it on the click handler..

  a.onclick = function () {
    // ..and to wait a frame
    requestAnimationFrame(function () {
      return URL.revokeObjectURL(a.href);
    });
    document.body.removeChild(a);
  };

  a.click();
} //from https://stackoverflow.com/a/37151835/620501


function dataURIToBlob(binStr) {
  var len = binStr.length,
      arr = new Uint8Array(len);

  for (var i = 0; i < len; i++) {
    arr[i] = binStr.charCodeAt(i);
  }

  return new Blob([arr]);
}
},{}],"rNge":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.cleanSnapshots = cleanSnapshots;
exports.downloadSnapshotsJSON = downloadSnapshotsJSON;
exports.serializeSnapshot = serializeSnapshot;
exports.validSnapshots = validSnapshots;
exports.SnapshotExport = SnapshotExport;
exports.SnapshotImportRemote = exports.SnapshotImportLocal = void 0;

var React = _interopRequireWildcard(require("react"));

var _base = require("./base");

var _download = require("./download");

var _sanddanceExplorer = require("@msrvida/sanddance-explorer");

var _url = require("./url");

var _language = require("./language");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _typeof(obj) { 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); }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

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; }

function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

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); }

function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

var VegaDeckGl = _sanddanceExplorer.SandDance.VegaDeckGl;
var util = VegaDeckGl.util;

function markdownImageLink(alt, imageUrl, link) {
  return "[![".concat(alt, "](").concat(imageUrl, ")](").concat(link, ")");
}

function cleanSnapshots(snapshots) {
  //remove data sources from snapshots
  var clean = util.clone(snapshots);
  clean.forEach(function (snapshot) {
    if (snapshot.dataSource) {
      delete snapshot.dataSource.snapshotsUrl;
    }
  });
  return clean;
}

function downloadSnapshotsJSON(snapshots, filename) {
  //clean prior to exporting
  var clean = cleanSnapshots(snapshots);
  (0, _download.downloadData)(JSON.stringify(clean, null, 2), filename);
}

function serializeSnapshot(snapshotWithImage) {
  var snapshot = util.clone(snapshotWithImage); //remove the image data from the snapshot

  delete snapshot.bgColor;
  delete snapshot.image;

  if (snapshot.dataSource) {
    delete snapshot.dataSource.rawText;
  }

  return JSON.stringify(snapshot);
}

function isSnapshot(snapshot) {
  return snapshot.insight && snapshot.title;
}

function validSnapshots(snapshots) {
  if (Array.isArray(snapshots)) {
    for (var i = 0; i < snapshots.length; i++) {
      if (!isSnapshot(snapshots[i])) {
        return false;
      }
    }

    return true;
  }

  return false;
}

var SnapshotImportLocal =
/*#__PURE__*/
function (_React$Component) {
  _inherits(SnapshotImportLocal, _React$Component);

  function SnapshotImportLocal(props) {
    var _this;

    _classCallCheck(this, SnapshotImportLocal);

    _this = _possibleConstructorReturn(this, _getPrototypeOf(SnapshotImportLocal).call(this, props));
    _this.state = {
      working: false
    };
    return _this;
  }

  _createClass(SnapshotImportLocal, [{
    key: "readFile",
    value: function readFile(e) {
      var _this2 = this;

      if (e.target.files) {
        this.setState({
          working: true
        });
        var file = e.target.files[0];
        var reader = new FileReader();

        reader.onload = function () {
          var rawText = reader.result;
          var snapshots;

          try {
            snapshots = JSON.parse(rawText);
          } catch (e) {
            _this2.setState({
              fileFormatError: _language.strings.errorInvalidFileFormat,
              working: false
            });
          } //validate these are snapshots


          if (validSnapshots(snapshots)) {
            _this2.props.onImportSnapshot(snapshots);

            _this2.setState({
              working: false
            });

            _this2.props.onDismiss();
          } else {
            _this2.setState({
              fileFormatError: _language.strings.errorInvalidFileFormat,
              working: false
            });
          }
        };

        reader.readAsText(file);
      }
    }
  }, {
    key: "render",
    value: function render() {
      var _this3 = this;

      return React.createElement("div", null, React.createElement(_base.base.fabric.Dialog, {
        hidden: false,
        onDismiss: this.props.onDismiss,
        dialogContentProps: {
          className: "sanddance-dialog ".concat(this.props.theme),
          type: _base.base.fabric.DialogType.normal,
          title: _language.strings.dialogTitleSnapshotsLocal,
          subText: _language.strings.dialogSubtextSnapshotsLocal
        }
      }, React.createElement("section", null, React.createElement("input", {
        type: "file",
        onChange: function onChange(e) {
          return _this3.readFile(e);
        },
        disabled: this.state.working
      }), this.state.fileFormatError && React.createElement("div", {
        className: "error"
      }, this.state.fileFormatError)), React.createElement(_base.base.fabric.DialogFooter, null, React.createElement(_base.base.fabric.DefaultButton, {
        onClick: this.props.onDismiss,
        text: _language.strings.dialogCloseButton
      }))));
    }
  }]);

  return SnapshotImportLocal;
}(React.Component);

exports.SnapshotImportLocal = SnapshotImportLocal;

var SnapshotImportRemote =
/*#__PURE__*/
function (_React$Component2) {
  _inherits(SnapshotImportRemote, _React$Component2);

  function SnapshotImportRemote(props) {
    var _this4;

    _classCallCheck(this, SnapshotImportRemote);

    _this4 = _possibleConstructorReturn(this, _getPrototypeOf(SnapshotImportRemote).call(this, props));
    _this4.state = {
      working: false
    };
    return _this4;
  }

  _createClass(SnapshotImportRemote, [{
    key: "getUrlShortcut",
    value: function getUrlShortcut() {
      var dataSource = util.clone(this.props.dataSource);
      delete dataSource.snapshots;
      dataSource.snapshotsUrl = this.state.url;
      var dss = {
        dataSource: dataSource
      };
      return '#' + JSON.stringify(dss);
    }
  }, {
    key: "loadUrl",
    value: function loadUrl() {
      var _this5 = this;

      var urlError = (0, _url.invalidUrlError)(this.state.url);

      if (urlError) {
        return this.setState({
          urlError: urlError
        });
      }

      var url = this.state.url;
      fetch(url).then(function (response) {
        if (response.status === 200) {
          return response.json();
        } else {
          _this5.setState({
            urlError: response.statusText
          });
        }
      }).then(function (snapshots) {
        if (validSnapshots(snapshots)) {
          _this5.props.onImportSnapshot(snapshots);

          _this5.props.onSnapshotsUrl(url);

          _this5.setState({
            working: false
          });

          _this5.props.onDismiss();
        } else {
          _this5.setState({
            fileFormatError: _language.strings.errorInvalidFileFormat,
            working: false
          });
        }
      }).catch(function (e) {
        _this5.setState({
          urlError: e
        });
      });
    }
  }, {
    key: "render",
    value: function render() {
      var _this6 = this;

      var shortcut;

      if (this.props.dataSource.dataSourceType !== 'local' && this.state.url && !(0, _url.invalidUrlError)(this.state.url) && !this.state.urlError) {
        shortcut = this.getUrlShortcut();
      }

      return React.createElement("div", null, React.createElement(_base.base.fabric.Dialog, {
        hidden: false,
        onDismiss: this.props.onDismiss,
        dialogContentProps: {
          className: "sanddance-dialog ".concat(this.props.theme),
          type: _base.base.fabric.DialogType.normal,
          title: _language.strings.dialogTitleSnapshotsUrl
        }
      }, React.createElement("section", null, React.createElement(_base.base.fabric.TextField, {
        label: _language.strings.labelUrl,
        placeholder: _language.strings.urlInputPlaceholder,
        onKeyUp: function onKeyUp(e) {
          return e.keyCode === 13 && _this6.loadUrl();
        },
        onChange: function onChange(e, url) {
          return _this6.setState({
            url: url,
            urlError: ''
          });
        },
        value: this.state.url,
        disabled: this.state.working
      }), this.state.urlError && React.createElement("div", {
        className: "error"
      }, this.state.urlError)), this.props.dataSource.dataSourceType !== 'local' && React.createElement("section", {
        className: 'tip',
        style: {
          visibility: !(0, _url.invalidUrlError)(this.state.url) && !this.state.urlError ? 'visible' : 'hidden'
        }
      }, _language.strings.labelSnapshotsShortcut, " ", React.createElement("a", {
        href: shortcut,
        title: _language.strings.labelLinkDescription,
        "aria-label": _language.strings.labelLinkDescription
      }, _language.strings.labelLink)), React.createElement(_base.base.fabric.DialogFooter, null, React.createElement(_base.base.fabric.PrimaryButton, {
        disabled: !this.state.url || !!this.state.urlError,
        key: 0,
        onClick: function onClick(e) {
          return _this6.loadUrl();
        },
        text: _language.strings.dialogLoadButton
      }), React.createElement(_base.base.fabric.DefaultButton, {
        onClick: this.props.onDismiss,
        text: _language.strings.dialogCloseButton
      }))));
    }
  }]);

  return SnapshotImportRemote;
}(React.Component);

exports.SnapshotImportRemote = SnapshotImportRemote;

function SnapshotExport(props) {
  return React.createElement(_base.base.fabric.Dialog, {
    hidden: false,
    onDismiss: props.onDismiss,
    dialogContentProps: {
      className: "sanddance-dialog ".concat(this.props.theme, " sanddance-export"),
      type: _base.base.fabric.DialogType.normal,
      title: _language.strings.dialogTitleSnapshotsExport
    }
  }, React.createElement("ul", null, React.createElement("li", null, React.createElement("strong", null, _language.strings.labelSnapshotsExportHTMLTitle), React.createElement("div", null, _language.strings.labelSnapshotsExportHTMLDescription), React.createElement(_base.base.fabric.PrimaryButton, {
    text: "".concat(_language.strings.buttonExport, " ").concat(_language.strings.labelSnapshotsExportHTMLTitle),
    onClick: function onClick(e) {
      var clean = cleanSnapshots(props.snapshots);
      var html = (0, _sanddanceExplorer.getEmbedHTML)(props.explorer.state.dataContent.data, props.dataSource.displayName, clean);
      (0, _download.downloadData)(html, "".concat(props.dataSource.displayName, ".html"));
    }
  })), React.createElement("li", null, React.createElement("strong", null, _language.strings.labelSnapshotsExportMarkdownTitle), React.createElement("div", null, _language.strings.labelSnapshotsExportMarkdownDescription), React.createElement(_base.base.fabric.PrimaryButton, {
    text: "".concat(_language.strings.buttonExport, " ").concat(_language.strings.labelSnapshotsExportMarkdownTitle),
    onClick: function onClick(e) {
      var sections = props.snapshots.map(function (snapshot) {
        var section = ["## ".concat(snapshot.title)];
        section.push(snapshot.description);
        section.push('\n');
        var url = "".concat(location.origin, "/#").concat(encodeURIComponent(serializeSnapshot(snapshot)));
        section.push(markdownImageLink(snapshot.title, snapshot.image, url));
        return section.join('\n');
      });
      sections.unshift("# ".concat(props.dataSource.displayName));
      (0, _download.downloadData)(sections.join('\n\n'), "".concat(props.dataSource.displayName, ".snapshots.md"));
    }
  }))), React.createElement(_base.base.fabric.DialogFooter, null, React.createElement(_base.base.fabric.DefaultButton, {
    onClick: props.onDismiss,
    text: _language.strings.dialogCloseButton
  })));
}
},{"react":"mpTF","./base":"Vlbn","./download":"GTzW","@msrvida/sanddance-explorer":"TX8u","./url":"BQaf","./language":"hk5u"}],"DMdn":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.SandDanceApp = void 0;

var React = _interopRequireWildcard(require("react"));

var _base = require("./base");

var _sanddanceExplorer = require("@msrvida/sanddance-explorer");

var _dataSourcePicker = require("./dataSourcePicker");

var _download = require("./download");

var _snapshots = require("./snapshots");

var _language = require("./language");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _typeof(obj) { 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); }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

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; }

function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

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); }

function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

var VegaDeckGl = _sanddanceExplorer.SandDance.VegaDeckGl;

function getViewerOptions(darkTheme, themeColors) {
  var colors = themeColors && themeColors[darkTheme ? 'dark' : 'light'];
  var viewerOptions = {
    colors: Object.assign(Object.assign({}, (0, _sanddanceExplorer.getColorSettingsFromThemePalette)(_sanddanceExplorer.themePalettes[darkTheme ? 'dark-theme' : ''])), colors)
  };
  return viewerOptions;
}

function getSnapshotFromHash() {
  var hash = document.location.hash && document.location.hash.substring(1);

  if (hash) {
    try {
      return JSON.parse(decodeURIComponent(hash));
    } catch (e) {// continue regardless of error
    }
  }
}

var snapshotOnLoad = getSnapshotFromHash();

if (snapshotOnLoad && snapshotOnLoad.dataSource && snapshotOnLoad.dataSource.dataSourceType === 'local') {
  snapshotOnLoad = null;
}

var SandDanceApp =
/*#__PURE__*/
function (_React$Component) {
  _inherits(SandDanceApp, _React$Component);

  function SandDanceApp(props) {
    var _this;

    _classCallCheck(this, SandDanceApp);

    _this = _possibleConstructorReturn(this, _getPrototypeOf(SandDanceApp).call(this, props));
    _this.state = {
      compactUI: !!localStorage.getItem('compactUI'),
      dialogMode: null,
      dataSource: snapshotOnLoad && snapshotOnLoad.dataSource || props.dataSources[0],
      darkTheme: props.darkTheme
    };
    _this.viewerOptions = getViewerOptions(_this.state.darkTheme, props.themeColors);
    _this.handlers = {
      hashchange: function hashchange(e) {
        var snapshot = getSnapshotFromHash();

        if (snapshot) {
          _this.explorer && _this.explorer.calculate(function () {
            return _this.hydrateSnapshot(snapshot);
          });
        }
      },
      resize: function resize(e) {
        _this.explorer && _this.explorer.resize();
      }
    };

    _this.wireEventHandlers(true);

    _this.changeColorScheme(_this.state.darkTheme);

    return _this;
  }

  _createClass(SandDanceApp, [{
    key: "wireEventHandlers",
    value: function wireEventHandlers(add) {
      for (var key in this.handlers) {
        if (add) {
          window.addEventListener(key, this.handlers[key]);
        } else {
          window.removeEventListener(key, this.handlers[key]);
        }
      }
    }
  }, {
    key: "isSameDataSource",
    value: function isSameDataSource(a, b) {
      if (a.dataSourceType === b.dataSourceType && a.type === b.type && a.id === b.id) {
        if (a.dataSourceType === 'url') {
          return a.dataUrl === b.dataUrl;
        }

        return true;
      }

      return false;
    }
  }, {
    key: "hydrateSnapshot",
    value: function hydrateSnapshot(snapshot) {
      var _this2 = this;

      var selectedSnapshotIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;

      if (snapshot.dataSource) {
        if (this.isSameDataSource(snapshot.dataSource, this.state.dataSource)) {
          if (selectedSnapshotIndex === -1) {
            this.explorer.reviveSnapshot(snapshot);
          } else {
            this.explorer.reviveSnapshot(selectedSnapshotIndex);
          }

          if (snapshot.dataSource.snapshotsUrl && snapshot.dataSource.snapshotsUrl !== this.state.dataSource.snapshotsUrl) {
            //load new snapshots url
            fetch(snapshot.dataSource.snapshotsUrl).then(function (response) {
              return response.json();
            }).then(function (snapshots) {
              if ((0, _snapshots.validSnapshots)(snapshots)) {
                _this2.explorer.setState({
                  snapshots: snapshots
                });

                var dataSource = Object.assign({}, _this2.state.dataSource);
                dataSource.snapshotsUrl = snapshot.dataSource.snapshotsUrl;

                _this2.setState({
                  dataSource: dataSource
                });
              }
            });
          }
        } else {
          if (snapshot.dataSource.dataSourceType === 'local') {
            this.dataSourcePicker.setState({
              dialogMode: 'local'
            });

            this.postLoad = function (ds) {
              if (_this2.isSameDataSource(snapshot.dataSource, ds)) {
                _this2.hydrateSnapshot(snapshot, selectedSnapshotIndex); //} else {                            //local file does not match snapshot

              }
            };
          } else {
            this.load(snapshot.dataSource, snapshot.insight).then(function () {
              _this2.explorer.setState({
                sideTabId: _sanddanceExplorer.SideTabId.Snapshots
              });
            }).catch(function (e) {
              _this2.loadError(snapshot.dataSource);
            });
          }
        }

        return true;
      }
    }
  }, {
    key: "load",
    value: function load(dataSource, partialInsight) {
      var _this3 = this;

      //clone so that we do not modify original object
      dataSource = VegaDeckGl.util.clone(dataSource);
      this.setState({
        dataSource: dataSource
      });
      document.title = "SandDance - ".concat(dataSource.displayName);
      return this.explorer.load(dataSource, function (columns) {
        return partialInsight || _this3.props.insights && _this3.props.insights[dataSource.id];
      }, this.props.initialOptions && VegaDeckGl.util.deepMerge({}, this.props.initialOptions['*'], this.props.initialOptions[dataSource.id]));
    }
  }, {
    key: "dataSourceError",
    value: function dataSourceError(dataSource) {
      switch (dataSource.dataSourceType) {
        case 'local':
          return _language.strings.errorDataSourceFromLocal(dataSource);

        case 'sample':
        case 'url':
          return _language.strings.errorDataSourceFromUrl(dataSource);
      }
    }
  }, {
    key: "loadError",
    value: function loadError(dataSource) {
      var error = this.dataSourceError(dataSource);
      this.explorer.setState({
        errors: [error]
      });
      this.setState({
        dataSource: {
          dataSourceType: null,
          id: null,
          type: null
        }
      });
    }
  }, {
    key: "updateExplorerViewerOptions",
    value: function updateExplorerViewerOptions(viewerOptions) {
      this.viewerOptions = viewerOptions;
      this.explorer && this.explorer.updateViewerOptions(this.viewerOptions);
    }
  }, {
    key: "getThemePalette",
    value: function getThemePalette(darkTheme) {
      var theme = darkTheme ? 'dark-theme' : '';
      return _sanddanceExplorer.themePalettes[theme];
    }
  }, {
    key: "changeColorScheme",
    value: function changeColorScheme(darkTheme) {
      var _this4 = this;

      this.updateExplorerViewerOptions(getViewerOptions(darkTheme, this.props.themeColors));
      VegaDeckGl.base.vega.scheme(_sanddanceExplorer.SandDance.constants.ColorScaleNone, function (x) {
        return VegaDeckGl.util.colorToString(_this4.explorer.viewer.options.colors.defaultCube);
      });
      this.explorer && this.explorer.viewer && this.explorer.viewer.render(this.explorer.viewer.insight, this.explorer.state.dataContent.data);

      _base.base.fabric.loadTheme({
        palette: this.getThemePalette(darkTheme)
      });
    }
  }, {
    key: "render",
    value: function render() {
      var _this5 = this;

      var theme = this.state.darkTheme ? 'dark-theme' : '';
      var dataSourceProps = {
        dataSource: this.state.dataSource,
        dataSources: this.props.dataSources,
        changeDataSource: function changeDataSource(dataSource) {
          document.location.hash = '';
          return _this5.load(dataSource).then(function () {
            if (_this5.postLoad) {
              _this5.postLoad(dataSource);

              _this5.postLoad = null;
            }
          }).catch(function () {
            return _this5.loadError(dataSource);
          });
        }
      };
      return React.createElement("section", {
        className: "sanddance-app"
      }, React.createElement(_sanddanceExplorer.Explorer, {
        logoClickTarget: "_self",
        theme: theme,
        snapshotProps: {
          modifySnapShot: function modifySnapShot(snapshot) {
            snapshot.dataSource = _this5.state.dataSource;
          },
          getTopActions: function getTopActions(snapshots) {
            var items = [{
              key: 'import',
              text: _language.strings.menuSnapshotsImport,
              subMenuProps: {
                items: [{
                  key: 'import-local',
                  text: _language.strings.menuLocal,
                  onClick: function onClick() {
                    return _this5.setState({
                      dialogMode: 'import-local'
                    });
                  }
                }, {
                  key: 'import-remote',
                  text: _language.strings.menuUrl,
                  onClick: function onClick() {
                    return _this5.setState({
                      dialogMode: 'import-remote'
                    });
                  }
                }]
              }
            }, {
              key: 'export',
              text: _language.strings.menuSnapshotsExportAsJSON,
              disabled: snapshots.length === 0,
              onClick: function onClick() {
                return (0, _snapshots.downloadSnapshotsJSON)(snapshots, "".concat(_this5.state.dataSource.displayName, ".snapshots"));
              }
            }, {
              key: 'export-as',
              text: _language.strings.menuSnapshotsExportAs,
              disabled: snapshots.length === 0,
              onClick: function onClick() {
                return _this5.setState({
                  dialogMode: 'export'
                });
              }
            }];
            return items;
          },
          getChildren: function getChildren(snapshots) {
            return React.createElement("div", null, _this5.state.dialogMode === 'import-local' && React.createElement(_snapshots.SnapshotImportLocal, {
              theme: theme,
              dataSource: _this5.state.dataSource,
              onImportSnapshot: function onImportSnapshot(snapshots) {
                return _this5.explorer.setState({
                  snapshots: snapshots
                });
              },
              onDismiss: function onDismiss() {
                return _this5.setState({
                  dialogMode: null
                });
              }
            }), _this5.state.dialogMode === 'import-remote' && React.createElement(_snapshots.SnapshotImportRemote, {
              theme: theme,
              dataSource: _this5.state.dataSource,
              onImportSnapshot: function onImportSnapshot(snapshots) {
                return _this5.explorer.setState({
                  snapshots: snapshots
                });
              },
              onSnapshotsUrl: function onSnapshotsUrl(snapshotsUrl) {
                var dataSource = Object.assign({}, _this5.state.dataSource);
                dataSource.snapshotsUrl = snapshotsUrl;

                _this5.setState({
                  dataSource: dataSource
                });
              },
              onDismiss: function onDismiss() {
                return _this5.setState({
                  dialogMode: null
                });
              }
            }), _this5.state.dialogMode === 'export' && React.createElement(_snapshots.SnapshotExport, {
              explorer: _this5.explorer,
              dataSource: _this5.state.dataSource,
              snapshots: snapshots,
              onDismiss: function onDismiss() {
                return _this5.setState({
                  dialogMode: null
                });
              }
            }));
          },
          getActions: function getActions(snapshot, i) {
            var url = '#' + (0, _snapshots.serializeSnapshot)(snapshot);
            var element;

            if (snapshot.dataSource && snapshot.dataSource.dataSourceType === 'local') {
              element = React.createElement("span", {
                key: "link".concat(i)
              }, _language.strings.labelLocal);
            } else {
              element = React.createElement("a", {
                key: "link".concat(i),
                href: url,
                title: _language.strings.labelLinkDescription,
                "aria-label": _language.strings.labelLinkDescription
              }, _language.strings.labelLink);
            }

            return [{
              element: element
            }];
          },
          getTitle: function getTitle(insight) {
            return "".concat(_this5.state.dataSource.displayName, " ").concat(insight.chart);
          },
          getDescription: function getDescription(insight) {
            return '';
          } //TODO create description from filter etc.

        },
        onSnapshotClick: function onSnapshotClick(snapshot, selectedSnapshotIndex) {
          return _this5.hydrateSnapshot(snapshot, selectedSnapshotIndex);
        },
        initialView: "2d",
        mounted: function mounted(e) {
          _this5.explorer = e;

          _this5.load(_this5.state.dataSource, snapshotOnLoad && snapshotOnLoad.insight).catch(function (e) {
            _this5.loadError(_this5.state.dataSource);
          });

          _this5.props.mounted(_this5);
        },
        dataExportHandler: function dataExportHandler(data, datatype, displayName) {
          try {
            (0, _download.downloadData)(data, "".concat(displayName, ".").concat(datatype));
          } catch (e) {
            _this5.explorer.setState({
              errors: [_language.strings.errorDownloadFailure]
            });
          }
        },
        datasetElement: React.createElement(_dataSourcePicker.DataSourceButton, Object.assign({
          getPicker: function getPicker() {
            return _this5.dataSourcePicker;
          }
        }, dataSourceProps)),
        topBarButtonProps: [{
          key: 'theme',
          text: this.state.darkTheme ? _language.strings.buttonThemeLight : _language.strings.buttonThemeDark,
          iconProps: {
            iconName: this.state.darkTheme ? 'Sunny' : 'ClearNight'
          },
          onClick: function onClick() {
            var darkTheme = !_this5.state.darkTheme;
            _this5.props.setTheme && _this5.props.setTheme(darkTheme);

            _this5.setState({
              darkTheme: darkTheme
            });

            _this5.changeColorScheme(darkTheme);
          }
        }],
        viewerOptions: this.viewerOptions,
        compactUI: this.state.compactUI,
        additionalSettings: [{
          groupLabel: _language.strings.labelPreferences,
          children: React.createElement(_base.base.fabric.Toggle, {
            label: _language.strings.labelCompactUI,
            title: _language.strings.labelCompactUIDescription,
            checked: this.state.compactUI,
            onChange: function onChange(e, checked) {
              if (checked) {
                localStorage.setItem('compactUI', 'true');
              } else {
                localStorage.removeItem('compactUI');
              }

              _this5.setState({
                compactUI: checked
              });
            }
          })
        }]
      }), React.createElement(_dataSourcePicker.DataSourcePicker, Object.assign({
        ref: function ref(dsp) {
          if (dsp && !_this5.dataSourcePicker) _this5.dataSourcePicker = dsp;
        },
        theme: theme
      }, dataSourceProps)));
    }
  }]);

  return SandDanceApp;
}(React.Component);

exports.SandDanceApp = SandDanceApp;
},{"react":"mpTF","./base":"Vlbn","@msrvida/sanddance-explorer":"TX8u","./dataSourcePicker":"EVeS","./download":"GTzW","./snapshots":"rNge","./language":"hk5u"}],"Focm":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.SandDanceExplorer = exports.explorer = void 0;

var deck = _interopRequireWildcard(require("@deck.gl/core"));

var layers = _interopRequireWildcard(require("@deck.gl/layers"));

var luma = _interopRequireWildcard(require("luma.gl"));

var React = _interopRequireWildcard(require("react"));

var ReactDOM = _interopRequireWildcard(require("react-dom"));

var SandDanceExplorer = _interopRequireWildcard(require("@msrvida/sanddance-explorer"));

exports.SandDanceExplorer = SandDanceExplorer;

var vega = _interopRequireWildcard(require("vega"));

var _fabricComponents = require("./fabricComponents");

var _sanddanceApp = require("./sanddanceApp");

var _base = require("./base");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _typeof(obj) { 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); }

(0, _base.use)(_fabricComponents.fabric, vega, deck, layers, luma);
var staticContent = Array.from(document.querySelectorAll('a.sanddance-app-static-content'));
var dataSets = staticContent.filter(function (f) {
  return f.id;
}).map(function (n) {
  var forData = staticContent.filter(function (f) {
    return f.dataset['for'] === n.id;
  })[0];
  return {
    dataSourceType: 'sample',
    id: n.id,
    displayName: n.dataset['displayName'],
    dataUrl: n.href,
    type: n.dataset['type'],
    snapshotsUrl: forData ? forData.href : null
  };
});
var explorer;
exports.explorer = explorer;
var undef = typeof undefined === "undefined" ? "undefined" : _typeof(undefined);
ReactDOM.render(React.createElement(_sanddanceApp.SandDanceApp, {
  setTheme: (typeof setTheme === "undefined" ? "undefined" : _typeof(setTheme)) !== undef && setTheme,
  darkTheme: (typeof darkTheme === "undefined" ? "undefined" : _typeof(darkTheme)) !== undef && darkTheme,
  insights: (typeof insights === "undefined" ? "undefined" : _typeof(insights)) !== undef && insights,
  initialOptions: (typeof options === "undefined" ? "undefined" : _typeof(options)) !== undef && options,
  themeColors: (typeof themeColors === "undefined" ? "undefined" : _typeof(themeColors)) !== undef && themeColors,
  dataSources: dataSets,
  mounted: function mounted(app) {
    exports.explorer = explorer = app.explorer;
  }
}), document.getElementById('app'));
},{"@deck.gl/core":"Tk4X","@deck.gl/layers":"MZ59","luma.gl":"GAQa","react":"mpTF","react-dom":"J77C","@msrvida/sanddance-explorer":"TX8u","vega":"VKat","./fabricComponents":"CjEO","./sanddanceApp":"DMdn","./base":"Vlbn"}]},{},["Focm"], "SandDanceApp")